Hello Oliver,

i tried to configure my DispatchInterceptor:

private String[] interceptedURLs = { "macro:///*" };

public XDispatch queryDispatch(URL aURL, String sTarget, int nSearchFlags) {
        [...]           
}

public String[] getInterceptedURLs() {
        return interceptedURLs;
}

to listen only for macro:/// dispatches, but this seems not to work,
my queryDispatches method is called for .uno: dispatches too

Is there a broken chain ?

i found an explanation i the 
docs/common/ref/com/sun/star/frame/XInterceptorInfo.html

No - it's not broken ... but it has some further disatvantages :-)
Your returned list of URL pattern is used as an optimization. If an URL match your pattern and no further registered interceptor (defined before your interceptor inside the dispatch queue) exists you will be called directly. BUT ... if there is another interceptor might be registered for the pattern "*" it will be called first and then the normal master/slave relation of dispatch provider objects will be used.

An example:

a)
01      frame.queryDispatch()
02              interception.queryDispatch()
03                      interceptor_uno.queryDispatch  (".uno:*"  )
04                      interceptor_slot.queryDispatch (".slot:*" )
05                      interceptor_macro.queryDispatch("macro:*" )

If an macro URL will be dispatched line 02 calls directly 05 because there is no further interceptor interested on macro URLs.

b)
01      frame.queryDispatch()
02              interception.queryDispatch()
03                      interceptor_all.queryDispatch  ("*"       )
04                      interceptor_macro.queryDispatch("macro:*" )
05                      interceptor_uno.queryDispatch  (".uno:*"  )
06                      interceptor_slot.queryDispatch (".slot:*" )

Now line 02 calls line 03 first because those interceptor is registered for ALL URLs. But then those interceptor_all will analyze the incoming URL and may be decide not to be interested on it. So it forwards the queryDispatch() call to it's slave dispatch provider ... it calls line 04. And so your dispatch provider is asked for non macro URLs too !

Providing the interface XInterceptorInfo is an optimzation only. It does not guarantee that your implementation will be called for those set of URLs only. So you have to check incoming URLs in queryDispatch() always. If your are interested on it return yourself (or an internal helper) ... if not forward the request to your slave dispatch provider.

Regards
Andreas

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

Reply via email to