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_SDEXT_SOURCE_PRESENTER_PRESENTERPROTOCOLHANDLER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPROTOCOLHANDLER_HXX
22 
23 #include <cppuhelper/compbase.hxx>
24 #include <cppuhelper/basemutex.hxx>
25 #include <com/sun/star/frame/XDispatchProvider.hpp>
26 #include <com/sun/star/frame/XDispatch.hpp>
27 #include <com/sun/star/lang/XInitialization.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <rtl/ref.hxx>
30 
31 namespace sdext::presenter {
32 
33 typedef ::cppu::WeakComponentImplHelper <
34     css::lang::XInitialization,
35     css::lang::XServiceInfo,
36     css::frame::XDispatchProvider
37 > PresenterProtocolHandlerInterfaceBase;
38 
39 class PresenterController;
40 
41 class PresenterProtocolHandler
42     : protected ::cppu::BaseMutex,
43       public PresenterProtocolHandlerInterfaceBase
44 {
45 public:
46     PresenterProtocolHandler ();
47     virtual ~PresenterProtocolHandler() override;
48 
49     void SAL_CALL disposing() override;
50 
51     // XInitialization
52 
53     virtual void SAL_CALL initialize(
54         const css::uno::Sequence<css::uno::Any>& aArguments) override;
55 
56     OUString SAL_CALL getImplementationName() override;
57 
58     sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
59 
60     css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
61 
62     // XDispatchProvider
63 
64     virtual css::uno::Reference<css::frame::XDispatch > SAL_CALL
65         queryDispatch (
66             const css::util::URL& aURL,
67             const OUString& aTargetFrameName,
68             sal_Int32 nSearchFlags ) override;
69 
70     virtual css::uno::Sequence<css::uno::Reference<css::frame::XDispatch> > SAL_CALL
71         queryDispatches(
72             const css::uno::Sequence< css::frame::DispatchDescriptor>& rDescriptors) override;
73 
74 private:
75     class Dispatch;
76     ::rtl::Reference<PresenterController> mpPresenterController;
77 
78     /// @throws css::lang::DisposedException
79     void ThrowIfDisposed() const;
80 };
81 
82 }
83 
84 #endif
85 
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
87