notes on annotating items as to whether they are 'checkable' ie. radio
or check buttons:


** Wow - it turns out that the .sdi files are not long for this world:


From: 	Carsten Driesner <Carsten.Driesner@Sun.COM>
To: 	michael.meeks@novell.com
Subject: 	Re: cut/paste action ...
Date: 	Wed, 23 Mar 2005 11:23:38 +0100  (10:23 GMT)
Mailer: 	Mozilla Thunderbird 1.0.2 (Windows/20050317)

michael meeks wrote:

>       Sure - I was slightly amazed at how the labels are fetched [ I assume
>from the slot information in sfx2 ultimately - not unwound that yet ],
>via some UNO service & a property set etc. Took a little while to get
>that.

The labels are not fetched from the sfx2 slot information anymore. We 
changed that as we want to get rid of many old sfx implementations. The 
slot mechanism itself won't be changed in the near future, but other 
tasks like user interface elements, configuration of ui elements, 
application window layout are now done in the framework library.
Some parts of the slot definitions are not used in OOo 2.0. All labels 
are now retrieved from new configuration files in 
officecfg/registry/data/org/openoffice/Office/UI/[module]Commands.xcu. 
They use the uno command name as a key for the labels and other 
properties. Just look into the Commands.xcs file for more info. We 
removed all the different resource files for toolbars/menus/statusbar 
which defined the labels locally. In the past it was a total mess to 
consolidate all strings, so we decided to go this way. Every 
toolbar/menu and statusbar is defined by separate XML files located in 
the module projects, see [module-project]/uiconfig/module/<ui element 
type>/.
You can find more information about the new user interface 
implementation here:
http://specs.openoffice.org/ui_in_general/api/ProgrammaticControlOfMenuAndToolbarItems.sxw
It's a little bit outdated, but I am currently working on the new 
chapters for the Developer's Guide.


Reference< XNameAccess > xNameAccess( getServiceFactory()->createInstance( SERVICENAME_UICOMMANDDESCRIPTION ), UNO_QUERY );

* It seems uicommanddescription.cxx gets the description:

goes via:
    m_xGenericUICommands = new ConfigurationAccess_UICommand( aGenericUICommand, xEmpty, xServiceManager );

    nProperties - 

const sal_Int32   COMMAND_PROPERTY_IMAGE                = 1;
const sal_Int32   COMMAND_PROPERTY_ROTATE               = 2;
const sal_Int32   COMMAND_PROPERTY_MIRROR               = 4;

beef up the uicommanddescription ...






---------------- old stuff ----------------



        Hmm - sounds like an unholy mess to me. At some stage we need to be
able to denote that a given item is 'checkable' ie. by the time we get
the information to:

        vcl/source/window/menu.cxx:

+                                       if ((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) ||
+                     (!(pData->nBits & (MIB_RADIOCHECK | MIB_CHECKABLE
| MIB_AUTOCHECK)) && !pData->bChecked))

        we have to have that data & have it reliably.

        I guess we need to get that information associated with the action
itself rather than the instance in the view.

        Thus it will need to go in the .sdi file I think;

        eg. svx/sdi/svx.sdi /SID_GRID_VISIBLE/
	    + has 'Toggle = TRUE'

http://go-ooo.org/lxr/search?filestring=&string=HasCoreId

        should give some pointers as to how/where to add that field so we can
start annotating those items & propagating that state to the
instantitated MenuItems as/when.

	Unfortunately eg. sw/sdi/swriter.sdi /FN_VIEW_FIELDNAME/
	    + has 'Toggle = FALSE'

Chase down what 'Toggle' means.

framework/idl/inc/globals.hxx, line 93
HASH_INLINE(HasCoreId) framework/idl/inc/globals.hxx, line 204
SvBOOL aHasCoreId; framework/idl/inc/slot.hxx, line 76
BOOL GetHasCoreId() const; framework/idl/inc/slot.hxx, line 228
if( nMask & 0x0004 ) rStm >> aHasCoreId; framework/idl/source/objects/slot.cxx, line 146
if( aHasCoreId.IsSet() ) nMask |= 0x0004; framework/idl/source/objects/slot.cxx, line 235
if( nMask & 0x0004 ) rStm << aHasCoreId; framework/idl/source/objects/slot.cxx, line 257
BOOL SvMetaSlot::GetHasCoreId() const framework/idl/source/objects/slot.cxx, line 409
if( aHasCoreId.IsSet() || !GetRef() ) return aHasCoreId; framework/idl/source/objects/slot.cxx, line 411
return ((SvMetaSlot *)GetRef())->GetHasCoreId(); framework/idl/source/objects/slot.cxx, line 412
bOk |= aHasCoreId.ReadSvIdl( SvHash_HasCoreId(), rInStm ); framework/idl/source/objects/slot.cxx, line 648
if( aHasCoreId ) framework/idl/source/objects/slot.cxx, line 792
aHasCoreId.WriteSvIdl( SvHash_HasCoreId(), rOutStm ); framework/idl/source/objects/slot.cxx, line 794
if( GetHasCoreId() ) framework/idl/source/objects/slot.cxx, line 1450
rOutStm << MakeSlotName( SvHash_HasCoreId() ).GetBuffer() << '|'; framework/idl/source/objects/slot.cxx, line 1451
if ( GetHasCoreId() != (BOOL) pSlot->GetHasCoreId() ) framework/idl/source/objects/slot.cxx, line 1860
aStr += " HasCoreId\n"; framework/idl/source/objects/slot.cxx, line 1861
WriteBool( GetHasCoreId(), rStrm ); framework/idl/source/objects/slot.cxx, line 1985
"\t\tHasCoreId", framework/idl/source/prj/command.cxx, line 137
, MM_HasCoreId( INS( "HasCoreId" ) ) framework/idl/source/prj/globals.cxx, line 165
#define SFX_SLOT_HASCOREID 0x0040L // Slot-ID/Which-ID Mappting durchf"uhren framework/sfx2/inc/msg.hxx, line 79

sfx2/inc/msg.hxx has:
#define SFX_SLOT_TOGGLE	   0x0004L // invertiert bei Execute alten Wert
				   // "inverted with execute old value"

sfx2/source/control/bindings.cxx /SFX_SLOT_TOGGLE/   - the only use.


the .sdi file is an 'IDL' file (apparently), hence
idl/* compiles it to a binary file.

Can we tell something else about a slot ? - a boolean payload ? - checkable ?

sfx2's menu code /SetMenuFlags/

./source/appl/newhelp.cxx:2618:                         aMenu.SetMenuFlags( aMenu.GetMenuFlags() | MENU_FLAG_HIDEDISABLEDENTRIES );
./source/menu/virtmenu.cxx:1024:                pMenu->SetMenuFlags( nFlag );
./source/menu/mnumgr.cxx:133:           pMenu->SetMenuFlags( pMenu->GetMenuFlags() | MENU_FLAG_HIDEDISABLEDENTRIES );
./source/view/ipenv.cxx:312:                    pMenuBar->SetMenuFlags( pMenuBar->GetMenuFlags() | MENU_FLAG_HIDEDISABLEDENTRIES );
./source/view/contenv.cxx:191:                  pMenuBar->SetMenuFlags( pMenuBar->GetMenuFlags() | MENU_FLAG_HIDEDISABLEDENTRIES );

It doesn't look like there is a nice piece of code to generate / insert a menu item
from an SfxPool information that we can clobber in 1 place.

The SfxSlot defined in sfx2/inc/msg.hxx
    + nFlags member .. [ GetMode ]

sfx2: /GetMode/
./source/appl/appuno.cxx:1951:            if ( pSfxSlot->GetMode() & nMode )
./source/appl/appuno.cxx:1993:                        if ( pSfxSlot->GetMode() & nMode )
./source/appl/appuno.cxx.orig:1947:            if ( pSfxSlot->GetMode() & nMode )
./source/appl/appuno.cxx.orig:1989:                        if ( pSfxSlot->GetMode() & nMode )
./source/view/sfxbasecontroller.cxx:1410:            if ( pSfxSlot->GetMode() & nMode )
./source/view/sfxbasecontroller.cxx:1452:                        if ( pSfxSlot->GetMode() & nMode )
./source/explorer/infodlgs.cxx:142:     if ( ( rEvt.GetMode() & HELPMODE_QUICK ) == HELPMODE_QUICK && _aQuickHelpText.Len() )
./source/control/macro.cxx:544:SfxMacroMode SfxMacro::GetMode() const
./source/control/dispatch.cxx:1154:             else if ( pSlot->GetMode() & SFX_SLOT_ASYNCHRON )
./source/control/dispatch.cxx:1211:             else if ( pSlot->GetMode() & SFX_SLOT_ASYNCHRON )
./source/dialog/cfg.cxx:923:                    if ( pSfxSlot->GetMode() & nMode )
./source/dialog/cfg.cxx:2058:                            !(pSlot->GetMode() & SFX_SLOT_STATUSBARCONFIG) )
./source/toolbox/tbxitem.cxx.orig:1467:                                                   rMEvt.GetClicks(), rMEvt.GetMode(),
./source/toolbox/tbxitem.cxx:1467:                                                        rMEvt.GetClicks(), rMEvt.GetMode(),

Menu item construction seems to happen via:

Breakpoint 1, Menu::InsertItem (this=0x8d9ffb8, nItemId=6, rStr=@0xbfffd4a0, nItemBits=0, nPos=65535)
    at /opt/OpenOffice/src680-m79/vcl/source/window/menu.cxx:1093
1093        if ( nPos >= (USHORT)pItemList->Count() )
(gdb) bt
#0  Menu::InsertItem (this=0x8d9ffb8, nItemId=6, rStr=@0xbfffd4a0, nItemBits=0, nPos=65535)
    at /opt/OpenOffice/src680-m79/vcl/source/window/menu.cxx:1093
#1  0x4469760f in framework::MenuBarManager::FillMenu () from ./libfwk680li.so
#2  0x44697728 in framework::MenuBarManager::FillMenu () from ./libfwk680li.so
#3  0x44699d9f in framework::MenuBarWrapper::initialize () from ./libfwk680li.so
#4  0x446e6fa0 in framework::MenuBarFactory::createUIElement () from ./libfwk680li.so
#5  0x446a5a5c in framework::UIElementFactoryManager::createUIElement () from ./libfwk680li.so
#6  0x4466fd3e in framework::LayoutManager::implts_createElement () from ./libfwk680li.so
#7  0x446740dd in framework::LayoutManager::createElement () from ./libfwk680li.so
#8  0x43c29f5b in SfxObjectShell::CreateMenuBarManager_Impl () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#9  0x43c91cc4 in SfxViewShell::GetMenuBar_Impl () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#10 0x43cd7444 in SfxDispatcher::SetMenu_Impl () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#11 0x43cd77e1 in SfxDispatcher::Update_Impl () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#12 0x43b7d3b9 in SfxApplication::SetViewFrame () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#13 0x43cb22eb in SfxViewFrame::MakeActive_Impl () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#14 0x43cb2072 in SfxViewFrame::Show () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#15 0x43cbe9bb in SfxTopFrame::InsertDocument () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#16 0x43b63975 in SfxApplication::NewDocDirectExec_ImplOld () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#17 0x43c94eda in SfxFrameLoader_Impl::load () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#18 0x446edbee in framework::LoadEnv::impl_loadContent () from ./libfwk680li.so
#19 0x446ead5f in framework::LoadEnv::startLoading () from ./libfwk680li.so
#20 0x445d1903 in framework::LoadDispatcher::dispatchWithNotification () from ./libfwk680li.so
#21 0x445d1c34 in framework::LoadDispatcher::dispatch () from ./libfwk680li.so
#22 0x43d0d1d3 in SfxAppToolBoxControl_Impl::ExecuteHdl_Impl () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285
#23 0x40350d3f in ImplHandleUserEvent () from ./libvcl680li.so
#24 0x4035186f in ImplWindowFrameProc () from ./libvcl680li.so
#25 0x4245a0eb in SalDisplay::DispatchInternalEvent () from ./libvclplug_gen680li.so
#26 0x41ef68fd in GtkXLib::userEventFn (data=0x80d48d0) at /opt/OpenOffice/src680-m79/vcl/unx/gtk/app/gtkdata.cxx:652
#27 0x42389221 in g_idle_dispatch () from /opt/gnome/lib/libglib-2.0.so.0

framework/source/uielement/menubarmanager.cxx (framework::MenuBarManager::FillMenu):
    Gets all manner of properties - constructs the menu item from them;

** Where does the slot data come in:

michael@linux:/opt/OpenOffice/src680-m79/framework> find -name '*.c*' -exec grep 'createUIElement' {} -Hn \; 
./source/layoutmanager/layoutmanager.cxx:860:            xUIElement = xUIElementFactory->createUIElement( aAddonToolBarName, aPropSeq );
./source/layoutmanager/layoutmanager.cxx:2746:        xUIElement = m_xUIElementFactoryManager->createUIElement( aName, aPropSeq );
./source/layoutmanager/layoutmanager.cxx.orig:860:            xUIElement = xUIElementFactory->createUIElement( aAddonToolBarName, aPropSeq );
./source/layoutmanager/layoutmanager.cxx.orig:2746:        xUIElement = m_xUIElementFactoryManager->createUIElement( aName, aPropSeq );
./source/uifactory/addonstoolboxfactory.cxx:227:Reference< XUIElement > SAL_CALL AddonsToolBoxFactory::createUIElement( 
./source/uifactory/menubarfactory.cxx:182:Reference< XUIElement > SAL_CALL MenuBarFactory::createUIElement( 
./source/uifactory/toolboxfactory.cxx:174:Reference< XUIElement > SAL_CALL ToolBoxFactory::createUIElement( 
./source/uifactory/statusbarfactory.cxx:174:Reference< XUIElement > SAL_CALL StatusBarFactory::createUIElement( 
./source/uifactory/uielementfactorymanager.cxx:619:Reference< XUIElement > SAL_CALL UIElementFactoryManager::createUIElement( 
./source/uifactory/uielementfactorymanager.cxx:656:            return xUIElementFactory->createUIElement( ResourceURL, Args );

#8  0x43c29f5b in SfxObjectShell::CreateMenuBarManager_Impl () at /opt/OpenOffice/src680-m79/sfx2/source/dialog/filedlghelper.cxx:285

sfx2/source/doc/objcont.cxx (CreateMenuBarManager_Impl)

Perhaps the data comes from:

framework/inc/uiconfigurationmanager.hxx (struct UIElementData)
    + populated from the XML ?

		<menu:menupopup>
			<menu:menuitem menu:id=".uno:AddDirect" menu:helpid="5537" menu:label="" />
			<menu:menuitem menu:id=".uno:Open" menu:helpid="5501" menu:label="" />
			<menu:menuitem menu:id=".uno:RecentFileList"/>

framework/source/xml/menudocumenthandler.cxx: reads this & inserts into m_xMenuBarContainer
					      as a set of properties

It seems we get the information from the Slots in eg.

String MenuBarManager::RetrieveLabelFromCommand( const String& aCmdURL )

    This creates some crazy UNO service to do this lookup for us.
