summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-04-08 20:05:23 +0200
committerEike Rathke <erack@redhat.com>2014-04-08 20:10:23 +0200
commit9a0ac1dd5154542f8cea0772c7c7c5d526cf5a2f (patch)
treed20ec18c9992c8964abfe2b2c64324a1cc601c15
parent5a26036cbfd9a2815d805359d936bf2cabe37e40 (diff)
write protectedRange elements to OOXML
Change-Id: I3b48d6adb3008856cc8ed8e9f0c8a3dbbccaed3f
-rw-r--r--sc/source/filter/excel/excrecds.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index 4dc124386b21..f45ba187ffd7 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -520,6 +520,33 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm )
XML_pivotTables, pTabProtect->isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? XclXmlUtils::ToPsz( false ) : NULL,
XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? NULL : XclXmlUtils::ToPsz( true ),
FSEND );
+
+ const ::std::vector<ScEnhancedProtection>& rProts( pTabProtect->getEnhancedProtection());
+ if (!rProts.empty())
+ {
+ rWorksheet->startElement( XML_protectedRanges, FSEND);
+ for (::std::vector<ScEnhancedProtection>::const_iterator it( rProts.begin()), end( rProts.end());
+ it != end; ++it)
+ {
+ SAL_WARN_IF( (*it).maSecurityDescriptorXML.isEmpty() && !(*it).maSecurityDescriptor.empty(),
+ "sc.filter", "XclExpSheetProtection::SaveXml: loosing BIFF security descriptor");
+ rWorksheet->singleElement( XML_protectedRange,
+ XML_name, (*it).maTitle.isEmpty() ? NULL : XclXmlUtils::ToOString( (*it).maTitle).getStr(),
+ XML_securityDescriptor, (*it).maSecurityDescriptorXML.isEmpty() ? NULL : XclXmlUtils::ToOString( (*it).maSecurityDescriptorXML).getStr(),
+ /* XXX 'password' is not part of OOXML, but Excel2013
+ * writes it if loaded from BIFF, in which case
+ * 'algorithmName', 'hashValue', 'saltValue' and
+ * 'spinCount' are absent; so do we if it was present. */
+ XML_password, (*it).mnPasswordVerifier ? OString::number( (*it).mnPasswordVerifier, 16).getStr() : NULL,
+ XML_algorithmName, (*it).maAlgorithmName.isEmpty() ? NULL : XclXmlUtils::ToOString( (*it).maAlgorithmName).getStr(),
+ XML_hashValue, (*it).maHashValue.isEmpty() ? NULL : XclXmlUtils::ToOString( (*it).maHashValue).getStr(),
+ XML_saltValue, (*it).maSaltValue.isEmpty() ? NULL : XclXmlUtils::ToOString( (*it).maSaltValue).getStr(),
+ XML_spinCount, (*it).mnSpinCount ? OString::number( (*it).mnSpinCount).getStr() : NULL,
+ XML_sqref, (*it).maRangeList.Is() ? XclXmlUtils::ToOString( *(*it).maRangeList).getStr() : NULL,
+ FSEND);
+ }
+ rWorksheet->endElement( XML_protectedRanges);
+ }
}
}