[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - desktop/qa desktop/source include/LibreOfficeKit include/vcl sd/source

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 15 00:33:22 UTC 2019


 desktop/qa/desktop_lib/test_desktop_lib.cxx |    3 ++-
 desktop/source/lib/init.cxx                 |   18 ++++++++++++++++++
 include/LibreOfficeKit/LibreOfficeKit.h     |    3 +++
 include/LibreOfficeKit/LibreOfficeKit.hxx   |    8 ++++++++
 include/vcl/ITiledRenderable.hxx            |    6 ++++++
 sd/source/ui/inc/unomodel.hxx               |    2 ++
 sd/source/ui/unoidl/unomodel.cxx            |    7 +++++++
 7 files changed, 46 insertions(+), 1 deletion(-)

New commits:
commit 3c9660f99e477436348ff5a4afed423ff2888df5
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Sep 16 17:27:35 2018 -0400
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Mon Apr 15 02:32:45 2019 +0200

    LOK: support for ordering/moving parts
    
    Currently reordering of slides is only supported
    for presentations, although it is provisioned for
    spreadsheets as well.
    
    Change-Id: I6c35066d6a5ef7586d34a8e8b89db69a20b86572
    Reviewed-on: https://gerrit.libreoffice.org/69612
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 7fe2cc41f2a0..a952dcd0a0a0 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2669,9 +2669,10 @@ void DesktopLOKTest::testABI()
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, createViewWithOptions));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), offsetof(struct _LibreOfficeKitDocumentClass, selectPart));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), offsetof(struct _LibreOfficeKitDocumentClass, moveSelectedParts));
     // Extending is fine, update this, and add new assert for the offsetof the
     // new method
-    CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), sizeof(struct _LibreOfficeKitDocumentClass));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(51), sizeof(struct _LibreOfficeKitDocumentClass));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c70b6d97dd29..26f3f585ade9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -684,6 +684,7 @@ static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis);
 static int doc_getPart(LibreOfficeKitDocument* pThis);
 static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart);
 static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect);
+static void doc_moveSelectedParts(LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate);
 static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart);
 static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode);
 static void doc_paintTile(LibreOfficeKitDocument* pThis,
@@ -835,6 +836,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
         m_pDocumentClass->getPart = doc_getPart;
         m_pDocumentClass->setPart = doc_setPart;
         m_pDocumentClass->selectPart = doc_selectPart;
+        m_pDocumentClass->moveSelectedParts = doc_moveSelectedParts;
         m_pDocumentClass->getPartName = doc_getPartName;
         m_pDocumentClass->setPartMode = doc_setPartMode;
         m_pDocumentClass->paintTile = doc_paintTile;
@@ -2265,6 +2267,22 @@ static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect
     pDoc->selectPart( nPart, nSelect );
 }
 
+static void doc_moveSelectedParts(LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate)
+{
+    SolarMutexGuard aGuard;
+    if (gImpl)
+        gImpl->maLastExceptionMsg.clear();
+
+    ITiledRenderable* pDoc = getTiledRenderable(pThis);
+    if (!pDoc)
+    {
+        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+        return;
+    }
+
+    pDoc->moveSelectedParts(nPosition, bDuplicate);
+}
+
 static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis)
 {
     SolarMutexGuard aGuard;
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 3cb204614f7c..4c3f0507e88b 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -363,6 +363,9 @@ struct _LibreOfficeKitDocumentClass
     /// @see lok::Document::selectPart().
     void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect);
 
+    /// @see lok::Document::moveSelectedParts().
+    void (*moveSelectedParts) (LibreOfficeKitDocument* pThis, int nPosition, bool bDuplicate);
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 3aadd72564a9..6f24ba0adcc5 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -628,6 +628,14 @@ public:
         mpDoc->pClass->selectPart(mpDoc, nPart, nSelect);
     }
 
+    /// Moves the selected pages/slides to a new position.
+    /// nPosition is the new position where the selection
+    /// should go. bDuplicate when true will copy instead of move.
+    void moveSelectedParts(int nPosition, bool bDuplicate)
+    {
+        mpDoc->pClass->moveSelectedParts(mpDoc, nPosition, bDuplicate);
+    }
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 42d823e734f2..dcd8d8a8bb1a 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -327,6 +327,12 @@ public:
      */
     virtual void selectPart(int /*nPart*/, int /*nSelect*/) {}
 
+    /**
+     * Move selected pages/slides to a new position.
+     * nPosition: the new position to move to.
+     * bDuplicate: to copy (true), or to move (false).
+     */
+    virtual void moveSelectedParts(int /*nPosition*/, bool /*bDuplicate*/) {}
 };
 } // namespace vcl
 
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 993749bbcb3d..b0345ce2d140 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -267,6 +267,8 @@ public:
     virtual OUString getPostIts() override;
     /// @see vcl::ITiledRenderable::selectPart().
     virtual void selectPart(int nPart, int nSelect) override;
+    /// @see vcl::ITiledRenderable::moveSelectedParts().
+    virtual void moveSelectedParts(int nPosition, bool bDuplicate) override;
     /// @see vcl::ITiledRenderable::getPartInfo().
     virtual OUString getPartInfo(int nPart) override;
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 2aa5dc247208..fe0c82d9309a 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2298,6 +2298,13 @@ void SdXImpressDocument::selectPart(int nPart, int nSelect)
     pViewSh->SelectPage(nPart, nSelect);
 }
 
+void SdXImpressDocument::moveSelectedParts(int nPosition, bool bDuplicate)
+{
+    // Duplicating is currently unsupported.
+    if (!bDuplicate)
+        mpDoc->MovePages(nPosition);
+}
+
 OUString SdXImpressDocument::getPartInfo(int nPart)
 {
     DrawViewShell* pViewSh = GetViewShell();


More information about the Libreoffice-commits mailing list