Update ooo320-m1
[ooovba.git] / xmlsecurity / source / helper / xsecparser.hxx
blobebba06d83379c9fbde50c9bca9beb5b3d8082ad1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xsecparser.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _XSEC_CTL_PARSER_HXX
32 #define _XSEC_CTL_PARSER_HXX
34 #include <xsecctl.hxx>
36 #include <com/sun/star/xml/sax/XParser.hpp>
37 #include <com/sun/star/lang/XInitialization.hpp>
38 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
39 #include <com/sun/star/xml/sax/XAttributeList.hpp>
41 #include <cppuhelper/implbase2.hxx>
43 class XSecParser: public cppu::WeakImplHelper2
45 com::sun::star::xml::sax::XDocumentHandler,
46 com::sun::star::lang::XInitialization
48 /****** XSecController.hxx/CLASS XSecParser ***********************************
50 * NAME
51 * XSecParser -- a SAX parser that can detect security elements
53 * FUNCTION
54 * The XSecParser object is connected on the SAX chain and detects
55 * security elements in the SAX event stream, then notifies
56 * the XSecController.
58 * HISTORY
59 * 05.01.2004 - Interface supported: XDocumentHandler, XInitialization
61 * NOTES
62 * This class is used when importing a document.
64 * AUTHOR
65 * Michael Mi
66 * Email: michael.mi@sun.com
67 ******************************************************************************/
69 friend class XSecController;
70 private:
72 * the following members are used to reserve the signature information,
73 * including X509IssuerName, X509SerialNumber, and X509Certificate,etc.
75 rtl::OUString m_ouX509IssuerName;
76 rtl::OUString m_ouX509SerialNumber;
77 rtl::OUString m_ouX509Certificate;
78 rtl::OUString m_ouDigestValue;
79 rtl::OUString m_ouSignatureValue;
80 rtl::OUString m_ouDate;
81 //rtl::OUString m_ouTime;
84 * whether inside a particular element
86 bool m_bInX509IssuerName;
87 bool m_bInX509SerialNumber;
88 bool m_bInX509Certificate;
89 bool m_bInDigestValue;
90 bool m_bInSignatureValue;
91 bool m_bInDate;
92 //bool m_bInTime;
95 * the XSecController collaborating with XSecParser
97 XSecController* m_pXSecController;
100 * the next XDocumentHandler on the SAX chain
102 com::sun::star::uno::Reference<
103 com::sun::star::xml::sax::XDocumentHandler > m_xNextHandler;
106 * this string is used to remember the current handled reference's URI,
108 * because it can be decided whether a stream reference is xml based or binary based
109 * only after the Transforms element is read in, so we have to reserve the reference's
110 * URI when the startElement event is met.
112 rtl::OUString m_currentReferenceURI;
113 bool m_bReferenceUnresolved;
115 private:
116 rtl::OUString getIdAttr(const com::sun::star::uno::Reference<
117 com::sun::star::xml::sax::XAttributeList >& xAttribs );
119 public:
120 XSecParser( XSecController* pXSecController,
121 const com::sun::star::uno::Reference<
122 com::sun::star::xml::sax::XDocumentHandler >& xNextHandler );
123 ~XSecParser(){};
126 * XDocumentHandler
128 virtual void SAL_CALL startDocument( )
129 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
131 virtual void SAL_CALL endDocument( )
132 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
134 virtual void SAL_CALL startElement(
135 const rtl::OUString& aName,
136 const com::sun::star::uno::Reference<
137 com::sun::star::xml::sax::XAttributeList >& xAttribs )
138 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
140 virtual void SAL_CALL endElement( const rtl::OUString& aName )
141 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
143 virtual void SAL_CALL characters( const rtl::OUString& aChars )
144 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
146 virtual void SAL_CALL ignorableWhitespace( const rtl::OUString& aWhitespaces )
147 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
149 virtual void SAL_CALL processingInstruction(
150 const rtl::OUString& aTarget,
151 const rtl::OUString& aData )
152 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
154 virtual void SAL_CALL setDocumentLocator(
155 const com::sun::star::uno::Reference<
156 com::sun::star::xml::sax::XLocator >& xLocator )
157 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
160 * XInitialization
162 virtual void SAL_CALL initialize(
163 const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments )
164 throw(com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
167 #endif