sw/qa/extras/rtfexport/data/tdf137085.rtf | 10 ++++++++++ sw/qa/extras/rtfexport/rtfexport5.cxx | 16 ++++++++++++++++ writerfilter/source/rtftok/rtfdispatchvalue.cxx | 10 ++++++++++ 3 files changed, 36 insertions(+)
New commits: commit 501975b1705a9724c91bcd13ec0de19d39551595 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Wed Oct 21 17:53:07 2020 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Oct 22 14:10:26 2020 +0200 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.st...@cib.de> (cherry picked from commit fc872146845e4d77ff404d0929f28abf2d3a1c51) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104604 Reviewed-by: Miklos Vajna <vmik...@collabora.com> 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); diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index d6b0fc79b21a..b43e85a2352a 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -624,6 +624,11 @@ bool RTFDocumentImpl::dispatchTableValue(RTFKeyword nKeyword, int nParam) default: break; } + putNestedAttribute(m_aStates.top().getTableRowSprms(), + NS_ooxml::LN_CT_TblPrBase_tblCellMar, nSprm, + new RTFValue(aAttributes)); + // tdf#74795 also set on current cell, and as default for table cells + // (why isn't this done by domainmapper?) putNestedAttribute(m_aStates.top().getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, new RTFValue(aAttributes)); putNestedAttribute(m_aDefaultState.getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcMar, @@ -655,6 +660,10 @@ bool RTFDocumentImpl::dispatchTableValue(RTFKeyword nKeyword, int nParam) default: break; } + putNestedSprm(m_aStates.top().getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblCellMar, + nSprm, new RTFValue(aAttributes)); + // tdf#74795 also set on current cell, and as default for table cells + // (why isn't this done by domainmapper?) putNestedSprm(m_aStates.top().getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, new RTFValue(aAttributes)); putNestedSprm(m_aDefaultState.getTableCellSprms(), NS_ooxml::LN_CT_TcPrBase_tcMar, @@ -670,6 +679,7 @@ bool RTFDocumentImpl::dispatchTableValue(RTFKeyword nKeyword, int nParam) aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)); aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, pIntValue); + // FIXME: this is wrong, it is half-gap, needs to be distinguished from margin! depending on TRPADDFL/TRPADDFR putNestedSprm(m_aStates.top().getTableRowSprms(), NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_left, new RTFValue(aAttributes)); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits