Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

See
http://cgit.freedesktop.org/libreoffice/core/commit/?id=7b58fc3dafc789aa55fff5ffef6ab83c3aa8b6e0

The patch won't apply as-is to -3-5, so I'm attaching a backport.

Thanks,

Miklos
From 291466d53ae514fa29fd73832f5167bb6bc71ce4 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@suse.cz>
Date: Wed, 4 Apr 2012 11:04:45 +0200
Subject: [PATCH] fdo#48104 fix RTF import of \page in inner groups

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


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.