diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-06-18 21:39:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-20 21:25:11 +0200 |
commit | cb95276e6e6bf12a1c06d5c252551e55c788fcb2 (patch) | |
tree | 9e54d9ddbd03f02f508af48ce8dce02d5c83a277 /sd/source | |
parent | 292d9519bd368db69920cf0f8b94e0e51c3d14a1 (diff) |
use JsonWriter for the rest of ITiledRenderable
and fix bug in buffer reallacotion where mPos pointing
at the beginning of the new buffer instead of at the
correct index inside it.
Change-Id: Ie1ffaa176f6165e2cec85c93adc945312eff38e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96650
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 26 |
2 files changed, 10 insertions, 18 deletions
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index f27ed3c21c7d..acd3d8ed02aa 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -262,7 +262,7 @@ public: /// @see vcl::ITiledRenderable::getPointer(). virtual PointerStyle getPointer() override; /// @see vcl::ITiledRenderable::getPostIts(). - virtual OUString getPostIts() override; + virtual void getPostIts(tools::JsonWriter& /*rJsonWriter*/) override; /// @see vcl::ITiledRenderable::selectPart(). virtual void selectPart(int nPart, int nSelect) override; /// @see vcl::ITiledRenderable::moveSelectedParts(). diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 54c3658183fa..fba4d8f68e6f 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -120,6 +120,7 @@ #include <sfx2/lokcharthelper.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <tools/json_writer.hxx> #define TWIPS_PER_PIXEL 15 @@ -2399,9 +2400,9 @@ Size SdXImpressDocument::getDocumentSize() return Size(convertMm100ToTwip(aSize.getWidth()), convertMm100ToTwip(aSize.getHeight())); } -OUString SdXImpressDocument::getPostIts() +void SdXImpressDocument::getPostIts(::tools::JsonWriter& rJsonWriter) { - boost::property_tree::ptree aAnnotations; + auto commentsNode = rJsonWriter.startNode("comments"); // Return annotations on master pages too ? const sal_uInt16 nMaxPages = mpDoc->GetPageCount(); SdPage* pPage; @@ -2412,24 +2413,15 @@ OUString SdXImpressDocument::getPostIts() for (const uno::Reference<office::XAnnotation>& xAnnotation : aPageAnnotations) { - boost::property_tree::ptree aAnnotation; - aAnnotation.put("id", sd::getAnnotationId(xAnnotation)); - aAnnotation.put("author", xAnnotation->getAuthor()); - aAnnotation.put("dateTime", utl::toISO8601(xAnnotation->getDateTime())); + auto commentNode = rJsonWriter.startNode(""); + rJsonWriter.put("id", sd::getAnnotationId(xAnnotation)); + rJsonWriter.put("author", xAnnotation->getAuthor()); + rJsonWriter.put("dateTime", utl::toISO8601(xAnnotation->getDateTime())); uno::Reference<text::XText> xText(xAnnotation->getTextRange()); - aAnnotation.put("text", xText->getString()); - aAnnotation.put("parthash", OUString(OUString::number(pPage->GetHashCode()))); - - aAnnotations.push_back(std::make_pair("", aAnnotation)); + rJsonWriter.put("text", xText->getString()); + rJsonWriter.put("parthash", pPage->GetHashCode()); } } - - boost::property_tree::ptree aTree; - aTree.add_child("comments", aAnnotations); - std::stringstream aStream; - boost::property_tree::write_json(aStream, aTree); - - return OUString::fromUtf8(aStream.str().c_str()); } void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) |