merge the formfield patch from ooo-build
[ooovba.git] / sdext / source / presenter / PresenterScreen.hxx
bloba64b2fd03052f37026e4eb9af931a01e59e6dfbb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterScreen.hxx,v $
11 * $Revision: 1.4 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef SDEXT_PRESENTER_PRESENTER_SCREEN_HXX
33 #define SDEXT_PRESENTER_PRESENTER_SCREEN_HXX
35 #include "PresenterConfigurationAccess.hxx"
36 #include "PresenterPaneContainer.hxx"
37 #include <cppuhelper/compbase1.hxx>
38 #include <cppuhelper/basemutex.hxx>
39 #include <com/sun/star/lang/XInitialization.hpp>
40 #include <com/sun/star/frame/XController.hpp>
41 #include <com/sun/star/frame/XModel2.hpp>
42 #include <com/sun/star/task/XJob.hpp>
43 #include <com/sun/star/document/XEventListener.hpp>
44 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
45 #include <com/sun/star/drawing/framework/XView.hpp>
46 #include <com/sun/star/presentation/XSlideShowController.hpp>
47 #include <com/sun/star/presentation/XPresentation2.hpp>
48 #include <rtl/ref.hxx>
49 #include <boost/noncopyable.hpp>
50 #include <boost/shared_ptr.hpp>
51 #include <boost/scoped_ptr.hpp>
53 namespace css = ::com::sun::star;
55 namespace sdext { namespace presenter {
57 class PresenterWindowManager;
58 class PresenterController;
60 namespace {
61 typedef ::cppu::WeakComponentImplHelper1 <
62 css::task::XJob
63 > PresenterScreenJobInterfaceBase;
64 typedef ::cppu::WeakComponentImplHelper1 <
65 css::lang::XEventListener
66 > PresenterScreenInterfaceBase;
72 /** The PresenterScreenJob service is instantiated every time a document is
73 created or loaded. In its execute() method it then filters out all
74 non-Impress documents and creates and registers a new PresenterScreen
75 object.
77 class PresenterScreenJob
78 : private ::boost::noncopyable,
79 private ::cppu::BaseMutex,
80 public PresenterScreenJobInterfaceBase
82 public:
83 static ::rtl::OUString getImplementationName_static (void);
84 static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void);
85 static css::uno::Reference<css::uno::XInterface> Create(
86 const css::uno::Reference<css::uno::XComponentContext>& rxContext)
87 SAL_THROW((css::uno::Exception));
89 virtual void SAL_CALL disposing (void);
91 // XJob
93 virtual css::uno::Any SAL_CALL execute(
94 const css::uno::Sequence<css::beans::NamedValue >& Arguments)
95 throw (css::lang::IllegalArgumentException,
96 css::uno::Exception,
97 css::uno::RuntimeException);
99 private:
100 PresenterScreenJob (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
101 virtual ~PresenterScreenJob (void);
103 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
109 /** This is the bootstrap class of the presenter screen. It is registered
110 as drawing framework startup service. That means that every drawing
111 framework instance creates an instance of this class.
113 <p>A PresenterScreen object registers itself as listener for drawing
114 framework configuration changes. It waits for the full screen marker (a
115 top level resource) to appear in the current configuration. When that
116 happens the actual presenter screen is initialized. A new
117 PresenterController is created and takes over the task of controlling
118 the presenter screen.</p>
120 class PresenterScreen
121 : private ::boost::noncopyable,
122 private ::cppu::BaseMutex,
123 public PresenterScreenInterfaceBase
125 public:
126 PresenterScreen (
127 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
128 const css::uno::Reference<css::frame::XModel2>& rxModel);
129 virtual ~PresenterScreen (void);
131 virtual void SAL_CALL disposing (void);
133 /** Make the presenter screen visible.
135 void InitializePresenterScreen (void);
137 /** Do not call ShutdownPresenterScreen() directly. Call
138 RequestShutdownPresenterScreen() instead. It will issue an
139 asynchronous call to ShutdownPresenterScreen() when that is safe.
141 void RequestShutdownPresenterScreen (void);
144 // XEventListener
146 virtual void SAL_CALL disposing ( const css::lang::EventObject& rEvent) throw (css::uno::RuntimeException);
148 private:
149 css::uno::Reference<css::frame::XModel2 > mxModel;
150 css::uno::Reference<css::frame::XController> mxController;
151 css::uno::WeakReference<css::drawing::framework::XConfigurationController>
152 mxConfigurationControllerWeak;
153 css::uno::WeakReference<css::uno::XComponentContext> mxContextWeak;
154 css::uno::WeakReference<css::presentation::XSlideShowController> mxSlideShowControllerWeak;
155 ::rtl::Reference<PresenterController> mpPresenterController;
156 css::uno::Reference<css::drawing::framework::XResourceId> mxSlideShowViewId;
157 css::uno::Reference<css::drawing::framework::XConfiguration> mxSavedConfiguration;
158 ::rtl::Reference<PresenterPaneContainer> mpPaneContainer;
159 sal_Int32 mnComponentIndex;
160 css::uno::Reference<css::drawing::framework::XResourceFactory> mxPaneFactory;
161 css::uno::Reference<css::drawing::framework::XResourceFactory> mxViewFactory;
163 class ViewDescriptor
165 public:
166 ::rtl::OUString msTitle;
167 ::rtl::OUString msAccessibleTitle;
168 bool mbIsOpaque;
170 typedef ::std::map<rtl::OUString,ViewDescriptor> ViewDescriptorContainer;
171 ViewDescriptorContainer maViewDescriptors;
174 void ShutdownPresenterScreen (void);
176 /** Create and initialize the factory for presenter view specific panes.
178 void SetupPaneFactory (
179 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
181 /** Create and initialize the factory for presenter view specific views.
183 void SetupViewFactory (
184 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
186 /** Read the current layout from the configuration and call
187 ProcessLayout to bring it on to the screen.
189 void SetupConfiguration (
190 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
191 const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
193 /** Read one layout from the configuration and make resource activation
194 requests to bring it on to the screen. When one layout references a
195 parent layout then this method calls itself recursively.
197 void ProcessLayout (
198 PresenterConfigurationAccess& rConfiguration,
199 const ::rtl::OUString& rsLayoutName,
200 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
201 const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
203 /** Called by ProcessLayout for a single entry of a Layouts
204 configuration list.
206 void ProcessComponent (
207 const ::rtl::OUString& rsKey,
208 const ::std::vector<css::uno::Any>& rValues,
209 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
210 const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
212 /** Read the view descriptions from the configuration.
214 void ProcessViewDescriptions (
215 PresenterConfigurationAccess& rConfiguration);
217 /** Called by ProcessViewDescriptions for a single entry.
219 void ProcessViewDescription (
220 const ::rtl::OUString& rsKey,
221 const ::std::vector<css::uno::Any>& rValues);
223 void SetupView (
224 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
225 const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId,
226 const ::rtl::OUString& rsPaneURL,
227 const ::rtl::OUString& rsViewURL,
228 const PresenterPaneContainer::ViewInitializationFunction& rViewInitialization,
229 const double nLeft,
230 const double nTop,
231 const double nRight,
232 const double nBottom);
234 /** Return the screen number on which to display the presenter screen.
235 @return
236 Returns -1 when the presenter screen can or shall not be
237 displayed.
239 sal_Int32 GetScreenNumber (
240 const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const;
242 /** Create a resource id for the full screen background pane so that it
243 is displayed on another screen than the full screen presentation.
245 css::uno::Reference<css::drawing::framework::XResourceId> GetMainPaneId (
246 const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const;
251 #endif