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 #ifndef _Addon_HXX 25 #define _Addon_HXX 26 27 #include <com/sun/star/lang/XInitialization.hpp> 28 #include <com/sun/star/frame/XDispatchProvider.hpp> 29 #include <com/sun/star/lang/XServiceInfo.hpp> 30 #include <cppuhelper/implbase4.hxx> 31 32 #define IMPLEMENTATION_NAME "org.openoffice.Office.addon.example" 33 34 namespace com 35 { 36 namespace sun 37 { 38 namespace star 39 { 40 namespace frame 41 { 42 class XFrame; 43 } 44 namespace awt 45 { 46 class XToolkit; 47 } 48 } 49 } 50 } 51 52 class Addon : public cppu::WeakImplHelper4 53 < 54 com::sun::star::frame::XDispatchProvider, 55 com::sun::star::frame::XDispatch, 56 com::sun::star::lang::XInitialization, 57 com::sun::star::lang::XServiceInfo 58 > 59 { 60 private: 61 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; 62 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame; 63 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > mxToolkit; 64 65 public: Addon(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> & rxMSF)66 Addon( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF) 67 : mxMSF( rxMSF ) {} 68 69 // XDispatchProvider 70 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > 71 SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, 72 const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags ) 73 throw( ::com::sun::star::uno::RuntimeException ); 74 virtual ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > 75 SAL_CALL queryDispatches( 76 const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor ) 77 throw( ::com::sun::star::uno::RuntimeException ); 78 79 // XDispatch 80 virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, 81 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) 82 throw (::com::sun::star::uno::RuntimeException); 83 virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, 84 const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException); 85 virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, 86 const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException); 87 88 // XInitialization 89 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) 90 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 91 92 // XServiceInfo 93 virtual ::rtl::OUString SAL_CALL getImplementationName( ) 94 throw (::com::sun::star::uno::RuntimeException); 95 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 96 throw (::com::sun::star::uno::RuntimeException); 97 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) 98 throw (::com::sun::star::uno::RuntimeException); 99 }; 100 101 ::rtl::OUString Addon_getImplementationName() 102 throw ( ::com::sun::star::uno::RuntimeException ); 103 104 sal_Bool SAL_CALL Addon_supportsService( const ::rtl::OUString& ServiceName ) 105 throw ( ::com::sun::star::uno::RuntimeException ); 106 107 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL Addon_getSupportedServiceNames( ) 108 throw ( ::com::sun::star::uno::RuntimeException ); 109 110 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > 111 SAL_CALL Addon_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) 112 throw ( ::com::sun::star::uno::Exception ); 113 114 #endif // _Addon_HXX 115