[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source

Regényi Balázs (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 21 20:59:21 UTC 2020


 sw/source/filter/ww8/wrtw8nds.cxx |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit b5a02acda8396c108e21e72fc830cc41a0bc890c
Author:     Regényi Balázs <regenyi.balazs at nisz.hu>
AuthorDate: Mon Dec 21 09:35:47 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Dec 21 21:58:39 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 <caolanm at redhat.com>
    (cherry picked from commit f80dcee922428fa564b4779b1f81ad087db937ae)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108008

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;


More information about the Libreoffice-commits mailing list