[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:31:10 UTC 2019


 desktop/qa/desktop_lib/test_desktop_lib.cxx  |    3 +
 desktop/source/lib/init.cxx                  |   20 +++++++++++
 include/LibreOfficeKit/LibreOfficeKit.h      |    3 +
 include/LibreOfficeKit/LibreOfficeKit.hxx    |    7 ++++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |    2 -
 include/vcl/ITiledRenderable.hxx             |    8 ++++
 sd/source/ui/inc/DrawViewShell.hxx           |    2 +
 sd/source/ui/inc/unomodel.hxx                |    3 +
 sd/source/ui/unoidl/unomodel.cxx             |    9 +++++
 sd/source/ui/view/drviews1.cxx               |   46 +++++++++++++++++++++++++++
 10 files changed, 101 insertions(+), 2 deletions(-)

New commits:
commit 6597c9be98b5058c028e980cfc6681a7fd09147d
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Sep 11 08:11:47 2018 -0400
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Mon Apr 15 02:30:30 2019 +0200

    slide-sorter: multiple selection
    
    Change-Id: I8624de25b0bb66020002890f33758e52059a24ab
    Reviewed-on: https://gerrit.libreoffice.org/69610
    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 691a82bcc4cb..7fe2cc41f2a0 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2668,9 +2668,10 @@ void DesktopLOKTest::testABI()
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(46), offsetof(struct _LibreOfficeKitDocumentClass, renderShapeSelection));
     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));
     // Extending is fine, update this, and add new assert for the offsetof the
     // new method
-    CPPUNIT_ASSERT_EQUAL(documentClassOffset(49), sizeof(struct _LibreOfficeKitDocumentClass));
+    CPPUNIT_ASSERT_EQUAL(documentClassOffset(50), sizeof(struct _LibreOfficeKitDocumentClass));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1d21b994289d..c70b6d97dd29 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -683,6 +683,7 @@ static int doc_getParts(LibreOfficeKitDocument* pThis);
 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 char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart);
 static void doc_setPartMode(LibreOfficeKitDocument* pThis, int nPartMode);
 static void doc_paintTile(LibreOfficeKitDocument* pThis,
@@ -833,6 +834,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
         m_pDocumentClass->getPartPageRectangles = doc_getPartPageRectangles;
         m_pDocumentClass->getPart = doc_getPart;
         m_pDocumentClass->setPart = doc_setPart;
+        m_pDocumentClass->selectPart = doc_selectPart;
         m_pDocumentClass->getPartName = doc_getPartName;
         m_pDocumentClass->setPartMode = doc_setPartMode;
         m_pDocumentClass->paintTile = doc_paintTile;
@@ -2247,6 +2249,22 @@ static char* doc_getPartInfo(LibreOfficeKitDocument* pThis, int nPart)
     return pMemory;
 }
 
+static void doc_selectPart(LibreOfficeKitDocument* pThis, int nPart, int nSelect)
+{
+    SolarMutexGuard aGuard;
+    if (gImpl)
+        gImpl->maLastExceptionMsg.clear();
+
+    ITiledRenderable* pDoc = getTiledRenderable(pThis);
+    if (!pDoc)
+    {
+        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+        return;
+    }
+
+    pDoc->selectPart( nPart, nSelect );
+}
+
 static char* doc_getPartPageRectangles(LibreOfficeKitDocument* pThis)
 {
     SolarMutexGuard aGuard;
@@ -2604,6 +2622,8 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
     if (pDoc)
     {
         doc_iniUnoCommands();
+        // Create the SlideSorter which is used for multiselection and reordering.
+        doc_postUnoCommand(pThis, ".uno:LeftPaneImpress", nullptr, false);
         pDoc->initializeForTiledRendering(
                 comphelper::containerToSequence(jsonToPropertyValuesVector(pArguments)));
     }
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 8a044b337e6d..3cb204614f7c 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -360,6 +360,9 @@ struct _LibreOfficeKitDocumentClass
                                   int nY,
                                   int nOffset);
 
+    /// @see lok::Document::selectPart().
+    void (*selectPart) (LibreOfficeKitDocument* pThis, int nPart, int nSelect);
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index b2e3a57fa3c2..3aadd72564a9 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -621,6 +621,13 @@ public:
         return mpDoc->pClass->postWindowGestureEvent(mpDoc, nWindowId, pType, nX, nY, nOffset);
     }
 
+    /// Set a part's selection mode.
+    /// nSelect is 0 to deselect, 1 to select, and 2 to toggle.
+    void selectPart(int nPart, int nSelect)
+    {
+        mpDoc->pClass->selectPart(mpDoc, nPart, nSelect);
+    }
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index dc200f220b68..992f64a9065b 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -571,7 +571,7 @@ typedef enum
      * - "invalidate" - the area as described by "rectangle" is invalidated
      *    Clients must request the new area
      * - "cursor_invalidate" - cursor is invalidated. New position is in "rectangle"
-     * - "cursor_visible" - cursor visible status is changed. Status is availabe
+     * - "cursor_visible" - cursor visible status is changed. Status is available
      *    in "visible" field
      * - "close" - window is closed
      */
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index db95bfd81de5..ff89f6dd26b9 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -318,6 +318,14 @@ public:
     {
         return OUString();
     }
+
+    /**
+     * Select/Unselect a document "part", i.e. slide for a slideshow, and
+     * tab for a spreadsheet(?).
+     * nSelect: 0 to deselect, 1 to select, and 2 to toggle.
+     */
+    virtual void selectPart(int /*nPart*/, int /*nSelect*/) {}
+
 };
 } // namespace vcl
 
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 17587ac5be1e..bda391f71858 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -245,6 +245,8 @@ public:
     bool            SwitchPage(sal_uInt16 nPage);
     bool            IsSwitchPageAllowed() const;
 
+    bool            SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect);
+
     void            GotoBookmark(const OUString& rBookmark);
     //Realize multi-selection of objects, If object is marked, the
     //corresponding entry is set true, else the corresponding entry is set
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 586f3279e06b..054f7ffa8b9a 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -265,6 +265,9 @@ public:
     virtual Pointer getPointer() override;
     /// @see vcl::ITiledRenderable::getPostIts().
     virtual OUString getPostIts() override;
+    /// @see vcl::ITiledRenderable::selectPart().
+    virtual void selectPart(int nPart, int nSelect) override;
+
 
     // XComponent
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 5eb8192a4e5b..44c84af76fee 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2289,6 +2289,15 @@ void SdXImpressDocument::paintTile( VirtualDevice& rDevice,
                                          nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 }
 
+void SdXImpressDocument::selectPart(int nPart, int nSelect)
+{
+    DrawViewShell* pViewSh = GetViewShell();
+    if (!pViewSh)
+        return;
+
+    pViewSh->SelectPage(nPart, nSelect);
+}
+
 void SdXImpressDocument::setPart( int nPart )
 {
     DrawViewShell* pViewSh = GetViewShell();
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 976d8dd1cb7b..369ab276bbe2 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -77,6 +77,10 @@
 #include <LayerTabBar.hxx>
 #include <ViewShellManager.hxx>
 #include <ViewShellHint.hxx>
+#include <SlideSorter.hxx>
+#include <SlideSorterViewShell.hxx>
+#include <controller/SlideSorterController.hxx>
+#include <controller/SlsPageSelector.hxx>
 
 #include <sfx2/request.hxx>
 #include <comphelper/lok.hxx>
@@ -744,6 +748,48 @@ bool DrawViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
 }
 
 /**
+ * Mark the desired page as selected (1), deselected (0), toggle (2).
+ * nPage refers to the page in question.
+ */
+bool DrawViewShell::SelectPage(sal_uInt16 nPage, sal_uInt16 nSelect)
+{
+    bool bOK = false;
+
+    // Tell the slide sorter about the name change (necessary for
+    // accessibility.)
+    slidesorter::SlideSorterViewShell* pSlideSorterViewShell
+        = slidesorter::SlideSorterViewShell::GetSlideSorter(GetViewShellBase());
+    if (pSlideSorterViewShell != nullptr)
+    {
+        slidesorter::controller::PageSelector& aPageSelector
+            = pSlideSorterViewShell->GetSlideSorter().GetController().GetPageSelector();
+        if (nSelect == 0)
+        {
+            // Deselect.
+            aPageSelector.DeselectPage(nPage);
+            bOK = true;
+        }
+        else if (nSelect == 1)
+        {
+            // Select.
+            aPageSelector.SelectPage(nPage);
+            bOK = true;
+        }
+        else
+        {
+            // Toggle.
+            if (aPageSelector.IsPageSelected(nPage))
+                aPageSelector.DeselectPage(nPage);
+            else
+                aPageSelector.SelectPage(nPage);
+            bOK = true;
+        }
+    }
+
+    return bOK;
+}
+
+/**
  * Switch to desired page.
  * nSelectPage refers to the current EditMode
  */


More information about the Libreoffice-commits mailing list