[Libreoffice-commits] .: writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Sat Sep 3 08:12:29 PDT 2011


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   41 ++++++++++++++-----------
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |    1 
 2 files changed, 25 insertions(+), 17 deletions(-)

New commits:
commit 1a2894941e25e7580eec7c189bf94989056d0d9c
Author: Miklos Vajna <vmiklos at frugalware.org>
Date:   Sat Sep 3 17:10:13 2011 +0200

    Related: fdo#38966 RTF import should not ignore page breaks before empty pars

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 658a3d2..f4a7226 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -409,6 +409,28 @@ void RTFDocumentImpl::checkFirstRun()
     }
 }
 
+void RTFDocumentImpl::checkNeedPap()
+{
+    if (m_bNeedPap)
+    {
+        checkChangedFrame();
+
+        if (!m_pCurrentBuffer)
+        {
+            writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties(
+                    new RTFReferenceProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)
+                    );
+            Mapper().props(pParagraphProperties);
+        }
+        else
+        {
+            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;
+    }
+}
+
 void RTFDocumentImpl::runBreak()
 {
     sal_uInt8 sBreak[] = { 0xd };
@@ -426,6 +448,7 @@ void RTFDocumentImpl::tableBreak()
 void RTFDocumentImpl::parBreak()
 {
     checkFirstRun();
+    checkNeedPap();
     // end previous paragraph
     Mapper().startCharacterGroup();
     runBreak();
@@ -864,24 +887,8 @@ void RTFDocumentImpl::text(OUString& rString)
         return;
     }
 
-    writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties(
-            new RTFReferenceProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)
-            );
-
     checkFirstRun();
-    if (m_bNeedPap)
-    {
-        checkChangedFrame();
-
-        if (!m_pCurrentBuffer)
-            Mapper().props(pParagraphProperties);
-        else
-        {
-            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;
-    }
+    checkNeedPap();
 
     // Don't return earlier, a bookmark start has to be in a paragraph group.
     if (m_aStates.top().nDestinationState == DESTINATION_BOOKMARKSTART)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index d5a65ef..66a2839 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -339,6 +339,7 @@ namespace writerfilter {
                 void tableBreak();
                 /// If this is the first run of the document, starts the initial paragraph.
                 void checkFirstRun();
+                void checkNeedPap();
                 void sectBreak(bool bFinal);
                 void replayBuffer(RTFBuffer_t& rBuffer);
                 bool inFrame();


More information about the Libreoffice-commits mailing list