summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-08-07 18:16:19 +0200
committerKohei Yoshida <kohei.yoshida@suse.com>2011-08-08 11:33:16 -0400
commitdb5239a5821ac8cd9d2f7e3c86c7c20223d8afc9 (patch)
tree7c3a65dcfb56f3db26d721dad56597c30ac990e6
parentb6166f4af917f05bc124208de77d76ece1a68b9b (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.cxx38
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));
}
}
}