Hi all the whole suite menus/action use dispatch framework
this is useful when one want to disable some UI commands by code (eg. for extension developers) http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Disable_Commands especially, it is said : The dispatch framework works with the design pattern chain of responsibility ... The disable commands implementation is the first chain member and can therefore work as a wall for all disabled commands. They are not be sent to the next chain member, and disappear. applying this to "Insert" command works for menu entries (insert > sheet or right click on a sheet tab) - see given macro code but, the Insert is still available by clicking empty space near sheet tabs --> these functionality should respect the dispatch framework it sounds a bug to me. any idea on how to avoid this ? Thanks in advance Laurent '------------ the macro to test this - answer yes/No wether you want to disable/enable the Insert sheet command '--------------------------- dim conf sub testDisableInsert conf = getConfigSetting("/org.openoffice.Office.Commands/Execute/Disabled" ,true) message = "do you want to DISABLE ""insert sheet"" command ?" response = msgBox(message, 32 + 4, "Question") value = (response = 6) setEnable(value,"Insert") end sub sub setEnable(state,url) if state then enable(url) else disable(url) endif conf.commitChanges() end sub sub disable(url) spliter = split(url,"?") nom = spliter(0) if not conf.hasByName(nom) then elem = conf.createInstanceWithArguments(array()) elem.setPropertyValue("Command",url) conf.insertByName(nom,elem) endif end sub sub enable(url) spliter = split(url,"?") nom = spliter(0) if conf.hasByName(nom) then conf.removeByName(nom) endif end sub function getConfigSetting(target as string, forUpdate as boolean) ' retourne le noeud de config demandé ' exemple: aSettings = getConfigSetting( "/org.openoffice.Office.Common/Path/Current", false) dim service as String ' nom du service d'acces à la configuration dim aSettings, aConfigProvider dim aParams(0) As new com.sun.star.beans.PropertyValue dim varEmpty if forUpdate then service = "com.sun.star.configuration.ConfigurationUpdateAccess" else service = "com.sun.star.configuration.ConfigurationAccess" endif aConfigProvider = createUnoService( "com.sun.star.configuration.ConfigurationProvider" ) aParams(0).Name = "nodepath" aParams(0).Value = target aSettings = aConfigProvider.createInstanceWithArguments(service, aParams() ) getConfigSetting = aSettings end function -- ----------------------------------------------------------------- To unsubscribe send email to [email protected] For additional commands send email to [email protected] with Subject: help
