1 /*************************************************************************
2  *
3  *  The Contents of this file are made available subject to the terms of
4  *  the BSD license.
5  *
6  *  Copyright 2000, 2010 Oracle and/or its affiliates.
7  *  All rights reserved.
8  *
9  *  Redistribution and use in source and binary forms, with or without
10  *  modification, are permitted provided that the following conditions
11  *  are met:
12  *  1. Redistributions of source code must retain the above copyright
13  *     notice, this list of conditions and the following disclaimer.
14  *  2. Redistributions in binary form must reproduce the above copyright
15  *     notice, this list of conditions and the following disclaimer in the
16  *     documentation and/or other materials provided with the distribution.
17  *  3. Neither the name of Sun Microsystems, Inc. nor the names of its
18  *     contributors may be used to endorse or promote products derived
19  *     from this software without specific prior written permission.
20  *
21  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
30  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  *************************************************************************/
34 
35 #ifndef _Addon_HXX
36 #define _Addon_HXX
37 
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <com/sun/star/frame/XDispatchProvider.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <cppuhelper/implbase4.hxx>
42 
43 #define IMPLEMENTATION_NAME "org.openoffice.Office.addon.example"
44 
45 namespace com
46 {
47 	namespace sun
48 	{
49 		namespace star
50 		{
51 			namespace frame
52 			{
53 				class XFrame;
54 			}
55 			namespace awt
56 			{
57 			    class XToolkit;
58 			}
59 		}
60 	}
61 }
62 
63 class Addon : public cppu::WeakImplHelper4
64 <
65 	com::sun::star::frame::XDispatchProvider,
66 	com::sun::star::frame::XDispatch,
67 	com::sun::star::lang::XInitialization,
68 	com::sun::star::lang::XServiceInfo
69 >
70 {
71 private:
72     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
73 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
74 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > mxToolkit;
75 
76 public:
77 	Addon( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
78         : mxMSF( rxMSF ) {}
79 
80 	// XDispatchProvider
81 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
82 			SAL_CALL queryDispatch(	const ::com::sun::star::util::URL& aURL,
83 				const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags )
84 				throw( ::com::sun::star::uno::RuntimeException );
85 	virtual ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > >
86 		SAL_CALL queryDispatches(
87 			const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
88 			throw( ::com::sun::star::uno::RuntimeException );
89 
90 	// XDispatch
91     virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL,
92 		const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs )
93 		throw (::com::sun::star::uno::RuntimeException);
94     virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl,
95 		const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
96     virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl,
97 		const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
98 
99 	// XInitialization
100     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
101 		throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
102 
103 	// XServiceInfo
104     virtual ::rtl::OUString SAL_CALL getImplementationName(  )
105 		throw (::com::sun::star::uno::RuntimeException);
106     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
107 		throw (::com::sun::star::uno::RuntimeException);
108     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
109 		throw (::com::sun::star::uno::RuntimeException);
110 };
111 
112 ::rtl::OUString Addon_getImplementationName()
113 	throw ( ::com::sun::star::uno::RuntimeException );
114 
115 sal_Bool SAL_CALL Addon_supportsService( const ::rtl::OUString& ServiceName )
116 	throw ( ::com::sun::star::uno::RuntimeException );
117 
118 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL Addon_getSupportedServiceNames(  )
119 	throw ( ::com::sun::star::uno::RuntimeException );
120 
121 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
122 SAL_CALL Addon_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
123 	throw ( ::com::sun::star::uno::Exception );
124 
125 #endif // _Addon_HXX
126