Hi Christoph,
Christoph Lutz wrote:
Hi,
I would like to remove the xcu-file
<my_applicationdata>\OpenOffice.org2\user\registry\data\org\openoffice\Office\Commands.xcu
in a programmatic way to ensure, that no user-configuration overwrites the
shared Commands.xcu. Does UNO provide an API to to remove a configuration
ressource from user-space?
The configuration API Objects in many locations support interface
com.sun.star.beans.XPropertyState (and
com.sun.star.beans.XMultiPropertyState). You can use these to reset
configuration setting to their default values, which amounts to removing
overrides from the user layer of the configuration.
Currently these interfaces don't work recursively on entire trees
(although that would be covered by the service specification), so
resetting data for an entire component isn't easy (you need to walk the
hierarchy and reset locally everywhere).
But if you only want to prevent overrides of your shared Commands
settings, there is an easier way: In the shared Commands.xcu add an
attribute 'oor.finalized="true"' to the root of the part(s) you want to
protect from being overridden. The range covered can be anything from a
single <prop ...>, to the entire <oor:node ...> that defines the component.
As a result these settings (and any settings done on layers preceding
the one where you add the attribute) will be protected from being
overridden by subsequent layers including the user layer. In the API
these settings will appear as read-only now. If there are existing
overrides in the user layer they will be ignored.
Unfortunately there is no API to control the finalized attribute (and
some other similar node attributes), so you have to do this by editing
the configuration file directly.
Ciao, Jörg
BTW: Sun has a configuration manager for StarOffice that allows doing
this through a web-based interface.
--
Joerg Barfurth Sun Microsystems - Desktop - Hamburg
>>>>>>>>>>>>>>>>>> using std::disclaimer <<<<<<<<<<<<<<<<<<<<<<<
Software Engineer [EMAIL PROTECTED]
OpenOffice.org Configuration http://util.openoffice.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]