summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-10-03 09:16:52 +0200
committerMichael Stahl <mstahl@redhat.com>2017-10-04 11:51:50 +0200
commit476cdd99d76d108e1b4f21382fabedc38e9e6d6b (patch)
treebaa454245010833d185d6fa1cdbe7c8e4781a323 /writerfilter
parente609558c98b7610928507a819ec30a2879fc2ca1 (diff)
tdf#112507 RTF import: fix too narrow table cell
Commit e6ec0794858df1444f43659b568119bf126a90e6 (tdf#104937 RTF import: \trwWidthA is an absolute value, 2017-08-29) changed the handling of the fake empty cell at the end of table rows so that the parameter of the control word is an absolute, not a relative value. Turns out this wasn't correct, the DOCX equivalent of that bugdoc shows that the parameter is a relative value after all. The RTF spec also talks about a "width", which is assumed to be a relative value. So fix that bug in a different way again (by making sure that this additional fake cell contributes to the total width of the table, so column separators are counted correctly), this time without less side-effects. (cherry picked from commit 409c230ed70707eeb5e6fcd4ab904bb4a411608a) Change-Id: Ic64fd3a6abae8e0398e8e77123f0473d73f0c4b0 Reviewed-on: https://gerrit.libreoffice.org/43080 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdispatchsymbol.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index e7b09b7a5f92..68c43c40cefe 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -236,16 +236,15 @@ 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>(nCellX);
+ auto pXValue = std::make_shared<RTFValue>(m_aStates.top().nTableRowWidthAfter);
m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, RTFOverwrite::NO_APPEND);
dispatchSymbol(RTF_CELL);
+
+ // Adjust total width, which is done in the \cellx handler for normal cells.
+ m_nTopLevelCurrentCellX += m_aStates.top().nTableRowWidthAfter;
+
m_aStates.top().nTableRowWidthAfter = 0;
}