diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-02-19 18:32:11 +0530 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-02-28 11:10:21 +0100 |
commit | 3d7e9a7faec98b92c61eac8bd10e2db4772b235f (patch) | |
tree | 5b04d360d02d0a4b49ccb2f8a19eeca113362b7c /sd | |
parent | f94b730492c0890bad7bb93ca1607434b429ae5f (diff) |
sd lok: Implement ViewAnnotations command
Change-Id: I87dde393adc82dc59c08ec96d1fd79145de6f3c6
(cherry picked from commit c3b26856cc4d69bc206dc56e0b6a47d9cf4afb6c)
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 37 |
2 files changed, 39 insertions, 0 deletions
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 0aff34745a0b..087fa521ca9e 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -265,6 +265,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 04578f87c1af..61a02779e5c3 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> @@ -65,6 +67,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 @@ -2376,6 +2379,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; |