desktop/qa/data/comments.odt |binary sw/inc/AnnotationWin.hxx | 2 ++ sw/source/core/inc/bookmark.hxx | 2 +- sw/source/uibase/docvw/AnnotationWin.cxx | 8 ++++++++ sw/source/uibase/docvw/AnnotationWin2.cxx | 1 - sw/source/uibase/shells/textfld.cxx | 8 ++++++++ 6 files changed, 19 insertions(+), 2 deletions(-)
New commits: commit d782e808719cf38b0f6e6f222292d1d870f6a6e1 Author: Gökay Şatır <gokaysa...@gmail.com> AuthorDate: Mon Sep 4 19:35:00 2023 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Sep 5 14:22:23 2023 +0200 Add parent / child relations to replied comments. Signed-off-by: Gökay Şatır <gokaysa...@gmail.com> Change-Id: Ia7d95c4e6020b501798a89cbdcae64dc5691437c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156523 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/desktop/qa/data/comments.odt b/desktop/qa/data/comments.odt index ee7f15f8b755..1bcdcc0385ea 100644 Binary files a/desktop/qa/data/comments.odt and b/desktop/qa/data/comments.odt differ diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index 4daa795886d1..19aa67dbfc5d 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -30,6 +30,7 @@ #include "swrect.hxx" #include "SidebarWindowsTypes.hxx" #include <optional> +#include <annotationmark.hxx> class EditView; class PopupMenu; @@ -76,6 +77,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow OUString GetAuthor() const; Date GetDate() const; tools::Time GetTime() const; + void GeneratePostItName(); sal_uInt32 MoveCaret(); diff --git a/sw/source/core/inc/bookmark.hxx b/sw/source/core/inc/bookmark.hxx index 6ba9484b3bd8..8a3fc98f260c 100644 --- a/sw/source/core/inc/bookmark.hxx +++ b/sw/source/core/inc/bookmark.hxx @@ -106,6 +106,7 @@ namespace sw::mark { { return m_wXBookmark; } void SetXBookmark(rtl::Reference<SwXBookmark> const& xBkmk); + static OUString GenerateNewName(std::u16string_view rPrefix); protected: // SwClient void SwClientNotify(const SwModify&, const SfxHint&) override; @@ -114,7 +115,6 @@ namespace sw::mark { std::optional<SwPosition> m_oPos1; std::optional<SwPosition> m_oPos2; OUString m_aName; - static OUString GenerateNewName(std::u16string_view rPrefix); unotools::WeakReference<SwXBookmark> m_wXBookmark; }; diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index 711d612ef173..7ebdbead067b 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -204,6 +204,14 @@ void SwAnnotationWin::SetPostItText() Invalidate(); } +void SwAnnotationWin::GeneratePostItName() +{ + if (mpField && mpField->GetName().isEmpty()) + { + mpField->SetName(sw::mark::MarkBase::GenerateNewName(u"__Annotation__")); + } +} + void SwAnnotationWin::SetResolved(bool resolved) { bool oldState = IsResolved(); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index d4faa06482ba..e8852a87f6e0 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1118,7 +1118,6 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot) // Get newly created SwPostItField and set its paraIdParent auto pPostItField = mrMgr.GetLatestPostItField(); pPostItField->SetParentId(GetTopReplyNote()->GetParaId()); - pPostItField->SetParentPostItId(GetTopReplyNote()->GetPostItId()); } break; } diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 9198cec0337a..b0603d4eed96 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -451,6 +451,14 @@ void SwTextShell::ExecField(SfxRequest &rReq) sText = pTextItem->GetValue(); pMgr->RegisterAnswerText(sText); pWin->ExecuteCommand(nSlot); + + // Set the parent postit id of the reply. + GetView().GetPostItMgr()->GetLatestPostItField()->SetParentPostItId(pIdItem->GetValue().toUInt32()); + + // If name of the replied comment is empty, we need to set a name in order to connect them in the xml file. + pWin->GeneratePostItName(); // Generates a name if the current name is empty. + + GetView().GetPostItMgr()->GetLatestPostItField()->SetParentName(pWin->GetPostItField()->GetName()); } } }