xref: /AOO41X/main/package/source/manifest/ManifestImport.hxx (revision 76bf0a21710da5d1469c432b026d64cb06069c7a)
1f319bb99SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f319bb99SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f319bb99SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f319bb99SAndrew Rist  * distributed with this work for additional information
6f319bb99SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f319bb99SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f319bb99SAndrew Rist  * "License"); you may not use this file except in compliance
9f319bb99SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11f319bb99SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13f319bb99SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f319bb99SAndrew Rist  * software distributed under the License is distributed on an
15f319bb99SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f319bb99SAndrew Rist  * KIND, either express or implied.  See the License for the
17f319bb99SAndrew Rist  * specific language governing permissions and limitations
18f319bb99SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20f319bb99SAndrew Rist  *************************************************************/
21f319bb99SAndrew Rist 
22f319bb99SAndrew 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
31*76bf0a21SHerbert Dürr #include "PackageConstants.hxx"
32cdf0e10cSrcweir #include <vector>
33cdf0e10cSrcweir 
34*76bf0a21SHerbert Dürr #include <com/sun/star/beans/PropertyValues.hpp>
35cdf0e10cSrcweir #include <HashMaps.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace com { namespace sun { namespace star {
38cdf0e10cSrcweir 	namespace xml { namespace sax { class XAttributeList; } }
39cdf0e10cSrcweir 	namespace beans { struct PropertyValue; }
40cdf0e10cSrcweir } } }
41cdf0e10cSrcweir 
42cdf0e10cSrcweir typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash, eqFunc > StringHashMap;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir struct ManifestScopeEntry
45cdf0e10cSrcweir {
46cdf0e10cSrcweir     ::rtl::OUString m_aConvertedName;
47cdf0e10cSrcweir     StringHashMap   m_aNamespaces;
48cdf0e10cSrcweir 
ManifestScopeEntryManifestScopeEntry49cdf0e10cSrcweir     ManifestScopeEntry( const ::rtl::OUString& aConvertedName, const StringHashMap& aNamespaces )
50cdf0e10cSrcweir     : m_aConvertedName( aConvertedName )
51cdf0e10cSrcweir     , m_aNamespaces( aNamespaces )
52cdf0e10cSrcweir     {}
53cdf0e10cSrcweir 
~ManifestScopeEntryManifestScopeEntry54cdf0e10cSrcweir     ~ManifestScopeEntry()
55cdf0e10cSrcweir     {}
56cdf0e10cSrcweir };
57cdf0e10cSrcweir 
58cdf0e10cSrcweir typedef ::std::vector< ManifestScopeEntry > ManifestStack;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir class ManifestImport : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler >
61cdf0e10cSrcweir {
62cdf0e10cSrcweir protected:
63*76bf0a21SHerbert Dürr 	::com::sun::star::uno::Any maValues[ PKG_SIZE_ENCR_MNFST ];
64cdf0e10cSrcweir 
65*76bf0a21SHerbert Dürr 	::std::vector < ::com::sun::star::beans::PropertyValues > & rManVector;
66*76bf0a21SHerbert Dürr 	ManifestStack aStack;
67*76bf0a21SHerbert Dürr     sal_Int32 nDerivedKeySize;
68*76bf0a21SHerbert Dürr 	bool bIgnoreEncryptData;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	const ::rtl::OUString sCdataAttribute;
71cdf0e10cSrcweir 	const ::rtl::OUString sMediaTypeAttribute;
72cdf0e10cSrcweir 	const ::rtl::OUString sVersionAttribute;
73cdf0e10cSrcweir 	const ::rtl::OUString sFullPathAttribute;
74cdf0e10cSrcweir 	const ::rtl::OUString sSizeAttribute;
75cdf0e10cSrcweir 	const ::rtl::OUString sSaltAttribute;
76cdf0e10cSrcweir 	const ::rtl::OUString sInitialisationVectorAttribute;
77cdf0e10cSrcweir 	const ::rtl::OUString sIterationCountAttribute;
78cdf0e10cSrcweir 	const ::rtl::OUString sKeySizeAttribute;
79cdf0e10cSrcweir 	const ::rtl::OUString sAlgorithmNameAttribute;
80cdf0e10cSrcweir 	const ::rtl::OUString sStartKeyAlgNameAttribute;
81cdf0e10cSrcweir 	const ::rtl::OUString sKeyDerivationNameAttribute;
82cdf0e10cSrcweir 	const ::rtl::OUString sChecksumAttribute;
83cdf0e10cSrcweir 	const ::rtl::OUString sChecksumTypeAttribute;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     ::rtl::OUString PushNameAndNamespaces( const ::rtl::OUString& aName,
86cdf0e10cSrcweir                                            const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs,
87cdf0e10cSrcweir                                            StringHashMap& o_aConvertedAttribs );
88cdf0e10cSrcweir     ::rtl::OUString ConvertNameWithNamespace( const ::rtl::OUString& aName, const StringHashMap& aNamespaces );
89cdf0e10cSrcweir     ::rtl::OUString ConvertName( const ::rtl::OUString& aName );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir public:
92cdf0e10cSrcweir 	ManifestImport( std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rNewVector );
93cdf0e10cSrcweir 	~ManifestImport( void );
94cdf0e10cSrcweir     virtual void SAL_CALL startDocument(  )
95cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
96cdf0e10cSrcweir     virtual void SAL_CALL endDocument(  )
97cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir     virtual void SAL_CALL startElement( const ::rtl::OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs )
99cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir     virtual void SAL_CALL endElement( const ::rtl::OUString& aName )
101cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir     virtual void SAL_CALL characters( const ::rtl::OUString& aChars )
103cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
104cdf0e10cSrcweir     virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces )
105cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
106cdf0e10cSrcweir     virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData )
107cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
108cdf0e10cSrcweir     virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator )
109cdf0e10cSrcweir 		throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
110cdf0e10cSrcweir };
111cdf0e10cSrcweir #endif
112