summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-10-03 09:16:52 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-10-03 10:38:20 +0200
commit409c230ed70707eeb5e6fcd4ab904bb4a411608a (patch)
tree91328c92be19f99e2f547cb7f8a95cce3c61005a /writerfilter
parent055766f79ef74e1774d0f434ac13c6276d849902 (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. Change-Id: Ic64fd3a6abae8e0398e8e77123f0473d73f0c4b0 Reviewed-on: https://gerrit.libreoffice.org/43063 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
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 abf8840adf29..a7546f4a923b 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;
}