diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-08 13:50:30 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-08 15:29:53 +0100 |
commit | f57baefbd3c4c5d8e5ec28e8702c91d60ffc5de2 (patch) | |
tree | 79e65468b9b8aba28c14533a89314389a5f4d727 /xmloff | |
parent | 4a90740fcee07996469ff702daa04953f39be191 (diff) |
add chaff to encrypted documents
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmloff/xmlexp.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 16 | ||||
-rw-r--r-- | xmloff/source/meta/MetaExportComponent.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/meta/xmlversion.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/text/XMLAutoTextEventExport.cxx | 2 |
5 files changed, 23 insertions, 2 deletions
diff --git a/xmloff/inc/xmloff/xmlexp.hxx b/xmloff/inc/xmloff/xmlexp.hxx index 153065f9b970..c1bb9c05eb17 100644 --- a/xmloff/inc/xmloff/xmlexp.hxx +++ b/xmloff/inc/xmloff/xmlexp.hxx @@ -431,6 +431,8 @@ public: SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; } + void addChaffWhenEncryptedStorage(); + // Export the document. virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ); diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 25f1e093cf03..7b03fad5a4a9 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -94,10 +94,11 @@ #include <tools/inetdef.hxx> #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> - +#include <com/sun/star/embed/XEncryptionProtectedSource2.hpp> #include <com/sun/star/rdf/XMetadatable.hpp> #include "RDFaExportHelper.hxx" +#include <comphelper/xmltools.hxx> using ::rtl::OUString; @@ -1278,6 +1279,16 @@ lcl_AddGrddl(SvXMLExport & rExport, const sal_Int32 /*nExportMode*/) #endif } +void SvXMLExport::addChaffWhenEncryptedStorage() +{ + uno::Reference< embed::XEncryptionProtectedSource2 > xEncr(mpImpl->mxTargetStorage, uno::UNO_QUERY); + + if (xEncr.is() && xEncr->hasEncryptionData() && mxExtHandler.is()) + { + mxExtHandler->comment(rtl::OStringToOUString(comphelper::xml::makeXMLChaff(), RTL_TEXTENCODING_ASCII_US)); + } +} + sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) { bool bOwnGraphicResolver = false; @@ -1366,9 +1377,10 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) } } - mxHandler->startDocument(); + addChaffWhenEncryptedStorage(); + // <office:document ...> CheckAttrList(); diff --git a/xmloff/source/meta/MetaExportComponent.cxx b/xmloff/source/meta/MetaExportComponent.cxx index 37af37bb498e..fac1984e3e39 100644 --- a/xmloff/source/meta/MetaExportComponent.cxx +++ b/xmloff/source/meta/MetaExportComponent.cxx @@ -135,6 +135,9 @@ sal_uInt32 XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) xDocHandler->startDocument(); + + addChaffWhenEncryptedStorage(); + { const SvXMLNamespaceMap& rMap = GetNamespaceMap(); diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx index 8163dd5adbb1..c80f5f7a5e66 100644 --- a/xmloff/source/meta/xmlversion.cxx +++ b/xmloff/source/meta/xmlversion.cxx @@ -75,6 +75,8 @@ sal_uInt32 XMLVersionListExport::exportDoc( enum ::xmloff::token::XMLTokenEnum ) { GetDocHandler()->startDocument(); + addChaffWhenEncryptedStorage(); + sal_uInt16 nPos = _GetNamespaceMap().GetIndexByKey( XML_NAMESPACE_DC ); AddAttribute( XML_NAMESPACE_NONE, _GetNamespaceMap().GetAttrNameByIndex( nPos ), diff --git a/xmloff/source/text/XMLAutoTextEventExport.cxx b/xmloff/source/text/XMLAutoTextEventExport.cxx index 1b14c1fb9665..30cc1246c700 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.cxx +++ b/xmloff/source/text/XMLAutoTextEventExport.cxx @@ -168,6 +168,8 @@ sal_uInt32 XMLAutoTextEventExport::exportDoc( enum XMLTokenEnum ) { GetDocHandler()->startDocument(); + addChaffWhenEncryptedStorage(); + addNamespaces(); { |