Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


This does work for me, but, only if I define some global variables in the defining module. Try setting OptionExplicit at the top of the module and it will flag all of those undefined variables for you.

Global oGlob
GLobal oListener
Global boFinished
Global url



On 07/06/2015 04:54 PM, Jerry Geis wrote:

Sub Load(arg as String)

'register a global event listener, because
'we have to wait until loading has finished
oGlob = CreateUnoService("com.sun.star.frame.GlobalEventBroadcaster")
oListener = CreateUnoListener("EvList_","com.sun.star.document.XEventListener")
oGlob.addEventListener(oListener)
boFinished = false

'hide the document while loading so that we do not see the loading window
Dim aProps(2) as new com.sun.star.beans.PropertyValue
Dim oDoc as Object
aProps(0).Name  = "Hidden"
aProps(0).Value = true
aProps(1).Name  = "ReadOnly"
aProps(1).Value = true
url = arg
oDoc = StarDesktop.loadComponentFromURL(url, "_default", 0, aProps)

'wait until loading has finished
while (not boFinished)
wait(5)
wend

oGlob.removeEventListener(oListener)

'loading is done, set the presentation parameters
oDoc.Presentation.Pause = 0
'show the window now as presentation cannot be started
'(segmentation faults) if it is not
oDoc.CurrentController.Frame.ContainerWindow.Visible = true
oDoc.CurrentController.Frame.ContainerWindow.setVisible(false)
'start the presentation
oDoc.Presentation.Start

End Sub

Sub EvList_notifyEvent( o as object )
if o.EventName = "OnLoadFinished" then
if url = o.Source.Location then
boFinished = true
endif
endif

End Sub

Sub EvList_disposing()
End Sub

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.