summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2024-06-28 11:41:47 +0900
committerTomaž Vajngerl <quikee@gmail.com>2024-06-28 14:22:30 +0200
commit221a82b541a2a46945fc21d1086f520f2f192178 (patch)
tree1f91a53e9ad6515927f9388f4da45c7c878215d6 /sd
parent12ff4396d973e7aae4dd68b742d9790f8c88ea53 (diff)
UniqueID class that generates and stores a uniqueID for an object
UniqueID generates an unique ID (unique for all users of UniqueID) and keeps the value for the object's life time. Change-Id: Ic2cc1665e57b1984c231a050f82a330c9dcf1ffc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169691 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/AnnotationTest.cxx32
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx4
2 files changed, 18 insertions, 18 deletions
diff --git a/sd/qa/unit/AnnotationTest.cxx b/sd/qa/unit/AnnotationTest.cxx
index 4883c7fb12ec..b62e5de1a0d3 100644
--- a/sd/qa/unit/AnnotationTest.cxx
+++ b/sd/qa/unit/AnnotationTest.cxx
@@ -124,12 +124,12 @@ CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationDelete)
CPPUNIT_ASSERT_EQUAL(size_t(3), pPage->GetObjCount());
- sal_uInt32 nID = pPage->getAnnotations().front()->GetId();
+ sal_uInt64 nID = pPage->getAnnotations().front()->GetId();
CPPUNIT_ASSERT_EQUAL(size_t(3), pPage->getAnnotations().size());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 1), pPage->getAnnotations().at(1)->GetId());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 2), pPage->getAnnotations().at(2)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 1), pPage->getAnnotations().at(1)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 2), pPage->getAnnotations().at(2)->GetId());
auto xAnnotation = pPage->getAnnotations().at(1);
@@ -142,8 +142,8 @@ CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationDelete)
CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount());
CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->getAnnotations().size());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 2), pPage->getAnnotations().at(1)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 2), pPage->getAnnotations().at(1)->GetId());
}
CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationInsertUndoRedo)
@@ -164,34 +164,34 @@ CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationInsertUndoRedo)
SdrObject* pObject = pPage->GetObj(0);
CPPUNIT_ASSERT_EQUAL(SdrObjKind::Annotation, pObject->GetObjIdentifier());
- sal_uInt32 nID = pPage->getAnnotations().front()->GetId();
+ sal_uInt64 nID = pPage->getAnnotations().front()->GetId();
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 1), pPage->getAnnotations().at(1)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 1), pPage->getAnnotations().at(1)->GetId());
dispatchCommand(mxComponent, ".uno:Undo", {});
CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount());
CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->getAnnotations().size());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId());
dispatchCommand(mxComponent, ".uno:Redo", {});
CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount());
CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->getAnnotations().size());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 1), pPage->getAnnotations().at(1)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 1), pPage->getAnnotations().at(1)->GetId());
dispatchCommand(mxComponent, ".uno:DeleteAnnotation", {});
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount());
CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->getAnnotations().size());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId());
dispatchCommand(mxComponent, ".uno:Undo", {});
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount());
CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->getAnnotations().size());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 0), pPage->getAnnotations().at(0)->GetId());
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(nID + 1), pPage->getAnnotations().at(1)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 0), pPage->getAnnotations().at(0)->GetId());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(nID + 1), pPage->getAnnotations().at(1)->GetId());
}
CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationUpdate)
@@ -217,7 +217,7 @@ CPPUNIT_TEST_FIXTURE(AnnotationTest, testAnnotationUpdate)
auto& pAnnotationData = pObject->getAnnotationData();
CPPUNIT_ASSERT(pAnnotationData);
- sal_Int32 nID = pAnnotationData->mxAnnotation->GetId();
+ sal_uInt64 nID = pAnnotationData->mxAnnotation->GetId();
CPPUNIT_ASSERT_EQUAL(tools::Long(0), pObject->GetLogicRect().Left());
CPPUNIT_ASSERT_EQUAL(tools::Long(0), pObject->GetLogicRect().Top());
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 84f9a36b5e44..08eba371d838 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2597,7 +2597,7 @@ OUString SdXImpressDocument::getPartHash(int nPart)
return OUString();
}
- return OUString::number(pPage->GetPageRandomHash());
+ return OUString::number(pPage->GetUniqueID());
}
bool SdXImpressDocument::isMasterViewMode()
@@ -2708,7 +2708,7 @@ void SdXImpressDocument::getPostIts(::tools::JsonWriter& rJsonWriter)
rJsonWriter.put("dateTime", utl::toISO8601(xAnnotation->getDateTime()));
uno::Reference<text::XText> xText(xAnnotation->getTextRange());
rJsonWriter.put("text", xText->getString());
- rJsonWriter.put("parthash", pPage->GetPageRandomHash());
+ rJsonWriter.put("parthash", pPage->GetUniqueID());
geometry::RealPoint2D const & rPoint = xAnnotation->getPosition();
geometry::RealSize2D const & rSize = xAnnotation->getSize();
::tools::Rectangle aRectangle(Point(rPoint.X * 100.0, rPoint.Y * 100.0), Size(rSize.Width * 100.0, rSize.Height * 100.0));