[Libreoffice-commits] core.git: sd/inc sd/qa sd/source
Pranav Kant
pranavk at collabora.co.uk
Tue Feb 21 10:01:20 UTC 2017
sd/inc/Annotation.hxx | 2 ++
sd/qa/unit/tiledrendering/tiledrendering.cxx | 4 ++++
sd/source/core/annotations/Annotation.cxx | 8 ++++++++
sd/source/ui/annotations/annotationmanager.cxx | 4 +++-
sd/source/ui/unoidl/unomodel.cxx | 1 +
5 files changed, 18 insertions(+), 1 deletion(-)
New commits:
commit ede35e5c693a287f31e3c02d8afd33580e827380
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Tue Feb 21 15:20:45 2017 +0530
sd lok: Include parthash in annotation list and callbacks
... and update the tests accordingly.
Change-Id: Id11f2d19274e743b0e2a0bbeb0c21936f12b7777
diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx
index 39e746c..27f1d51 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 c70bdd5..d142921 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 fcc0a60..6d2cdeb 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 8d8c883..e4d593f 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 27ed31db..ec701f0 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));
}
More information about the Libreoffice-commits
mailing list