diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-02 11:00:59 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-10 20:37:37 +0100 |
commit | 5deb0ca100bf2bf962ea77c77b561186c3952b01 (patch) | |
tree | ab5dc90de744c2fd905349475835418a3b9b169a | |
parent | cc38980d71ce6b8771f43bdb89656fc0d28ee5d8 (diff) |
crashtesting: failure to reload conversion of forum-de3-6592.odt to docx
Change-Id: Ic2781bbd25e794992a181b2f4807fc0ca08ef33b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177675
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
(cherry picked from commit 9efc47ac6fb7c6b82ac35f114898e4e8e510c5f4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177689
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | oox/source/shape/WpsContext.cxx | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 83934745d946..56abef55fcc1 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. @@ -778,9 +793,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; } @@ -834,9 +854,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; |