diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-07-16 21:29:20 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-07-16 22:19:53 +0200 |
commit | 0ae9523012269ee2d093f35ecbf58da1d7f13f53 (patch) | |
tree | e01f6cc40757b05203a42706410156318f52cde3 | |
parent | handle trendline checkbox in series panel (diff) | |
download | core-0ae9523012269ee2d093f35ecbf58da1d7f13f53.tar.gz core-0ae9523012269ee2d093f35ecbf58da1d7f13f53.zip |
extract the modify listener
Change-Id: Ie191e47b009afc5e3d4655d9b83189540e280dca
5 files changed, 99 insertions, 38 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk index facaf66eedca..f2d4b281886c 100644 --- a/chart2/Library_chartcontroller.mk +++ b/chart2/Library_chartcontroller.mk @@ -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 diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index 42f88db359f5..2dadc78336ee 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -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()); diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx index 51e7e49bcd18..358a8bec2194 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx @@ -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 diff --git a/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx b/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx new file mode 100644 index 000000000000..fdf2dc14a460 --- /dev/null +++ b/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx @@ -0,0 +1,42 @@ +/* -*- 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: */ diff --git a/chart2/source/controller/sidebar/ChartSidebarModifyListener.hxx b/chart2/source/controller/sidebar/ChartSidebarModifyListener.hxx new file mode 100644 index 000000000000..5db469e753f7 --- /dev/null +++ b/chart2/source/controller/sidebar/ChartSidebarModifyListener.hxx @@ -0,0 +1,50 @@ +/* -*- 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: */ |