sw/source/filter/ww8/wrtw8nds.cxx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
New commits: commit f80dcee922428fa564b4779b1f81ad087db937ae Author: Regényi Balázs <regenyi.bal...@nisz.hu> AuthorDate: Mon Dec 21 09:35:47 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Dec 21 17:05:32 2020 +0100 tdf#138986 Fix DOC export of LinkDisplayName The LinkedDisplayName could be empty what caused an assert. tdf#138986 regression from commit: bda05ba17362222b74727872579b65b3fa14e3d8 (tdf#41466 DOCX import: fix VML v:shape/v:textbox) Change-Id: I166a7e4c1defc201d0563a961b28ecb6c6be500c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108077 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index fc75ac5ff02a..77cdab41e879 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -149,6 +149,22 @@ static ww::eField lcl_getFieldId(const IFieldmark*const pFieldmark) return ww::eUNKNOWN; } +static OUString +lcl_getLinkChainName(const uno::Reference<beans::XPropertySet>& rPropertySet, + const uno::Reference<beans::XPropertySetInfo>& rPropertySetInfo) +{ + OUString sLinkChainName; + if (rPropertySetInfo->hasPropertyByName("LinkDisplayName")) + { + rPropertySet->getPropertyValue("LinkDisplayName") >>= sLinkChainName; + if (!sLinkChainName.isEmpty()) + return sLinkChainName; + } + if (rPropertySetInfo->hasPropertyByName("ChainName")) + rPropertySet->getPropertyValue("ChainName") >>= sLinkChainName; + return sLinkChainName; +} + MSWordAttrIter::MSWordAttrIter( MSWordExportBase& rExport ) : pOld( rExport.m_pChpIter ), m_rExport( rExport ) { @@ -637,7 +653,6 @@ bool SwWW8AttrIter::HasFlysAt(sal_Int32 nSwPos) const FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos) { // collection point to first gather info about all of the potentially linked textboxes: to be analyzed later. - OUString sLinkChainName; ww8::FrameIter linkedTextboxesIter = maFlyIter; while ( linkedTextboxesIter != maFlyFrames.end() ) { @@ -654,10 +669,7 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos) { MSWordExportBase::LinkedTextboxInfo aLinkedTextboxInfo; - if( xPropertySetInfo->hasPropertyByName("LinkDisplayName") ) - xPropertySet->getPropertyValue("LinkDisplayName") >>= sLinkChainName; - else if( xPropertySetInfo->hasPropertyByName("ChainName") ) - xPropertySet->getPropertyValue("ChainName") >>= sLinkChainName; + const OUString sLinkChainName = lcl_getLinkChainName(xPropertySet, xPropertySetInfo); if( xPropertySetInfo->hasPropertyByName("ChainNextName") ) xPropertySet->getPropertyValue("ChainNextName") >>= aLinkedTextboxInfo.sNextChain; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits