[Libreoffice-commits] .: Branch 'libreoffice-3-5' - writerfilter/source
Michael Stahl
mst at kemper.freedesktop.org
Tue Jan 31 08:50:38 PST 2012
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 17 ++++++++++++++++-
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 ++
2 files changed, 18 insertions(+), 1 deletion(-)
New commits:
commit d219815d282c66a4aacdb0ed9640bbd14b4f9bde
Author: Miklos Vajna <vmiklos at frugalware.org>
Date: Mon Jan 30 21:29:57 2012 +0100
fdo#43965 fix RTF import of page break symbol
This was unnoticed so far as both Writer and Word output \pagebb instead
of \page when exporting page breaks.
(cherry-picked from commits 2aa3d43a3746c797391afb1a08c024d512976006 and
d1f3018b0e6d0889febcf09a6c95a2ec354137c0)
Signed-off-by: Michael Stahl <mstahl at redhat.com>
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 18643af..e23a25f 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -294,6 +294,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_bFormField(false),
m_bWasInFrame(false),
m_bIsInFrame(false),
+ m_bHasPage(false),
m_aUnicodeBuffer()
{
OSL_ASSERT(xInputStream.is());
@@ -1320,6 +1321,12 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
m_bWasInFrame = inFrame();
if (!m_bWasInFrame)
m_bNeedPar = false;
+ if (m_bHasPage)
+ {
+ // this has to be reset even without a pard, since it's a symbol in RTF terms
+ m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PFPageBreakBefore);
+ m_bHasPage = false;
+ }
}
break;
case RTF_SECT:
@@ -1440,6 +1447,14 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
case RTF_CHFTN:
// Nothing to do, dmapper assumes this is the default.
break;
+ case RTF_PAGE:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(1));
+ dispatchSymbol(RTF_PAR);
+ m_aStates.top().aParagraphSprms->push_back(make_pair(NS_sprm::LN_PFPageBreakBefore, pValue));
+ m_bHasPage = true;
+ }
+ break;
default:
#if OSL_DEBUG_LEVEL > 1
OSL_TRACE("%s: TODO handle symbol '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword));
@@ -1642,7 +1657,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_KEEP: if (m_pCurrentBuffer != &m_aTableBuffer) nParam = NS_sprm::LN_PFKeep; break;
case RTF_KEEPN: if (m_pCurrentBuffer != &m_aTableBuffer) nParam = NS_sprm::LN_PFKeepFollow; break;
case RTF_INTBL: m_pCurrentBuffer = &m_aTableBuffer; nParam = NS_sprm::LN_PFInTable; break;
- case RTF_PAGEBB: nParam = NS_sprm::LN_PFPageBreakBefore; break;
+ case RTF_PAGEBB: nParam = NS_sprm::LN_PFPageBreakBefore; m_bHasPage = false; break;
default: break;
}
if (nParam >= 0)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 178cdb3..12d414c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -431,6 +431,8 @@ namespace writerfilter {
bool m_bWasInFrame;
/// If a frame start token is already sent to dmapper (nesting them is not OK).
bool m_bIsInFrame;
+ /// If we should reset the page break property when we start the next paragraph.
+ bool m_bHasPage;
// Unicode characters are collected here so we don't have to send them one by one.
rtl::OUStringBuffer m_aUnicodeBuffer;
};
More information about the Libreoffice-commits
mailing list