[Libreoffice-commits] core.git: writerfilter/source

Justin Luth justin_luth at sil.org
Sat Dec 17 16:19:44 UTC 2016


 writerfilter/source/dmapper/DomainMapper.cxx      |    2 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   14 +++++---------
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    6 +++---
 3 files changed, 9 insertions(+), 13 deletions(-)

New commits:
commit 223dd0c15e383144bdeea040f86efb7a06f89450
Author: Justin Luth <justin_luth at sil.org>
Date:   Sat Dec 17 16:55:07 2016 +0300

    tdf#104714 bRemove paragraph: ignore frames in Headers/Footers
    
    Empty paragraphs are removed in certain cases. If the previous
    paragraph was in a frame, then this one shouldn't be removed
    (unless that previous paragraph was in a header/footer).
    
    Most of this patch is renaming the function to clarify that
    it refers to the latest paragraph, not the very last one.
    
    As noted in original tdf#75573, there may be other paragraph
    containers that should also ignore their framed status - so
    I've tried to set this up to make it easier to add those cases
    when proof documents are found.
    
    Change-Id: Icd09793f652616622ab266942f4b81eeb39c0ccc
    Reviewed-on: https://gerrit.libreoffice.org/32121
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 929671a..8d47e98 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3280,7 +3280,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
                            && !bSingleParagraph
                            && !( pContext && pContext->isSet(PROP_BREAK_TYPE) )
                            && !m_pImpl->GetIsDummyParaAddedForTableInSection()
-                           && !m_pImpl->GetIsLastParagraphFramed();
+                           && !m_pImpl->GetIsPreviousParagraphFramed();
             PropertyMapPtr xContext = bRemove ? m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr();
             if (xContext)
             {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fec064c..15ec945 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -216,7 +216,7 @@ DomainMapper_Impl::DomainMapper_Impl(
         m_bIsFirstParaInSection( true ),
         m_bDummyParaAddedForTableInSection( false ),
         m_bTextFrameInserted(false),
-        m_bIsLastParagraphFramed( false ),
+        m_bIsPreviousParagraphFramed( false ),
         m_bIsLastParaInSection( false ),
         m_bIsLastSectionGroup( false ),
         m_bIsInComments( false ),
@@ -1203,15 +1203,11 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap )
         }
     }
 
-    if(    (pParaContext && pParaContext->IsFrameMode())
-        || (IsInHeaderFooter() && GetIsLastParagraphFramed()) )
-    {
-        SetIsLastParagraphFramed(true);
-    }
+    bool bIgnoreFrameState = IsInHeaderFooter();
+    if( (!bIgnoreFrameState && pParaContext && pParaContext->IsFrameMode()) || (bIgnoreFrameState && GetIsPreviousParagraphFramed()) )
+        SetIsPreviousParagraphFramed(true);
     else
-    {
-        SetIsLastParagraphFramed(false);
-    }
+        SetIsPreviousParagraphFramed(false);
 
     m_bParaChanged = false;
     if (!pParaContext || !pParaContext->IsFrameMode())
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index ae50366..d3cc079 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -436,7 +436,7 @@ private:
     bool                            m_bIsFirstParaInSection;
     bool                            m_bDummyParaAddedForTableInSection;
     bool                            m_bTextFrameInserted;
-    bool                            m_bIsLastParagraphFramed;
+    bool                            m_bIsPreviousParagraphFramed;
     bool                            m_bIsLastParaInSection;
     bool                            m_bIsLastSectionGroup;
     bool                            m_bIsInComments;
@@ -525,8 +525,8 @@ public:
     bool GetIsDummyParaAddedForTableInSection() { return m_bDummyParaAddedForTableInSection;}
     void SetIsTextFrameInserted( bool bIsInserted );
     bool GetIsTextFrameInserted() { return m_bTextFrameInserted;}
-    void SetIsLastParagraphFramed( bool bIsFramed ) { m_bIsLastParagraphFramed = bIsFramed; }
-    bool GetIsLastParagraphFramed() { return m_bIsLastParagraphFramed; }
+    void SetIsPreviousParagraphFramed( bool bIsFramed ) { m_bIsPreviousParagraphFramed = bIsFramed; }
+    bool GetIsPreviousParagraphFramed() { return m_bIsPreviousParagraphFramed; }
     void SetParaSectpr(bool bParaSectpr);
     bool GetParaSectpr() { return m_bParaSectpr;}
 


More information about the Libreoffice-commits mailing list