summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2014-04-03 16:27:37 +0200
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2014-04-03 22:19:20 +0200
commitae61569eea0719a882010cfbb260a1a0d690d974 (patch)
treec65a7a303fd6f656b15b68655ebb1ce54fd38a78 /writerfilter/source/dmapper/DomainMapperTableHandler.cxx
parentf9636d50e6543302f236164aeebadab2733e849b (diff)
oox: Do not overwrite table style properties
Some table properties can be defined by the table style but cells can overwrite them in their cell properties section. Our exporter was writing all the cell properties in all cases, regardless of them being defined by the theme or not, and we shouldn't do that if we want the document to work properly in Word. To fix the issue I store the style-defined cell properties (the format of all four borders) in the table grab bag. The exporter recovers them and compares with the cell properties before writing them; if the cell property matches the stlye-defined one, we don't write it to the document. An existing unit test was slightly modified to check that the actual cell properties are not being skipped. Change-Id: I3aa12d76fb8f73d3fd300f254d19e1683fb6146c
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapperTableHandler.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx30
1 files changed, 29 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 7ed56aa38700..08d1919dd345 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -340,7 +340,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
PropertyMap::iterator aTableStyleIter =
m_aTableProperties->find(META_PROP_TABLE_STYLE_NAME);
- uno::Sequence< beans::PropertyValue > aGrabBag( 1 );
+ uno::Sequence< beans::PropertyValue > aGrabBag( 5 );
sal_Int32 nGrabBagSize = 0;
if(aTableStyleIter != m_aTableProperties->end())
{
@@ -366,6 +366,33 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
PropertyMapPtr pMergedProperties = lcl_SearchParentStyleSheetAndMergeProperties(pStyleSheet, pStyleSheetTable);
+ table::BorderLine2 aBorderLine;
+ TableInfo rStyleInfo;
+ if (lcl_extractTableBorderProperty(pMergedProperties, PROP_TOP_BORDER, rStyleInfo, aBorderLine))
+ {
+ aGrabBag[1].Name = "TableStyleTopBorder";
+ aGrabBag[1].Value = uno::makeAny( aBorderLine );
+ nGrabBagSize++;
+ }
+ if (lcl_extractTableBorderProperty(pMergedProperties, PROP_BOTTOM_BORDER, rStyleInfo, aBorderLine))
+ {
+ aGrabBag[2].Name = "TableStyleBottomBorder";
+ aGrabBag[2].Value = uno::makeAny( aBorderLine );
+ nGrabBagSize++;
+ }
+ if (lcl_extractTableBorderProperty(pMergedProperties, PROP_LEFT_BORDER, rStyleInfo, aBorderLine))
+ {
+ aGrabBag[3].Name = "TableStyleLeftBorder";
+ aGrabBag[3].Value = uno::makeAny( aBorderLine );
+ nGrabBagSize++;
+ }
+ if (lcl_extractTableBorderProperty(pMergedProperties, PROP_RIGHT_BORDER, rStyleInfo, aBorderLine))
+ {
+ aGrabBag[4].Name = "TableStyleRightBorder";
+ aGrabBag[4].Value = uno::makeAny( aBorderLine );
+ nGrabBagSize++;
+ }
+
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
dmapper_logger->startElement("mergedProps");
pMergedProperties->dumpXml( dmapper_logger );
@@ -402,6 +429,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
if( nGrabBagSize > 0 )
{
+ aGrabBag.realloc( nGrabBagSize );
m_aTableProperties->Insert( PROP_TABLE_INTEROP_GRAB_BAG, uno::makeAny( aGrabBag ) );
}