shourtcut libeoffice zoom in out code example

Example: shourtcut libeoffice zoom in out

Sub ZoomIn

Dim doc As Object
Dim new_zoom_value As Integer
Dim dispatcher As Object

doc = ThisComponent.CurrentController.Frame
new_zoom_value = ThisComponent.CurrentController.viewSettings.ZoomValue + 5
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Zoom.Value"
args1(0).Value = new_zoom_value
args1(1).Name = "Zoom.ValueSet"
args1(1).Value = 28703
args1(2).Name = "Zoom.Type"
args1(2).Value = 0

dispatcher.executeDispatch(doc, ".uno:Zoom", "", 0, args1())

End Sub



Sub ZoomOut

Dim doc As Object
Dim new_zoom_value As Integer
Dim dispatcher As Object

doc = ThisComponent.CurrentController.Frame
new_zoom_value = ThisComponent.CurrentController.viewSettings.ZoomValue - 5
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Zoom.Value"
args1(0).Value = new_zoom_value
args1(1).Name = "Zoom.ValueSet"
args1(1).Value = 28703
args1(2).Name = "Zoom.Type"
args1(2).Value = 0

dispatcher.executeDispatch(doc, ".uno:Zoom", "", 0, args1())

End Sub

Tags:

Misc Example