Paolo Mantovani wrote:

> Hi Mathias,
> 
> Alle 16:50, martedì 5 settembre 2006, Mathias Bauer ha scritto:
>> Cor Nouws wrote:
>> > Hi *,
>> >
>> > In order to force/advice the saving of certain documents on a specified
>> > location, I prepared some macro's, looking at the documents state, name
>> > and such, and opening the save-dialog.
>> > Then I assigned the macro's to Save(-As) with Tools|Customisation|Events
>> > in order that a click on the 'floppy' or File|Save triggers my macro.
>> >
>> > However, it appears (2.0.3, on XP, 2.0.2 on Madrake) that my code is
>> > triggered áfter the regular Save(-As) actions :-\
>>
>> Yes and no. Your code will be triggered right after the dialog is closed
>> but before the real saving starts. These events are means to perform
>> actions on the document before they get saved, not as a hook to replace
>> the built-in UI code.
>>
>> > What am I supposed to do to actually replace those?
>>
>> This is what DispatchInterceptors are for. Unfortunately you can't
>> implement them in Basic. Replacing dispatch actions triggered by the UI
>> with macros is currently not supported. Sounds like a good idea though.
> 
> Although an "official" support is actually missing, with a "creative" ;-) use 
> of the createUnoListener() function it's possible to intercept dispatches and 
> replace dispatch actions with your arbitrary basic code.

Yes, correct. Of course this is something I recommend only to
experienced developers. Thanks for posting this example. Does it exist
as a code snippet BTW?

We should mention two things here:

Your example does not support the StatusListeners so it will not send
any status events to the GUI. This will work in many cases but not in
all. In case of the "Save" command this command will never be disabled
then. This is not a serious problem but it will look unusual at least.
In this case it could help to redirect StatusListeners to the
SlaveDispatcher.

The interceptor also must be registered somehow, so binding the macro
that registers it to the event "OnViewCreated" on a global level is
recommened.

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]

Reply via email to