summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-09-14 22:11:50 +0300
committerJustin Luth <justin_luth@sil.org>2018-09-28 05:52:33 +0200
commitfe847dda1751bc2c96ef646baa4f16bcc431c1e3 (patch)
treeee382a5b87d47d107e2ca7d324598772fc7eec01 /writerfilter
parentf7a065f8cb3270a3fae382325e87dbec5e9a16fa (diff)
tdf#119760 writerfilter: cell border priority over tblBorder
If the tblBorder does not exist, or if first row's left-border has a different sized border than the overall table settings, use the cell's lineWidth value to determine the the spacing needed. The potential regression here is the spacing given to the cells. However, the current calculation is totally wrong (it needs to be based on per-cell, not on some table-level default) and so it was "wrong" a different way before. The unit test shows this visually. Plus, MS Office version are inconsistent in handling this unit test. The latest versions base the position on the *last* row and not the first row. The key reason for making this change is to support a table that doesn't have a table default, needed to fix tdf#92026. Change-Id: I319513a2f5550c1527dc564fb8b3806d1251a0c2 Reviewed-on: https://gerrit.libreoffice.org/60988 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx27
1 files changed, 19 insertions, 8 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index cf973bbaef9a..c0a8cbda54db 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -476,14 +476,6 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
{
aTableBorder.LeftLine = aLeftBorder;
aTableBorder.IsLeftLineValid = true;
- // Only top level table position depends on border width
- if (rInfo.nNestLevel == 1)
- {
- if (rFrameProperties.empty())
- rInfo.nLeftBorderDistance += aLeftBorder.LineWidth * 0.5;
- else
- lcl_DecrementHoriOrientPosition(rFrameProperties, aLeftBorder.LineWidth * 0.5);
- }
}
if (lcl_extractTableBorderProperty(m_aTableProperties.get(), PROP_RIGHT_BORDER, rInfo, aBorderLine))
{
@@ -515,6 +507,25 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
// so table's position depends on table's cells margin
// - nested tables: the goal is to have left-most border starting at table_indent pos
+ // Only top level table position depends on border width of Column A.
+ // TODO: Position based on last row (at least in MSOffice 2016), but first row in Office 2003.
+ // Export code is also based on first cell, so using first row here...
+ if ( rInfo.nNestLevel == 1 && !m_aCellProperties.empty() && !m_aCellProperties[0].empty() )
+ {
+ // aLeftBorder already contains tblBorder; overwrite if cell is different.
+ const boost::optional<PropertyMap::Property> aCellBorder
+ = m_aCellProperties[0][0]->getProperty(PROP_LEFT_BORDER);
+ if ( aCellBorder )
+ aCellBorder->second >>= aLeftBorder;
+ }
+ if ( rInfo.nNestLevel == 1 && aLeftBorder.LineWidth )
+ {
+ if (rFrameProperties.empty())
+ rInfo.nLeftBorderDistance += aLeftBorder.LineWidth * 0.5;
+ else
+ lcl_DecrementHoriOrientPosition(rFrameProperties, aLeftBorder.LineWidth * 0.5);
+ }
+
// tdf#106742: since MS Word 2013 (compatibilityMode >= 15), top-level tables are handled the same as nested tables;
// this is also the default behavior in LO when DOCX doesn't define "compatibilityMode" option
sal_Int32 nMode = m_rDMapper_Impl.GetSettingsTable()->GetWordCompatibilityMode();