Hello Alexander,

On Friday 02 October 2009, 00:19, Alexander Anisimov wrote:
> Hi,
> 
> I am trying to remove toolbars items. I understand how to remove it using
> LayoutManager. But LayoutManager doesn't save changes to the document
> storage.

you need the com.sun.star.ui.UIConfigurationManager

> I have read
> http://specs.openoffice.org/ui_in_general/api/ProgrammaticControlOfMenuAndT
> oolbarItems.sxw, where said:
> 
> [quote]
> User interface configuration manager retrieved from the document model -
> Make changes to menu and/or toolbars and store them persistently to the
> document storage.
> [/quote]tttt
> 
> I think it is what I need.
> 
> I know how to open document. After opening the document, I have XComponent
> Object. And now, how could I take user interface configuration manager? 

the document implements the com.sun.star.ui.XUIConfigurationManagerSupplier 
Invoke XUIConfigurationManagerSupplier.getUIConfigurationManager() to access 
the 
document's UIConfigurationManager


> how could I, using user interface configuration manager, remove toolbars
> items?

I understood you are talking here about a document UI, not a module level.
If so, then there are two main scenarios:

* if the document has already a modified toolbar, you can access it by its 
resource URL

* if the document does not have a customized version of the toolbar you want 
to modify, then you have to access the toolbar configuration at the module 
level, and insert the modified version on the document.
I do this by getting a writable copy of the module toolbar, so that I con 
modify it, and then I don't store this changes at the module level but at the 
document level
(I guess that a cleaner approach would be to ask for a read-only copy of the 
module config. and make an own copy item by item...)

Look  for sample code at 
http://arielch.fedorapeople.org/docs/com.sun.star.ui.XUIConfigirationManager.odt

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to