My Technical Notes

Tuesday, 10 February 2015

OpenOffice InsertDraw Command

The InsertDraw command can be used to select an item from the Drawing Toolbar:

To use the `InsertDraw` command, we need to specify the button, from the left, as an integer starting from 1. For example:

Sub InsertEllipse
    Dim document   As Object
    Dim dispatcher As Object

    document   = ThisComponent.CurrentController.Frame
    dispatcher = createUnoService("")

    Dim args1(0) As New
    args1(0).Name = "InsertDraw"
    args1(0).Value = 4

    dispatcher.executeDispatch(document, ".uno:InsertDraw", "", 0, args1())
End Sub

Will insert an Ellipse, because it is the 4th button in the Drawing Toolbar.

No comments: