[Libreoffice-commits] core.git: sw/source

Serge Krot Serge.Krot at cib.de
Wed Oct 25 18:45:14 UTC 2017


 sw/source/filter/ww8/docxattributeoutput.cxx |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

New commits:
commit b7e8c7631d3ef3af53e873a9435bd954790cab05
Author: Serge Krot <Serge.Krot at cib.de>
Date:   Wed Oct 25 13:07:35 2017 +0200

    tdf#38778 Added colors into run properties of field run
    
    During export into DOCX all runs inside fields should
    contain all character properties including character color.
    
    Change-Id: I2a7d4fc26f1e1de1080f51de84180a19794709a9
    Reviewed-on: https://gerrit.libreoffice.org/43723
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Serge Krot (CIB) <Serge.Krot at cib.de>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 54d2819c2445..c8e690ac7b9e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1811,15 +1811,31 @@ void DocxAttributeOutput::DoWriteFieldRunProperties( const SwTextNode * pNode, s
     {
         m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
 
+        // 1. output webHidden flag
         if(GetExport().m_bHideTabLeaderAndPageNumbers && m_pHyperlinkAttrList.is() )
         {
             m_pSerializer->singleElementNS( XML_w, XML_webHidden, FSEND );
         }
 
+        // 2. output color
+        if ( m_pColorAttrList.is() )
+        {
+            XFastAttributeListRef xAttrList( m_pColorAttrList.get() );
+            m_pColorAttrList.clear();
+
+            m_pSerializer->singleElementNS( XML_w, XML_color, xAttrList );
+        }
+
+        // 3. output all other character properties
         SwWW8AttrIter aAttrIt( m_rExport, *pNode );
         aAttrIt.OutAttr( nPos, false );
 
         m_pSerializer->endElementNS( XML_w, XML_rPr );
+
+        // During SwWW8AttrIter::OutAttr() call the new value of the text color could be set into [m_pColorAttrList].
+        // But we do not need to keep it any more and should clean up,
+        // While the next run could define a new color that is different to current one.
+        m_pColorAttrList.clear();
     }
 
     m_bPreventDoubleFieldsHandling = false;
@@ -6600,9 +6616,6 @@ void DocxAttributeOutput::CharCaseMap( const SvxCaseMapItem& rCaseMap )
 
 void DocxAttributeOutput::CharColor( const SvxColorItem& rColor )
 {
-    if (m_bPreventDoubleFieldsHandling)
-        return;
-
     const Color aColor( rColor.GetValue() );
     OString aColorString;
 


More information about the Libreoffice-commits mailing list