xref: /AOO41X/main/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.hxx (revision 34dd1e2512dbacb6a9a7e4c7f17b9296daa8eff3)
1*34dd1e25SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*34dd1e25SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*34dd1e25SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*34dd1e25SAndrew Rist  * distributed with this work for additional information
6*34dd1e25SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*34dd1e25SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*34dd1e25SAndrew Rist  * "License"); you may not use this file except in compliance
9*34dd1e25SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*34dd1e25SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*34dd1e25SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*34dd1e25SAndrew Rist  * software distributed under the License is distributed on an
15*34dd1e25SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*34dd1e25SAndrew Rist  * KIND, either express or implied.  See the License for the
17*34dd1e25SAndrew Rist  * specific language governing permissions and limitations
18*34dd1e25SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*34dd1e25SAndrew Rist  *************************************************************/
21*34dd1e25SAndrew Rist 
22*34dd1e25SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _Addon_HXX
25cdf0e10cSrcweir #define _Addon_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
28cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
30cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #define IMPLEMENTATION_NAME "org.openoffice.Office.addon.example"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace com
35cdf0e10cSrcweir {
36cdf0e10cSrcweir 	namespace sun
37cdf0e10cSrcweir 	{
38cdf0e10cSrcweir 		namespace star
39cdf0e10cSrcweir 		{
40cdf0e10cSrcweir 			namespace frame
41cdf0e10cSrcweir 			{
42cdf0e10cSrcweir 				class XFrame;
43cdf0e10cSrcweir 			}
44cdf0e10cSrcweir 			namespace awt
45cdf0e10cSrcweir 			{
46cdf0e10cSrcweir 			    class XToolkit;
47cdf0e10cSrcweir 			}
48cdf0e10cSrcweir 		}
49cdf0e10cSrcweir 	}
50cdf0e10cSrcweir }
51cdf0e10cSrcweir 
52cdf0e10cSrcweir class Addon : public cppu::WeakImplHelper4
53cdf0e10cSrcweir <
54cdf0e10cSrcweir 	com::sun::star::frame::XDispatchProvider,
55cdf0e10cSrcweir 	com::sun::star::frame::XDispatch,
56cdf0e10cSrcweir 	com::sun::star::lang::XInitialization,
57cdf0e10cSrcweir 	com::sun::star::lang::XServiceInfo
58cdf0e10cSrcweir >
59cdf0e10cSrcweir {
60cdf0e10cSrcweir private:
61cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
62cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
63cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > mxToolkit;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir public:
Addon(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> & rxMSF)66cdf0e10cSrcweir 	Addon( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
67cdf0e10cSrcweir         : mxMSF( rxMSF ) {}
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	// XDispatchProvider
70cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
71cdf0e10cSrcweir 			SAL_CALL queryDispatch(	const ::com::sun::star::util::URL& aURL,
72cdf0e10cSrcweir 				const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags )
73cdf0e10cSrcweir 				throw( ::com::sun::star::uno::RuntimeException );
74cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > >
75cdf0e10cSrcweir 		SAL_CALL queryDispatches(
76cdf0e10cSrcweir 			const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
77cdf0e10cSrcweir 			throw( ::com::sun::star::uno::RuntimeException );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	// XDispatch
80cdf0e10cSrcweir     virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL,
81cdf0e10cSrcweir 		const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs )
82cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir     virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl,
84cdf0e10cSrcweir 		const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir     virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl,
86cdf0e10cSrcweir 		const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	// XInitialization
89cdf0e10cSrcweir     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
90cdf0e10cSrcweir 		throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	// XServiceInfo
93cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName(  )
94cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
96cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
97cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
98cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir };
100cdf0e10cSrcweir 
101cdf0e10cSrcweir ::rtl::OUString Addon_getImplementationName()
102cdf0e10cSrcweir 	throw ( ::com::sun::star::uno::RuntimeException );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir sal_Bool SAL_CALL Addon_supportsService( const ::rtl::OUString& ServiceName )
105cdf0e10cSrcweir 	throw ( ::com::sun::star::uno::RuntimeException );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL Addon_getSupportedServiceNames(  )
108cdf0e10cSrcweir 	throw ( ::com::sun::star::uno::RuntimeException );
109cdf0e10cSrcweir 
110cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
111cdf0e10cSrcweir SAL_CALL Addon_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
112cdf0e10cSrcweir 	throw ( ::com::sun::star::uno::Exception );
113cdf0e10cSrcweir 
114cdf0e10cSrcweir #endif // _Addon_HXX
115