Need code pointer for import of <draw:layer> attributes

Regina Henschel rb.henschel at
Sun Nov 26 22:01:27 UTC 2017

Hi Michael,

Michael Stahl schrieb am 23.11.2017 um 21:37:
> On 22.11.2017 17:32, Regina Henschel wrote:
>> Hi all,
>> I've started on
>> My current
>> work is in the attachment.
>> Problem: Although I remove the config-items IsVisible, IsPrintable,
>> IsLocked from the settings.xml of a file, the values from draw:display
>> and draw:locked of the <draw:layer> element are not used. It seems to
>> me, that somewhere the read values are overwritten with a default.
>> Where and when are the values from settings.xml transformed to
>> properties of the layers of a newly opened draw document?
> probably in sd/source/ui/view/frmview.cxx,
> FrameView::ReadUserDataSequence(), around line 858

There the values from settings.xml are indeed read, but it sets no 
defaults. If the node does not exists, nothing is changed.

>> Any other hint, where to look?
> there are SetVisibleLayers functions on 3 different classes, maybe
> setting breakpoints on those would be helpful.

"setting breakpoints" was a good tip.

I use VS2017 and there is no "vs2017-ide-integration" yet. But I have 
tried the "vs2015-ide-integration" and it seems to work :)

I looked a little bit around for SetVisibleLayers and SdrLayerIDSet 
without success.

Then I started from the other end and looked what happens with my not 
xLayer->setPropertyValue("IsLocked",(msbProtected == "true") ? Any(true) 
: Any(false) );
compared to the working
xLayer->setPropertyValue("Title", Any( sTitleBuffer.makeStringAndClear() 
) );

I found this:
setPropertyValue is a method of class SdLayer [in 

The SdLayer itself has no members to store the information. In case of 
"Title" the SdrLayer is used, for which the SdLayer has a pointer. This 
SdrLayer has the member maTitle to take the information. It has no 
members to take IsLocked, IsVisible or IsPrintable.

In case of "IsLocked" the SdLayer uses its member mxLayerManager to get 
a View of a page or a FrameView of the DocShell. But both doesn't exists 
at this stage, when loading a document. So the call of set(...) returns 
false; the source has the comment "//TODO: uno::Exception?"

The result is, that the information is not overwritten as I first 
thought, but is simple lost.

A <draw:page> can have its own <draw:layer-set>. But the 
<draw:layer-set> to be used for the page can also be inherited from a 
master page via <style:master-page> or <office:master-styles>. Therefore 
a solution is needed, which can be extended to support all three places.

As you know, currently the IsLocked/IsVisible/IsPrintable is not stored 
in the document itself, but in the settings.xml, despite the fact, that 
ODF can express the information. [Remember ODF TC discussion on 
OFFICE-3693 to not use settings.xml in those cases.]

New members mbIsLocked, mbIsVisible and mbIsPrintable for the SdrLayer 
would likely work [not worked out yet] as long as the layer settings are 
unique throughout the document, but they need not be unique in ODF.

So what to do?

Kind regard

More information about the LibreOffice mailing list