From dd229e4cd9a0211c9a80031da1d2f7fb71b6683e Mon Sep 17 00:00:00 2001 From: Dennis Francis Date: Tue, 15 Mar 2022 13:00:35 +0530 Subject: lok: ensure unique id for annotations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: When a cell containing comment is copied and pasted to another cell, the cloned comment/annotation in the target cell has the same id as the original one. The lok clients depend upon the id of each comment to identify them and update coordinates when updates are requested through .uno:ViewAnnotationsPosition. So the client does not have enough information to distinguish between comments of same id. Change-Id: Iebd7281113e0830826aff1bbdaae234bd5d5cd4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131689 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos --- sc/source/core/data/postit.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index bafd2e9e901b..2e85eb0faf08 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -876,7 +877,8 @@ ScPostIt::~ScPostIt() std::unique_ptr ScPostIt::Clone( const ScAddress& rOwnPos, ScDocument& rDestDoc, const ScAddress& rDestPos, bool bCloneCaption ) const { CreateCaptionFromInitData( rOwnPos ); - return bCloneCaption ? std::make_unique( rDestDoc, rDestPos, *this, mnPostItId ) : std::make_unique( rDestDoc, rDestPos, maNoteData, false, mnPostItId ); + sal_uInt32 nPostItId = comphelper::LibreOfficeKit::isActive() ? 0 : mnPostItId; + return bCloneCaption ? std::make_unique( rDestDoc, rDestPos, *this, nPostItId ) : std::make_unique( rDestDoc, rDestPos, maNoteData, false, mnPostItId ); } void ScPostIt::SetDate( const OUString& rDate ) -- cgit