summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2012-01-30 21:29:57 +0100
committerMichael Stahl <mstahl@redhat.com>2012-01-31 17:41:58 +0100
commitd219815d282c66a4aacdb0ed9640bbd14b4f9bde (patch)
tree25adcfe4865c39530b9db83c1205eb9d291ce7b0 /writerfilter
parentd26f06b33b6958cb15b16dbfe3e12ab0126c23a7 (diff)
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@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx17
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx2
2 files changed, 18 insertions, 1 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 18643afa1034..e23a25f4d7d4 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 178cdb314322..12d414c343a6 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;
};