summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-03-11 12:16:18 +0000
committerEike Rathke <erack@redhat.com>2016-03-14 15:59:20 +0000
commitb067f794b99855c318f894dd4ec247f65cec0dd3 (patch)
treeac01bafa7182af216cc534161379108823cdcea8
parente1206bfbf508f4a458e7ac8fe6d0935d177cb778 (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 (cherry picked from commit 9048e7f58763cf87460a25cba374741352ceb98b) Reviewed-on: https://gerrit.libreoffice.org/23148 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-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()