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

New commits:
commit d0221fb6c35ecceb53e347d2790ac66b8a021044
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Tue Mar 15 13:00:35 2022 +0530
Commit:     Dennis Francis <dennis.fran...@collabora.com>
CommitDate: Thu Mar 31 07:38:27 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.
    
    Conflicts:
            sc/source/core/data/postit.cxx
    
    Change-Id: Iebd7281113e0830826aff1bbdaae234bd5d5cd4e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131689
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    (cherry picked from commit dd229e4cd9a0211c9a80031da1d2f7fb71b6683e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132170
    Tested-by: Jenkins
    Reviewed-by: Dennis Francis <dennis.fran...@collabora.com>

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 )

Reply via email to