Apache OpenOffice (AOO) Bugzilla – Issue 101422
set nodes can't be reset correctly via configuration API
Last modified: 2017-05-20 10:55:50 UTC
I am encountering a problem to reset the Accelerators.xcu in the user layer to it's default values in the default layer. I want to reset the nodes of a set in the user layer to it's default values in the share layer. It seems that method com.sun.star.beans.XPropertyWithState.setToDefaultAsProperty() doesn't work correctly. In order to test this configuration API, I wrote a macro(please see the attachment) to reset all the nodes of org.openoffice.Office.Views/Windows, and got the result as following: <node oor:name="Windows"> <node oor:name="SplitWindow0" oor:op="remove"/> <node oor:name="SplitWindow2" oor:op="remove"/> <node oor:name="SplitWindow1" oor:op="remove"/> <node oor:name="SplitWindow3" oor:op="remove"/> </node> If such nodes(SplitWindow0,1,...) exist in the default layer, they would be overrided. A better result in the user layer would be: <node oor:name="Windows"> </node> BTW, com.sun.star.beans.XMultiPropertyStates.setAllPropertiesToDefault() works fine to reset the properties of a group node. It removes those properties in the user layer.
Created attachment 61881 [details] to retrieve default configuration values for set nodes
@wuy: I assume this is a misunderstanding. Properties can have default values, which must be specified in the corresponding .xcs files. The configuration API allows to reset a given property to its default value, if any. For a given set, there cannot be any set elements specified in the corresponding .xcs file. Hence, resetting a set element to its default can only be interpreted as removing that set element. So, in turn, the current behavior look OK to me.
cd: This sounds like a misunderstanding. Joerg Barfurth explained to us that setToDefaultXXX(...) methods are designed to have something like reset to factory settings. Your explanation of the setToDefaultXXX() method makes sense and that it works as designed. Unfortunately this is not what we need for the accelerator configuration. I think this is worth to be converted to an request for enhancement.
lets see whether something can be done here
Reset assigne to the default "issues@openoffice.apache.org".