Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_
21 : #define __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_
22 :
23 : #include <threadhelp/threadhelpbase.hxx>
24 : #include <threadhelp/resetableguard.hxx>
25 : #include <macros/xinterface.hxx>
26 : #include <macros/xtypeprovider.hxx>
27 : #include <macros/xserviceinfo.hxx>
28 : #include <macros/debug.hxx>
29 : #include <macros/generic.hxx>
30 : #include <general.h>
31 : #include <stdtypes.h>
32 :
33 : #include <com/sun/star/lang/XTypeProvider.hpp>
34 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 : #include <com/sun/star/frame/XNotifyingDispatch.hpp>
36 : #include <com/sun/star/frame/XStatusListener.hpp>
37 : #include <com/sun/star/frame/XFrame.hpp>
38 : #include <com/sun/star/document/XExtendedFilterDetection.hpp>
39 : #include <com/sun/star/beans/PropertyValue.hpp>
40 : #include <com/sun/star/util/URL.hpp>
41 :
42 : #include <cppuhelper/weak.hxx>
43 :
44 : namespace framework{
45 :
46 : /*-************************************************************************************************************//**
47 : @short handler to detect and play sounds ("wav" and "au" only!)
48 : @descr Register this implementation as a content handler to detect and/or play wav- and au-sounds.
49 : It doesn't depend from the target platform. But one instance of this class
50 : can play one sound at the same time only. Means every new dispatch request will stop the
51 : might still running one. So we support one operation/one URL/one listener at the same time
52 : only.
53 :
54 : @devstatus ready
55 : @threadsafe yes
56 : *//*-*************************************************************************************************************/
57 : class Oxt_Handler : // interfaces
58 : public css::lang::XTypeProvider
59 : , public css::lang::XServiceInfo
60 : , public css::frame::XNotifyingDispatch // => XDispatch
61 : , public css::document::XExtendedFilterDetection
62 : // baseclasses
63 : // Order is neccessary for right initialization!
64 : , private ThreadHelpBase
65 : , public ::cppu::OWeakObject
66 : {
67 : //-------------------------------------------------------------------------------------------------------------
68 : // public methods
69 : //-------------------------------------------------------------------------------------------------------------
70 : public:
71 :
72 : //---------------------------------------------------------------------------------------------------------
73 : // constructor / destructor
74 : //---------------------------------------------------------------------------------------------------------
75 : Oxt_Handler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
76 : virtual ~Oxt_Handler( );
77 :
78 : //---------------------------------------------------------------------------------------------------------
79 : // XInterface, XTypeProvider, XServiceInfo
80 : //---------------------------------------------------------------------------------------------------------
81 : FWK_DECLARE_XINTERFACE
82 : FWK_DECLARE_XTYPEPROVIDER
83 : DECLARE_XSERVICEINFO
84 :
85 : //---------------------------------------------------------------------------------------------------------
86 : // XNotifyingDispatch
87 : //---------------------------------------------------------------------------------------------------------
88 : virtual void SAL_CALL dispatchWithNotification(const css::util::URL& aURL ,
89 : const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
90 : const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw( css::uno::RuntimeException );
91 :
92 : //---------------------------------------------------------------------------------------------------------
93 : // XDispatch
94 : //---------------------------------------------------------------------------------------------------------
95 : virtual void SAL_CALL dispatch ( const css::util::URL& aURL ,
96 : const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException );
97 : // not supported !
98 0 : virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/ ,
99 0 : const css::util::URL& /*aURL*/ ) throw( css::uno::RuntimeException ) {};
100 0 : virtual void SAL_CALL removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/ ,
101 0 : const css::util::URL& /*aURL*/ ) throw( css::uno::RuntimeException ) {};
102 :
103 : //---------------------------------------------------------------------------------------------------------
104 : // XExtendedFilterDetection
105 : //---------------------------------------------------------------------------------------------------------
106 : virtual ::rtl::OUString SAL_CALL detect ( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ) throw( css::uno::RuntimeException );
107 :
108 : //-------------------------------------------------------------------------------------------------------------
109 : // protected methods
110 : //-------------------------------------------------------------------------------------------------------------
111 : protected:
112 :
113 : //-------------------------------------------------------------------------------------------------------------
114 : // private methods
115 : //-------------------------------------------------------------------------------------------------------------
116 : private:
117 :
118 : //-------------------------------------------------------------------------------------------------------------
119 : // variables
120 : // (should be private everyway!)
121 : //-------------------------------------------------------------------------------------------------------------
122 : private:
123 :
124 : css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// global uno service factory to create new services
125 : css::uno::Reference< css::uno::XInterface > m_xSelfHold ; /// we must protect us against dieing during async(!) dispatch() call!
126 : css::uno::Reference< css::frame::XDispatchResultListener > m_xListener ;
127 :
128 : }; // class Oxt_Handler
129 :
130 : } // namespace framework
131 :
132 : #endif // #ifndef __FRAMEWORK_HANDLER_OXT_HANDLER_HXX_
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|