summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2014-01-31 14:02:12 +0100
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2014-02-05 02:00:03 +0100
commit2fcf3a871c94feeca11619ef5c8c0466ce61eb74 (patch)
treebe65c549156c3dea9c5b4d8ceadd7f3e43280c71 /sw
parentfdo#39944: fallback for DOCUMENT_* roles in ATK < 2.1.0 (diff)
downloadcore-2fcf3a871c94feeca11619ef5c8c0466ce61eb74.tar.gz
core-2fcf3a871c94feeca11619ef5c8c0466ce61eb74.zip
ooxml: preserve gradient shape fill
LibreOffice is unable to properly import the custom gradient fills defined in ooxml documents. To prevent data loss, we save the original gradient fill definition in the shape interopgrabbag and we write it back to the document on export. In case the user has changed the fill properties of a shape, the original fill will be discarded in favor of the new fill. We have added a new ooxmlexport unit test to test this feature. We have also added some missing transformations to the methods getColorTransformationName and getColorTransformationToken in Color class, and refactored some code in class DrawingML to the method WriteColor( OUString, Sequence ). Change-Id: Ie71f89eaa20313561aa9180ea33b76f3fb5e5df6
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/gradient-fill-preservation.docxbin0 -> 9390 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx39
2 files changed, 39 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/gradient-fill-preservation.docx b/sw/qa/extras/ooxmlexport/data/gradient-fill-preservation.docx
new file mode 100644
index 000000000000..c9abc10d2922
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/gradient-fill-preservation.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 239bb0286c03..1c820440f73d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2781,6 +2781,45 @@ DECLARE_OOXMLEXPORT_TEST(testDMLCustomGeometry, "dml-customgeometry-cubicbezier.
CPPUNIT_ASSERT_EQUAL(aCoordinates[i].second, aPairs[i].Second.Value.get<sal_Int32>());
}
}
+
+DECLARE_OOXMLEXPORT_TEST(testGradientFillPreservation, "gradient-fill-preservation.docx")
+{
+ xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+ if (!pXmlDocument)
+ return;
+
+ // check rgb colors for every step in the gradient of the first shape
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr",
+ "val", "ffff00");
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr",
+ "val", "ffff33");
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[3]/a:srgbClr",
+ "val", "ff0000");
+
+ // check theme colors for every step in the gradient of the second shape
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='0']/a:schemeClr",
+ "val", "accent5");
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:schemeClr",
+ "val", "accent1");
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='100000']/a:schemeClr",
+ "val", "accent1");
+
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:srgbClr/a:alpha",
+ "val", "20000");
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:schemeClr/a:tint",
+ "val", "44500");
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:gradFill/a:gsLst/a:gs[@pos='50000']/a:schemeClr/a:satMod",
+ "val", "160000");
+}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();