DataBrowser interface beamer grid selection Bernard Marcelly Marc Santhoff Frank Schönheit Paolo Mantovani Fernand In Basic, how to call a method offered by a specific interface of an object ?

An object may support the same method name from several interfaces. In this case Basic uses the first method it finds. This snippet shows how to specify which method to use.

Based on Developer's Guide chapter 6.2.6.

Option Explicit Sub RowSelectionInDataBrowser ' finds which rows in the DataSourceBrowser are selected by the user Dim frame1 As Object, frame2 As Object Dim oModel As Object, oResults As Object Dim oDoc As Object, oGrid As Object Dim oDataSourceBrowser as Object Dim oSelection as Variant, ii As Long oDoc = thiscomponent frame1 = oDoc.CurrentController.Frame frame2 = frame1.findFrame("_beamer",4) ' get DataBrowser frame if IsNull(frame2) then MsgBox("Beamer not found !", 16) Exit Sub end if oDataSourcebrowser = frame2.Controller ' the DataSourceBrowser object has several getModel methods ' choose getModel from interface com.sun.star.awt.XTabController ' to get the form used by DataSourceBrowser oModel = oDataSourcebrowser.com_sun_star_awt_XTabController_getModel ' creating a "clone" of the form oResults = oModel.createResultSet oGrid = oDataSourceBrowser.CurrentControl oSelection = oGrid.Selection if UBound(oSelection) >= 0 then ' we get a list of Bookmarks For ii= 0 To UBound(oSelection) if oResults.moveToBookmark(oSelection(ii)) then MsgBox( oResults.Columns(0).String & " : " & oResults.Columns(4).String ) else MsgBox("Bookmark not found : " & oSelection(ii), 16) end if Next else MsgBox("No line selected in the DataBrowser", 16) end if End Sub