Hi,

i have a problem with a XDispatchProviderInterceptor and menu entries

Scenario:

If a user changes to a sheet named "Tabelle2" i register a 
XDispatchProviderInterceptor.
Now all GUI elements with URL "macro:///InterceptorDemo" should be disabled.

I added entries for "OfficeMenuBar", "OfficeToolBar" and "OfficeHelp" using a 
Addons.xcu.

Everything works fine so far. Changing to the sheet "Tabelle2" disables the 
elements.
Changing to another sheet, enables the elements.

But if i remove the "OfficeToolBar" entry from the Addons.xcu, the menu entries 
will
stay *disabled*, even if i change to another sheet ...

What i noticed:

- registering the interceptor does not call menu URL's
  they are called only if one opens the menue ... only "OfficeToolBar" are 
called at this time.

- opening a menu will call "com.sun.star.frame.XDispatch.addStatusListener"
  **and** "com.sun.star.frame.XDispatch.removeStatusListener" ...
  this does not happen for "OfficeToolBar" elements...

  public void addStatusListener(XStatusListener xControl,       URL aURL) {
         aListenerHelper.addListener(xFrame, xControl, aURL.Complete);
         aListenerHelper.notify(xFrame, aURL, false);
  }

  public void removeStatusListener(XStatusListener xControl, URL aURL) {

        // why is removeStatusListener called for menu entries on open ???
        if (interceptor.isDispatchRegistered() == true)
                return;

        aListenerHelper.notify(xFrame, aURL, true);
        aListenerHelper.removeListener(xFrame, xControl, aURL.Complete);
 }


any hints are welcome ;-)

i can provide a ready to run example ...

Oliver

--

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to