Paolo Mantovani wrote:
> you can assign macros to "global" events using the service:
> com.sun.star.frame.GlobalEventBroadcaster"
>
> This is an example:
>
>
> REM ***** BASIC *****
>
> Sub TestGlobalEventSupplier
>
> Dim mEventProps(1) as new com.sun.star.beans.PropertyValue
> mEventProps(0).Name = "EventType"
> mEventProps(0).Value = "StarBasic"
> mEventProps(1).Name = "Script"
> mEventProps(1).Value = "macro:///Gimmicks.Userfields.StartChangesUserfields()"
>
> oGlobalEventBroadcaster = _
> createUnoservice("com.sun.star.frame.GlobalEventBroadcaster")
> oGlobalEventBroadcaster.Events.ReplaceByName("OnStartApp", mEventProps())
>
> End Sub
>
> You can retrieve all available event names using the method:
> oGlobalEventBroadcaster.Events.getElementNames()
>
> anyway this is the list:
>
> OnStartApp
> OnCloseApp
> OnNew
> OnUnload
> OnPrepareUnload
> OnLoad
> OnSave
> OnSaveAs
> OnSaveDone
> OnSaveAsDone
> OnFocus
> OnUnfocus
> OnPrint
> OnModifyChanged
... and you can do the same for a single document by replacing one line
of code from Paolos macro:
mydoc.Events.ReplaceByName("OnNew", mEventProps")
(mydoc should be a reference to a document).
Of course you can't assign macros to "OnStartApp" and "OnCloseApp" for a
single document.
IIRC this should be described in the Developers Guide (chapter "Document
Events").
Best regards,
Mathias
--
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]