xref: /AOO41X/main/sdext/source/presenter/PresenterPaneFactory.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef SDEXT_PRESENTER_PANE_FACTORY_HXX
29*cdf0e10cSrcweir #define SDEXT_PRESENTER_PANE_FACTORY_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <cppuhelper/compbase1.hxx>
32*cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx>
33*cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/drawing/XPresenterHelper.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XResourceFactory.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
40*cdf0e10cSrcweir #include <rtl/ref.hxx>
41*cdf0e10cSrcweir #include <boost/scoped_ptr.hpp>
42*cdf0e10cSrcweir #include <map>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir namespace css = ::com::sun::star;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir namespace sdext { namespace presenter {
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir class PresenterController;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir namespace {
51*cdf0e10cSrcweir     typedef ::cppu::WeakComponentImplHelper1 <
52*cdf0e10cSrcweir         css::drawing::framework::XResourceFactory
53*cdf0e10cSrcweir     > PresenterPaneFactoryInterfaceBase;
54*cdf0e10cSrcweir }
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir /** The PresenerPaneFactory provides a fixed set of panes.
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir     In order to make the presener screen more easily extendable in the
60*cdf0e10cSrcweir     future the set of supported panes could be made extendable on demand.
61*cdf0e10cSrcweir */
62*cdf0e10cSrcweir class PresenterPaneFactory
63*cdf0e10cSrcweir     : public ::cppu::BaseMutex,
64*cdf0e10cSrcweir       public PresenterPaneFactoryInterfaceBase
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir public:
67*cdf0e10cSrcweir     static const ::rtl::OUString msCurrentSlidePreviewPaneURL;
68*cdf0e10cSrcweir     static const ::rtl::OUString msNextSlidePreviewPaneURL;
69*cdf0e10cSrcweir     static const ::rtl::OUString msNotesPaneURL;
70*cdf0e10cSrcweir     static const ::rtl::OUString msToolBarPaneURL;
71*cdf0e10cSrcweir     static const ::rtl::OUString msSlideSorterPaneURL;
72*cdf0e10cSrcweir     static const ::rtl::OUString msHelpPaneURL;
73*cdf0e10cSrcweir     static const ::rtl::OUString msOverlayPaneURL;
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir     /** Create a new instance of this class and register it as resource
76*cdf0e10cSrcweir         factory in the drawing framework of the given controller.
77*cdf0e10cSrcweir         This registration keeps it alive.  When the drawing framework is
78*cdf0e10cSrcweir         shut down and releases its reference to the factory then the factory
79*cdf0e10cSrcweir         is destroyed.
80*cdf0e10cSrcweir     */
81*cdf0e10cSrcweir     static css::uno::Reference<css::drawing::framework::XResourceFactory> Create (
82*cdf0e10cSrcweir         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
83*cdf0e10cSrcweir         const css::uno::Reference<css::frame::XController>& rxController,
84*cdf0e10cSrcweir         const ::rtl::Reference<PresenterController>& rpPresenterController);
85*cdf0e10cSrcweir     virtual ~PresenterPaneFactory (void);
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir     static ::rtl::OUString getImplementationName_static (void);
88*cdf0e10cSrcweir     static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void);
89*cdf0e10cSrcweir     static css::uno::Reference<css::uno::XInterface> Create(
90*cdf0e10cSrcweir         const css::uno::Reference<css::uno::XComponentContext>& rxContext)
91*cdf0e10cSrcweir         SAL_THROW((css::uno::Exception));
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir     virtual void SAL_CALL disposing (void)
94*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir     // XResourceFactory
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir     virtual css::uno::Reference<css::drawing::framework::XResource>
99*cdf0e10cSrcweir         SAL_CALL createResource (
100*cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
101*cdf0e10cSrcweir                 com::sun::star::drawing::framework::XResourceId>& rxPaneId)
102*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException);
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir     virtual void SAL_CALL
105*cdf0e10cSrcweir         releaseResource (
106*cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResource>&
107*cdf0e10cSrcweir                 rxPane)
108*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir private:
111*cdf0e10cSrcweir     css::uno::WeakReference<css::uno::XComponentContext> mxComponentContextWeak;
112*cdf0e10cSrcweir     css::uno::WeakReference<css::drawing::framework::XConfigurationController>
113*cdf0e10cSrcweir         mxConfigurationControllerWeak;
114*cdf0e10cSrcweir     ::rtl::Reference<PresenterController> mpPresenterController;
115*cdf0e10cSrcweir     typedef ::std::map<rtl::OUString, css::uno::Reference<css::drawing::framework::XResource> >
116*cdf0e10cSrcweir         ResourceContainer;
117*cdf0e10cSrcweir     ::boost::scoped_ptr<ResourceContainer> mpResourceCache;
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     PresenterPaneFactory (
120*cdf0e10cSrcweir         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
121*cdf0e10cSrcweir         const ::rtl::Reference<PresenterController>& rpPresenterController);
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     void Register (const css::uno::Reference<css::frame::XController>& rxController);
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     css::uno::Reference<css::drawing::framework::XResource> CreatePane (
126*cdf0e10cSrcweir         const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
127*cdf0e10cSrcweir         const ::rtl::OUString& rsTitle);
128*cdf0e10cSrcweir     css::uno::Reference<css::drawing::framework::XResource> CreatePane (
129*cdf0e10cSrcweir         const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
130*cdf0e10cSrcweir         const ::rtl::OUString& rsTitle,
131*cdf0e10cSrcweir         const css::uno::Reference<css::drawing::framework::XPane>& rxParentPane,
132*cdf0e10cSrcweir         const bool bIsSpritePane);
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir     void ThrowIfDisposed (void) const throw (::com::sun::star::lang::DisposedException);
135*cdf0e10cSrcweir };
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir } }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir #endif
140