 | OO-Snippets: Remove a toolbarCommons| Keywords | remove, tool, bar |
|---|
| Language | ooRexx |
|---|
| Application | Office |
|---|
| Authors | Josef Frysak (initial)
|
|---|
| Supported Versions | 2.4.1 |
|---|
| Supported OS | All |
|---|
| Question | How to remove the toolbar again?
|
|---|
| Answer | Use the "ModuleUIConfigurationManagerSupplier" service to get the document type specific user interface manager (for Writer, for Calc, ...) again. Next check if the toolbar, defined by the ToolbarURL, is present. If that is the case, execute the "removeSettings" function to remove it. For further details see http://wi.wu-wien.ac.at/rgf/diplomarbeiten/BakkStuff/2008/200809_Frysak/200809_Frysak_Automating_OOo_ooRexx_Nutshells.pdf. |
|---|
x_ScriptContext = uno.getScriptContext()
if (x_ScriptContext <> .nil) then
do
x_ComponentContext = x_ScriptContext~getComponentContext
x_Desktop = x_ScriptContext~getDesktop
x_Document = x_ScriptContext~getDocument
end
else
do
x_ComponentContext = UNO.connect()
service = "com.sun.star.frame.Desktop"
s_Desktop = x_ComponentContext~getServiceManager~XMultiServiceFactory~createInstance(service)
x_Desktop = s_Desktop~XDesktop
x_Document = x_Desktop~getCurrentComponent()
end
ToolbarURL = "private:resource/toolbar/custom_exampletoolbar"
x_MultiServiceFactory = x_ComponentContext~getServiceManager()~XMultiServiceFactory
configsupplier = "com.sun.star.ui.ModuleUIConfigurationManagerSupplier"
s_Supplier = x_MultiServiceFactory~createInstance(configsupplier)
x_Supplier = s_Supplier~XModuleUIConfigurationManagerSupplier
DocumentType = "com.sun.star.text.TextDocument"
x_UIConfigurationManager = x_Supplier~getUIConfigurationManager(DocumentType)
If x_UIConfigurationManager~hasSettings(ToolbarURL) then
do
x_UIConfigurationManager~removeSettings(ToolbarURL)
.bsf.dialog~messageBox("Toolbar removed", "RemoveToolbar.rex", "information")
end
else
do
.bsf.dialog~messageBox("Toolbar not installed", "RemoveToolbar.rex", "error")
end
::requires UNO.CLS
|
Changelog| Date | User | Modification |
|---|
| 2008-10-13 | 1 | Initial version |
|