Created attachment 145585 [details] Sample DOCX (restricted using pw 1234) The attached DOCX was created in Word, contains a legacy form field, and has been restricted to only allow filling in forms, with a password set (which is "1234"). Writer has a compatibility setting for such forms: LibreOffice Writer -> Compatibility -> Protect form. It's a simple check box, and doesn't ask for a password. There should be a password prompt when enabling/disabling form protection (would be optional when enabling). The question is, when: when the checkbox is ticket/unticked, or when the setting is applied? I assume the setting would have a single implementation for DOC and DOCX documents, just the filter code would be different (currently exporting form protection doesn't work in DOC format, see bug 52555). Observed using LO 6.2.0.0.alpha0+ (425af6845ebe066c950b0b63f50563e067485f3e) / Windows 7.
Interesting note. Word 2003 unrestricts without a password too, but it properly saves a password.
DOCX: only round-trips these settings, but doesn't use them other than to turn on PROTECT_FORM. (look for XML_documentProtection in docxexport.cxx and GetDocumentProtectionSettings() in writerfilter). I like being able to bypass these passwords in LO, and the way to disable protection is buried pretty deep, so it hardly seems necessary.
Created attachment 145686 [details] protectSection.odt: the LO way of protecting - half works in DOCX and doesn't in DOC Personally, if I do decide to work on this, I would start by making sure that this ODT file exports/imports well with doc/docx. Currently, it exports OK to both doc and docx (except that it doesn't export the password). Word 2016 can edit the unprotected section, honours the protected area, but unprotects without a password. LO currently imports the resulting .doc file very poorly - no protection at all. Importing the resulting .docx file protects everything, not just the section.
I expect that the password will need to use functions from include/comphelper/docpasswordhelper.hxx
(In reply to Justin L from comment #3) > Currently, it exports OK to both doc and docx (except that it doesn't export > the password). So, from a theoretical perspective, it would probably be a very bad thing to take the password implementation of LibreOffice and export it into .doc's lKeyDocProt password because that is very weak encryption. That would allow someone to take a confidential .odt file, export to .doc and then easily be able to crack the password. However, that is NOT what OP was suggesting. They are only asking for the compatibility flag PROTECT_FORM to be connected to the .doc* password. This would not be a security concern. The passwords exist in the InteropGrabBag, and so could be checked, or re-written.
In 7.1, the situation for import is very good. Both DOC and DOCX protect the first section, and both allow editing in the second section. In neither case is the section password protected. (I created a new password, in case LO caches an MS Format compatible password as well as an ODT password, but that wasn't the case. I know that IS used in some places, like document crash recovery.)
*** Bug 130565 has been marked as a duplicate of this bug. ***