openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Alcock <ke...@keithalcock.com>
Subject Manipulate menu item titles (text) defined in Addons.xcu
Date Thu, 16 Oct 2014 09:13:19 GMT
API experts,

This question below couldn't be answered in the forums, so I'll try here:

I have a very nice addon programmed in C++ and the related menu items
are stored in Addons.xcu. The addon would be even nicer if I could
adjust the menu item texts as the user works, similarly to how the
undo, redo, and repeat items function in the edit menu. I can't figure
out how to get ahold of the XMenu associated with my addon. From there
it seems that I could use setItemText(). Who knows how to get that
XMenu and is willing to tell? Thanks.

Additional information:

I've seen examples (e.g.,
https://issues.apache.org/ooo/show_bug.cgi?id=6778 and
http://www.libreoffice-forum.de/viewtopic.php?f=12&t=12691) of how so
search through the standard OpenOffice menus, but I don't think that
the addon menu items are included based on the popupCount I get from

Reference<XIndexAccess> xIndexAccess =
xUIConfigurationManager->getSettings(OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/menubar/menubar")),
sal_True);
sal_Int32 popupCount = xIndexAccess->getCount();

The count returned matches the number of standard menu items without
my addon.  If I continue with the code from the first link, I get lost
converting

for i = 0 to nCount-1
    oPopupMenu() = oMenuBarSettings.getByIndex( i )
    nPopupMenuCount = ubound(oPopupMenu())
        for j = 0 to nPopupMenuCount
            if oPopupMenu(j).Name = "CommandURL" then

to C++.  The code below is not correct (in particular, Sequence<Any>),
but I don't think the popup menu is here anyway.  I don't really know
what type is returned from xIndexAccess->getByIndex() or what to do
with it.

for (sal_Int32 i = 0; i < popupCount; i++) {
   Sequence<Any> xPopupMenus;
   xIndexAccess->getByIndex(i) >>= xPopupMenus;

Thanks!

Keith Alcock

---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Mime
View raw message