summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-24 00:52:42 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-26 00:26:58 +0200
commite4daf8be5e9c84c378ec6477163647d1c9b7ef55 (patch)
tree22f32c7fcfc8e5358a29100a7b19419e81a51e13 /chart2/source
parentdbeba7e2aa2effee5f73382573b6523d70e0f4d2 (diff)
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
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.cxx30
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.hxx1
2 files changed, 30 insertions, 1 deletions
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<css::beans::XPropertySet> getPropSet(
return ObjectIdentifier::getObjectPropertySet(aCID, xModel);
}
+class PreventUpdate
+{
+public:
+ PreventUpdate(bool& bUpdate):
+ mbUpdate(bUpdate)
+ {
+ mbUpdate = false;
+ }
+
+ ~PreventUpdate()
+ {
+ mbUpdate = true;
+ }
+
+private:
+ bool& mbUpdate;
+};
+
}
VclPtr<vcl::Window> 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<css::beans::XPropertySet> 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<css::beans::XPropertySet> 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<css::beans::XPropertySet> 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<css::beans::XPropertySet> 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<css::beans::XPropertySet> 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<css::beans::XPropertySet> 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<css::beans::XPropertySet> 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