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

2019-02-01 Thread Winfried Donkers
Hi Heiko,


> I wrote a blog post some time ago about how to make a feature optional. It 
> comes from a
> non-developer/layman perspective to encourage people to look into the code. 
> Perhaps it’s 
> a bit helpful. 
> https://design.blog.documentfoundation.org/2018/04/14/easyhacking-how-to-make-a-feature-optional/
>  

Yes, that's helpful, especially for when I want to add the configuration option 
to the Options dialog.
FTB it's just under advanced -expert configuration.

In you blog you say it's surprisingly complex to implement a simple option. 
Well, in you case the framework was already present in module sw. 
In chart2, there is nothing yet and that presents a lot of challenges ;-)

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2019-02-01 Thread Heiko Tietze
I wrote a blog post some time ago about how to make a feature optional. It 
comes from a non-developer/layman perspective to encourage people to look into 
the code. Perhaps it’s a bit helpful. 
https://design.blog.documentfoundation.org/2018/04/14/easyhacking-how-to-make-a-feature-optional/
 

> Am 01.02.2019 um 09:31 schrieb Winfried Donkers :
> 
> Hi Michael,
> 
 utl::ConfigItem is sort of deprecated and you should have a really good
 excuse to use it in new code.
>>> 
>>> I have no better excuse than that it existed in the same component.
>>> Which method should I use instead (or where can I find good examples of 
>>> code to use as guide)?
>> 
>> just "git grep officecfg::" will find lots of examples, there are 
>> headers generated that have a class for every config item and you can 
>> get() and set() it.
> 
> I found sufficient examples to use; so far chart2 (where I'm currently 
> working) does use officecfg:: yet.
> Thanks!
> 
> Winfried
> ___
> LibreOffice mailing list
> LibreOffice@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/libreoffice

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2019-02-01 Thread Winfried Donkers
Hi Michael,

>>> utl::ConfigItem is sort of deprecated and you should have a really good
>>> excuse to use it in new code.
>> 
>> I have no better excuse than that it existed in the same component.
>> Which method should I use instead (or where can I find good examples of code 
>> to use as guide)?
>
> just "git grep officecfg::" will find lots of examples, there are 
> headers generated that have a class for every config item and you can 
> get() and set() it.

I found sufficient examples to use; so far chart2 (where I'm currently working) 
does use officecfg:: yet.
Thanks!

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2019-01-31 Thread Michael Stahl

On 31.01.19 11:48, Winfried Donkers wrote:

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.


I have no better excuse than that it existed in the same component.
Which method should I use instead (or where can I find good examples of code to 
use as guide)?


just "git grep officecfg::" will find lots of examples, there are 
headers generated that have a class for every config item and you can 
get() and set() it.


now there are some places that are tied to utl::ConfigItem; perhaps the 
Tools->Options dialog has some need for that but i forgot about that.


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2019-01-31 Thread Winfried Donkers
Including the mailing list this time...

Winfried

-
Hi Michael, Stephan,

Thank you for your quick responses.

>> 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.

I have no better excuse than that it existed in the same component. 
Which method should I use instead (or where can I find good examples of code to 
use as guide)?

> 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.

I should have mentioned that; I have added the item to 
officecfg/registry/schema/org/openoffice/Office/Calc/xcs.

> 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).

That was what I didn't do, I ran make officecfg without the postprocess.
Now I no longer have the exceptions and can start testing thoroughly :)

Winfried

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2019-01-31 Thread Michael Stahl

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.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2019-01-31 Thread Stephan Bergmann

On 31/01/2019 11:00, Winfried Donkers wrote:

Therefore I need to add a configuration item to registrymodifications.xcu.


The form of configuration content is defined in .xcs files in 
officecfg/registry/schema/, and the configuration data that ships with 
LO is defined in .xcu files in officecfg/registry/data/.


A UserInstallation's registrymodifications.xcu merely contains the 
configuration data value "overrides" that are set for that user.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice