diff options
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/Annotation.hxx | 2 | ||||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 4 | ||||
-rw-r--r-- | sd/source/core/annotations/Annotation.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/annotations/annotationmanager.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 1 |
5 files changed, 18 insertions, 1 deletions
diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index 39e746c7da3e..27f1d51c969d 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -37,6 +37,8 @@ SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const css::uno::Reference< cs sal_uInt32 getAnnotationId(const css::uno::Reference <css::office::XAnnotation>& xAnnotation); +const SdPage* getAnnotationPage(const css::uno::Reference<css::office::XAnnotation>& xAnnotation); + } #endif diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index c70bdd5024b9..d142921db5ec 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -1618,6 +1618,8 @@ void SdTiledRenderingTest::testCommentCallbacks() CPPUNIT_ASSERT_EQUAL(std::string("LOK User1"), aView2.m_aCommentCallbackResult.get<std::string>("author")); CPPUNIT_ASSERT_EQUAL(std::string("Comment"), aView1.m_aCommentCallbackResult.get<std::string>("text")); CPPUNIT_ASSERT_EQUAL(std::string("Comment"), aView2.m_aCommentCallbackResult.get<std::string>("text")); + CPPUNIT_ASSERT(!aView1.m_aCommentCallbackResult.get<std::string>("parthash").empty()); + CPPUNIT_ASSERT(!aView2.m_aCommentCallbackResult.get<std::string>("parthash").empty()); // Reply to a just added comment SfxLokHelper::setView(nView2); @@ -1642,6 +1644,8 @@ void SdTiledRenderingTest::testCommentCallbacks() CPPUNIT_ASSERT(aReplyTextView1.endsWith("Reply to comment")); CPPUNIT_ASSERT(aReplyTextView2.startsWith("Reply to LOK User1")); CPPUNIT_ASSERT(aReplyTextView2.endsWith("Reply to comment")); + CPPUNIT_ASSERT(!aView1.m_aCommentCallbackResult.get<std::string>("parthash").empty()); + CPPUNIT_ASSERT(!aView2.m_aCommentCallbackResult.get<std::string>("parthash").empty()); // Delete the comment aArgs = comphelper::InitPropertySequence( diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index fcc0a60f2868..6d2cdeb185a3 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -379,6 +379,14 @@ sal_uInt32 getAnnotationId(const Reference<XAnnotation>& xAnnotation) return nId; } +const SdPage* getAnnotationPage(const Reference<XAnnotation>& xAnnotation) +{ + Annotation* pAnnotation = dynamic_cast<Annotation*>(xAnnotation.get()); + if (pAnnotation) + return pAnnotation->GetPage(); + return nullptr; +} + UndoInsertOrRemoveAnnotation::UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert ) : SdrUndoAction( *rAnnotation.GetModel() ) , mxAnnotation( &rAnnotation ) diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index 8d8c88304d1c..e4d593f36562 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -122,13 +122,15 @@ namespace { (nType == CommentNotificationType::Remove ? "Remove" : (nType == CommentNotificationType::Modify ? "Modify" : "???")))); aAnnotation.put("id", sd::getAnnotationId(rxAnnotation)); - if (nType != CommentNotificationType::Remove) + if (nType != CommentNotificationType::Remove && rxAnnotation.is()) { aAnnotation.put("id", sd::getAnnotationId(rxAnnotation)); aAnnotation.put("author", rxAnnotation->getAuthor()); aAnnotation.put("dateTime", utl::toISO8601(rxAnnotation->getDateTime())); uno::Reference<text::XText> xText(rxAnnotation->getTextRange()); aAnnotation.put("text", xText->getString()); + const SdPage* pPage = sd::getAnnotationPage(rxAnnotation); + aAnnotation.put("parthash", pPage ? OString::number(pPage->GetHashCode()) : OString()); } boost::property_tree::ptree aTree; diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 27ed31db6444..ec701f0bc410 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2387,6 +2387,7 @@ OUString SdXImpressDocument::getPostIts() aAnnotation.put("dateTime", utl::toISO8601(xAnnotation->getDateTime())); uno::Reference<text::XText> xText(xAnnotation->getTextRange()); aAnnotation.put("text", xText->getString()); + aAnnotation.put("parthash", OUString::number(pPage->GetHashCode())); aAnnotations.push_back(std::make_pair("", aAnnotation)); } |