summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2022-03-15 13:00:35 +0530
committerDennis Francis <dennis.francis@collabora.com>2022-03-31 07:38:27 +0200
commitd0221fb6c35ecceb53e347d2790ac66b8a021044 (patch)
tree334f131d8cfbdcd73dc31d57d6451a2c07af444a /sc
parent4ee8a4662bb85a130467805194124ab649acd7e7 (diff)
lok: ensure unique id for annotations
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. Conflicts: sc/source/core/data/postit.cxx Change-Id: Iebd7281113e0830826aff1bbdaae234bd5d5cd4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131689 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> (cherry picked from commit dd229e4cd9a0211c9a80031da1d2f7fb71b6683e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132170 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/postit.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index ef7ff3bc4725..cd8acfdceec4 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -29,6 +29,7 @@
#include <editeng/editobj.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <osl/diagnose.h>
+#include <comphelper/lok.hxx>
#include <scitems.hxx>
#include <svx/xfillit0.hxx>
@@ -877,7 +878,8 @@ ScPostIt::~ScPostIt()
std::unique_ptr<ScPostIt> ScPostIt::Clone( const ScAddress& rOwnPos, ScDocument& rDestDoc, const ScAddress& rDestPos, bool bCloneCaption ) const
{
CreateCaptionFromInitData( rOwnPos );
- return bCloneCaption ? std::make_unique<ScPostIt>( rDestDoc, rDestPos, *this, mnPostItId ) : std::make_unique<ScPostIt>( rDestDoc, rDestPos, maNoteData, false, mnPostItId );
+ sal_uInt32 nPostItId = comphelper::LibreOfficeKit::isActive() ? 0 : mnPostItId;
+ return bCloneCaption ? std::make_unique<ScPostIt>( rDestDoc, rDestPos, *this, nPostItId ) : std::make_unique<ScPostIt>( rDestDoc, rDestPos, maNoteData, false, mnPostItId );
}
void ScPostIt::SetDate( const OUString& rDate )