summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-04-02 10:22:45 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-04-07 11:29:27 +0200
commitd2db4bc9507653a46fdea282d41b9683910a072f (patch)
treead926d7198edac7c8c0d5068e7b5fd0eca0c180e /sw/source/filter
parenta7f36ba45bf86ccd8f8a61c27f5b25d0999176b1 (diff)
tdf#119760 docx: table starts at left, not mid-border
related to compatibilityMode = 15; the new export default. In Word 2013+, it appears that the table starts immediately, and then the border is added. In Writer, the table is considered to start mid-border. So that difference needs to be emulated by adjusting the table margin. The same appears to be true for nested tables. Negative margins appear to just be ignored for nested tables, and Word's UI does not accept a negative value. I modified the existing table-position-15.docx slightly (in Word 2016), just to remove spacing between the caption and the table so that it would be easy to visually compare the table position. One slight difference is that WORD seems to add a small "margin" to the the paragraph shading area - don't let that throw you off. The existing unit test enforced settings that didn't match how Word 2013 was showing the files, despite being written to test exactly that. I assume the author was focusing more on OLDER versions of Word and didn't care too much about the NEW version. A man after my own heart. MISC: -I removed my earlier TODO which was just plain wrong. -the ambiguous make::any caused me untold problems, so I made it unambiguous by moving it into a variable. Change-Id: I0685ab74777f1def2841c7d18ff1cdaf2753f47b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91608 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8505571f545d..a8ed8e88a47d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4091,11 +4091,13 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
// LO uses a higher compatibility than 2010's 14.
sal_Int32 nMode = lcl_getWordCompatibilityMode( *m_rExport.m_pDoc );
+ const SwFrameFormat* pFrameFormat = pTableTextNodeInfoInner->getTableBox()->GetFrameFormat();
if ((0 < nMode && nMode <= 14) && m_tableReference->m_nTableDepth == 0)
+ nIndent += pFrameFormat->GetBox().GetDistance( SvxBoxItemLine::LEFT );
+ else
{
- const SwTableBox* pTabBox = pTableTextNodeInfoInner->getTableBox();
- const SwFrameFormat* pFrameFormat = pTabBox->GetFrameFormat();
- nIndent += sal_Int32( pFrameFormat->GetBox().GetDistance( SvxBoxItemLine::LEFT ) );
+ // adjust for SW considering table to start mid-border instead of nested/2013's left-side-of-border.
+ nIndent -= pFrameFormat->GetBox().CalcLineWidth( SvxBoxItemLine::LEFT ) / 2;
}
break;