[Libreoffice-commits] core.git: sw/source
Armin Le Grand (Allotropia) (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 22 07:31:02 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 0bac5c7e7d71658c5056c4bf0b71fbfb51b92ca0
Author: Armin Le Grand (Allotropia) <Armin.Le.Grand at me.com>
AuthorDate: Wed Jul 21 14:57:05 2021 +0200
Commit: Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Thu Jul 22 09:30:25 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>
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 41bea3fa7211..00fd1522d291 100644
--- a/sw/source/core/inc/rootfrm.hxx
+++ b/sw/source/core/inc/rootfrm.hxx
@@ -114,6 +114,7 @@ class SW_DLLPUBLIC SwRootFrame final : 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
@@ -278,6 +279,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 e73022542a79..0d381ac00314 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -657,8 +657,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