summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-02-21 15:20:45 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-02-21 15:30:50 +0530
commitede35e5c693a287f31e3c02d8afd33580e827380 (patch)
treeef5ad251ad1ae41f0412b4b68313529422a33926 /sd
parent0e21f6619c72f1e17a7b0a52b6317810973d8a3e (diff)
sd lok: Include parthash in annotation list and callbacks
... and update the tests accordingly. Change-Id: Id11f2d19274e743b0e2a0bbeb0c21936f12b7777
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/Annotation.hxx2
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx4
-rw-r--r--sd/source/core/annotations/Annotation.cxx8
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx4
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx1
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));
}