summaryrefslogtreecommitdiff
path: root/writerfilter
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 /writerfilter
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 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/CellColorHandler.cxx13
-rw-r--r--writerfilter/source/dmapper/TablePropertiesHandler.cxx2
2 files changed, 14 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx b/writerfilter/source/dmapper/CellColorHandler.cxx
index c883991991cf..c70936dccf3d 100644
--- a/writerfilter/source/dmapper/CellColorHandler.cxx
+++ b/writerfilter/source/dmapper/CellColorHandler.cxx
@@ -131,6 +131,15 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal)
case NS_ooxml::LN_CT_Shd_themeFillTint:
createGrabBag("themeFillTint", uno::makeAny(OUString::number(nIntValue, 16)));
break;
+ case NS_ooxml::LN_CT_Shd_themeColor:
+ createGrabBag("themeColor", uno::makeAny(TDefTableHandler::getThemeColorTypeString(nIntValue)));
+ break;
+ case NS_ooxml::LN_CT_Shd_themeShade:
+ createGrabBag("themeShade", uno::makeAny(OUString::number(nIntValue, 16)));
+ break;
+ case NS_ooxml::LN_CT_Shd_themeTint:
+ createGrabBag("themeTint", uno::makeAny(OUString::number(nIntValue, 16)));
+ break;
default:
OSL_FAIL( "unknown attribute");
}
@@ -319,6 +328,10 @@ TablePropertyMapPtr CellColorHandler::getProperties()
pPropertyMap->Insert( m_OutputFormat == Form ? PROP_BACK_COLOR
: m_OutputFormat == Paragraph ? PROP_PARA_BACK_COLOR
: PROP_CHAR_BACK_COLOR, uno::makeAny( nApplyColor ));
+
+ createGrabBag("originalColor", uno::makeAny( OStringToOUString(
+ msfilter::util::ConvertColor( nApplyColor, true ), RTL_TEXTENCODING_UTF8 )));
+
return pPropertyMap;
}
diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index b839e2e70f37..0edbd71b33c0 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -324,10 +324,10 @@ namespace dmapper {
CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
pCellColorHandler->enableInteropGrabBag("shd"); //enable to store shd unsupported props in grab bag
pProperties->resolve( *pCellColorHandler );
+ TablePropertyMapPtr pPropertyMap = pCellColorHandler->getProperties();
beans::PropertyValue aGrabBag = pCellColorHandler->getInteropGrabBag();
if (m_pCurrentInteropGrabBag)
m_pCurrentInteropGrabBag->push_back(aGrabBag);
- TablePropertyMapPtr pPropertyMap = pCellColorHandler->getProperties();
pPropertyMap->Insert( PROP_CELL_INTEROP_GRAB_BAG, aGrabBag.Value );
cellProps( pPropertyMap );
}