diff options
author | László Németh <nemeth@numbertext.org> | 2018-12-30 02:15:30 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2018-12-30 16:10:29 +0100 |
commit | 92863700cddb70b07e4722551b1f1db78c2474d3 (patch) | |
tree | c2fadc3dbd59cb7b9018a9ebd1309dda84cc7fec /writerfilter/source/rtftok/rtfdocumentimpl.cxx | |
parent | 6f967e3403c6675bbaf2c17dcadf7e640dd719ca (diff) |
tdf#121623 RTF import: keep table in multicolumn section
instead of losing columns when the section starts with that table.
Change-Id: I1c9d4eb03d24e54600956cb41b835c5e37bfdd8b
Reviewed-on: https://gerrit.libreoffice.org/65730
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter/source/rtftok/rtfdocumentimpl.cxx')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 8853941cfe35..22b766889711 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -44,6 +44,7 @@ #include "rtfreferenceproperties.hxx" #include "rtfskipdestination.hxx" #include "rtftokenizer.hxx" +#include "rtflookahead.hxx" using namespace com::sun::star; @@ -258,6 +259,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x , m_aDefaultState(this) , m_bSkipUnknown(false) , m_bFirstRun(true) + , m_bFirstRunException(false) , m_bNeedPap(true) , m_bNeedCr(false) , m_bNeedCrOrig(false) @@ -377,7 +379,7 @@ void RTFDocumentImpl::checkFirstRun() outputSettingsTable(); // start initial paragraph m_bFirstRun = false; - assert(!m_bNeedSect); + assert(!m_bNeedSect || m_bFirstRunException); setNeedSect(true); // first call that succeeds // set the requested default font, if there are none @@ -397,8 +399,18 @@ void RTFDocumentImpl::setNeedPar(bool bNeedPar) { m_bNeedPar = bNeedPar; } void RTFDocumentImpl::setNeedSect(bool bNeedSect) { + if (!m_bNeedSect && bNeedSect && m_bFirstRun) + { + RTFLookahead aLookahead(Strm(), m_pTokenizer->getGroupStart()); + if (aLookahead.hasTable() && aLookahead.hasColumns()) + { + m_bFirstRunException = true; + } + } + // ignore setting before checkFirstRun - every keyword calls setNeedSect! - if (!m_bNeedSect && bNeedSect && !m_bFirstRun) + // except the case of a table in a multicolumn section + if (!m_bNeedSect && bNeedSect && (!m_bFirstRun || m_bFirstRunException)) { if (!m_pSuperstream) // no sections in header/footer! { |