tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / package / source / manifest / ManifestImport.hxx
blob883f1de62387df4e8def7c4c74a12c82e98afbc4
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/implbase.hxx>
24 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
25 #include <com/sun/star/beans/NamedValue.hpp>
26 #include <unordered_map>
27 #include <utility>
28 #include <vector>
29 #include <rtl/ustrbuf.hxx>
31 namespace com::sun::star {
32 namespace xml::sax { class XAttributeList; }
33 namespace beans { struct PropertyValue; }
36 typedef std::unordered_map< OUString, OUString > StringHashMap;
38 struct ManifestScopeEntry
40 OUString m_aConvertedName;
41 StringHashMap m_aNamespaces;
42 bool m_bValid;
44 ManifestScopeEntry( OUString aConvertedName, StringHashMap&& aNamespaces )
45 : m_aConvertedName(std::move( aConvertedName ))
46 , m_aNamespaces( std::move(aNamespaces) )
47 , m_bValid( true )
51 typedef ::std::vector< ManifestScopeEntry > ManifestStack;
53 class ManifestImport final : public cppu::WeakImplHelper < css::xml::sax::XDocumentHandler >
55 std::vector< css::beans::NamedValue > aKeyInfoSequence;
56 std::vector< css::uno::Sequence< css::beans::NamedValue > > aKeys;
57 std::vector< css::beans::PropertyValue > aSequence;
58 OUStringBuffer aCurrentCharacters{64};
59 ManifestStack aStack;
60 bool bIgnoreEncryptData;
61 bool bPgpEncryption;
62 sal_Int32 nDerivedKeySize;
63 ::std::vector < css::uno::Sequence < css::beans::PropertyValue > > & rManVector;
64 OUString m_PackageVersion; // on root element
67 OUString PushNameAndNamespaces( const OUString& aName,
68 const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs,
69 StringHashMap& o_aConvertedAttribs );
70 static OUString ConvertNameWithNamespace( const OUString& aName, const StringHashMap& aNamespaces );
71 OUString ConvertName( const OUString& aName );
73 public:
74 ManifestImport( std::vector < css::uno::Sequence < css::beans::PropertyValue > > & rNewVector );
75 virtual ~ManifestImport() override;
76 virtual void SAL_CALL startDocument( ) override;
77 virtual void SAL_CALL endDocument( ) override;
78 virtual void SAL_CALL startElement( const OUString& aName, const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs ) override;
79 virtual void SAL_CALL endElement( const OUString& aName ) override;
80 virtual void SAL_CALL characters( const OUString& aChars ) override;
81 virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) override;
82 virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) override;
83 virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& xLocator ) override;
85 private:
86 /// @throws css::uno::RuntimeException
87 void doFileEntry(StringHashMap &rConvertedAttribs);
88 /// @throws css::uno::RuntimeException
89 void doEncryptionData(StringHashMap &rConvertedAttribs);
90 /// @throws css::uno::RuntimeException
91 void doAlgorithm(StringHashMap &rConvertedAttribs);
92 /// @throws css::uno::RuntimeException
93 void doKeyDerivation(StringHashMap &rConvertedAttribs);
94 /// @throws css::uno::RuntimeException
95 void doStartKeyAlg(StringHashMap &rConvertedAttribs);
96 void doEncryptedKey(StringHashMap &);
97 void doEncryptionMethod(StringHashMap &, const OUString &);
98 void doEncryptedCipherValue();
99 void doEncryptedKeyId();
100 void doEncryptedKeyPacket();
102 #endif
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */