I want to import MathML from Clipboard in Writer in one go, using a macro. Doing it manually, you have to insert a formula, then use the command "Import MathML from Clipboard" from its Tools menu (which is .uno:ImportMathMLClipboard), and finally click into the text document to leave Math.
I can insert a Math-object into the text document and when I activate it (MS_OLEVERB_OPEN), then I can use the dispatcher to execute the uno command. That works, but opening the Math-object generates a window. Although it will be closed in a short time, that is not nice.
Is there a way to activate a Math OLE without visible window?
The relevant part of the macro is
Code: Select all
dim oDispatcher as variant
oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim oXCOEO as variant
oXCOEO = oMathOLE.ExtendedControlOverEmbeddedObject
oXCOEO.doVerb(com.sun.star.embed.EmbedVerbs.MS_OLEVERB_OPEN)
dim oMathFrame as variant
oMathFrame = oMathOLE.Model.CurrentController.Frame
oDispatcher.executeDispatch(oMathFrame, ".uno:ImportMathMLClipboard", "", 0, Array())
oDispatcher.executeDispatch(oMathFrame, ".uno:CloseDoc", "", 0, Array())