Hello Gerhard.
Schuster Gerhard escribió:
I think, if a context menu has a icon or a submenu, this has to show in
the corresponding XPropertySet
But someone might want to implement his very
special "Line Spaceing" or "Allignment".
How would he do that?
here I must disagree with you: it is possible to get any SubContainer
when getPropertyValue("SubContainer") returns a not null object, and
insert items. So, "Line Spaceing" or "Allignment" are completely
accessible to the developer: ".uno:LineSpacingMenu" and
".uno:AlignTextMenu" *have* SubContanier, and you can access them.
In the case you cited in your first mail, ".uno:CharFontName", I think
that the explanation is the one I told you in my first answer: the
ActionTriggerContainer you get has a list of all possible commands for
this context, "possible" does not mean they are going to be shown (the
example I told: "Open hyperlink" is only shown if the cursor is
over/inside an hyperlink), "possible" means "predefined" for this context.
In some cases, like ".uno:CharFontName", there can not be a predefined
list of fonts: this list must be generated at runtime. That's way there
is a Popup Menu Controller dedicated to do that job:
com.sun.star.comp.framework.FontMenuController.
That's also the reason why ".uno:FontHeight" does not return a
SubContainer: this command has also a Popup Menu Controller,
com.sun.star.comp.framework.FontSizeMenuController.
Besides these cases where there are pop up menu controllers, menu
entries can have sub containers, you can get them, and insert or replace
elements.
This is an example I've been working in:
http://www.arielconstenlahaile.com.ar/ooo/temp/EditHyperlinkContextMenuInterceptor.oxt
and does the following:
* queries for the command URL of the "Open hyperlink" (""slot:10955""),
gets its index, and inserts the command for "Edit hyperlink"
(".uno:EditHyperlink") right after it. This uses OOo commands URL, and
will be displayed on the context menu if you are with the cursor over/on
an hyperlink. The new entry will dispatch the "Edit hyperlink" dialog.
* adds two menu entries and a separator at the top most position, using
custom command URL that will be dispatched by an XDispatch provide by a
ProtocolHandler's queryDispatch() implementation; this commands have
images assigned in a configuration file
* queries for the "Style" (".uno:StyleMenu") subcontainer, and within
it, for the position of the "Outline" (".uno:OutlineFont") entry, in
order to insert a separator, two items (the same as before), and a menu
item with a subcontainer
* this subcontainer has two entries: ".uno:Save" and ".uno:SaveAs", they
are OOo's commands, and are context sensitive: ".uno:Save" will be
displayed only if the doc. is modified
As you see, you *CAN* accesses every subcontainer, replace, remove and
insert menu entries at any position. As the ActionTriggerContainer is an
XIndexContainer, you can browse this container looking for an element
with the desired command URL (".uno:LineSpacingMenu"), if it has a
SuContainer get it: it is also an XIndexContainerget, and then add
items: you can add your own Line Spacing styles :-)
Please use the example just for testing and then remove it: I can not
guarantee it won't crash your office installation
Regards
Ariel.
--
Ariel Constenla-Haile
La Plata, Argentina
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://www.arielconstenlahaile.com.ar/ooo/
"Aus der Kriegsschule des Lebens
- Was mich nicht umbringt,
macht mich härter."
Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]