summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-03-11 12:16:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-03-11 12:19:37 +0000
commit9048e7f58763cf87460a25cba374741352ceb98b (patch)
treea2c29f1ac1577a2ebd5b9a7314728ce0f63c8b26
parent96e44b3b510bc97ddda6caf937d031ae6a656d58 (diff)
Resolves: tdf#98390 ChartAreaPanel throw during ctor
after a ChartSidebarModifyListener pointing to it has been created and added to the model, so ChartSidebarModifyListeners exist which point to a dead ChartAreaPanel which has never even completed its ctor workaround this by checking that properties it querys for exist before accessing them and triggering the IllegalProperty throw Change-Id: I0c251360714592c78132c0867903216f3866489a
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.cxx117
1 files changed, 71 insertions, 46 deletions
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 7dc2b766fd08..103921412d24 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -387,59 +387,84 @@ void ChartAreaPanel::updateData()
if (!xPropSet.is())
return;
- css::drawing::FillStyle eFillStyle = css::drawing::FillStyle_SOLID;
- xPropSet->getPropertyValue("FillStyle") >>= eFillStyle;
- XFillStyleItem aFillStyleItem(eFillStyle);
- updateFillStyle(false, true, &aFillStyleItem);
-
- sal_uInt16 nFillTransparence = 0;
- xPropSet->getPropertyValue("FillTransparence") >>= nFillTransparence;
- SfxUInt16Item aTransparenceItem(0, nFillTransparence);
- updateFillTransparence(false, true, &aTransparenceItem);
-
- OUString aGradientName;
- xPropSet->getPropertyValue("FillGradientName") >>= aGradientName;
- XGradient xGradient = getXGradientForName(mxModel, aGradientName);
- XFillGradientItem aGradientItem(aGradientName, xGradient);
- updateFillGradient(false, true, &aGradientItem);
-
- OUString aHatchName;
- xPropSet->getPropertyValue("FillHatchName") >>= aHatchName;
- XHatch xHatch = getXHatchFromName(mxModel, aHatchName);
- XFillHatchItem aHatchItem(aHatchName, xHatch);
- updateFillHatch(false, true, &aHatchItem);
-
- OUString aBitmapName;
- xPropSet->getPropertyValue("FillBitmapName") >>= aBitmapName;
- GraphicObject xBitmap = getXBitmapFromName(mxModel, aBitmapName);
- XFillBitmapItem aBitmapItem(aBitmapName, xBitmap);
- XFillBitmapItem* pBitmapItem = nullptr;
- DrawModelWrapper* pModelWrapper = nullptr;
- try
+ css::uno::Reference<css::beans::XPropertySetInfo> xInfo(xPropSet->getPropertySetInfo());
+ if (!xInfo.is())
+ return;
+
+ if (xInfo->hasPropertyByName("FillStyle"))
{
- pModelWrapper = getDrawModelWrapper(mxModel);
- if (pModelWrapper)
- {
- pBitmapItem = aBitmapItem.checkForUniqueItem(&pModelWrapper->getSdrModel());
- }
+ css::drawing::FillStyle eFillStyle = css::drawing::FillStyle_SOLID;
+ xPropSet->getPropertyValue("FillStyle") >>= eFillStyle;
+ XFillStyleItem aFillStyleItem(eFillStyle);
+ updateFillStyle(false, true, &aFillStyleItem);
}
- catch (...)
+
+ if (xInfo->hasPropertyByName("FillTransparence"))
+ {
+ sal_uInt16 nFillTransparence = 0;
+ xPropSet->getPropertyValue("FillTransparence") >>= nFillTransparence;
+ SfxUInt16Item aTransparenceItem(0, nFillTransparence);
+ updateFillTransparence(false, true, &aTransparenceItem);
+ }
+
+ if (xInfo->hasPropertyByName("FillGradientName"))
+ {
+ OUString aGradientName;
+ xPropSet->getPropertyValue("FillGradientName") >>= aGradientName;
+ XGradient xGradient = getXGradientForName(mxModel, aGradientName);
+ XFillGradientItem aGradientItem(aGradientName, xGradient);
+ updateFillGradient(false, true, &aGradientItem);
+ }
+
+ if (xInfo->hasPropertyByName("FillHatchName"))
{
+ OUString aHatchName;
+ xPropSet->getPropertyValue("FillHatchName") >>= aHatchName;
+ XHatch xHatch = getXHatchFromName(mxModel, aHatchName);
+ XFillHatchItem aHatchItem(aHatchName, xHatch);
+ updateFillHatch(false, true, &aHatchItem);
}
- updateFillBitmap(false, true, pBitmapItem ? pBitmapItem : &aBitmapItem);
- delete pBitmapItem;
- OUString aFillFloatTransparenceName;
- xPropSet->getPropertyValue("FillTransparenceGradientName") >>= aFillFloatTransparenceName;
- XFillFloatTransparenceItem aFillFloatTransparenceItem = getXTransparencyGradientForName(mxModel, aFillFloatTransparenceName);
- updateFillFloatTransparence(false, true, &aFillFloatTransparenceItem);
+ if (xInfo->hasPropertyByName("FillBitmapName"))
+ {
+ OUString aBitmapName;
+ xPropSet->getPropertyValue("FillBitmapName") >>= aBitmapName;
+ GraphicObject xBitmap = getXBitmapFromName(mxModel, aBitmapName);
+ XFillBitmapItem aBitmapItem(aBitmapName, xBitmap);
+ XFillBitmapItem* pBitmapItem = nullptr;
+ DrawModelWrapper* pModelWrapper = nullptr;
+ try
+ {
+ pModelWrapper = getDrawModelWrapper(mxModel);
+ if (pModelWrapper)
+ {
+ pBitmapItem = aBitmapItem.checkForUniqueItem(&pModelWrapper->getSdrModel());
+ }
+ }
+ catch (...)
+ {
+ }
+ updateFillBitmap(false, true, pBitmapItem ? pBitmapItem : &aBitmapItem);
+ delete pBitmapItem;
+ }
+
+ if (xInfo->hasPropertyByName("FillTransparenceGradientName"))
+ {
+ OUString aFillFloatTransparenceName;
+ xPropSet->getPropertyValue("FillTransparenceGradientName") >>= aFillFloatTransparenceName;
+ XFillFloatTransparenceItem aFillFloatTransparenceItem = getXTransparencyGradientForName(mxModel, aFillFloatTransparenceName);
+ updateFillFloatTransparence(false, true, &aFillFloatTransparenceItem);
- maFillColorWrapper.updateData();
+ maFillColorWrapper.updateData();
+ }
- sal_uInt32 nFillColor = 0;
- xPropSet->getPropertyValue("FillColor") >>= nFillColor;
- XFillColorItem aFillColorItem("", Color(nFillColor));
- updateFillColor(true, &aFillColorItem);
+ if (xInfo->hasPropertyByName("FillColor"))
+ {
+ sal_uInt32 nFillColor = 0;
+ xPropSet->getPropertyValue("FillColor") >>= nFillColor;
+ XFillColorItem aFillColorItem("", Color(nFillColor));
+ updateFillColor(true, &aFillColorItem);
+ }
}
void ChartAreaPanel::modelInvalid()