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 INCLUDED_FRAMEWORK_INC_DISPATCH_OXT_HANDLER_HXX
21 : #define INCLUDED_FRAMEWORK_INC_DISPATCH_OXT_HANDLER_HXX
22 :
23 : #include <macros/xinterface.hxx>
24 : #include <macros/xtypeprovider.hxx>
25 : #include <macros/xserviceinfo.hxx>
26 : #include <macros/generic.hxx>
27 : #include <general.h>
28 : #include <stdtypes.h>
29 :
30 : #include <com/sun/star/lang/XTypeProvider.hpp>
31 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 : #include <com/sun/star/frame/XNotifyingDispatch.hpp>
33 : #include <com/sun/star/frame/XStatusListener.hpp>
34 : #include <com/sun/star/frame/XFrame.hpp>
35 : #include <com/sun/star/document/XExtendedFilterDetection.hpp>
36 : #include <com/sun/star/beans/PropertyValue.hpp>
37 : #include <com/sun/star/util/URL.hpp>
38 :
39 : #include <cppuhelper/implbase3.hxx>
40 :
41 : namespace framework{
42 :
43 : /*-************************************************************************************************************
44 : @short handler to detect and play sounds ("wav" and "au" only!)
45 : @descr Register this implementation as a content handler to detect and/or play wav- and au-sounds.
46 : It doesn't depend from the target platform. But one instance of this class
47 : can play one sound at the same time only. Means every new dispatch request will stop the
48 : might still running one. So we support one operation/one URL/one listener at the same time
49 : only.
50 :
51 : @devstatus ready
52 : @threadsafe yes
53 : *//*-*************************************************************************************************************/
54 : class Oxt_Handler : public ::cppu::WeakImplHelper3<
55 : css::lang::XServiceInfo,
56 : css::frame::XNotifyingDispatch, // => XDispatch
57 : css::document::XExtendedFilterDetection >
58 : {
59 :
60 : // public methods
61 :
62 : public:
63 :
64 : // constructor / destructor
65 :
66 : Oxt_Handler( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
67 : virtual ~Oxt_Handler( );
68 :
69 : // XInterface, XTypeProvider, XServiceInfo
70 :
71 : DECLARE_XSERVICEINFO
72 :
73 : // XNotifyingDispatch
74 :
75 : virtual void SAL_CALL dispatchWithNotification(const css::util::URL& aURL ,
76 : const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
77 : const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
78 :
79 : // XDispatch
80 :
81 : virtual void SAL_CALL dispatch ( const css::util::URL& aURL ,
82 : const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
83 : // not supported !
84 0 : virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/ ,
85 0 : const css::util::URL& /*aURL*/ ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE {};
86 0 : virtual void SAL_CALL removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& /*xListener*/ ,
87 0 : const css::util::URL& /*aURL*/ ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE {};
88 :
89 : // XExtendedFilterDetection
90 : virtual OUString SAL_CALL detect ( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
91 :
92 : // protected methods
93 :
94 : protected:
95 :
96 : // private methods
97 :
98 : private:
99 :
100 : // variables
101 : // (should be private everyway!)
102 :
103 : private:
104 : osl::Mutex m_mutex;
105 :
106 : css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; /// global uno service factory to create new services
107 : css::uno::Reference< css::uno::XInterface > m_xSelfHold; /// we must protect us against dieing during async(!) dispatch() call!
108 : css::uno::Reference< css::frame::XDispatchResultListener > m_xListener;
109 :
110 : }; // class Oxt_Handler
111 :
112 : } // namespace framework
113 :
114 : #endif // INCLUDED_FRAMEWORK_INC_DISPATCH_OXT_HANDLER_HXX
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|