How do I add a new configuration item to registrymodifications.xcu

Michael Stahl mst at
Thu Jan 31 10:27:23 UTC 2019

On 31.01.19 11:00, Winfried Donkers wrote:
> Hi,
> I am working on an enhancement for Calc, tdf90180.
> Therefore I need to add a configuration item to registrymodifications.xcu.
> I have created a class to obtain the configuration item, using a derivative of ::com::sun::star::utl::ConfigItem and copying/adapting existing code to retrieve configuration items.

utl::ConfigItem is sort of deprecated and you should have a really good 
excuse to use it in new code.

> When the new configuration item is not yet in registrymodifications.xcu and upon opening a relevant Calc document I get an exception:
> "warn::unotools::config:7006:7006:unotools/source/config/configitem.cxx:426: ignoring XHierarchicalNamesAccess to /org.openoffice.Office.Calc/Content/ErrorRectangle Exception: N3com3sun4star3uno9ExceptionE msg: ErrorRectangle"
> When I manually add the configuration item to registrymodifications.xcu and open a relevant Calc document I get the same exception.
> After running soffice (or scalc) my manual entry to registrymodifications.xcu is no longer there.
> I have grepped similar -existing- configuration items in the code, and could not find anything that writes the item to registrymodifications.xcu.
> Is there a simple way to fix this?
> The only alternative I see now is to submit an incomplete patch to gerrit for review; I would like to avoid that.

i see no mention of the word "officecfg" in your mail, which is worrisome :)

so you first need to add your config item to the schema in 
officecfg/registry/schema/ somewhere.

then "make officecfg postprocess" will get you the new configuration in 
instdir; it should show up in Expert Configuration now, and if you 
change it there it should automatically be written to 
registrymodifications.xcu (which only contains non-default values).

to get and set it from C++ code it's most convenient to use officecfg's 
generated headers, "git grep officecfg::" should find you plenty examples.

More information about the LibreOffice mailing list