summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-02-15 08:28:27 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-03-02 09:11:44 +0100
commit09f6cd19a8f1a073d002e2835c67ea4f4739bf83 (patch)
tree615b5a5cc97dda6eae1164896e262ab19b709217 /writerfilter
parentf823b3a0c004129450fa2e39fd8241362e4ea6a0 (diff)
DOCX filter: fix horizontal pos of floattables with compat mode >= 15
The floating table in the bugdoc has a small negative horizontal indent, which carefully aligns it so that the contained paragraph lines up with the text above the table. It turns out that compatibilityMode >= 15 doesn't do this anymore in Word, so we should at least avoid this tweak on import/export when we know the compat mode. Fix the problem by avoiding the <w:tblpPr w:tblpX="..."> decrease during import and the matching increase on export. This is similar to what commit 9a31d1c83e08600507689dc18f6f0973bc7e4389 (tdf#106742: OOXML import/export: treat "tblInd" properly., 2017-04-04) did for non-floating tables. I discovered this while working on multi-page sw floattables, but this is relevant for single-page sw floattables as well. Next to the modified testcase, sw/qa/core/layout/data/floattable.docx is also a good test file, which shows how the left border now lines up with the body frame, and there used to be a noticeable gap there. Now sw/qa/core/layout/data/floattable.docx gets rendered ~perfectly (with SW_FORCE_FLY_SPLIT=1). (cherry picked from commit 7fb8b73ad320e32af130ceddec80a9ff08407eab) Change-Id: Ia52202f1bc3274f4ce2b7ee02c85d07589454ae9
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 58d96a9cd8f5..042cc142c71d 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -536,7 +536,8 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
m_aTableProperties->Insert( PROP_TABLE_BORDER_DISTANCES, uno::Any( aDistances ) );
- if (!rFrameProperties.empty())
+ sal_Int32 nMode = m_rDMapper_Impl.GetSettingsTable()->GetWordCompatibilityMode();
+ if (!rFrameProperties.empty() && nMode < 15)
lcl_DecrementHoriOrientPosition(rFrameProperties, rInfo.nLeftBorderDistance);
// Set table above/bottom spacing to 0.
@@ -613,7 +614,6 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
// tdf#106742: since MS Word 2013 (compatibilityMode >= 15), top-level tables are handled the same as nested tables;
// the default behavior when DOCX doesn't define "compatibilityMode" option is to add the cell spacing
- sal_Int32 nMode = m_rDMapper_Impl.GetSettingsTable()->GetWordCompatibilityMode();
if (0 < nMode && nMode <= 14 && rInfo.nNestLevel == 1)
{