Bump version to 5.0-14
[LibreOffice.git] / xmlsecurity / source / helper / xsecparser.hxx
blob85a9260d0ed5dca663aea16f7ee7a3be3e09e392
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_XMLSECURITY_SOURCE_HELPER_XSECPARSER_HXX
21 #define INCLUDED_XMLSECURITY_SOURCE_HELPER_XSECPARSER_HXX
23 #include "xsecctl.hxx"
25 #include <com/sun/star/xml/sax/XParser.hpp>
26 #include <com/sun/star/lang/XInitialization.hpp>
27 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
28 #include <com/sun/star/xml/sax/XAttributeList.hpp>
30 #include <cppuhelper/implbase2.hxx>
32 class XSecParser: public cppu::WeakImplHelper2
34 com::sun::star::xml::sax::XDocumentHandler,
35 com::sun::star::lang::XInitialization
37 /****** XSecController.hxx/CLASS XSecParser ***********************************
39 * NAME
40 * XSecParser -- a SAX parser that can detect security elements
42 * FUNCTION
43 * The XSecParser object is connected on the SAX chain and detects
44 * security elements in the SAX event stream, then notifies
45 * the XSecController.
47 * NOTES
48 * This class is used when importing a document.
50 * AUTHOR
51 * Michael Mi
52 * Email: michael.mi@sun.com
53 ******************************************************************************/
55 friend class XSecController;
56 private:
58 * the following members are used to reserve the signature information,
59 * including X509IssuerName, X509SerialNumber, and X509Certificate,etc.
61 OUString m_ouX509IssuerName;
62 OUString m_ouX509SerialNumber;
63 OUString m_ouX509Certificate;
64 OUString m_ouDigestValue;
65 OUString m_ouSignatureValue;
66 OUString m_ouDate;
69 * whether inside a particular element
71 bool m_bInX509IssuerName;
72 bool m_bInX509SerialNumber;
73 bool m_bInX509Certificate;
74 bool m_bInDigestValue;
75 bool m_bInSignatureValue;
76 bool m_bInDate;
79 * the XSecController collaborating with XSecParser
81 XSecController* m_pXSecController;
84 * the next XDocumentHandler on the SAX chain
86 com::sun::star::uno::Reference<
87 com::sun::star::xml::sax::XDocumentHandler > m_xNextHandler;
90 * this string is used to remember the current handled reference's URI,
92 * because it can be decided whether a stream reference is xml based or binary based
93 * only after the Transforms element is read in, so we have to reserve the reference's
94 * URI when the startElement event is met.
96 OUString m_currentReferenceURI;
97 bool m_bReferenceUnresolved;
99 private:
100 static OUString getIdAttr(const com::sun::star::uno::Reference<
101 com::sun::star::xml::sax::XAttributeList >& xAttribs );
103 public:
104 XSecParser( XSecController* pXSecController,
105 const com::sun::star::uno::Reference<
106 com::sun::star::xml::sax::XDocumentHandler >& xNextHandler );
107 virtual ~XSecParser(){};
110 * XDocumentHandler
112 virtual void SAL_CALL startDocument( )
113 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 virtual void SAL_CALL endDocument( )
116 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 virtual void SAL_CALL startElement(
119 const OUString& aName,
120 const com::sun::star::uno::Reference<
121 com::sun::star::xml::sax::XAttributeList >& xAttribs )
122 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 virtual void SAL_CALL endElement( const OUString& aName )
125 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 virtual void SAL_CALL characters( const OUString& aChars )
128 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces )
131 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 virtual void SAL_CALL processingInstruction(
134 const OUString& aTarget,
135 const OUString& aData )
136 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
138 virtual void SAL_CALL setDocumentLocator(
139 const com::sun::star::uno::Reference<
140 com::sun::star::xml::sax::XLocator >& xLocator )
141 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 * XInitialization
146 virtual void SAL_CALL initialize(
147 const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments )
148 throw(com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 #endif
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */