1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SDEXT_PRESENTER_PRESENTER_PROTOCOL_HANDLER_HXX
29 #define SDEXT_PRESENTER_PRESENTER_PROTOCOL_HANDLER_HXX
30 
31 #include <cppuhelper/compbase2.hxx>
32 #include <cppuhelper/basemutex.hxx>
33 #include <com/sun/star/frame/XDispatchProvider.hpp>
34 #include <com/sun/star/frame/XDispatch.hpp>
35 #include <com/sun/star/lang/XInitialization.hpp>
36 #include <com/sun/star/uno/XComponentContext.hpp>
37 #include <hash_map>
38 #include <rtl/ref.hxx>
39 #include <boost/scoped_ptr.hpp>
40 
41 namespace css = ::com::sun::star;
42 
43 namespace sdext { namespace presenter {
44 
45 
46 namespace {
47     typedef ::cppu::WeakComponentImplHelper2 <
48         css::lang::XInitialization,
49         css::frame::XDispatchProvider
50     > PresenterProtocolHandlerInterfaceBase;
51 }
52 
53 class PresenterController;
54 
55 class PresenterProtocolHandler
56     : protected ::cppu::BaseMutex,
57       public PresenterProtocolHandlerInterfaceBase
58 {
59 public:
60     PresenterProtocolHandler (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
61     virtual ~PresenterProtocolHandler (void);
62 
63     void SAL_CALL disposing (void);
64 
65     static ::rtl::OUString getImplementationName_static (void);
66     static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void);
67     static css::uno::Reference<css::uno::XInterface> Create(
68         const css::uno::Reference<css::uno::XComponentContext>& rxContext)
69         SAL_THROW((css::uno::Exception));
70 
71 
72     // XInitialization
73 
74     virtual void SAL_CALL initialize(
75         const css::uno::Sequence<css::uno::Any>& aArguments)
76         throw (css::uno::Exception, css::uno::RuntimeException);
77 
78 
79     // XDispatchProvider
80 
81     virtual css::uno::Reference<css::frame::XDispatch > SAL_CALL
82         queryDispatch (
83             const css::util::URL& aURL,
84             const rtl::OUString& aTargetFrameName,
85             sal_Int32 nSearchFlags )
86         throw(css::uno::RuntimeException);
87 
88     virtual css::uno::Sequence<css::uno::Reference<css::frame::XDispatch> > SAL_CALL
89         queryDispatches(
90             const css::uno::Sequence< css::frame::DispatchDescriptor>& rDescriptors)
91         throw(css::uno::RuntimeException);
92 
93 
94 private:
95     class Dispatch;
96     ::rtl::Reference<PresenterController> mpPresenterController;
97 
98     void ThrowIfDisposed (void) const throw (css::lang::DisposedException);
99 };
100 
101 } }
102 
103 #endif
104