1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _MANIFEST_IMPORT_HXX
21 #define _MANIFEST_IMPORT_HXX
23 #include <cppuhelper/implbase1.hxx> // helper for implementations
24 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
25 #include <comphelper/sequenceasvector.hxx>
28 #include <HashMaps.hxx>
30 namespace com
{ namespace sun
{ namespace star
{
31 namespace xml
{ namespace sax
{ class XAttributeList
; } }
32 namespace beans
{ struct PropertyValue
; }
35 typedef ::boost::unordered_map
< OUString
, OUString
, OUStringHash
, eqFunc
> StringHashMap
;
37 struct ManifestScopeEntry
39 OUString m_aConvertedName
;
40 StringHashMap m_aNamespaces
;
43 ManifestScopeEntry( const OUString
& aConvertedName
, const StringHashMap
& aNamespaces
)
44 : m_aConvertedName( aConvertedName
)
45 , m_aNamespaces( aNamespaces
)
53 typedef ::std::vector
< ManifestScopeEntry
> ManifestStack
;
55 class ManifestImport
: public cppu::WeakImplHelper1
< com::sun::star::xml::sax::XDocumentHandler
>
58 comphelper::SequenceAsVector
< com::sun::star::beans::PropertyValue
> aSequence
;
60 sal_Bool bIgnoreEncryptData
;
61 sal_Int32 nDerivedKeySize
;
62 ::std::vector
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> > & rManVector
;
64 const OUString sFileEntryElement
;
65 const OUString sManifestElement
;
66 const OUString sEncryptionDataElement
;
67 const OUString sAlgorithmElement
;
68 const OUString sStartKeyAlgElement
;
69 const OUString sKeyDerivationElement
;
71 const OUString sCdataAttribute
;
72 const OUString sMediaTypeAttribute
;
73 const OUString sVersionAttribute
;
74 const OUString sFullPathAttribute
;
75 const OUString sSizeAttribute
;
76 const OUString sSaltAttribute
;
77 const OUString sInitialisationVectorAttribute
;
78 const OUString sIterationCountAttribute
;
79 const OUString sKeySizeAttribute
;
80 const OUString sAlgorithmNameAttribute
;
81 const OUString sStartKeyAlgNameAttribute
;
82 const OUString sKeyDerivationNameAttribute
;
83 const OUString sChecksumAttribute
;
84 const OUString sChecksumTypeAttribute
;
86 const OUString sFullPathProperty
;
87 const OUString sMediaTypeProperty
;
88 const OUString sVersionProperty
;
89 const OUString sIterationCountProperty
;
90 const OUString sDerivedKeySizeProperty
;
91 const OUString sSaltProperty
;
92 const OUString sInitialisationVectorProperty
;
93 const OUString sSizeProperty
;
94 const OUString sDigestProperty
;
95 const OUString sEncryptionAlgProperty
;
96 const OUString sStartKeyAlgProperty
;
97 const OUString sDigestAlgProperty
;
99 const OUString sWhiteSpace
;
101 const OUString sSHA256_URL
;
102 const OUString sSHA1_Name
;
103 const OUString sSHA1_URL
;
105 const OUString sSHA256_1k_URL
;
106 const OUString sSHA1_1k_Name
;
107 const OUString sSHA1_1k_URL
;
109 const OUString sBlowfish_Name
;
110 const OUString sBlowfish_URL
;
111 const OUString sAES128_URL
;
112 const OUString sAES192_URL
;
113 const OUString sAES256_URL
;
115 const OUString sPBKDF2_Name
;
116 const OUString sPBKDF2_URL
;
119 OUString
PushNameAndNamespaces( const OUString
& aName
,
120 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttribs
,
121 StringHashMap
& o_aConvertedAttribs
);
122 OUString
ConvertNameWithNamespace( const OUString
& aName
, const StringHashMap
& aNamespaces
);
123 OUString
ConvertName( const OUString
& aName
);
126 ManifestImport( std::vector
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> > & rNewVector
);
127 ~ManifestImport( void );
128 virtual void SAL_CALL
startDocument( )
129 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
130 virtual void SAL_CALL
endDocument( )
131 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
132 virtual void SAL_CALL
startElement( const OUString
& aName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttribs
)
133 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
134 virtual void SAL_CALL
endElement( const OUString
& aName
)
135 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
136 virtual void SAL_CALL
characters( const OUString
& aChars
)
137 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
138 virtual void SAL_CALL
ignorableWhitespace( const OUString
& aWhitespaces
)
139 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
140 virtual void SAL_CALL
processingInstruction( const OUString
& aTarget
, const OUString
& aData
)
141 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
142 virtual void SAL_CALL
setDocumentLocator( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XLocator
>& xLocator
)
143 throw(::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
145 void doFileEntry(StringHashMap
&rConvertedAttribs
) throw(::com::sun::star::uno::RuntimeException
);
146 void doEncryptionData(StringHashMap
&rConvertedAttribs
) throw(::com::sun::star::uno::RuntimeException
);
147 void doAlgorithm(StringHashMap
&rConvertedAttribs
) throw(::com::sun::star::uno::RuntimeException
);
148 void doKeyDerivation(StringHashMap
&rConvertedAttribs
) throw(::com::sun::star::uno::RuntimeException
);
149 void doStartKeyAlg(StringHashMap
&rConvertedAttribs
) throw(::com::sun::star::uno::RuntimeException
);
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */