diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-08-07 18:16:19 +0200 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-08-08 11:33:16 -0400 |
commit | db5239a5821ac8cd9d2f7e3c86c7c20223d8afc9 (patch) | |
tree | 7c3a65dcfb56f3db26d721dad56597c30ac990e6 | |
parent | b6166f4af917f05bc124208de77d76ece1a68b9b (diff) |
fix for fdo#39678: don't write password algorithm in odf 1.0 and 1.1
Signed-off-by: Kohei Yoshida <kohei.yoshida@suse.com>
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 4a5eecb25..514e27a30 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -1525,16 +1525,19 @@ void ScXMLExport::SetBodyAttributes() if (aBuffer.getLength()) { AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear()); - if (eHashUsed == PASSHASH_XL) + if ( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) { - AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, - ScPassHashHelper::getHashURI(PASSHASH_XL)); - AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2, - ScPassHashHelper::getHashURI(PASSHASH_SHA1)); + if (eHashUsed == PASSHASH_XL) + { + AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, + ScPassHashHelper::getHashURI(PASSHASH_XL)); + AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2, + ScPassHashHelper::getHashURI(PASSHASH_SHA1)); + } + else if (eHashUsed == PASSHASH_SHA1) + AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, + ScPassHashHelper::getHashURI(PASSHASH_SHA1)); } - else if (eHashUsed == PASSHASH_SHA1) - AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, - ScPassHashHelper::getHashURI(PASSHASH_SHA1)); } } } @@ -2695,16 +2698,19 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe if (aBuffer.getLength()) { AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear()); - if (eHashUsed == PASSHASH_XL) + if ( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) { - AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, - ScPassHashHelper::getHashURI(PASSHASH_XL)); - AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2, - ScPassHashHelper::getHashURI(PASSHASH_SHA1)); + if (eHashUsed == PASSHASH_XL) + { + AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, + ScPassHashHelper::getHashURI(PASSHASH_XL)); + AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2, + ScPassHashHelper::getHashURI(PASSHASH_SHA1)); + } + else if (eHashUsed == PASSHASH_SHA1) + AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, + ScPassHashHelper::getHashURI(PASSHASH_SHA1)); } - else if (eHashUsed == PASSHASH_SHA1) - AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, - ScPassHashHelper::getHashURI(PASSHASH_SHA1)); } } } |