diff options
author | Eike Rathke <erack@redhat.com> | 2018-02-24 20:56:28 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-02-24 21:02:41 +0100 |
commit | 1bf8006f6344d67dbfe0055da7d7dd5bdfa529d2 (patch) | |
tree | eaf5d1f55ca9b5702d90e45d6b45cb9e06234fca /sc/source/filter | |
parent | e3dd12fa8a71c7d0d35fb2146436934d1f4ee004 (diff) |
Write ScOoxPasswordHash to OOXML if set, tdf#104250 prep
Change-Id: I51996c673e6c44bbfc27972800d78d9807fe67db
Diffstat (limited to 'sc/source/filter')
-rw-r--r-- | sc/source/filter/excel/excrecds.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index e3af479967a0..4dab73a20805 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -469,6 +469,12 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) const ScTableProtection* pTabProtect = rDoc.GetTabProtection(mnTab); if ( pTabProtect ) { + const ScOoxPasswordHash& rPH = pTabProtect->getPasswordHash(); + // Do not write any hash attributes if there is no password. + ScOoxPasswordHash aPH; + if (rPH.hasPassword()) + aPH = rPH; + Sequence<sal_Int8> aHash = pTabProtect->getPasswordHash(PASSHASH_XL); OString sHash; if (aHash.getLength() >= 2) @@ -480,6 +486,10 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm ) } sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); rWorksheet->singleElement( XML_sheetProtection, + XML_algorithmName, aPH.maAlgorithmName.isEmpty() ? nullptr : XclXmlUtils::ToOString( aPH.maAlgorithmName).getStr(), + XML_hashValue, aPH.maHashValue.isEmpty() ? nullptr : XclXmlUtils::ToOString( aPH.maHashValue).getStr(), + XML_saltValue, aPH.maSaltValue.isEmpty() ? nullptr : XclXmlUtils::ToOString( aPH.maSaltValue).getStr(), + XML_spinCount, aPH.mnSpinCount ? OString::number( aPH.mnSpinCount).getStr() : nullptr, XML_sheet, ToPsz( true ), XML_password, sHash.isEmpty()? nullptr : sHash.getStr(), XML_objects, pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ? nullptr : ToPsz( true ), |