summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2014-04-01 17:18:39 +0200
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2014-04-03 09:59:17 +0200
commita3efbb5d33f5c6928141fd3e7aa7c6d3bdc6a087 (patch)
treee4fa257d59181f85ce421cd4cd98fac36a403428 /writerfilter
parenta718b02f8e24d7c167a56456523bc921b12e4f64 (diff)
oox: Preserve cell theme color.
When some background color is set to a table cell, it is stored in the cell properties tag <tcPr> like this: <w:shd w:fill="ECD2B6" w:color="auto" w:themeFill="accent6" w:themeFillTint="66" w:val="clear"/> The theme-related attributes in w:shd were not being preserved. To fix this I added an InteropGrabBag to the cell properties object, which is filled with the attributes of w:shd to be checked on export. The exporter checks if the cell color is still the original color that was imported from the file, if it is not it means the user has manually changed it during the edition and the new color is written instead. Finally, added a unit test for theme attributes on tables. Change-Id: Ica8091b5eb4075e51912a255650a1d9d64f5767a
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/PropertyIds.cxx1
-rw-r--r--writerfilter/source/dmapper/PropertyIds.hxx1
-rw-r--r--writerfilter/source/dmapper/TablePropertiesHandler.cxx10
3 files changed, 8 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index 8bdba4e404b3..24e523be35de 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -388,6 +388,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_CHAR_STYLISTICSETS_TEXT_EFFECT : sName = "CharStylisticSetsTextEffect"; break;
case PROP_CHAR_CNTXTALTS_TEXT_EFFECT : sName = "CharCntxtAltsTextEffect"; break;
case PROP_SDTPR : sName = "SdtPr"; break;
+ case PROP_CELL_INTEROP_GRAB_BAG : sName = "CellInteropGrabBag"; break;
}
::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index 1d29c0b1c497..ab6f92f5c12e 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -360,6 +360,7 @@ enum PropertyIds
,PROP_CHAR_STYLISTICSETS_TEXT_EFFECT
,PROP_CHAR_CNTXTALTS_TEXT_EFFECT
,PROP_SDTPR
+ ,PROP_CELL_INTEROP_GRAB_BAG
};
struct PropertyNameSupplier_Impl;
class PropertyNameSupplier
diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index e5e41726fdf6..877c602a5231 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -322,12 +322,14 @@ namespace dmapper {
if( pProperties.get())
{
CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
- if (m_pCurrentInteropGrabBag)
- pCellColorHandler->enableInteropGrabBag("shd");
+ pCellColorHandler->enableInteropGrabBag("shd"); //enable to store shd unsupported props in grab bag
pProperties->resolve( *pCellColorHandler );
+ beans::PropertyValue aGrabBag = pCellColorHandler->getInteropGrabBag();
if (m_pCurrentInteropGrabBag)
- m_pCurrentInteropGrabBag->push_back(pCellColorHandler->getInteropGrabBag());
- cellProps( pCellColorHandler->getProperties());
+ m_pCurrentInteropGrabBag->push_back(aGrabBag);
+ TablePropertyMapPtr pPropertyMap = pCellColorHandler->getProperties();
+ pPropertyMap->Insert( PROP_CELL_INTEROP_GRAB_BAG, aGrabBag.Value );
+ cellProps( pPropertyMap );
}
}
break;