From 80d1ada96010a943ff1793139d176086f4598d98 Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Sun, 19 Feb 2017 18:51:13 +0530 Subject: sd lok: Use IDs in ViewAnnotations output Change-Id: Ifb1f55ad5a1d21d63f9b37a83e3218c40dfa0b59 --- sd/inc/Annotation.hxx | 2 ++ sd/source/core/annotations/Annotation.cxx | 9 +++++++++ sd/source/ui/unoidl/unomodel.cxx | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index fe2f39a961e4..39e746c7da3e 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -35,6 +35,8 @@ void createAnnotation( css::uno::Reference< css::office::XAnnotation >& xAnnotat SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const css::uno::Reference< css::office::XAnnotation >& xAnnotation, bool bInsert ); +sal_uInt32 getAnnotationId(const css::uno::Reference & xAnnotation); + } #endif diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 3289eb6c4590..fcc0a60f2868 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -370,6 +370,15 @@ SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const Reference< XAnnotation } } +sal_uInt32 getAnnotationId(const Reference& xAnnotation) +{ + Annotation* pAnnotation = dynamic_cast(xAnnotation.get()); + sal_uInt32 nId = 0; + if (pAnnotation) + nId = pAnnotation->GetId(); + return nId; +} + UndoInsertOrRemoveAnnotation::UndoInsertOrRemoveAnnotation( Annotation& rAnnotation, bool bInsert ) : SdrUndoAction( *rAnnotation.GetModel() ) , mxAnnotation( &rAnnotation ) diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 3fcc45b58b0f..efd1b2dfd476 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -78,6 +78,7 @@ #include "ViewShellBase.hxx" #include +#include #include #include #include @@ -2380,7 +2381,7 @@ OUString SdXImpressDocument::getPostIts() uno::Reference xAnnotation(aPageAnnotation); boost::property_tree::ptree aAnnotation; - + aAnnotation.put("id", sd::getAnnotationId(xAnnotation)); aAnnotation.put("author", xAnnotation->getAuthor()); aAnnotation.put("dateTime", utl::toISO8601(xAnnotation->getDateTime())); uno::Reference xText(xAnnotation->getTextRange()); -- cgit