From e4daf8be5e9c84c378ec6477163647d1c9b7ef55 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Fri, 24 Jul 2015 00:52:42 +0200 Subject: this nasty update cycle was causing many issues Setting the property from the sidebar was causing the model to be changed and therefore updating the sidebar again. Change-Id: I9ca690ae05d4cb0f2ce16f905a29582cc9e86f64 --- .../source/controller/sidebar/ChartAreaPanel.cxx | 30 +++++++++++++++++++++- .../source/controller/sidebar/ChartAreaPanel.hxx | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx index 72da2c911b6f..6dcadd19e9ec 100644 --- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx +++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx @@ -42,6 +42,24 @@ css::uno::Reference getPropSet( return ObjectIdentifier::getObjectPropertySet(aCID, xModel); } +class PreventUpdate +{ +public: + PreventUpdate(bool& bUpdate): + mbUpdate(bUpdate) + { + mbUpdate = false; + } + + ~PreventUpdate() + { + mbUpdate = true; + } + +private: + bool& mbUpdate; +}; + } VclPtr ChartAreaPanel::Create( @@ -64,7 +82,8 @@ ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent, svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame), mxModel(pController->getModel()), mxListener(new ChartSidebarModifyListener(this)), - mxSelectionListener(new ChartSidebarSelectionListener(this)) + mxSelectionListener(new ChartSidebarSelectionListener(this)), + mbUpdate(true) { Initialize(); } @@ -98,6 +117,7 @@ void ChartAreaPanel::Initialize() void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& rItem) { + PreventUpdate aProtector(mbUpdate); css::uno::Reference xPropSet = getPropSet(mxModel); if (!xPropSet.is()) return; @@ -108,6 +128,7 @@ void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& rItem) void ChartAreaPanel::setFillFloatTransparence( const XFillFloatTransparenceItem& rItem) { + PreventUpdate aProtector(mbUpdate); css::uno::Reference xPropSet = getPropSet(mxModel); if (!xPropSet.is()) return; @@ -117,6 +138,7 @@ void ChartAreaPanel::setFillFloatTransparence( void ChartAreaPanel::setFillStyle(const XFillStyleItem& rItem) { + PreventUpdate aProtector(mbUpdate); css::uno::Reference xPropSet = getPropSet(mxModel); if (!xPropSet.is()) return; @@ -139,6 +161,7 @@ void ChartAreaPanel::setFillStyleAndColor(const XFillStyleItem* pStyleItem, void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem, const XFillGradientItem& rGradientItem) { + PreventUpdate aProtector(mbUpdate); css::uno::Reference xPropSet = getPropSet(mxModel); if (!xPropSet.is()) return; @@ -151,6 +174,7 @@ void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem, void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& rHatchItem) { + PreventUpdate aProtector(mbUpdate); css::uno::Reference xPropSet = getPropSet(mxModel); if (!xPropSet.is()) return; @@ -163,6 +187,7 @@ void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem, void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& rBitmapItem) { + PreventUpdate aProtector(mbUpdate); css::uno::Reference xPropSet = getPropSet(mxModel); if (!xPropSet.is()) return; @@ -174,6 +199,9 @@ void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, void ChartAreaPanel::updateData() { + if (!mbUpdate) + return; + css::uno::Reference xPropSet = getPropSet(mxModel); if (!xPropSet.is()) return; diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.hxx b/chart2/source/controller/sidebar/ChartAreaPanel.hxx index 6678fee64a49..827f1c9d37ac 100644 --- a/chart2/source/controller/sidebar/ChartAreaPanel.hxx +++ b/chart2/source/controller/sidebar/ChartAreaPanel.hxx @@ -90,6 +90,7 @@ private: void Initialize(); + bool mbUpdate; }; } } // end of namespace svx::sidebar -- cgit