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 #ifndef __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_
29 #define __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_
30 
31 //_________________________________________________________________________________________________________________
32 //	my own includes
33 //_________________________________________________________________________________________________________________
34 
35 #ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
36 #include <threadhelp/threadhelpbase.hxx>
37 #endif
38 
39 #ifndef __FRAMEWORK_THREADHELP_RESETABLEGUARD_HXX_
40 #include <threadhelp/resetableguard.hxx>
41 #endif
42 
43 #ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_
44 #include <macros/xinterface.hxx>
45 #endif
46 
47 #ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_
48 #include <macros/xtypeprovider.hxx>
49 #endif
50 
51 #ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_
52 #include <macros/xserviceinfo.hxx>
53 #endif
54 
55 #ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
56 #include <macros/debug.hxx>
57 #endif
58 
59 #ifndef __FRAMEWORK_MACROS_GENERIC_HXX_
60 #include <macros/generic.hxx>
61 #endif
62 
63 #ifndef __FRAMEWORK_GENERAL_H_
64 #include <general.h>
65 #endif
66 
67 #ifndef __FRAMEWORK_STDTYPES_H_
68 #include <stdtypes.h>
69 #endif
70 
71 //_________________________________________________________________________________________________________________
72 //	interface includes
73 //_________________________________________________________________________________________________________________
74 
75 #ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
76 #include <com/sun/star/lang/XTypeProvider.hpp>
77 #endif
78 
79 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
80 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
81 #endif
82 
83 #ifndef _COM_SUN_STAR_FRAME_XNOTIFYINGDISPATCH_HPP_
84 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
85 #endif
86 
87 #ifndef _COM_SUN_STAR_FRAME_XSTATUSLISTENER_HPP_
88 #include <com/sun/star/frame/XStatusListener.hpp>
89 #endif
90 
91 #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
92 #include <com/sun/star/frame/XFrame.hpp>
93 #endif
94 
95 #ifndef _COM_SUN_STAR_DOCUMENT_XEXTENDEDFILTERDETECTION_HPP_
96 #include <com/sun/star/document/XExtendedFilterDetection.hpp>
97 #endif
98 
99 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
100 #include <com/sun/star/beans/PropertyValue.hpp>
101 #endif
102 
103 #ifndef _COM_SUN_STAR_UTIL_URL_HPP_
104 #include <com/sun/star/util/URL.hpp>
105 #endif
106 
107 //_________________________________________________________________________________________________________________
108 //	other includes
109 //_________________________________________________________________________________________________________________
110 
111 #ifndef _CPPUHELPER_WEAK_HXX_
112 #include <cppuhelper/weak.hxx>
113 #endif
114 
115 //_________________________________________________________________________________________________________________
116 //	namespace
117 //_________________________________________________________________________________________________________________
118 
119 namespace framework{
120 
121 //_________________________________________________________________________________________________________________
122 //	exported const
123 //_________________________________________________________________________________________________________________
124 
125 //_________________________________________________________________________________________________________________
126 //	exported definitions
127 //_________________________________________________________________________________________________________________
128 
129 /*-************************************************************************************************************//**
130     @short          handler to detect and play sounds ("wav" and "au" only!)
131     @descr          Register this implementation as a content handler to detect and/or play wav- and au-sounds.
132                     It doesn't depend from the target platform. But one instance of this class
133                     can play one sound at the same time only. Means every new dispatch request will stop the
134                     might still running one. So we support one operation/one URL/one listener at the same time
135                     only.
136 
137     @devstatus      ready
138     @threadsafe     yes
139 *//*-*************************************************************************************************************/
140 class Oxt_Handler  :   // interfaces
141                         public  css::lang::XTypeProvider
142                     ,   public  css::lang::XServiceInfo
143                     ,   public  css::frame::XNotifyingDispatch // => XDispatch
144                     ,   public  css::document::XExtendedFilterDetection
145                         // baseclasses
146                         // Order is neccessary for right initialization!
147                     ,   private ThreadHelpBase
148                     ,   public  ::cppu::OWeakObject
149 {
150 	//-------------------------------------------------------------------------------------------------------------
151 	//	public methods
152 	//-------------------------------------------------------------------------------------------------------------
153 	public:
154 
155 		//---------------------------------------------------------------------------------------------------------
156 		//	constructor / destructor
157 		//---------------------------------------------------------------------------------------------------------
158                  Oxt_Handler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
159         virtual ~Oxt_Handler(                                                                        );
160 
161 		//---------------------------------------------------------------------------------------------------------
162         //  XInterface, XTypeProvider, XServiceInfo
163 		//---------------------------------------------------------------------------------------------------------
164 		FWK_DECLARE_XINTERFACE
165 		FWK_DECLARE_XTYPEPROVIDER
166             DECLARE_XSERVICEINFO
167 
168         //---------------------------------------------------------------------------------------------------------
169         //  XNotifyingDispatch
170         //---------------------------------------------------------------------------------------------------------
171         virtual void SAL_CALL dispatchWithNotification(const css::util::URL&                                             aURL      ,
172                                                        const css::uno::Sequence< css::beans::PropertyValue >&            lArguments,
173                                                        const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw( css::uno::RuntimeException );
174 
175 		//---------------------------------------------------------------------------------------------------------
176 		//	XDispatch
177 		//---------------------------------------------------------------------------------------------------------
178         virtual void SAL_CALL dispatch              (  const css::util::URL&                                     aURL        ,
179                                                        const css::uno::Sequence< css::beans::PropertyValue >&    lArguments  ) throw( css::uno::RuntimeException );
180         // not supported !
181         virtual void SAL_CALL addStatusListener     (  const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/   ,
182                                                        const css::util::URL&                                     /*aURL*/        ) throw( css::uno::RuntimeException ) {};
183         virtual void SAL_CALL removeStatusListener  (  const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/   ,
184                                                        const css::util::URL&                                     /*aURL*/        ) throw( css::uno::RuntimeException ) {};
185 
186 		//---------------------------------------------------------------------------------------------------------
187         //  XExtendedFilterDetection
188 		//---------------------------------------------------------------------------------------------------------
189         virtual ::rtl::OUString SAL_CALL detect     (        css::uno::Sequence< css::beans::PropertyValue >&    lDescriptor ) throw( css::uno::RuntimeException );
190 
191 	//-------------------------------------------------------------------------------------------------------------
192 	//	protected methods
193 	//-------------------------------------------------------------------------------------------------------------
194 	protected:
195 
196 	//-------------------------------------------------------------------------------------------------------------
197 	//	private methods
198 	//-------------------------------------------------------------------------------------------------------------
199 	private:
200 
201 	//-------------------------------------------------------------------------------------------------------------
202 	//	variables
203 	//	(should be private everyway!)
204 	//-------------------------------------------------------------------------------------------------------------
205 	private:
206 
207         css::uno::Reference< css::lang::XMultiServiceFactory >     m_xFactory          ;   /// global uno service factory to create new services
208         css::uno::Reference< css::uno::XInterface >                m_xSelfHold         ;   /// we must protect us against dieing during async(!) dispatch() call!
209         css::uno::Reference< css::frame::XDispatchResultListener > m_xListener         ;
210 
211 };      //  class Oxt_Handler
212 
213 }		//	namespace framework
214 
215 #endif  //  #ifndef __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_
216