1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include <tools/link.hxx> 29 #include <rtl/ustring.hxx> 30 31 #include <cppuhelper/implbase1.hxx> 32 #include <cppuhelper/implbase3.hxx> 33 34 #include <com/sun/star/xml/sax/XDocumentHandler.hpp> 35 #include <com/sun/star/xml/crypto/sax/XSignatureCreationResultListener.hpp> 36 #include <com/sun/star/xml/crypto/sax/XSignatureVerifyResultListener.hpp> 37 38 namespace com { 39 namespace sun { 40 namespace star { 41 namespace io { 42 class XStream; 43 class XOutputStream; 44 class XInputStream; } 45 namespace embed { 46 class XStorage; } 47 }}} 48 49 50 // MT: Not needed any more, remove later... 51 52 class ImplXMLSignatureListener : public cppu::WeakImplHelper3 53 < 54 com::sun::star::xml::crypto::sax::XSignatureCreationResultListener, 55 com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener, 56 com::sun::star::xml::sax::XDocumentHandler 57 > 58 { 59 private: 60 Link maCreationResultListenerListener; 61 Link maVerifyResultListenerListener; 62 Link maStartVerifySignatureElementListener; 63 64 com::sun::star::uno::Reference< 65 com::sun::star::xml::sax::XDocumentHandler > m_xNextHandler; 66 67 public: 68 ImplXMLSignatureListener( const Link& rCreationResultListenerListener, const Link rVerifyResultListenerListener, const Link rStartVerifySignatureElement ); 69 ~ImplXMLSignatureListener(); 70 71 void setNextHandler(com::sun::star::uno::Reference< 72 com::sun::star::xml::sax::XDocumentHandler > xNextHandler); 73 74 // com::sun::star::xml::crypto::sax::XSignatureCreationResultListener 75 virtual void SAL_CALL signatureCreated( sal_Int32 securityId, com::sun::star::xml::crypto::SecurityOperationStatus creationResult ) 76 throw (com::sun::star::uno::RuntimeException); 77 78 // com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener 79 virtual void SAL_CALL signatureVerified( sal_Int32 securityId, com::sun::star::xml::crypto::SecurityOperationStatus verifyResult ) 80 throw (com::sun::star::uno::RuntimeException); 81 82 // com::sun::star::xml::sax::XDocumentHandler 83 virtual void SAL_CALL startElement( const rtl::OUString& aName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttribs ) 84 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); 85 86 virtual void SAL_CALL startDocument( ) 87 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); 88 89 virtual void SAL_CALL endDocument( ) 90 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); 91 92 virtual void SAL_CALL endElement( const rtl::OUString& aName ) 93 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); 94 95 virtual void SAL_CALL characters( const rtl::OUString& aChars ) 96 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); 97 98 virtual void SAL_CALL ignorableWhitespace( const rtl::OUString& aWhitespaces ) 99 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); 100 101 virtual void SAL_CALL processingInstruction( const rtl::OUString& aTarget, const rtl::OUString& aData ) 102 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); 103 104 virtual void SAL_CALL setDocumentLocator( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XLocator >& xLocator ) 105 throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException); 106 }; 107 108 109 // --------------------------------------------------------------------------------- 110 // XUriBinding 111 // --------------------------------------------------------------------------------- 112 113 class UriBindingHelper : public cppu::WeakImplHelper1 114 < 115 com::sun::star::xml::crypto::XUriBinding 116 > 117 { 118 private: 119 com::sun::star::uno::Reference < com::sun::star::embed::XStorage > mxStorage; 120 121 122 public: 123 UriBindingHelper(); 124 UriBindingHelper( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rxStorage ); 125 126 void SAL_CALL setUriBinding( const rtl::OUString& uri, const com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& aInputStream ) 127 throw (com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 128 129 com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL getUriBinding( const rtl::OUString& uri ) 130 throw (com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 131 132 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 ); 133 }; 134 135