API: Object to access the Page Pane of a Draw or Impress document?

Drawings in ‘Draw’ or ‘Impress’ are inserted in pages (aka slides).
The UI supplies a ‘Page Pane’ (titled “Pages”) which allows to pick any selection of pages.
I would like to get access to that selection of pages in macros. How can I get the respective object?

(Editing:)
See also this post of mine in the forum.openoffice.org/en. The thread there gives the background of my question here.

The pane is the SlideSorter. Maybe XSlideSorterBase.DocumentSlides, although I’m not sure how to access this object.

@jimk: Thanks. I did not find a way and therefore abandoned the search. See also my comment to the answer by @librebel.
I did not yet publish the code I wrote motivated by the question starting the above linked thread. It is mainly made to loop through the shapes of a Draw / Impress document, and to resolve groups and/or a selection for the purpose. If somebody is interested, I will post it, of course. (There is also a sorting function for arrays.)

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

Thanks @librebel . Yes. I found the behaviour you described.
Firstly I never had heard of that way to create objects. I hoped to be able to use "createUnoService to get a service. In fact I still cannot understand for what reosen there is not (accessible) a dedicated controller for the Page Pane.
I think I will abandon this special kick concerning the code I wrote for walking recursively through DrawingDocuments or selections made there.

Thanks for the confirmation @Lupp,

i agree that the API could be improved here … perhaps a parameter to getSideBar(), specifying which SideBar to get ( Left or Right ) ?

about the ResourceID object … it could also be created by createUNOservice() and then initialized by .initialize( URLarray ), but this way is shorter :slight_smile:

Btw @Lupp, i believe that the above does answer your question correctly, in sofar that it does provide an object to access the Page Pane of a Draw or Impress document.

So … please mark the answer as correct by clicking on the checkmark icon on the left :slight_smile:

Ok. I expressed myself not very precisely. Assuming there was only one such pane and it would give access to the selection of pages, I worded the question as I did. In fact I should have asked for access to the selection of pages. The newly created ‘SlideSorter’ doesn’t heplp with my original intentions.