Hello everyone,
Version: 24.2.5.2 (X86_64) / LibreOffice Community
Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: en-CA (en_CA); UI: en-US
Calc: threaded
I am opening a new Draw file by initiating it from a subroutine located in a Base module. The files opens up, but when I try to invoke an event, it gives me an error. I believe I have all the references in order, but it still does not work. What am I doing wrong here?
Option Explicit
Sub startDrawDocument
Dim oDoc As object: oDoc = starDesktop
Dim oFrames As object: oFrames = oDoc.getFrames()
Dim oFrame As object
Dim oDrawDoc As object
Dim Array()
Dim i As Long
Dim oMML As object
'close all open Draw files
For i = 0 To oFrames.Count() - 1
oFrame = oFrames(i)
With oFrame.controller.model
If .supportsService("com.sun.star.drawing.DrawingDocument") Then
.close(true)
End if
End with
Next i
'create new Draw file
oDrawDoc = oDoc.loadComponentFromURL("private:factory/sdraw", "_blank", 0, Array())
'create and register and subsequently close MML event
oMML = createUnoListener("MML_", "com.sun.star.awt.XMouseMotionListener")
With oDrawDoc.currentController
If .supportsService("com.sun.star.drawing.DrawingDocumentDrawView") Then
.addMouseMotionListener(oMML)
End if
End With
oDrawDoc.currentController.removeMouseMotionListener(oMML)
End Sub
Sub MML_mouseDragged(oEvt As com.sun.star.awt.MouseEvent)
End Sub
Sub MML_mouseMoved(oEvt As com.sun.star.awt.MouseEvent)
End Sub
Sub MML_disposing(oEvt As com.sun.star.lang.EventObject)
End Sub