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