LibreOffice writes the ODF attributes 'draw:display' and 'draw:protected' of the 'draw:layer' element since version 6.2. It can read the ODF attributes since version 6.2. But they are only evaluated if non of the config items VisibleLayers, PrintableLayers and LockedLayers exists. These config items are written as proprietary information into the 'office:settings' element.
Because default values for the ODF attributes 'draw:display' and 'draw:protected' are not written, it is not possible to decide from the ODF attributes, whether it is an old document, which has the layer state in config items or a new document with default layer state. Only the absence of config items ensures, that it is a new document with layer state in ODF attributes.
I propose a hidden expert options, that determines whether config items for layer state are written or not. It provides a smooth transition from using the proprietary settings to using ODF conform attributes. In the beginning the new option will have the default value 'true', so that the proprietary settings are written parallel to the ODF attributes. When version 6.1 is end of life, the default value can be set to 'false'. Users can then still set it to 'true' in case they need interoperability with older versions or with Apache OpenOffice. The option influences only writing of documents. Existing documents are read the same as before the option exists.
Users who use the file format directly or work with macros can immediately set the option to 'false' to produce documents without the config items, so that on loading the ODF attributes are used. In case users remove unused default layers per macro when saving a document, config items must not be written, because otherwise ODF attributes and config items are out of sync on reopening the document in LibreOffice. Removing unused default layers might be desired, if the document is going to be used in other applications like Calligra Karbon or Scribus.
If one day the set of default layers are changed, not writing config items is then necessary too, so that older versions with old set of default layers will not assign not fitting config items.
The proposed change is in https://gerrit.libreoffice.org/67784
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":
tdf#123440 new expert option 'WriteLayerStateAsConfigItem'
It will be available in 6.3.0.
The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.
Feature is available in Version: 18.104.22.168.alpha0+ (x64)
Build ID: 9c5dbbe4b0a62ff1af009beb00f1fc45318dad79
CPU threads: 8; OS: Windows 10.0; UI render: default; VCL: win;
TinderBox: Win-x86_64@42, Branch:master, Time: 2019-02-27_20:03:12
Locale: de-DE (en_US); UI-Language: en-US
(In reply to Regina Henschel from comment #3)
> Feature is available in Version: 22.214.171.124.alpha0+ (x64)
> Build ID: 9c5dbbe4b0a62ff1af009beb00f1fc45318dad79
> CPU threads: 8; OS: Windows 10.0; UI render: default; VCL: win;
> TinderBox: Win-x86_64@42, Branch:master, Time: 2019-02-27_20:03:12
> Locale: de-DE (en_US); UI-Language: en-US
> Calc: threaded
Thanks for implementing this feature.
Please, do no forget to mention it in the release notes -> https://wiki.documentfoundation.org/ReleaseNotes/6.3