sw/inc/docufld.hxx | 1 + sw/source/core/fields/docufld.cxx | 5 +++++ sw/source/core/txtnode/thints.cxx | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-)
New commits: commit 3a885196bbf673960f72c45e21b1226b80ad26d1 Author: Pranam Lashkari <lpra...@collabora.com> AuthorDate: Fri May 20 20:24:46 2022 +0530 Commit: Pranam Lashkari <lpra...@collabora.com> CommitDate: Wed May 25 20:01:16 2022 +0200 comments: reassign ID when copy comment reassigning new ID will make all the comments have unique IDs this will also ensure there is no mixup when working with comments ID Signed-off-by: Pranam Lashkari <lpra...@collabora.com> Change-Id: I94b433130c68354ab94d4d6e9b86751038b31af5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134686 Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-by: Gökay ŞATIR <gokaysa...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> (cherry picked from commit 0d3bba5c383ef8b9f62c121a26fed4445c813949) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134792 Tested-by: Jenkins (cherry picked from commit a4536c53eceac8eec6e5ac273583fefb6bafcb3f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134898 diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index f1023e372970..32ab1d5d12ba 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -481,6 +481,7 @@ public: Date GetDate() const { return Date(m_aDateTime.GetDate()); } tools::Time GetTime() const { return tools::Time(m_aDateTime.GetTime()); } sal_uInt32 GetPostItId() const { return m_nPostItId; } + void SetPostItId(const sal_uInt32 nPostItId = 0); /// Author virtual OUString GetPar1() const override; diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 902a7bcea33a..a3b5d5a5e12d 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1831,6 +1831,11 @@ sal_Int32 SwPostItField::GetNumberOfParagraphs() const return mpText ? mpText->Count() : 1; } +void SwPostItField::SetPostItId(const sal_uInt32 nPostItId) +{ + m_nPostItId = nPostItId == 0 ? s_nLastPostItId++ : nPostItId; +} + bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 75f04356e476..71d0263850d2 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1092,7 +1092,9 @@ SwTextAttr* MakeTextAttr( // the relation to its annotation mark (relation established via annotation field's name). // If the annotation mark is also copied, the relation and thus the annotated text range will be reestablished, // when the annotation mark is created and inserted into the document. - const_cast<SwPostItField&>(dynamic_cast<const SwPostItField&>(*(pNew->GetFormatField().GetField()))).SetName(OUString()); + auto& pField = const_cast<SwPostItField&>(dynamic_cast<const SwPostItField&>(*(pNew->GetFormatField().GetField()))); + pField.SetName(OUString()); + pField.SetPostItId(); } } break;