Kaydet (Commit) 9048e7f5 authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst 96e44b3b
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment