sw/inc/PostItMgr.hxx | 3 ++- sw/source/uibase/docvw/PostItMgr.cxx | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-)
New commits: commit fe5dbd90cd5a39b5130f7c962cc6c7dee1c80f8f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Nov 4 12:06:58 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Nov 4 14:35:10 2021 +0100 Resolves: tdf#143643 ensure relayout on undo of insert comment Change-Id: I732e23b8ff7c17abf4b5b9b7c7964fca6069543c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124685 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index c12f840dfd52..c94eac984edf 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -154,7 +154,8 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener bool LayoutByPage( std::vector<sw::annotation::SwAnnotationWin*> &aVisiblePostItList, const tools::Rectangle& rBorder, tools::Long lNeededHeight); - void CheckForRemovedPostIts(); + // return true if a postit was found to have been removed + bool CheckForRemovedPostIts(); bool ArrowEnabled(sal_uInt16 aDirection,tools::ULong aPage) const; bool BorderOverPageBorder(tools::ULong aPage) const; bool HasScrollbars() const; diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 2a20ab94b303..a7dc4d3f4323 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -237,7 +237,7 @@ SwPostItMgr::~SwPostItMgr() mPages.clear(); } -void SwPostItMgr::CheckForRemovedPostIts() +bool SwPostItMgr::CheckForRemovedPostIts() { IDocumentRedlineAccess const& rIDRA(mpWrtShell->getIDocumentRedlineAccess()); bool bRemoved = false; @@ -259,7 +259,7 @@ void SwPostItMgr::CheckForRemovedPostIts() } if ( !bRemoved ) - return; + return false; // make sure that no deleted items remain in page lists // todo: only remove deleted ones?! @@ -269,9 +269,13 @@ void SwPostItMgr::CheckForRemovedPostIts() PrepareView(); } else + { // if postits are there make sure that page lists are not empty // otherwise sudden paints can cause pain (in BorderOverPageBorder) CalcRects(); + } + + return true; } SwSidebarItem* SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExistence, bool bFocus) @@ -369,7 +373,10 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { if (!pField) { - CheckForRemovedPostIts(); + const bool bWasRemoved = CheckForRemovedPostIts(); + // tdf#143643 ensure relayout on undo of insert comment + if (bWasRemoved) + mbLayout = true; break; } RemoveItem(pField);