diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-10-21 17:53:07 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-10-22 09:38:19 +0200 |
commit | fc872146845e4d77ff404d0929f28abf2d3a1c51 (patch) | |
tree | 96803522a9404360df0b731993dd9a7d9d0e1403 /sw/qa | |
parent | b6fb3551d890f0ccbb88eb7ab81c83f9a2b1694c (diff) |
tdf#137085 writerfilter: RTF import: \trpaddfl and \trpaddl are row...
...properties, not cell properties.
What is supposed to happen here, afaict:
1. \trpaddfr3 either has an effect on the left margin too (despite being
defined for right), or \trpaddfl3 is the default, 0 is not the
default
2. \trgaph600 should be ignored if the \trpaddfl3 is in effect
3. \trpaddl0 should be in effect, overriding both the value from
\trgaph600 and the built-in default of #define DEF_BORDER_DIST 190
CellMarginHandler::lcl_sprm() needs to distinguish between \trpaddfl0
and \trpaddfl3 cases, but its not possible currently because a)
\trpaddfl is processed after \trgaph/\trpaddl, and b) both \trgaph and
\trpaddl produce the same srpm-id.
This fixes \trpaddl handling just enough to import the bugdoc properly,
for more fixing a new sprm-id for \trgaph would be needed at least.
At the other end, there is a line in DomainMapperTableHandler.cxx:
m_aTableProperties->getValue( TablePropertyMap::GAP_HALF, nGapHalf )
... but nothing that would initialize the GAP_HALF there.
That this bugdoc looked right before commit
c2a5346b19c57f93f210b76c15cdba64f6871203 appears to be entirely
accidental.
Change-Id: I80dc34bdd5dadb7d7d7f5ec595907035d621a656
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104638
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf137085.rtf | 10 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport5.cxx | 16 |
2 files changed, 26 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf137085.rtf b/sw/qa/extras/rtfexport/data/tdf137085.rtf new file mode 100644 index 000000000000..6aed787ef8ad --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf137085.rtf @@ -0,0 +1,10 @@ +{\rtf1\ansi + +\trowd +\trgaph600\trpaddfr3\trpaddl0 +\cellx3000 +\cellx6000 +<- no padding here\cell +<- no padding here\cell +\row +} diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index aa043ecfc750..4bac42fecfb4 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -1002,6 +1002,22 @@ DECLARE_RTFEXPORT_TEST(testTdf74795, "tdf74795.rtf") getProperty<sal_Int32>(xCell, "LeftBorderDistance")); } +DECLARE_RTFEXPORT_TEST(testTdf137085, "tdf137085.rtf") +{ + uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); + // \trpaddl0 overrides \trgaph600 (-1058 mm100) and built-in default of 190 + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xTable, "LeftMargin")); + + // the \trpaddl0 is applied to all cells + uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), + getProperty<sal_Int32>(xCell, "LeftBorderDistance")); + + xCell.set(xTable->getCellByName("B1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), + getProperty<sal_Int32>(xCell, "LeftBorderDistance")); +} + DECLARE_RTFEXPORT_TEST(testTdf77349, "tdf77349.rtf") { uno::Reference<container::XNamed> xImage(getShape(1), uno::UNO_QUERY); |