Created attachment 144335 [details]
File to reproduce the problem
Open the attached document. It has eight user defined layers, which have all possible combinations of visible/printable/locked. They are named accordingly to make the properties more obvious. The layer "VP-" is visible, printable, not locked, for example. Besides that the tab-bar shows the status of that properties. These properties can be toggled by shortcuts.
visible black, not visible blue, toggle Shift
printable normal, not printable underline, toggle Ctrl+Shift
locked italic, not locked upright, toggle Ctrl
Click on tab "V--" to make it the active layer.
Rightclick > Insert Layer
Name the new layer "NewV--" and set its properties to visible, not printable, not locked. OK.
Notice, that the new layer is inserted after "V--" and the tab has the appearance black+underline+upright, which is correct.
Save the document and reopen it.
Notice, that the properties are assigned to the layers as if the new layer has been inserted at the end of the tab-bar. The error is in the saved document. I don't know yet, where in the inserting process the wrong assignment happens.
I see this error already in OOo2.4.3.
The ODF attributes draw:display and draw:protected (support was implemented in bug 101242) get the correct values on saving. But currently the settings.xml has precedence and so the wrong values are used on loading.
The SdrLayerIDSet in a view interprets its bits according the layer ID. But in file the attribute "ID" does not exists. In file the bitfield is interpreted in order of the layers in <draw:layer-set>. It is needed to reorder the bits when saving the file.
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":
tdf#119392 write bitfield in <draw:layer-set> order
It will be available in 6.2.0.
The patch should be included in the daily builds available at
http://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.
Fixed in current master
*** Bug 121494 has been marked as a duplicate of this bug. ***