diff options
author | Regényi Balázs <regenyi.balazs@nisz.hu> | 2020-12-21 09:35:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-12-21 17:05:32 +0100 |
commit | f80dcee922428fa564b4779b1f81ad087db937ae (patch) | |
tree | 8efa698e7e87a90141b259db365fafccea383ed0 /sw | |
parent | d360147a9943634d5ad4950aa99ad3f4a1666424 (diff) |
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 <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 22 |
1 files changed, 17 insertions, 5 deletions
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; |