[PATCH] fdo#48104 fix RTF import of \page in inner groups
Miklos Vajna
vmiklos at suse.cz
Wed Apr 4 02:04:45 PDT 2012
If we have a postponed page break and it's sent to dmapper during a new
inner group, we'll still have the page break request after the parser
state is popped, leading to duplicated page breaks. Instead of the
earlier workaround, just send the proper token to the domain mapper, and
it'll handle it properly.
---
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 18 +++++-------------
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 --
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index ef4d3b8..9600414 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -304,7 +304,6 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_bFormField(false),
m_bWasInFrame(false),
m_bIsInFrame(false),
- m_bHasPage(false),
m_aUnicodeBuffer(),
m_aHexBuffer()
{
@@ -432,7 +431,6 @@ void RTFDocumentImpl::checkNeedPap()
{
dispatchSymbol(RTF_PAR);
m_bNeedPap = false;
- m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PFPageBreakBefore);
}
Mapper().props(pParagraphProperties);
if (hasBreakBeforeFrame)
@@ -1377,12 +1375,6 @@ 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:
@@ -1505,10 +1497,10 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
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;
+ sal_uInt8 sBreak[] = { 0xc };
+ Mapper().text(sBreak, 1);
+ if (!m_bNeedPap)
+ parBreak();
}
break;
default:
@@ -1713,7 +1705,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; m_bHasPage = false; break;
+ case RTF_PAGEBB: nParam = NS_sprm::LN_PFPageBreakBefore; break;
default: break;
}
if (nParam >= 0)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 3644375..4a28e62 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -450,8 +450,6 @@ 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;
/// Same for hex characters.
--
1.7.7
--2oS5YaxWCcQjTEyO--
More information about the LibreOffice
mailing list