[Libreoffice-commits] .: writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Fri Feb 10 01:06:07 PST 2012
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
New commits:
commit 63dfa72b5eca7be9df3076314055c5c74aa1f4fa
Author: Miklos Vajna <vmiklos at frugalware.org>
Date: Thu Feb 2 09:21:25 2012 +0100
n#703032 fix RTF import of page breaks right before text frames
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 721d3bb..a3a9e73 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -409,12 +409,25 @@ void RTFDocumentImpl::checkNeedPap()
{
if (m_bNeedPap)
{
+ m_bNeedPap = false; // reset early, so we can avoid recursion when calling ourselves
if (!m_pCurrentBuffer)
{
writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties(
new RTFReferenceProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)
);
+
+ // Writer will ignore a page break before a text frame, so guard it with empty paragraphs
+ bool hasBreakBeforeFrame = m_aStates.top().aFrame.hasProperties() &&
+ m_aStates.top().aParagraphSprms.find(NS_sprm::LN_PFPageBreakBefore).get();
+ if (hasBreakBeforeFrame)
+ {
+ dispatchSymbol(RTF_PAR);
+ m_bNeedPap = false;
+ m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PFPageBreakBefore);
+ }
Mapper().props(pParagraphProperties);
+ if (hasBreakBeforeFrame)
+ dispatchSymbol(RTF_PAR);
if (m_aStates.top().aFrame.hasProperties())
{
@@ -428,7 +441,6 @@ void RTFDocumentImpl::checkNeedPap()
RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms));
m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
}
- m_bNeedPap = false;
}
}
More information about the Libreoffice-commits
mailing list