sc/source/core/data/postit.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 9c156554e59922ce56df061b56292972e0f88549
Author:     Dennis Francis <[email protected]>
AuthorDate: Tue Mar 15 13:00:35 2022 +0530
Commit:     Andras Timar <[email protected]>
CommitDate: Fri Apr 1 13:48:35 2022 +0200

    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.
    
    Change-Id: Iebd7281113e0830826aff1bbdaae234bd5d5cd4e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131689
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>
    (cherry picked from commit dd229e4cd9a0211c9a80031da1d2f7fb71b6683e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132253
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index b92082ef7115..fc7bea8fd718 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -28,6 +28,7 @@
 #include <editeng/outlobj.hxx>
 #include <editeng/editobj.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
+#include <comphelper/lok.hxx>
 
 #include <scitems.hxx>
 #include <svx/xfillit0.hxx>
@@ -876,7 +877,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 )

Reply via email to