summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-10-26 08:56:05 +0100
committerAndras Timar <andras.timar@collabora.com>2015-11-10 22:31:17 +0100
commitd39b2593f894225d3ca202d66bc49f3585a93a3d (patch)
tree95bc72b4b50a9adf6fd80717c3770317b4301428 /writerfilter
parentf51ac9efddc426682da0e95e1d503eb10e74bbda (diff)
tdf#59454 RTF import: handle section break right before a table
DOCX import could handle this situation, as commit 2e8aad6d45c53d554ccaf26de998ede708cfc289 (fdo#39056 fdo#75431 Section Properties if section starts with table, 2014-04-18) added support for this situation, in case NS_ooxml::LN_tblStart/End is emitted by the tokenizer. Fix the problem by sending these tokens in the RTF tokenizer as well, at least for non-nested tables. Change-Id: Ifedb121754634529c27820dd5175e7f9e24019e1 (cherry picked from commit e57752170e604c85a6fe8aeaa38784796e00bab1) Reviewed-on: https://gerrit.libreoffice.org/19878 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 610e6fddbc19dd2ac23b6a6cf4d8cbfb0dcf589a)
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index d61c6646196a..6dd24056837c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2138,6 +2138,15 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
{
parBreak();
// Not in table? Reset max width.
+ if (m_nCellxMax)
+ {
+ // Was in table, but not anymore -> tblEnd.
+ RTFSprms aAttributes;
+ RTFSprms aSprms;
+ aSprms.set(NS_ooxml::LN_tblEnd, std::make_shared<RTFValue>(1));
+ writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms);
+ Mapper().props(pProperties);
+ }
m_nCellxMax = 0;
}
else if (m_aStates.top().eDestination != Destination::SHAPETEXT)
@@ -4236,6 +4245,15 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes;
// We assume text after a row definition always belongs to the table, to handle text before the real INTBL token
dispatchFlag(RTF_INTBL);
+ if (!m_nCellxMax)
+ {
+ // Wasn't in table, but now is -> tblStart.
+ RTFSprms aAttributes;
+ RTFSprms aSprms;
+ aSprms.set(NS_ooxml::LN_tblStart, std::make_shared<RTFValue>(1));
+ writerfilter::Reference<Properties>::Pointer_t pProperties = std::make_shared<RTFReferenceProperties>(aAttributes, aSprms);
+ Mapper().props(pProperties);
+ }
m_nCellxMax = std::max(m_nCellxMax, nParam);
}
break;