[Libreoffice-bugs] [Bug 36210] disable "Insert" command impossible through dispatch framework

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Apr 13 08:31:28 PDT 2011


https://bugs.freedesktop.org/show_bug.cgi?id=36210

--- Comment #1 from Laurent Godard <oooconv at free.fr> 2011-04-13 08:31:29 PDT ---
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

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Libreoffice-bugs mailing list