Kaydet (Commit) 0ae95230 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

extract the modify listener

Change-Id: Ie191e47b009afc5e3d4655d9b83189540e280dca
üst 329818a7
......@@ -190,6 +190,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/sidebar/Chart2PanelFactory \
chart2/source/controller/sidebar/ChartElementsPanel \
chart2/source/controller/sidebar/ChartSeriesPanel \
chart2/source/controller/sidebar/ChartSidebarModifyListener \
))
# Runtime dependency for unit-tests
......
......@@ -44,6 +44,7 @@
#include "ChartModel.hxx"
using namespace css;
using namespace css::uno;
using ::sfx2::sidebar::Theme;
......@@ -69,42 +70,6 @@ enum class AxisType
Y_SECOND
};
class ChartSidebarModifyListener : public cppu::WeakImplHelper1<css::util::XModifyListener>
{
public:
ChartSidebarModifyListener(ChartElementsPanel* pParent);
virtual ~ChartSidebarModifyListener();
virtual void SAL_CALL modified(const css::lang::EventObject& rEvent)
throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent)
throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
private:
VclPtr<ChartElementsPanel> mpParent;
};
ChartSidebarModifyListener::ChartSidebarModifyListener(ChartElementsPanel* pParent):
mpParent(pParent)
{
}
ChartSidebarModifyListener::~ChartSidebarModifyListener()
{
}
void ChartSidebarModifyListener::modified(const css::lang::EventObject& /*rEvent*/)
throw (::css::uno::RuntimeException, ::std::exception)
{
mpParent->updateData();
}
void ChartSidebarModifyListener::disposing(const css::lang::EventObject& /*rEvent*/)
throw (::css::uno::RuntimeException, ::std::exception)
{}
ChartModel* getChartModel(css::uno::Reference<css::frame::XModel> xModel)
{
ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
......
......@@ -22,6 +22,7 @@
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <svx/sidebar/PanelLayout.hxx>
#include "ChartSidebarModifyListener.hxx"
#include <com/sun/star/util/XModifyListener.hpp>
......@@ -37,7 +38,8 @@ namespace sidebar {
class ChartElementsPanel : public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface,
public ChartSidebarModifyListenerParent
{
public:
static VclPtr<vcl::Window> Create(
......@@ -67,7 +69,8 @@ public:
virtual ~ChartElementsPanel();
virtual void dispose() SAL_OVERRIDE;
void updateData();
virtual void updateData() SAL_OVERRIDE;
virtual void modelInvalid() SAL_OVERRIDE;
private:
//ui controls
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "ChartSidebarModifyListener.hxx"
namespace chart {
namespace sidebar {
ChartSidebarModifyListenerParent::~ChartSidebarModifyListenerParent()
{
}
ChartSidebarModifyListener::ChartSidebarModifyListener(ChartSidebarModifyListenerParent* pParent):
mpParent(pParent)
{
}
ChartSidebarModifyListener::~ChartSidebarModifyListener()
{
}
void ChartSidebarModifyListener::modified(const css::lang::EventObject& /*rEvent*/)
throw (::css::uno::RuntimeException, ::std::exception)
{
mpParent->updateData();
}
void ChartSidebarModifyListener::disposing(const css::lang::EventObject& /*rEvent*/)
throw (::css::uno::RuntimeException, ::std::exception)
{
mpParent->modelInvalid();
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSIDEBAR_MODIFYLISTENER_HXX
#define INCLUDED_CHART2_SOURCE_CONTROLLER_SIDEBAR_CHARTSIDEBAR_MODIFYLISTENER_HXX
#include <com/sun/star/util/XModifyListener.hpp>
#include <cppuhelper/implbase1.hxx>
namespace chart {
namespace sidebar {
class ChartSidebarModifyListenerParent
{
public:
virtual ~ChartSidebarModifyListenerParent();
virtual void updateData() = 0;
virtual void modelInvalid() = 0;
};
class ChartSidebarModifyListener : public cppu::WeakImplHelper1<css::util::XModifyListener>
{
public:
ChartSidebarModifyListener(ChartSidebarModifyListenerParent* pParent);
virtual ~ChartSidebarModifyListener();
virtual void SAL_CALL modified(const css::lang::EventObject& rEvent)
throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent)
throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
private:
ChartSidebarModifyListenerParent* mpParent;
};
} }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment