diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-07-23 16:47:49 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-07-26 00:26:56 +0200 |
commit | 427f28ea2f49005c63338e6df4fc5cf010fa38c0 (patch) | |
tree | ef8e940c785413043a216b67ff7cc462ece34dbd /chart2/source | |
parent | bc4592132f3f6b5b04c8c9c5e63976c5d2dc6b4f (diff) |
add selection change listener to area panel
Change-Id: I4e3f0c1c669ec1c584cc2d6932fd78e177effa89
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/controller/sidebar/ChartAreaPanel.cxx | 25 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/ChartAreaPanel.hxx | 8 |
2 files changed, 30 insertions, 3 deletions
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx index 897d8ad61cae..5a3d4b68b489 100644 --- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx +++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx @@ -63,7 +63,8 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent, ChartController* pController): svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame), mxModel(pController->getModel()), - mxListener(new ChartSidebarModifyListener(this)) + mxListener(new ChartSidebarModifyListener(this)), + mxSelectionListener(new ChartSidebarSelectionListener(this)) { } @@ -77,6 +78,10 @@ void ChartAreaPanel::dispose() css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); xBroadcaster->removeModifyListener(mxListener); + css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY); + if (xSelectionSupplier.is()) + xSelectionSupplier->removeSelectionChangeListener(mxSelectionListener); + AreaPropertyPanelBase::dispose(); } @@ -84,6 +89,10 @@ void ChartAreaPanel::Initialize() { css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW); xBroadcaster->addModifyListener(mxListener); + + css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY); + if (xSelectionSupplier.is()) + xSelectionSupplier->addSelectionChangeListener(mxSelectionListener); } void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& rItem) @@ -170,6 +179,16 @@ void ChartAreaPanel::modelInvalid() { } +void ChartAreaPanel::selectionChanged(bool bCorrectType) +{ + if (bCorrectType) + updateData(); +} + +void ChartAreaPanel::SelectionInvalid() +{ +} + void ChartAreaPanel::updateModel( css::uno::Reference<css::frame::XModel> xModel) { @@ -180,6 +199,10 @@ void ChartAreaPanel::updateModel( css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW); xBroadcasterNew->addModifyListener(mxListener); + + css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY); + if (xSelectionSupplier.is()) + xSelectionSupplier->addSelectionChangeListener(mxSelectionListener); } diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx index 7a0875b4b97c..6678fee64a49 100644 --- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx +++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx @@ -29,6 +29,7 @@ #include <svx/sidebar/AreaPropertyPanelBase.hxx> #include "ChartSidebarModifyListener.hxx" +#include "ChartSidebarSelectionListener.hxx" class XFillFloatTransparenceItem; class XFillTransparenceItem; @@ -47,7 +48,7 @@ namespace sidebar { class ChartAreaPanel : public svx::sidebar::AreaPropertyPanelBase, public sfx2::sidebar::SidebarModelUpdate, public ChartSidebarModifyListenerParent, - public sfx2::sidebar::SidebarModelUpdate + public ChartSidebarSelectionListenerParent { public: static VclPtr<vcl::Window> Create( @@ -72,9 +73,11 @@ public: virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& rBitmapItem); virtual void updateData() SAL_OVERRIDE; - virtual void modelInvalid() SAL_OVERRIDE; + virtual void selectionChanged(bool bCorrectType) SAL_OVERRIDE; + virtual void SelectionInvalid() SAL_OVERRIDE; + virtual void dispose() SAL_OVERRIDE; virtual void updateModel(css::uno::Reference<css::frame::XModel> xModel) SAL_OVERRIDE; @@ -83,6 +86,7 @@ private: css::uno::Reference<css::frame::XModel> mxModel; css::uno::Reference<css::util::XModifyListener> mxListener; + css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener; void Initialize(); |