filter/source/msfilter/svdfppt.cxx | 7 ----- include/filter/msfilter/svdfppt.hxx | 1 oox/source/shape/WpsContext.cxx | 49 ++++++++++++++++++++++++++++-------- 3 files changed, 40 insertions(+), 17 deletions(-)
New commits: commit 264c333b055bcebf0ba85f5d7ebf66fe6b245bbc Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon Dec 2 11:00:59 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Dec 2 15:34:12 2024 +0100 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.mcnam...@collabora.com> Tested-by: Jenkins 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; commit d4d74fc3b44b8e9b00330d2fd9c4f8809f01f063 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon Dec 2 12:01:47 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Dec 2 15:33:59 2024 +0100 mnOriginalTextPos is only written to, never read Change-Id: Iaca97dc3a0534847cbe96816a0827549a8f8d371 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177685 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index bea4a2aec8e5..472a1e106f40 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -4408,8 +4408,7 @@ PPTStyleSheet::~PPTStyleSheet() } PPTParaPropSet::PPTParaPropSet() - : mnOriginalTextPos(0) - , mxParaSet( new ImplPPTParaPropSet ) + : mxParaSet( new ImplPPTParaPropSet ) { mxParaSet->mnHasAnm = 1; } @@ -4417,7 +4416,6 @@ PPTParaPropSet::PPTParaPropSet() PPTParaPropSet::PPTParaPropSet( PPTParaPropSet const & rParaPropSet ) { mxParaSet = rParaPropSet.mxParaSet; - mnOriginalTextPos = rParaPropSet.mnOriginalTextPos; } PPTParaPropSet::~PPTParaPropSet() @@ -4429,7 +4427,6 @@ PPTParaPropSet& PPTParaPropSet::operator=( const PPTParaPropSet& rParaPropSet ) if ( this != &rParaPropSet ) { mxParaSet = rParaPropSet.mxParaSet; - mnOriginalTextPos = rParaPropSet.mnOriginalTextPos; } return *this; } @@ -5069,7 +5066,6 @@ void PPTStyleTextPropReader::ReadParaProps(SvStream& rIn, const DffRecordHeader& OSL_FAIL( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" ); } PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet ); - pPara->mnOriginalTextPos = nCharReadCnt; aParaPropList.emplace_back( pPara ); if ( nCharCount ) { @@ -5079,7 +5075,6 @@ void PPTStyleTextPropReader::ReadParaProps(SvStream& rIn, const DffRecordHeader& if ( pDat[ nCount ] == 0xd ) { pPara = new PPTParaPropSet( aParaPropSet ); - pPara->mnOriginalTextPos = nCharReadCnt + nCount + 1; aParaPropList.emplace_back( pPara ); } } diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index dcb6f87061d2..094c22a5918f 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -903,7 +903,6 @@ struct ImplPPTParaPropSet final : public salhelper::SimpleReferenceObject struct PPTParaPropSet { - sal_uInt32 mnOriginalTextPos; rtl::Reference<ImplPPTParaPropSet> mxParaSet; PPTParaPropSet();