sd lok: Include parthash in annotation list and callbacks
... and update the tests accordingly. Change-Id: Id11f2d19274e743b0e2a0bbeb0c21936f12b7777
This commit is contained in:
parent
0e21f6619c
commit
ede35e5c69
5 changed files with 18 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue