1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include <tools/link.hxx>
25 #include <rtl/ustring.hxx>
26 
27 #include <cppuhelper/implbase1.hxx>
28 #include <cppuhelper/implbase3.hxx>
29 
30 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
31 #include <com/sun/star/xml/crypto/sax/XSignatureCreationResultListener.hpp>
32 #include <com/sun/star/xml/crypto/sax/XSignatureVerifyResultListener.hpp>
33 
34 namespace com {
35 namespace sun {
36 namespace star {
37 namespace io {
38     class XStream;
39     class XOutputStream;
40     class XInputStream; }
41 namespace embed {
42     class XStorage; }
43 }}}
44 
45 
46 // MT: Not needed any more, remove later...
47 
48 class ImplXMLSignatureListener : public cppu::WeakImplHelper3
49 <
50 	com::sun::star::xml::crypto::sax::XSignatureCreationResultListener,
51 	com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener,
52 	com::sun::star::xml::sax::XDocumentHandler
53 >
54 {
55 private:
56     Link        maCreationResultListenerListener;
57     Link        maVerifyResultListenerListener;
58     Link        maStartVerifySignatureElementListener;
59 
60 	com::sun::star::uno::Reference<
61 		com::sun::star::xml::sax::XDocumentHandler > m_xNextHandler;
62 
63 public:
64 	ImplXMLSignatureListener( const Link& rCreationResultListenerListener, const Link rVerifyResultListenerListener, const Link rStartVerifySignatureElement );
65 	~ImplXMLSignatureListener();
66 
67 	void setNextHandler(com::sun::star::uno::Reference<
68 		com::sun::star::xml::sax::XDocumentHandler > xNextHandler);
69 
70 	// com::sun::star::xml::crypto::sax::XSignatureCreationResultListener
71 	virtual void SAL_CALL signatureCreated( sal_Int32 securityId, com::sun::star::xml::crypto::SecurityOperationStatus creationResult )
72 		throw (com::sun::star::uno::RuntimeException);
73 
74     // com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener
75     virtual void SAL_CALL signatureVerified( sal_Int32 securityId, com::sun::star::xml::crypto::SecurityOperationStatus verifyResult )
76 		throw (com::sun::star::uno::RuntimeException);
77 
78     // com::sun::star::xml::sax::XDocumentHandler
79 	virtual void SAL_CALL startElement( const rtl::OUString& aName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttribs )
80 		throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
81 
82 	virtual void SAL_CALL startDocument(  )
83 		throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
84 
85 	virtual void SAL_CALL endDocument(  )
86 		throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
87 
88 	virtual void SAL_CALL endElement( const rtl::OUString& aName )
89 		throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
90 
91 	virtual void SAL_CALL characters( const rtl::OUString& aChars )
92 		throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
93 
94 	virtual void SAL_CALL ignorableWhitespace( const rtl::OUString& aWhitespaces )
95 		throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
96 
97 	virtual void SAL_CALL processingInstruction( const rtl::OUString& aTarget, const rtl::OUString& aData )
98 		throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
99 
100 	virtual void SAL_CALL setDocumentLocator( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XLocator >& xLocator )
101 		throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
102 };
103 
104 
105 // ---------------------------------------------------------------------------------
106 // XUriBinding
107 // ---------------------------------------------------------------------------------
108 
109 class UriBindingHelper : public cppu::WeakImplHelper1
110 <
111 	com::sun::star::xml::crypto::XUriBinding
112 >
113 {
114 private:
115     com::sun::star::uno::Reference < com::sun::star::embed::XStorage > mxStorage;
116 
117 
118 public:
119     UriBindingHelper();
120     UriBindingHelper( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rxStorage );
121 
122     void SAL_CALL setUriBinding( const rtl::OUString& uri, const com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& aInputStream )
123 		throw (com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
124 
125     com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL getUriBinding( const rtl::OUString& uri )
126 		throw (com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
127 
128     static com::sun::star::uno::Reference < com::sun::star::io::XInputStream > OpenInputStream( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rxStore, const rtl::OUString& rURI );
129 };
130 
131