1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: oxt_handler.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_
32 #define __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_
34 //_________________________________________________________________________________________________________________
36 //_________________________________________________________________________________________________________________
38 #ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
39 #include <threadhelp/threadhelpbase.hxx>
42 #ifndef __FRAMEWORK_THREADHELP_RESETABLEGUARD_HXX_
43 #include <threadhelp/resetableguard.hxx>
46 #ifndef __FRAMEWORK_MACROS_XINTERFACE_HXX_
47 #include <macros/xinterface.hxx>
50 #ifndef __FRAMEWORK_MACROS_XTYPEPROVIDER_HXX_
51 #include <macros/xtypeprovider.hxx>
54 #ifndef __FRAMEWORK_MACROS_XSERVICEINFO_HXX_
55 #include <macros/xserviceinfo.hxx>
58 #ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
59 #include <macros/debug.hxx>
62 #ifndef __FRAMEWORK_MACROS_GENERIC_HXX_
63 #include <macros/generic.hxx>
66 #ifndef __FRAMEWORK_GENERAL_H_
70 #ifndef __FRAMEWORK_STDTYPES_H_
74 //_________________________________________________________________________________________________________________
76 //_________________________________________________________________________________________________________________
78 #ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
79 #include <com/sun/star/lang/XTypeProvider.hpp>
82 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
83 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
86 #ifndef _COM_SUN_STAR_FRAME_XNOTIFYINGDISPATCH_HPP_
87 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
90 #ifndef _COM_SUN_STAR_FRAME_XSTATUSLISTENER_HPP_
91 #include <com/sun/star/frame/XStatusListener.hpp>
94 #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
95 #include <com/sun/star/frame/XFrame.hpp>
98 #ifndef _COM_SUN_STAR_DOCUMENT_XEXTENDEDFILTERDETECTION_HPP_
99 #include <com/sun/star/document/XExtendedFilterDetection.hpp>
102 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
103 #include <com/sun/star/beans/PropertyValue.hpp>
106 #ifndef _COM_SUN_STAR_UTIL_URL_HPP_
107 #include <com/sun/star/util/URL.hpp>
110 //_________________________________________________________________________________________________________________
112 //_________________________________________________________________________________________________________________
114 #ifndef _CPPUHELPER_WEAK_HXX_
115 #include <cppuhelper/weak.hxx>
118 //_________________________________________________________________________________________________________________
120 //_________________________________________________________________________________________________________________
124 //_________________________________________________________________________________________________________________
126 //_________________________________________________________________________________________________________________
128 //_________________________________________________________________________________________________________________
129 // exported definitions
130 //_________________________________________________________________________________________________________________
132 /*-************************************************************************************************************//**
133 @short handler to detect and play sounds ("wav" and "au" only!)
134 @descr Register this implementation as a content handler to detect and/or play wav- and au-sounds.
135 It doesn't depend from the target platform. But one instance of this class
136 can play one sound at the same time only. Means every new dispatch request will stop the
137 might still running one. So we support one operation/one URL/one listener at the same time
142 *//*-*************************************************************************************************************/
143 class Oxt_Handler
: // interfaces
144 public css::lang::XTypeProvider
145 , public css::lang::XServiceInfo
146 , public css::frame::XNotifyingDispatch
// => XDispatch
147 , public css::document::XExtendedFilterDetection
149 // Order is neccessary for right initialization!
150 , private ThreadHelpBase
151 , public ::cppu::OWeakObject
153 //-------------------------------------------------------------------------------------------------------------
155 //-------------------------------------------------------------------------------------------------------------
158 //---------------------------------------------------------------------------------------------------------
159 // constructor / destructor
160 //---------------------------------------------------------------------------------------------------------
161 Oxt_Handler( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xFactory
);
162 virtual ~Oxt_Handler( );
164 //---------------------------------------------------------------------------------------------------------
165 // XInterface, XTypeProvider, XServiceInfo
166 //---------------------------------------------------------------------------------------------------------
167 FWK_DECLARE_XINTERFACE
168 FWK_DECLARE_XTYPEPROVIDER
171 //---------------------------------------------------------------------------------------------------------
172 // XNotifyingDispatch
173 //---------------------------------------------------------------------------------------------------------
174 virtual void SAL_CALL
dispatchWithNotification(const css::util::URL
& aURL
,
175 const css::uno::Sequence
< css::beans::PropertyValue
>& lArguments
,
176 const css::uno::Reference
< css::frame::XDispatchResultListener
>& xListener
) throw( css::uno::RuntimeException
);
178 //---------------------------------------------------------------------------------------------------------
180 //---------------------------------------------------------------------------------------------------------
181 virtual void SAL_CALL
dispatch ( const css::util::URL
& aURL
,
182 const css::uno::Sequence
< css::beans::PropertyValue
>& lArguments
) throw( css::uno::RuntimeException
);
184 virtual void SAL_CALL
addStatusListener ( const css::uno::Reference
< css::frame::XStatusListener
>& /*xListener*/ ,
185 const css::util::URL
& /*aURL*/ ) throw( css::uno::RuntimeException
) {};
186 virtual void SAL_CALL
removeStatusListener ( const css::uno::Reference
< css::frame::XStatusListener
>& /*xListener*/ ,
187 const css::util::URL
& /*aURL*/ ) throw( css::uno::RuntimeException
) {};
189 //---------------------------------------------------------------------------------------------------------
190 // XExtendedFilterDetection
191 //---------------------------------------------------------------------------------------------------------
192 virtual ::rtl::OUString SAL_CALL
detect ( css::uno::Sequence
< css::beans::PropertyValue
>& lDescriptor
) throw( css::uno::RuntimeException
);
194 //-------------------------------------------------------------------------------------------------------------
196 //-------------------------------------------------------------------------------------------------------------
199 //-------------------------------------------------------------------------------------------------------------
201 //-------------------------------------------------------------------------------------------------------------
204 //-------------------------------------------------------------------------------------------------------------
206 // (should be private everyway!)
207 //-------------------------------------------------------------------------------------------------------------
210 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xFactory
; /// global uno service factory to create new services
211 css::uno::Reference
< css::uno::XInterface
> m_xSelfHold
; /// we must protect us against dieing during async(!) dispatch() call!
212 css::uno::Reference
< css::frame::XDispatchResultListener
> m_xListener
;
214 }; // class Oxt_Handler
216 } // namespace framework
218 #endif // #ifndef __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_