summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2014-05-05 11:50:58 +0200
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2014-05-06 16:32:27 +0200
commit9bb6956197c5caaa150fc8ed52233741749a4060 (patch)
tree6ac76c7ba5e3f2e65979103f0610acb47dbfcc0b /sw
parent2d8694c2f9cef9eddeb2184b40045099dadbab90 (diff)
ooxml: fix cell theme color and shade preservation
The cell property w:shd was not being properly preserved when the shade value was different from "clear". The shading affects the cell color and the exporter was not taking that into account when comparing the cell color with the original color to know if the user had changed it. Besides, we were not preserving the attributes themeColor, themeTint and themeShade. I have modified the existing unit test testTableThemePreservation to add a check for those new attributes. Change-Id: I06d2e668486803cba039eacb717a69413bd5a1df
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/table-theme-preservation.docxbin37479 -> 37575 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx4
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx11
3 files changed, 13 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx b/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx
index 522dac899417..ae4ede04b4d3 100644
--- a/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx
+++ b/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 55b08e703b06..8c9938246074 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1972,6 +1972,10 @@ DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, "table-theme-preservation.d
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFill", "accent6");
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillShade", "80");
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillTint", "");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "val", "horzStripe");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeColor", "accent3");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeTint", "33");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "color", "E7EEEE");
// check table style has been preserved
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tblPr/w:tblStyle", "val", "Sombreadoclaro-nfasis1");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 66b1b260441a..553b444434d6 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2896,7 +2896,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
sw::util::HasItem<SfxGrabBagItem>( pFmt->GetAttrSet(), RES_FRMATR_GRABBAG )->GetGrabBag();
OString sOriginalColor;
- std::map<OUString, com::sun::star::uno::Any>::iterator aGrabBagElement = aGrabBag.find("fill");
+ std::map<OUString, com::sun::star::uno::Any>::iterator aGrabBagElement = aGrabBag.find("originalColor");
if( aGrabBagElement != aGrabBag.end() )
sOriginalColor = OUStringToOString( aGrabBagElement->second.get<OUString>(), RTL_TEXTENCODING_UTF8 );
@@ -2911,7 +2911,6 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
else
{
::sax_fastparser::FastAttributeList* aAttrList = NULL;
- AddToAttrList( aAttrList, FSNS( XML_w, XML_fill ), sColor.getStr() );
for( aGrabBagElement = aGrabBag.begin(); aGrabBagElement != aGrabBag.end(); ++aGrabBagElement )
{
@@ -2922,6 +2921,14 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
AddToAttrList( aAttrList, FSNS( XML_w, XML_themeFillTint ), sValue.getStr() );
else if( aGrabBagElement->first == "themeFillShade")
AddToAttrList( aAttrList, FSNS( XML_w, XML_themeFillShade ), sValue.getStr() );
+ else if( aGrabBagElement->first == "fill" )
+ AddToAttrList( aAttrList, FSNS( XML_w, XML_fill ), sValue.getStr() );
+ else if( aGrabBagElement->first == "themeColor")
+ AddToAttrList( aAttrList, FSNS( XML_w, XML_themeColor ), sValue.getStr() );
+ else if( aGrabBagElement->first == "themeTint")
+ AddToAttrList( aAttrList, FSNS( XML_w, XML_themeTint ), sValue.getStr() );
+ else if( aGrabBagElement->first == "themeShade")
+ AddToAttrList( aAttrList, FSNS( XML_w, XML_themeShade ), sValue.getStr() );
else if( aGrabBagElement->first == "color")
AddToAttrList( aAttrList, FSNS( XML_w, XML_color ), sValue.getStr() );
else if( aGrabBagElement->first == "val")