diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-10-21 17:53:07 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-10-22 14:10:26 +0200 |
commit | 501975b1705a9724c91bcd13ec0de19d39551595 (patch) | |
tree | 32a88cf95dbf34c2a24ce7b43a81962cd4bbe06b /sw | |
parent | ada52994d053a8f0085d580a9f25face8be0d11e (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>
(cherry picked from commit fc872146845e4d77ff404d0929f28abf2d3a1c51)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104604
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-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 25c0bdb788f3..e005ce674b92 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -1004,6 +1004,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); |