[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/qa sw/source

Michael Stahl mstahl at redhat.com
Sat Aug 29 13:18:59 PDT 2015


 sw/qa/extras/odfexport/odfexport.cxx   |    9 +++++++++
 sw/source/core/unocore/swunohelper.cxx |   14 +++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 8c4bb051d644996eb92e3a6c6dd8d09972450733
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Aug 25 23:29:18 2015 +0200

    related: tdf#92379: sw: backward compatible ODF export of overriding
    
    ... frame/paragraph backgrounds.
    
    If a style is set to have draw:fill="solid" and a derived style to
    draw:fill="none" then the derived one must have
    fo:background-color="transparent" to override the parent for old
    consumers like LO <= 4.3/AOO <= 4.1 that don't understand draw:fill.
    
    Change-Id: I5b56c7ace927338239195c6bfcfef1950544c8d2
    (cherry picked from commit 25c50a71ffdf7c43f8f3dd10736188271cc75ef0)
    Reviewed-on: https://gerrit.libreoffice.org/18039
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 94fbd5b..735cd05 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -284,6 +284,15 @@ DECLARE_ODFEXPORT_TEST(testTdf92379, "tdf92379.fodt")
 //    CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle32, "FillColor"));
 //    CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle32, "FillTransparence"));
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x461900), getProperty<sal_Int32>(xStyle32, "CharColor"));
+
+    if (xmlDocPtr pXmlDoc = parseExport("styles.xml"))
+    {
+        // check that fo:background-color attribute is exported properly
+        assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and @style:display-name='Titre Avis expert']/style:paragraph-properties[@fo:background-color='#661900']", 1);
+        assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and @style:display-name='Avis expert questions']/style:paragraph-properties[@fo:background-color='transparent']", 1);
+        assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and @style:display-name='avis expert questions non cadres']/style:paragraph-properties[@fo:background-color='#801900']", 1);
+        assertXPath(pXmlDoc, "//style:style[@style:family='paragraph' and @style:display-name='Avis expert rXponses']/style:paragraph-properties[@fo:background-color='transparent']", 1);
+    }
 }
 
 DECLARE_ODFEXPORT_TEST(testFdo79358, "fdo79358.odt")
diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx
index 05dd0da..b4a8a4f 100644
--- a/sw/source/core/unocore/swunohelper.cxx
+++ b/sw/source/core/unocore/swunohelper.cxx
@@ -286,7 +286,18 @@ bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet,
     switch (eFill)
     {
         case drawing::FillStyle_NONE:
-            return false; // ignoring some extremely limited XFillColorItem eval
+            // claim that BackColor and BackTransparent are available so that
+            // fo:background="transparent" attribute is exported to override
+            // the parent style in case it is != NONE
+            switch (nMID)
+            {
+                case MID_BACK_COLOR:
+                case MID_BACK_COLOR_R_G_B:
+                case MID_GRAPHIC_TRANSPARENT: // this is *BackTransparent
+                    return true;
+                default:
+                    return false;
+            }
             break;
         case drawing::FillStyle_SOLID:
         case drawing::FillStyle_GRADIENT: // gradient and hatch don't exist in
@@ -294,6 +305,7 @@ bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet,
             switch (nMID)
             {
                 case MID_BACK_COLOR:
+                case MID_GRAPHIC_TRANSPARENT: // this is *BackTransparent
                     // Gradient/Hatch always have emulated color
                     return (drawing::FillStyle_SOLID != eFill)
                         || SfxItemState::SET == rSet.GetItemState(XATTR_FILLCOLOR)


More information about the Libreoffice-commits mailing list