summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-12-02 11:00:59 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-12-02 15:34:12 +0100
commit264c333b055bcebf0ba85f5d7ebf66fe6b245bbc (patch)
treea9a75f84562fa05adf26cbfef3035b5e6f92f94d /oox/source
parentd4d74fc3b44b8e9b00330d2fd9c4f8809f01f063 (diff)
crashtesting: failure to reload conversion of forum-de3-6592.odt to docx
Change-Id: Ic2781bbd25e794992a181b2f4807fc0ca08ef33b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177673 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/shape/WpsContext.cxx49
1 files changed, 39 insertions, 10 deletions
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 4734505302bb..78cef2a0d45c 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -682,6 +682,8 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
xPropertySet->setPropertyValue(u"InteropGrabBag"_ustr, uno::Any(aGrabBag));
}
+ auto xPropertySetInfo = xPropertySet->getPropertySetInfo();
+
if (xServiceInfo.is())
{
// Handle inset attributes for Writer textframes.
@@ -701,16 +703,29 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
= { u"TextLeftDistance"_ustr, u"TextUpperDistance"_ustr,
u"TextRightDistance"_ustr, u"TextLowerDistance"_ustr };
for (std::size_t i = 0; i < SAL_N_ELEMENTS(aShapeProps); ++i)
- if (oInsets[i])
+ {
+ if (!oInsets[i])
+ continue;
+ if (xPropertySetInfo && xPropertySetInfo->hasPropertyByName(aShapeProps[i]))
xPropertySet->setPropertyValue(aShapeProps[i], uno::Any(*oInsets[i]));
+ else
+ SAL_WARN("oox", "Property: " << aShapeProps[i] << " not supported");
+ }
}
// Handle text vertical adjustment inside a text frame
if (rAttribs.hasAttribute(XML_anchor))
{
- drawing::TextVerticalAdjust eAdjust
- = drawingml::GetTextVerticalAdjust(rAttribs.getToken(XML_anchor, XML_t));
- xPropertySet->setPropertyValue(u"TextVerticalAdjust"_ustr, uno::Any(eAdjust));
+ if (xPropertySetInfo
+ && xPropertySetInfo->hasPropertyByName(u"TextVerticalAdjust"_ustr))
+ {
+ drawing::TextVerticalAdjust eAdjust = drawingml::GetTextVerticalAdjust(
+ rAttribs.getToken(XML_anchor, XML_t));
+ xPropertySet->setPropertyValue(u"TextVerticalAdjust"_ustr,
+ uno::Any(eAdjust));
+ }
+ else
+ SAL_WARN("oox", "Property: TextVerticalAdjust not supported");
}
// Apply character color of the shape to the shape's textbox.
@@ -775,9 +790,14 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
}
}
- auto nWrappingType = rAttribs.getToken(XML_wrap, XML_square);
- xPropertySet->setPropertyValue(u"TextWordWrap"_ustr,
- uno::Any(nWrappingType == XML_square));
+ if (xPropertySetInfo && xPropertySetInfo->hasPropertyByName(u"TextWordWrap"_ustr))
+ {
+ auto nWrappingType = rAttribs.getToken(XML_wrap, XML_square);
+ xPropertySet->setPropertyValue(u"TextWordWrap"_ustr,
+ uno::Any(nWrappingType == XML_square));
+ }
+ else
+ SAL_WARN("oox", "Property: TextWordWrap not supported");
return this;
}
@@ -831,9 +851,18 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
u"FrameIsAutomaticHeight"_ustr,
uno::Any(getBaseToken(nElementToken) == XML_spAutoFit));
else
- xPropertySet->setPropertyValue(
- u"TextAutoGrowHeight"_ustr,
- uno::Any(getBaseToken(nElementToken) == XML_spAutoFit));
+ {
+ auto xPropertySetInfo = xPropertySet->getPropertySetInfo();
+ if (xPropertySetInfo
+ && xPropertySetInfo->hasPropertyByName(u"TextAutoGrowHeight"_ustr))
+ {
+ xPropertySet->setPropertyValue(
+ u"TextAutoGrowHeight"_ustr,
+ uno::Any(getBaseToken(nElementToken) == XML_spAutoFit));
+ }
+ else
+ SAL_WARN("oox", "Property: TextAutoGrowHeight not supported");
+ }
}
}
break;