summaryrefslogtreecommitdiff
path: root/sw/source/uibase/docvw/PostItMgr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/docvw/PostItMgr.cxx')
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx40
1 files changed, 24 insertions, 16 deletions
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 32d0f938e71c..95eaea2a5557 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -695,6 +695,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();
@@ -724,24 +746,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,
@@ -808,6 +815,7 @@ void SwPostItMgr::LayoutPostIts()
}
else // we don't want to see it
{
+ VclPtr<SwAnnotationWin> pPostIt = pItem->mpPostIt;
if (pPostIt)
pPostIt->HideNote();
}