diff options
author | Tünde Tóth <toth.tunde@nisz.hu> | 2021-10-12 15:11:48 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-10-26 11:59:19 +0200 |
commit | 1b53c1dfc76f08ca7df40a0673aa50eca700d072 (patch) | |
tree | a1b4d8b32e9a7ff7e0e95670a6358807349f6270 /sfx2 | |
parent | 31ded6f8718a90c7b3b9eb36909c2b7a0c6e9b68 (diff) |
tdf#144374 DOCX: export the password for editing
The password for editing wasn't exported in DOCX,
resulting unprotected documents in Writer and
in MSO 2019 or newer.
Change-Id: Ieb8a339795635bc1c4223ccbe2a40ea85222cc2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123543
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/filedlghelper.cxx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 99e0de639070..35fc5d166e11 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2944,11 +2944,24 @@ ErrCode RequestPassword(const std::shared_ptr<const SfxFilter>& pCurrentFilter, if ( bMSType ) { - // the empty password has 0 as Hash - sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( pPasswordRequest->getPasswordToModify(), - pCurrentFilter->GetServiceName() == "com.sun.star.text.TextDocument" ); - if ( nHash ) - pSet->Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, uno::makeAny( nHash ) ) ); + if (bOOXML) + { + uno::Sequence<beans::PropertyValue> aModifyPasswordInfo + = ::comphelper::DocPasswordHelper::GenerateNewModifyPasswordInfoOOXML( + pPasswordRequest->getPasswordToModify()); + if (aModifyPasswordInfo.hasElements()) + pSet->Put( + SfxUnoAnyItem(SID_MODIFYPASSWORDINFO, uno::makeAny(aModifyPasswordInfo))); + } + else + { + // the empty password has 0 as Hash + sal_Int32 nHash = SfxMedium::CreatePasswordToModifyHash( + pPasswordRequest->getPasswordToModify(), + pCurrentFilter->GetServiceName() == "com.sun.star.text.TextDocument"); + if (nHash) + pSet->Put(SfxUnoAnyItem(SID_MODIFYPASSWORDINFO, uno::makeAny(nHash))); + } } else { |