Product: Application Framework
          Type: new
         Title: scripts bound to document/events get the event passed
     Posted by: [EMAIL PROTECTED]
      Affected: -
         TaskId: i49133
<http://www.openoffice.org/issues/show_bug.cgi?id=49133>
Effective from: CWS odbmacros3
           CWS:
<http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=DEV300/odbmacros3>
    CWS status: ready for QA


*Flags*
-------
API/ BASIC [x]
Configuration [ ]
File format change [ ]
Help/ Guide [x]
Performance test [ ]
Translation [ ]
UI relevant [ ]


*Description*
-------------
With the integration of CWS odbmacros3 (expected for m34 or m35), a change
in how macros/scripts bound to application/document events becomes
effective.

Up to know, your macros/scripts which you bound to such events (using
Tools /
Customize / Events) did not receive the actual event object. The two
consequences were that you needed different macros for different
events and, worse, that application-level events did *not* pass you
the document which they actually applied to.

For instance, if you assigned a macro such as
  Sub OnLoadDocument
    ...
  End Sub
to the "Open Document" in Tools / Customize / Events, on the
application level, then you were notified for each and every document
which was loaded, but your macro had no chance of determining the
actual document whose event was just broadcasted.

Now, macros and scripts assigned to all the events in the "Customize
Events" tab page get an instance of the (new)
com.sun.star.document.DocumentEvent passed, which contains the source
document, the name of the event (as specified in the
css.document.Events service), the controller which the event applies
to (if any), and arbitary supplemental information which depends on
the concrete event.

So, your macro can now look like
  Sub OnAnyEvent( oEvent as Object )
    ' ... evaluate oEvent.EventName
    ' ... evaluate oEvent.Source
    ' ... evaluate oEvent.ViewController
    ' ... evaluate oEvent.Supplement
  End Sub


Send feedback to [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to