Bug 107690 - FILEOPEN DOCX: Mark as Final property not read
Summary: FILEOPEN DOCX: Mark as Final property not read
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: interoperability target:6.2.0 target:...
Keywords: filter:docx
Depends on:
Blocks: DOCX
  Show dependency treegraph
 
Reported: 2017-05-07 21:55 UTC by Gabor Kelemen (allotropia)
Modified: 2020-03-31 09:30 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file marked as final (11.95 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-05-07 21:55 UTC, Gabor Kelemen (allotropia)
Details
Example file in Word 2013 (22.98 KB, image/png)
2017-05-07 21:57 UTC, Gabor Kelemen (allotropia)
Details
Same document in current Writer master (44.77 KB, image/png)
2017-05-07 21:57 UTC, Gabor Kelemen (allotropia)
Details
patch (2.84 KB, patch)
2018-06-20 14:57 UTC, László Németh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2017-05-07 21:55:47 UTC
Created attachment 133141 [details]
Example file marked as final

Attached docx file was marked as final in Word 2013. 
See: https://support.office.com/en-us/article/Prevent-changes-to-a-final-version-of-a-document-37281a8d-3c15-41f3-9a75-e6463acdf04f

In Writer this should mean that on the File - Properties - Security tab the option "Open file read-only" is checked, but it is not.

Interesting fact that checking this box on a new document, saving it as docx and opening it in Word activates the correct warning that says this document is marked as final.
Comment 1 Gabor Kelemen (allotropia) 2017-05-07 21:57:19 UTC
Created attachment 133142 [details]
Example file in Word 2013
Comment 2 Gabor Kelemen (allotropia) 2017-05-07 21:57:57 UTC
Created attachment 133143 [details]
Same document in current Writer master
Comment 3 Aron Budea 2017-05-08 00:49:16 UTC
Confirmed in 5.3.3.2 and 3.3.0 / Windows 7.
Comment 4 QA Administrators 2018-05-09 02:34:34 UTC Comment hidden (obsolete)
Comment 5 László Németh 2018-06-19 15:59:35 UTC
This property is opened correctly, see "_MarkAsFinal" on File->Properties->Custom Properties page, moreover, it's possible to switch off it before saving.

Unfortunately, This property is not a standard DOCX property. MS Office uses a custom property to store it, see in docProp/custom.xml:

<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="9" name="_MarkAsFinal"><vt:bool>1</vt:bool></property>

It seems, D5CDD505-2E9C-101B-9397-08002B2CF9AE is a "predefined property set format identifier" of Microsoft for "The DocumentSummaryInformation and UserDefined Property Sets": https://msdn.microsoft.com/en-us/library/windows/desktop/aa380060(v=vs.85).aspx

Unfortunately, it seems, this is not the same, as "Read-only document", ie. DocSecurity=1 "Document is recommended to be opened as read-only." or DocSecurity=2 "Document is enforced to be opened as read-only." (ECMA 22.2.2.7 DocSecurity (Document Security)), see in docProp/app.xml:

<DocSecurity>0</DocSecurity>

So it's hard to handle this in a correct way, because neither MS Office does it.

> Interesting fact that checking this box on a new document, saving it as docx and opening it in Word activates the correct warning that says this document is marked as final.

This is possible, if the default empty document template was replaced by an ODT document containing this custom property (which comes from a DOCX document).
Comment 6 László Németh 2018-06-20 14:57:19 UTC
Created attachment 142963 [details]
patch

patch: tdf#107690 Initial support of Mark as Final property of MSO
    
    Don't save modified documents with property _MarkAsFinal=True
    silently to avoid to get unintended warning messages in MSO.
    
    Show read-only info bar for documents with custom document
    property _MarkAsFinal=True, similar to MSO.
    
    This improves interoperability a lot, because this is a
    basic document protection of MSO, recommended on its UI.
Comment 7 László Németh 2018-06-20 18:02:06 UTC
In gerrit: https://gerrit.libreoffice.org/#/c/56180/

NOTE: OOXML DocSecurity doesn't supported by MSO 2016, only this _MarkAsFinal.

NOTE II: Missing info bar for LO LoadReadonly property (associated to read-only document property) is likely an ugly regression from LO 6.0. It needs to fix it to solve this issue in the proposed way.
Comment 8 Commit Notification 2018-06-28 14:36:10 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9a5c56a9c4e04589b0a6bb710573922e459d9685

tdf#107690 OOXML import/export of setting "Open as read-only"

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:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2018-06-28 14:37:28 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=bbdb6cb8ed0d77eeb2e413b38f29d2084bd8257b

tdf#107690 DOCX, XLSX and PPTX unit tests for "Open as read-only"

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:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2018-07-18 13:41:11 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=61aaefd8e902f86f5f7347efdb56686638149133&h=libreoffice-6-1

tdf#107690 OOXML import/export of setting "Open as read-only"

It will be available in 6.1.0.2.

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:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.