sw/inc/unotxdoc.hxx | 1 + sw/source/uibase/uno/loktxdoc.cxx | 1 + sw/source/uibase/uno/unotxdoc.cxx | 15 +++++++++++++++ 3 files changed, 17 insertions(+)
New commits: commit 39fd407aa2c3eec8de12fa4bcc21f1f563751d99 Author: Sahil Gautam <[email protected]> AuthorDate: Sun Feb 22 00:46:16 2026 +0530 Commit: Michael Stahl <[email protected]> CommitDate: Thu Feb 26 13:47:49 2026 +0100 add whether partHasComments to the writer partInfo Change-Id: Ia33910fbcf6609188299a9fbfb781f0b03322683 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199739 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit ee612f2c1bcf94efc93e2548b93442a9973a3df6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200376 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index e440821d2e49..88c7505d5444 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -241,6 +241,7 @@ private: void ThrowIfInvalid() const; SwDoc& GetDocOrThrow() const; + bool partHasComments() const; public: SwXTextDocument(SwDocShell* pShell); diff --git a/sw/source/uibase/uno/loktxdoc.cxx b/sw/source/uibase/uno/loktxdoc.cxx index 27f0ebca1d3c..5fa3ad62fff9 100644 --- a/sw/source/uibase/uno/loktxdoc.cxx +++ b/sw/source/uibase/uno/loktxdoc.cxx @@ -1172,6 +1172,7 @@ OUString SwXTextDocument::getPartInfo(int /*nPart*/) { tools::JsonWriter jsonWriter; jsonWriter.put("mode", getEditMode()); + jsonWriter.put("partHasComments", partHasComments() ? "true" : "false"); return OUString::fromUtf8(jsonWriter.finishAndGetAsOString()); } diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index c244f003507f..40eb82c01f10 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -388,6 +388,21 @@ SwDoc& SwXTextDocument::GetDocOrThrow() const const_cast<SwXTextDocument*>(this)->getXWeak()); } +bool SwXTextDocument::partHasComments() const +{ + if (!m_pDocShell) + return false; + + for (auto const& sidebarItem : *m_pDocShell->GetView()->GetPostItMgr()) + { + if (!sidebarItem->mpPostIt) + continue; + return true; + } + + return false; +} + SdrModel& SwXTextDocument::getSdrModelFromUnoModel() const { return *GetDocOrThrow().getIDocumentDrawModelAccess().GetDrawModel();
