summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-08-29 09:04:49 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-29 10:38:03 +0200
commite6ec0794858df1444f43659b568119bf126a90e6 (patch)
treeec43be356404747758a63a083db1d41594cea2ed /writerfilter/source/rtftok/rtfdispatchsymbol.cxx
parent8514f192c9e385550b336e57997c9e0dbd3a9bc3 (diff)
tdf#104937 RTF import: \trwWidthA is an absolute value
Not a relative one, so similar to \cellx need to convert these before sending the value to dmapper (which expects an OOXML value, which is always relative). The result of the correct type is that the relative width of the last cell in the table row is smaller, so other cells are wider -> they now reach the expected width. Change-Id: If282eb9a5ec644b38e552b5a66fc64a93538f216 Reviewed-on: https://gerrit.libreoffice.org/41668 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerfilter/source/rtftok/rtfdispatchsymbol.cxx')
-rw-r--r--writerfilter/source/rtftok/rtfdispatchsymbol.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index 8b3b4318c2ee..abf8840adf29 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -236,9 +236,14 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
m_bAfterCellBeforeRow = false;
if (m_aStates.top().nTableRowWidthAfter > 0)
{
+ // nTableRowWidthAfter is an absolute value, gridCol wants a
+ // relative value, so count the delta from the last cellx.
+ int& rCurrentCellX((Destination::NESTEDTABLEPROPERTIES == m_aStates.top().eDestination) ? m_nNestedCurrentCellX : m_nTopLevelCurrentCellX);
+ int nCellX = m_aStates.top().nTableRowWidthAfter - rCurrentCellX;
+
// Add fake cellx / cell, RTF equivalent of
// OOXMLFastContextHandlerTextTableRow::handleGridAfter().
- auto pXValue = std::make_shared<RTFValue>(m_aStates.top().nTableRowWidthAfter);
+ auto pXValue = std::make_shared<RTFValue>(nCellX);
m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND);
dispatchSymbol(RTF_CELL);
m_aStates.top().nTableRowWidthAfter = 0;