summaryrefslogtreecommitdiff
path: root/sw/source/uibase/docvw
diff options
context:
space:
mode:
authorMohit Marathe <mohitmarathe@proton.me>2024-05-17 14:00:18 +0530
committerSarper Akdemir <sarper.akdemir@allotropia.de>2024-09-13 12:35:45 +0200
commitbe16c6cf5c14c17ec3e7d860636e5c7b2cd7f654 (patch)
treed7aba0c7ef50b98209b4bdaaee0177573c434fac /sw/source/uibase/docvw
parent59c123d62a7d155e0b5715e5d1804f2a0cee77fa (diff)
sw: add Comments Panel in sidebar
This commit adds a sidebar deck for comments. It has all the functionalities of the old comments shown via annotation window. Change-Id: Ibab0e21a54c097d0f42bddb1d07da74319970135 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167840 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir@allotropia.de>
Diffstat (limited to 'sw/source/uibase/docvw')
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx27
1 files changed, 25 insertions, 2 deletions
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 589f6c02a9cd..56abcb248cfd 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -319,6 +319,17 @@ SwSidebarItem* SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExisten
return pAnnotationItem;
}
+sw::annotation::SwAnnotationWin* SwPostItMgr::GetRemovedAnnotationWin( const SfxBroadcaster* pBroadcast )
+{
+ auto i = std::find_if(mvPostItFields.begin(), mvPostItFields.end(),
+ [&pBroadcast](const std::unique_ptr<SwSidebarItem>& pField) { return pField->GetBroadcaster() == pBroadcast; });
+ if (i != mvPostItFields.end())
+ {
+ return (*i)->mpPostIt;
+ }
+ return nullptr;
+}
+
void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast )
{
EndListening(*pBroadcast);
@@ -400,6 +411,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
mbLayout = true;
break;
}
+ this->Broadcast(rHint);
RemoveItem(pField);
// If LOK has disabled tiled annotations, emit annotation callbacks
@@ -430,6 +442,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
postItField->mpPostIt->SetPostItText();
mbLayout = true;
+ this->Forward(rBC, rHint);
}
// If LOK has disabled tiled annotations, emit annotation callbacks
@@ -821,6 +834,9 @@ void SwPostItMgr::LayoutPostIts()
if (pPostIt)
pPostIt->HideNote();
}
+ SwFormatField* pFormatField = &(pItem->GetFormatField());
+ SwFormatFieldHintWhich nWhich = SwFormatFieldHintWhich::INSERTED;
+ this->Broadcast(SwFormatFieldHint(pFormatField, nWhich, mpView));
}
if (!aVisiblePostItList.empty() && ShowNotes())
@@ -1331,9 +1347,8 @@ bool SwPostItMgr::LayoutByPage(std::vector<SwAnnotationWin*> &aVisiblePostItList
return bScrollbars;
}
-void SwPostItMgr::AddPostIts(const bool bCheckExistence, const bool bFocus)
+std::vector<SwFormatField*> SwPostItMgr::UpdatePostItsParentInfo()
{
- const bool bEmpty = mvPostItFields.empty();
IDocumentRedlineAccess const& rIDRA(mpWrtShell->getIDocumentRedlineAccess());
SwFieldType* pType = mpView->GetDocShell()->GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Postit, OUString(),false);
std::vector<SwFormatField*> vFormatFields;
@@ -1361,6 +1376,14 @@ void SwPostItMgr::AddPostIts(const bool bCheckExistence, const bool bFocus)
}
}
}
+ return vFormatFields;
+}
+
+
+void SwPostItMgr::AddPostIts(const bool bCheckExistence, const bool bFocus)
+{
+ const bool bEmpty = mvPostItFields.empty();
+ std::vector<SwFormatField*> vFormatFields = UpdatePostItsParentInfo();
for(auto pFormatField : vFormatFields)
InsertItem(pFormatField, bCheckExistence, bFocus);