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

Miklos Vajna vmiklos at suse.cz
Thu Jun 13 02:04:04 PDT 2013


 sw/qa/extras/ooxmlexport/data/page-graphic-background.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                  |   11 +++++++++++
 sw/source/filter/ww8/docxexport.cxx                       |    3 ++-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 837ccd73e23f31f1fe2da1972a9f41b60373f8e5
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jun 12 15:13:32 2013 +0200

    DOCX: don't export auto color as page background
    
    That auto here would mean black, potentially rendering the whole
    document unreadable.
    
    Change-Id: Ie17a6a9b00c9ab24204291d09175a3fba69cd4ea

diff --git a/sw/qa/extras/ooxmlexport/data/page-graphic-background.odt b/sw/qa/extras/ooxmlexport/data/page-graphic-background.odt
new file mode 100644
index 0000000..15050e6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/page-graphic-background.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 8b4308e..494076c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -72,6 +72,7 @@ public:
     void testI120928();
     void testFdo64826();
     void testPageBackground();
+    void testPageGraphicBackground();
     void testFdo65265();
     void testFdo65655();
 
@@ -123,6 +124,7 @@ void Test::run()
         {"i120928.docx", &Test::testI120928},
         {"fdo64826.docx", &Test::testFdo64826},
         {"page-background.docx", &Test::testPageBackground},
+        {"page-graphic-background.odt", &Test::testPageGraphicBackground},
         {"fdo65265.docx", &Test::testFdo65265},
         {"fdo65655.docx", &Test::testFdo65655},
     };
@@ -692,6 +694,15 @@ void Test::testPageBackground()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor"));
 }
 
+void Test::testPageGraphicBackground()
+{
+    // No idea how the graphic background should be exported (seems there is no
+    // way to do a non-tiling export to OOXML), but at least the background
+    // color shouldn't be black.
+    uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xPageStyle, "BackColor"));
+}
+
 void Test::testFdo65265()
 {
     // Redline (tracked changes) of text formatting were not exported
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 0afa634..40dc957 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -746,7 +746,8 @@ boost::optional<const SvxBrushItem*> DocxExport::getBackground()
     {
         // The 'color' is set for the first page style - take it and use it as the background color of the entire DOCX
         const SvxBrushItem* pBrush = (const SvxBrushItem*)pItem;
-        oRet.reset(pBrush);
+        if (pBrush->GetColor().GetColor() != COL_AUTO)
+            oRet.reset(pBrush);
     }
     return oRet;
 }


More information about the Libreoffice-commits mailing list