Hello @Lupp,
Unfortunately this is not so straightforward as accessing SideBar elements from the Right Sidebar, which can be obtained by CurrentController.getSideBar().
The Pages Pane ( a.k.a. “Slide Sorter” ) is by default located in the Left Sidebar.
But even though it can be dragged over to the Right Sidebar, it is not included in the Decks collection from getSideBar().
( The Decks that are accessible via getSideBar() are apparently limited to:
PropertyDeck, ShapesDeck, StyleListDeck, GalleryDeck, NavigatorDeck. )
To access the Slide Sorter from a specific anchor such as the Left Sidebar, the Right Sidebar, or a floating window, i tried using the BasicViewFactory service.
It succeeds in getting the Slide Sorter pane, and it does even have a method getSelection()
that returns an array of Objects.
But to my chagrin, this array still contains only 1 selected Slide object, even when multiple Slides are selected by the user in the Slide Sorter pane.
Please see if you can verify this behaviour.
Code fragment:
REM NB. ThisComponent must be a Draw or Impress document.
Dim oController As Object : oController = ThisComponent.getCurrentController()
Dim oBasicViewFactory As Object
oBasicViewFactory = createUNOservice( "com.sun.star.drawing.framework.BasicViewFactory" )
oBasicViewFactory.initialize( Array( oController ) )
Dim vResourceId As Variant: vResourceId = com.sun.star.drawing.framework.ResourceId
Dim strResourceURL As String : strResourceURL = "private:resource/view/SlideSorter"
Dim strAnchorURL As String : strAnchorURL = "private:resource/pane/LeftDrawPane" REM LeftDrawPane; LeftImpressPane.
Dim oResourceID As Object : oResourceID = vResourceId.createWithAnchorURL( strResourceURL, strAnchorURL )
Dim oSlideSorter As Object : oSlideSorter = oBasicViewFactory.createResource( oResourceID )
If Not IsNull( oSlideSorter ) Then
Dim aSelection() : aSelection = oSlideSorter.getSelection() REM Ouch: Array contains only 1 item,
Dim i As Integer : i = uBound( aSelection ) REM even when multiple items are selected ...
Dim oSelectedSlide As Object : oSelectedSlide = aSelection(0) REM The "only selected" item.
End If
With Regards, lib