summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-09-11 08:11:47 -0400
committerJan Holesovsky <kendy@collabora.com>2019-07-10 15:32:53 +0200
commit74d56d44804efa3424cff3434d2baf00c60b3cd5 (patch)
tree0a67b6ff20180882d5d01a00845721877d52ab60
parent5583ee37101a748d901fae1da315aeb453278ecd (diff)
slide-sorter: multiple selection
Change-Id: I8624de25b0bb66020002890f33758e52059a24ab Reviewed-on: https://gerrit.libreoffice.org/69610 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/73493 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx5
-rw-r--r--desktop/source/lib/init.cxx20
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h3
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx12
-rw-r--r--include/vcl/ITiledRenderable.hxx8
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx2
-rw-r--r--sd/source/ui/inc/unomodel.hxx3
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx9
-rw-r--r--sd/source/ui/view/drviews1.cxx46
9 files changed, 104 insertions, 4 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index f3f09b71aa2a..e51346e22587 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -927,7 +927,7 @@ void DesktopLOKTest::testTrackChanges()
pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
Scheduler::ProcessEventsToIdle();
- // Enable track changes and assert that both views get notified.
+ // Enable trak changes and assert that both views get notified.
m_nTrackChanges = 0;
pDocument->pClass->postUnoCommand(pDocument, ".uno:TrackChanges", nullptr, false);
Scheduler::ProcessEventsToIdle();
@@ -2715,9 +2715,10 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(documentClassOffset(46), offsetof(struct _LibreOfficeKitDocumentClass, renderShapeSelection));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(47), offsetof(struct _LibreOfficeKitDocumentClass, postWindowGestureEvent));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(48), offsetof(struct _LibreOfficeKitDocumentClass, createViewWithOptions));
+ 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 b014080b4aff..c8ec63210664 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -710,6 +710,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,
@@ -860,6 +861,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;
@@ -2340,6 +2342,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)
{
comphelper::ProfileZone aZone("doc_getPartPageRectangles");
@@ -2696,6 +2714,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 e4e96483c354..81a4787d24df 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -378,6 +378,9 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document::createViewWithOptions().
int (*createViewWithOptions) (LibreOfficeKitDocument* pThis, const char* pOptions);
+ /// @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 d1a3106b7d6b..6b3968b5ff6c 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -303,7 +303,7 @@ public:
}
/**
- * Posts a UNO command to the document.
+ * Posts an UNO command to the document.
*
* Example argument string:
*
@@ -648,6 +648,14 @@ 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
};
@@ -669,7 +677,7 @@ public:
}
/**
- * Loads a document from a URL.
+ * Loads a document from an URL.
*
* @param pUrl the URL of the document to load
* @param pFilterOptions options for the import filter, e.g. SkipImages.
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index e95e2bdf0f61..e8d09599ace9 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -273,6 +273,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 64bcabc7cc9c..7d4ea407175a 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -247,6 +247,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 2be081b447f1..4d712f69a503 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -263,6 +263,9 @@ public:
virtual PointerStyle 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 e26670b321e4..6329f2a4bf97 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2273,6 +2273,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 e72080fe00fd..b725833c7b3c 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -79,6 +79,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>
@@ -765,6 +769,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
*/