Bump version to 5.0-14
[LibreOffice.git] / package / source / manifest / ManifestImport.hxx
blob7bebfb1f13f10a4733e86326db765a5aec82f78f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_PACKAGE_SOURCE_MANIFEST_MANIFESTIMPORT_HXX
21 #define INCLUDED_PACKAGE_SOURCE_MANIFEST_MANIFESTIMPORT_HXX
23 #include <cppuhelper/implbase1.hxx>
24 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
25 #include <vector>
27 #include <HashMaps.hxx>
29 namespace com { namespace sun { namespace star {
30 namespace xml { namespace sax { class XAttributeList; } }
31 namespace beans { struct PropertyValue; }
32 } } }
34 typedef std::unordered_map< OUString, OUString, OUStringHash, eqFunc > StringHashMap;
36 struct ManifestScopeEntry
38 OUString m_aConvertedName;
39 StringHashMap m_aNamespaces;
40 bool m_bValid;
42 ManifestScopeEntry( const OUString& aConvertedName, const StringHashMap& aNamespaces )
43 : m_aConvertedName( aConvertedName )
44 , m_aNamespaces( aNamespaces )
45 , m_bValid( true )
48 ~ManifestScopeEntry()
52 typedef ::std::vector< ManifestScopeEntry > ManifestStack;
54 class ManifestImport : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler >
56 protected:
57 std::vector< com::sun::star::beans::PropertyValue > aSequence;
58 ManifestStack aStack;
59 bool bIgnoreEncryptData;
60 sal_Int32 nDerivedKeySize;
61 ::std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rManVector;
63 const OUString sFileEntryElement;
64 const OUString sManifestElement;
65 const OUString sEncryptionDataElement;
66 const OUString sAlgorithmElement;
67 const OUString sStartKeyAlgElement;
68 const OUString sKeyDerivationElement;
70 const OUString sCdataAttribute;
71 const OUString sMediaTypeAttribute;
72 const OUString sVersionAttribute;
73 const OUString sFullPathAttribute;
74 const OUString sSizeAttribute;
75 const OUString sSaltAttribute;
76 const OUString sInitialisationVectorAttribute;
77 const OUString sIterationCountAttribute;
78 const OUString sKeySizeAttribute;
79 const OUString sAlgorithmNameAttribute;
80 const OUString sStartKeyAlgNameAttribute;
81 const OUString sKeyDerivationNameAttribute;
82 const OUString sChecksumAttribute;
83 const OUString sChecksumTypeAttribute;
85 const OUString sFullPathProperty;
86 const OUString sMediaTypeProperty;
87 const OUString sVersionProperty;
88 const OUString sIterationCountProperty;
89 const OUString sDerivedKeySizeProperty;
90 const OUString sSaltProperty;
91 const OUString sInitialisationVectorProperty;
92 const OUString sSizeProperty;
93 const OUString sDigestProperty;
94 const OUString sEncryptionAlgProperty;
95 const OUString sStartKeyAlgProperty;
96 const OUString sDigestAlgProperty;
98 const OUString sWhiteSpace;
100 const OUString sSHA256_URL;
101 const OUString sSHA1_Name;
102 const OUString sSHA1_URL;
104 const OUString sSHA256_1k_URL;
105 const OUString sSHA1_1k_Name;
106 const OUString sSHA1_1k_URL;
108 const OUString sBlowfish_Name;
109 const OUString sBlowfish_URL;
110 const OUString sAES128_URL;
111 const OUString sAES192_URL;
112 const OUString sAES256_URL;
114 const OUString sPBKDF2_Name;
115 const OUString sPBKDF2_URL;
117 OUString PushNameAndNamespaces( const OUString& aName,
118 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs,
119 StringHashMap& o_aConvertedAttribs );
120 static OUString ConvertNameWithNamespace( const OUString& aName, const StringHashMap& aNamespaces );
121 OUString ConvertName( const OUString& aName );
123 public:
124 ManifestImport( std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rNewVector );
125 virtual ~ManifestImport();
126 virtual void SAL_CALL startDocument( )
127 throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 virtual void SAL_CALL endDocument( )
129 throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 virtual void SAL_CALL startElement( const OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs )
131 throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 virtual void SAL_CALL endElement( const OUString& aName )
133 throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 virtual void SAL_CALL characters( const OUString& aChars )
135 throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
136 virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces )
137 throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
138 virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData )
139 throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
140 virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator )
141 throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 private:
143 void doFileEntry(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
144 void doEncryptionData(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
145 void doAlgorithm(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
146 void doKeyDerivation(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
147 void doStartKeyAlg(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
149 #endif
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */