diff options
-rw-r--r-- | sw/inc/PostItMgr.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/PostItMgr.cxx | 40 |
2 files changed, 26 insertions, 16 deletions
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index 98d9f4f2ef30..f66e38748a64 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -172,6 +172,8 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener SwSidebarItem* InsertItem( SfxBroadcaster* pItem, bool bCheckExistence, bool bFocus); void RemoveItem( SfxBroadcaster* pBroadcast ); + VclPtr<sw::annotation::SwAnnotationWin> GetOrCreateAnnotationWindow(SwSidebarItem& rItem); + public: SwPostItMgr(SwView* aDoc); virtual ~SwPostItMgr() override; diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index ee7cb16685f2..501e3fa449d2 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -710,6 +710,28 @@ void SwPostItMgr::PreparePageContainer() } } +VclPtr<SwAnnotationWin> SwPostItMgr::GetOrCreateAnnotationWindow(SwSidebarItem& rItem) +{ + VclPtr<SwAnnotationWin> pPostIt = rItem.mpPostIt; + if (!pPostIt) + { + pPostIt = rItem.GetSidebarWindow( mpView->GetEditWin(), + *this ); + pPostIt->InitControls(); + pPostIt->SetReadonly(mbReadOnly); + rItem.mpPostIt = pPostIt; + if (mpAnswer) + { + if (pPostIt->GetPostItField()->GetParentPostItId() != 0) //do we really have another note in front of this one + { + pPostIt->InitAnswer(*mpAnswer); + } + mpAnswer.reset(); + } + } + return rItem.mpPostIt; +} + void SwPostItMgr::LayoutPostIts() { const bool bLoKitActive = comphelper::LibreOfficeKit::isActive(); @@ -739,24 +761,9 @@ void SwPostItMgr::LayoutPostIts() for (auto const& pItem : pPage->mvSidebarItems) { - VclPtr<SwAnnotationWin> pPostIt = pItem->mpPostIt; - if (pItem->mbShow) { - if (!pPostIt) - { - pPostIt = pItem->GetSidebarWindow( mpView->GetEditWin(), - *this ); - pPostIt->InitControls(); - pPostIt->SetReadonly(mbReadOnly); - pItem->mpPostIt = pPostIt; - if (mpAnswer) - { - if (pPostIt->GetPostItField()->GetParentPostItId() != 0) //do we really have another note in front of this one - pPostIt->InitAnswer(*mpAnswer); - mpAnswer.reset(); - } - } + VclPtr<SwAnnotationWin> pPostIt = GetOrCreateAnnotationWindow(*pItem); pPostIt->SetChangeTracking( pItem->mLayoutStatus, @@ -823,6 +830,7 @@ void SwPostItMgr::LayoutPostIts() } else // we don't want to see it { + VclPtr<SwAnnotationWin> pPostIt = pItem->mpPostIt; if (pPostIt) pPostIt->HideNote(); } |