xref: /AOO41X/main/package/source/manifest/ManifestImport.hxx (revision f319bb99b6b251a37b98027a84e8048ce3778b1f)
1*f319bb99SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f319bb99SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f319bb99SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f319bb99SAndrew Rist  * distributed with this work for additional information
6*f319bb99SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f319bb99SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f319bb99SAndrew Rist  * "License"); you may not use this file except in compliance
9*f319bb99SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f319bb99SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f319bb99SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f319bb99SAndrew Rist  * software distributed under the License is distributed on an
15*f319bb99SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f319bb99SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f319bb99SAndrew Rist  * specific language governing permissions and limitations
18*f319bb99SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f319bb99SAndrew Rist  *************************************************************/
21*f319bb99SAndrew Rist 
22*f319bb99SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _MANIFEST_IMPORT_HXX
25cdf0e10cSrcweir #define _MANIFEST_IMPORT_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> // helper for implementations
28cdf0e10cSrcweir #ifndef _COM_SUN_STAR_XML_SAX_XDUCUMENTHANDLER_HPP_
29cdf0e10cSrcweir #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir #include <vector>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <HashMaps.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace com { namespace sun { namespace star {
36cdf0e10cSrcweir 	namespace xml { namespace sax { class XAttributeList; } }
37cdf0e10cSrcweir 	namespace beans { struct PropertyValue; }
38cdf0e10cSrcweir } } }
39cdf0e10cSrcweir 
40cdf0e10cSrcweir typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash, eqFunc > StringHashMap;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir struct ManifestScopeEntry
43cdf0e10cSrcweir {
44cdf0e10cSrcweir     ::rtl::OUString m_aConvertedName;
45cdf0e10cSrcweir     StringHashMap   m_aNamespaces;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     ManifestScopeEntry( const ::rtl::OUString& aConvertedName, const StringHashMap& aNamespaces )
48cdf0e10cSrcweir     : m_aConvertedName( aConvertedName )
49cdf0e10cSrcweir     , m_aNamespaces( aNamespaces )
50cdf0e10cSrcweir     {}
51cdf0e10cSrcweir 
52cdf0e10cSrcweir     ~ManifestScopeEntry()
53cdf0e10cSrcweir     {}
54cdf0e10cSrcweir };
55cdf0e10cSrcweir 
56cdf0e10cSrcweir typedef ::std::vector< ManifestScopeEntry > ManifestStack;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class ManifestImport : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler >
59cdf0e10cSrcweir {
60cdf0e10cSrcweir protected:
61cdf0e10cSrcweir 	com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aSequence;
62cdf0e10cSrcweir 	sal_Int16 		nNumProperty;
63cdf0e10cSrcweir 	ManifestStack aStack;
64cdf0e10cSrcweir 	sal_Bool bIgnoreEncryptData;
65cdf0e10cSrcweir     sal_Int32 nDerivedKeySize;
66cdf0e10cSrcweir 	::std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rManVector;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	const ::rtl::OUString sFileEntryElement;
69cdf0e10cSrcweir 	const ::rtl::OUString sManifestElement;
70cdf0e10cSrcweir 	const ::rtl::OUString sEncryptionDataElement;
71cdf0e10cSrcweir 	const ::rtl::OUString sAlgorithmElement;
72cdf0e10cSrcweir 	const ::rtl::OUString sStartKeyAlgElement;
73cdf0e10cSrcweir 	const ::rtl::OUString sKeyDerivationElement;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	const ::rtl::OUString sCdataAttribute;
76cdf0e10cSrcweir 	const ::rtl::OUString sMediaTypeAttribute;
77cdf0e10cSrcweir 	const ::rtl::OUString sVersionAttribute;
78cdf0e10cSrcweir 	const ::rtl::OUString sFullPathAttribute;
79cdf0e10cSrcweir 	const ::rtl::OUString sSizeAttribute;
80cdf0e10cSrcweir 	const ::rtl::OUString sSaltAttribute;
81cdf0e10cSrcweir 	const ::rtl::OUString sInitialisationVectorAttribute;
82cdf0e10cSrcweir 	const ::rtl::OUString sIterationCountAttribute;
83cdf0e10cSrcweir 	const ::rtl::OUString sKeySizeAttribute;
84cdf0e10cSrcweir 	const ::rtl::OUString sAlgorithmNameAttribute;
85cdf0e10cSrcweir 	const ::rtl::OUString sStartKeyAlgNameAttribute;
86cdf0e10cSrcweir 	const ::rtl::OUString sKeyDerivationNameAttribute;
87cdf0e10cSrcweir 	const ::rtl::OUString sChecksumAttribute;
88cdf0e10cSrcweir 	const ::rtl::OUString sChecksumTypeAttribute;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	const ::rtl::OUString sFullPathProperty;
91cdf0e10cSrcweir 	const ::rtl::OUString sMediaTypeProperty;
92cdf0e10cSrcweir 	const ::rtl::OUString sVersionProperty;
93cdf0e10cSrcweir 	const ::rtl::OUString sIterationCountProperty;
94cdf0e10cSrcweir 	const ::rtl::OUString sDerivedKeySizeProperty;
95cdf0e10cSrcweir 	const ::rtl::OUString sSaltProperty;
96cdf0e10cSrcweir 	const ::rtl::OUString sInitialisationVectorProperty;
97cdf0e10cSrcweir 	const ::rtl::OUString sSizeProperty;
98cdf0e10cSrcweir 	const ::rtl::OUString sDigestProperty;
99cdf0e10cSrcweir     const ::rtl::OUString sEncryptionAlgProperty;
100cdf0e10cSrcweir     const ::rtl::OUString sStartKeyAlgProperty;
101cdf0e10cSrcweir     const ::rtl::OUString sDigestAlgProperty;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	const ::rtl::OUString sWhiteSpace;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	const ::rtl::OUString sSHA256_URL;
106cdf0e10cSrcweir 	const ::rtl::OUString sSHA1_Name;
107cdf0e10cSrcweir 	const ::rtl::OUString sSHA1_URL;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	const ::rtl::OUString sSHA256_1k_URL;
110cdf0e10cSrcweir 	const ::rtl::OUString sSHA1_1k_Name;
111cdf0e10cSrcweir 	const ::rtl::OUString sSHA1_1k_URL;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	const ::rtl::OUString sBlowfish_Name;
114cdf0e10cSrcweir 	const ::rtl::OUString sBlowfish_URL;
115cdf0e10cSrcweir 	const ::rtl::OUString sAES128_URL;
116cdf0e10cSrcweir 	const ::rtl::OUString sAES192_URL;
117cdf0e10cSrcweir 	const ::rtl::OUString sAES256_URL;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	const ::rtl::OUString sPBKDF2_Name;
120cdf0e10cSrcweir 	const ::rtl::OUString sPBKDF2_URL;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     ::rtl::OUString PushNameAndNamespaces( const ::rtl::OUString& aName,
124cdf0e10cSrcweir                                            const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs,
125cdf0e10cSrcweir                                            StringHashMap& o_aConvertedAttribs );
126cdf0e10cSrcweir     ::rtl::OUString ConvertNameWithNamespace( const ::rtl::OUString& aName, const StringHashMap& aNamespaces );
127cdf0e10cSrcweir     ::rtl::OUString ConvertName( const ::rtl::OUString& aName );
128cdf0e10cSrcweir 
129cdf0e10cSrcweir public:
130cdf0e10cSrcweir 	ManifestImport( std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rNewVector );
131cdf0e10cSrcweir 	~ManifestImport( void );
132cdf0e10cSrcweir     virtual void SAL_CALL startDocument(  )
133cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
134cdf0e10cSrcweir     virtual void SAL_CALL endDocument(  )
135cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
136cdf0e10cSrcweir     virtual void SAL_CALL startElement( const ::rtl::OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs )
137cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
138cdf0e10cSrcweir     virtual void SAL_CALL endElement( const ::rtl::OUString& aName )
139cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
140cdf0e10cSrcweir     virtual void SAL_CALL characters( const ::rtl::OUString& aChars )
141cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir     virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces )
143cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
144cdf0e10cSrcweir     virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData )
145cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
146cdf0e10cSrcweir     virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator )
147cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
148cdf0e10cSrcweir };
149cdf0e10cSrcweir #endif
150