https://bugs.documentfoundation.org/show_bug.cgi?id=98803

--- Comment #1 from Maxim Monastirsky <[email protected]> ---
(In reply to ThierryT from comment #0)
> I tryed also the using of the XmenuBar interface and the XPopupMenu
> interface by using the "enableItem" method.
This isn't going to work. UI elements such as menubar are controlled internally
by LO, and changing them directly will easily break that code (because it won't
be aware of the changes you made).

In general what you need isn't to disable the individual menu item - but to
disable the *command* to which this item is bound. Disabling a command will be
reflected in the UI by (usually) disabling all elements that bound to this
command - be it a menu item or a toolbar button. There are several official
solutions, that can be used to achieve this:

- org.openoffice.Office.Commands configuration. This can be used for simple
enabling/disabling [1].

- Dispatch Interception. Besides enabling/disabling, this allows you even to
change the behavior of commands (e.g. you want a different thing to happen when
clicking the "Save" button) [2]. Surprisingly there is even a way to use that
from BASIC [3].

- Protocol Handlers [4].

----

[1]
https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Disable_Commands

[2]
https://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Dispatch_Interception

[3]
http://openoffice.2283327.n4.nabble.com/Intercepting-commands-quot-uno-xxx-quot-td2772465.html
- There is a sample document if you scroll a bit.

[4]
https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Protocol_Handler

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to