[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/source

Armin Le Grand (Allotropia) (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 28 10:12:46 UTC 2021


 sw/source/core/edit/edtox.cxx    |    4 ++++
 sw/source/core/inc/rootfrm.hxx   |    4 ++++
 sw/source/core/layout/layact.cxx |    5 ++++-
 sw/source/core/layout/newfrm.cxx |    1 +
 4 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 2b99db827e5bb5d43ca51b5fb90a054975361a7c
Author:     Armin Le Grand (Allotropia) <Armin.Le.Grand at me.com>
AuthorDate: Wed Jul 21 14:57:05 2021 +0200
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Wed Jul 28 12:12:12 2021 +0200

    tdf#139426 Supress AssertFlyPages in Tabe re-layout
    
    The current code tries to on-demand create content in
    form of a SwBodyFrame at a SwPageFrame. That
    unexpectedly and unfortunately leads - when done
    during a Table re-layout action - to an endless
    layout loop.
    I tried quite some solutions, but the simplest and
    safest is to just supress AssertFlyPages in that
    specialized TableLayout. Other solutons may break
    MailMergse, so CppunitTest_sw_mailmerge needs to
    be checked with any fix in this area.
    
    For more details, see tdf#task comnments.
    
    Change-Id: I02de9ee72848061497678936aa1d0c492694bfc2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119324
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at me.com>
    (cherry picked from commit 0bac5c7e7d71658c5056c4bf0b71fbfb51b92ca0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119266
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 46ab7e7bcbf8..b03dc5088f8c 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -30,6 +30,7 @@
 #include <sfx2/docfile.hxx>
 
 #include <swtypes.hxx>
+#include <rootfrm.hxx>
 #include <editsh.hxx>
 #include <doc.hxx>
 #include <IDocumentContentOperations.hxx>
@@ -172,7 +173,10 @@ void SwEditShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
         rTOXSect.SetPosAtStartEnd(*GetCursor()->GetPoint());
 
     // start formatting
+    // tdf#139426 ..but allow supression of AssertFlyPages
+    GetLayout()->SetTableUpdateInProgress(true);
     CalcLayout();
+    GetLayout()->SetTableUpdateInProgress(false);
 
     // insert page numbering
     rTOXSect.UpdatePageNum();
diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx
index fbc95b8a8691..f10298e757d5 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -114,6 +114,7 @@ class SAL_DLLPUBLIC_RTTI SwRootFrame: public SwLayoutFrame
     bool    mbBrowseWidthValid   :1; // Is mnBrowseWidth valid?
     bool    mbTurboAllowed       :1;
     bool    mbAssertFlyPages     :1; // Insert more Pages for Flys if needed?
+    bool    mbTableUpdateInProgress : 1; // tdf#139426 to allow supression of AssertFlyPages during TableUpdate
     bool    mbIsVirtPageNum      :1; // Do we have a virtual pagenumber?
     bool    mbIsNewLayout        :1; // Layout loaded or newly created
     bool    mbCallbackActionEnabled:1; // No Action in Notification desired
@@ -280,6 +281,9 @@ public:
     void AssertFlyPages();
     bool IsAssertFlyPages() const { return mbAssertFlyPages; }
 
+    void SetTableUpdateInProgress(bool bValue) { mbTableUpdateInProgress = bValue; }
+    bool IsTableUpdateInProgress() const { return mbTableUpdateInProgress; }
+
     /**
      * Makes sure that, starting from the passed Page, all page-bound Frames
      * are on the right Page (pagenumber).
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 59878d682303..cb5b818881b9 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -606,8 +606,11 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
         if ((bTakeShortcut || !pPage) && !IsInterrupt() &&
              (m_pRoot->IsSuperfluous() || m_pRoot->IsAssertFlyPages()) )
         {
-            if ( m_pRoot->IsAssertFlyPages() )
+            // tdf#139426 allow supression of AssertFlyPages
+            if ( m_pRoot->IsAssertFlyPages() && !m_pRoot->IsTableUpdateInProgress())
+            {
                 m_pRoot->AssertFlyPages();
+            }
             if ( m_pRoot->IsSuperfluous() )
             {
                 bool bOld = IsAgain();
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 61084de170a5..be525f776625 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -410,6 +410,7 @@ SwRootFrame::SwRootFrame( SwFrameFormat *pFormat, SwViewShell * pSh ) :
     mbBrowseWidthValid( false ),
     mbTurboAllowed( true ),
     mbAssertFlyPages( true ),
+    mbTableUpdateInProgress( false ),
     mbIsVirtPageNum( false ),
     mbIsNewLayout( true ),
     mbCallbackActionEnabled ( false ),


More information about the Libreoffice-commits mailing list