[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 2 commits - sd/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 29 19:54:29 UTC 2020


 sd/source/core/annotations/Annotation.cxx |    6 ++++++
 sd/source/filter/pdf/sdpdffilter.cxx      |    8 +++++++-
 sd/source/ui/unoidl/unomodel.cxx          |   14 +++++++++++---
 3 files changed, 24 insertions(+), 4 deletions(-)

New commits:
commit 5e7d767643bcf86b4ea7c5fb4cd91c5ea5d737ff
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri Jun 26 09:06:18 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Jun 29 21:54:11 2020 +0200

    sd: send annotation position for LOKit, fix multiple annotations
    
    This adds support to send annotation position in the document when
    sending the available annotations using LOKit.
    
    It also fixes an issue with the json structure for the annotations,
    which sends multiple annotation objects with the same (empty) key,
    that after parsing reduces to only one (so only one of the many
    annotations is present). This fix changes that so annotation
    objects have each its own unique key.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97329
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    (cherry picked from commit f008bd0277001226f2dd695836a019c9b9c84799)
    
    Change-Id: I9d994383d6ee322f27f1426be5bd96ac81e8e609
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97446
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx
index 554dc4318786..17dcb12eb638 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -429,6 +429,12 @@ std::string lcl_LOKGetCommentPayload(CommentNotificationType nType, Reference<XA
         aAnnotation.put("text", xText->getString());
         const SdPage* pPage = sd::getAnnotationPage(rxAnnotation);
         aAnnotation.put("parthash", pPage ? OString::number(pPage->GetHashCode()) : OString());
+        geometry::RealPoint2D const & rPoint = rxAnnotation->getPosition();
+        geometry::RealSize2D const & rSize = rxAnnotation->getSize();
+        ::tools::Rectangle aRectangle(Point(rPoint.X * 100.0, rPoint.Y * 100.0), Size(rSize.Width * 100.0, rSize.Height * 100.0));
+        aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+        OString sRectangle = aRectangle.toString();
+        aAnnotation.put("rectangle", sRectangle.getStr());
     }
 
     boost::property_tree::ptree aTree;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 5b8386022652..cea0b9f4c420 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -118,6 +118,7 @@
 #include <drawinglayer/primitive2d/structuretagprimitive2d.hxx>
 
 #include <sfx2/lokcharthelper.hxx>
+#include <tools/gen.hxx>
 #include <tools/debug.hxx>
 #include <tools/diagnose_ex.h>
 
@@ -2399,14 +2400,21 @@ OUString SdXImpressDocument::getPostIts()
         for (const uno::Reference<office::XAnnotation>& xAnnotation : aPageAnnotations)
         {
             boost::property_tree::ptree aAnnotation;
-            aAnnotation.put("id", sd::getAnnotationId(xAnnotation));
+            sal_uInt32 nID = sd::getAnnotationId(xAnnotation);
+            OString nodeName = "comment" + OString::number(nID);
+            aAnnotation.put("id", nID);
             aAnnotation.put("author", xAnnotation->getAuthor());
             aAnnotation.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));
+            geometry::RealPoint2D const & rPoint = xAnnotation->getPosition();
+            geometry::RealSize2D const & rSize = xAnnotation->getSize();
+            ::tools::Rectangle aRectangle(Point(rPoint.X * 100.0, rPoint.Y * 100.0), Size(rSize.Width * 100.0, rSize.Height * 100.0));
+            aRectangle = OutputDevice::LogicToLogic(aRectangle, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+            OString sRectangle = aRectangle.toString();
+            aAnnotation.put("rectangle", sRectangle.getStr());
+            aAnnotations.push_back(std::make_pair(nodeName.getStr(), aAnnotation));
         }
     }
 
commit 6a95b382272cccc1887fc56c48baa192cf23a9e5
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Jun 23 14:51:59 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Mon Jun 29 21:53:58 2020 +0200

    sd: ignore UNDO when importing a PDF with SdPdfFilter
    
    Change-Id: I6c695ca4edb284d70726b6f30148a508d0e70911
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96944
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    (cherry picked from commit c834ea3e4973ca20ae40d0353eb70a47bda9a7a4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97445
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>

diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index 43c6c6fdac36..6bc036f7fa21 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -49,6 +49,11 @@ bool SdPdfFilter::Import()
     if (vcl::ImportPDFUnloaded(aFileName, aGraphics) == 0)
         return false;
 
+    bool bWasLocked = mrDocument.isLocked();
+    mrDocument.setLock(true);
+    const bool bSavedUndoEnabled = mrDocument.IsUndoEnabled();
+    mrDocument.EnableUndo(false);
+
     // Add as many pages as we need up-front.
     mrDocument.CreateFirstPages();
     for (size_t i = 0; i < aGraphics.size() - 1; ++i)
@@ -93,7 +98,8 @@ bool SdPdfFilter::Import()
             xAnnotation->setDateTime(rPDFAnnotation.maDateTime);
         }
     }
-
+    mrDocument.setLock(bWasLocked);
+    mrDocument.EnableUndo(bSavedUndoEnabled);
     return true;
 }
 


More information about the Libreoffice-commits mailing list