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

Miklos Vajna vmiklos at collabora.co.uk
Thu Apr 3 05:01:34 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo76979.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx  |   10 ++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |    2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 84c04d73e6f80120c2fc7d17dd12e3b68214a63b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Apr 3 13:35:04 2014 +0200

    fdo#76979 DOCX export: a:srgbClr should be always an explicit color
    
    The brush color contains both the color itself and transparency as well.
    In case of DocxAttributeOutput::FormatBackground(), the sColor should
    contain the color part, and oAlpha the transparency part.
    
    In case of drawingML export of Writer TextFrames, an automatic color
    (0xFFFFFFF) shouldn't be recognized as "auto", as that's invalid:
    instead an explicit 0xFFFFFF with zero transparency should be written.
    
    Fix the problem by calling msfilter::util::ConvertColor() for the RGB
    color only.
    
    Change-Id: I2132375a4dbcac1667aed49c74e581183178b0cc

diff --git a/sw/qa/extras/ooxmlexport/data/fdo76979.docx b/sw/qa/extras/ooxmlexport/data/fdo76979.docx
new file mode 100644
index 0000000..f8ee995
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76979.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 417e92c..535ee1a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1000,6 +1000,16 @@ DECLARE_OOXMLEXPORT_TEST(testFdo76249, "fdo76249.docx")
     assertXPath(pXmlDoc, "//mc:Choice/w:drawing//w:txbxContent//w:drawing//lc:lockedCanvas", 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFdo76979, "fdo76979.docx")
+{
+    // The problem was that black was exported as "auto" fill color, resulting in well-formed, but invalid XML.
+    xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
+    if (!pXmlDoc)
+       return;
+    // This was "auto", not "FFFFFF".
+    assertXPath(pXmlDoc, "//wps:spPr/a:solidFill/a:srgbClr", "val", "FFFFFF");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index caea79e..947cd16 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6528,7 +6528,7 @@ boost::optional<sal_Int32> lcl_getDmlAlpha(const SvxBrushItem& rBrush)
 
 void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
 {
-    OString sColor = msfilter::util::ConvertColor( rBrush.GetColor( ) );
+    OString sColor = msfilter::util::ConvertColor( rBrush.GetColor().GetRGBColor() );
     boost::optional<sal_Int32> oAlpha = lcl_getDmlAlpha(rBrush);
     if (m_rExport.SdrExporter().getTextFrameSyntax())
     {


More information about the Libreoffice-commits mailing list