summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-02-19 18:32:11 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-02-20 13:39:43 +0530
commitc3b26856cc4d69bc206dc56e0b6a47d9cf4afb6c (patch)
tree5c2b55c7d3c0e0d1b5a3867c8875e835980206fe /sd
parent6b4103984f31b42c791800925328dda00f17f122 (diff)
sd lok: Implement ViewAnnotations command
Change-Id: I87dde393adc82dc59c08ec96d1fd79145de6f3c6
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/inc/unomodel.hxx2
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx37
2 files changed, 39 insertions, 0 deletions
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 913266255fd9..0e34762e51fb 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -264,6 +264,8 @@ public:
virtual bool isMimeTypeSupported() override;
/// @see vcl::ITiledRenderable::getPointer().
virtual Pointer getPointer() override;
+ /// @see vcl::ITiledRenderable::getPostIts().
+ virtual OUString getPostIts() override;
// XComponent
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index d68755018766..3fcc45b58b0f 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <boost/property_tree/json_parser.hpp>
+
#include <com/sun/star/presentation/XPresentation2.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
@@ -66,6 +68,7 @@
#include <svx/unoshape.hxx>
#include <editeng/unonrule.hxx>
#include <editeng/eeitem.hxx>
+#include <unotools/datetime.hxx>
#include <unotools/saveopt.hxx>
// Support creation of GraphicObjectResolver and EmbeddedObjectResolver
@@ -2361,6 +2364,40 @@ Size SdXImpressDocument::getDocumentSize()
return Size(convertMm100ToTwip(aSize.getWidth()), convertMm100ToTwip(aSize.getHeight()));
}
+OUString SdXImpressDocument::getPostIts()
+{
+ boost::property_tree::ptree aAnnotations;
+ // Return annotations on master pages too ?
+ const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
+ SdPage* pPage;
+ for (sal_uInt16 nPage = 0; nPage < nMaxPages; ++nPage)
+ {
+ pPage = static_cast<SdPage*>(mpDoc->GetPage(nPage));
+ const sd::AnnotationVector& aPageAnnotations = pPage->getAnnotations();
+
+ for (const auto& aPageAnnotation : aPageAnnotations)
+ {
+ uno::Reference<office::XAnnotation> xAnnotation(aPageAnnotation);
+
+ boost::property_tree::ptree aAnnotation;
+
+ aAnnotation.put("author", xAnnotation->getAuthor());
+ aAnnotation.put("dateTime", utl::toISO8601(xAnnotation->getDateTime()));
+ uno::Reference<text::XText> xText(xAnnotation->getTextRange());
+ aAnnotation.put("text", xText->getString());
+
+ aAnnotations.push_back(std::make_pair("", aAnnotation));
+ }
+ }
+
+ boost::property_tree::ptree aTree;
+ aTree.add_child("comments", aAnnotations);
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aTree);
+
+ return OUString::createFromAscii(aStream.str().c_str());
+}
+
void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
{
SolarMutexGuard aGuard;