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_PRESENTER_SCREEN_HXX 29*cdf0e10cSrcweir #define SDEXT_PRESENTER_PRESENTER_SCREEN_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "PresenterConfigurationAccess.hxx" 32*cdf0e10cSrcweir #include "PresenterPaneContainer.hxx" 33*cdf0e10cSrcweir #include <cppuhelper/compbase1.hxx> 34*cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 35*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/frame/XModel2.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/task/XJob.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/document/XEventListener.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfigurationController.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XView.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShowController.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/presentation/XPresentation2.hpp> 44*cdf0e10cSrcweir #include <rtl/ref.hxx> 45*cdf0e10cSrcweir #include <boost/noncopyable.hpp> 46*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 47*cdf0e10cSrcweir #include <boost/scoped_ptr.hpp> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir namespace css = ::com::sun::star; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir namespace sdext { namespace presenter { 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir class PresenterWindowManager; 54*cdf0e10cSrcweir class PresenterController; 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir namespace { 57*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper1 < 58*cdf0e10cSrcweir css::task::XJob 59*cdf0e10cSrcweir > PresenterScreenJobInterfaceBase; 60*cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper1 < 61*cdf0e10cSrcweir css::lang::XEventListener 62*cdf0e10cSrcweir > PresenterScreenInterfaceBase; 63*cdf0e10cSrcweir } 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir /** The PresenterScreenJob service is instantiated every time a document is 69*cdf0e10cSrcweir created or loaded. In its execute() method it then filters out all 70*cdf0e10cSrcweir non-Impress documents and creates and registers a new PresenterScreen 71*cdf0e10cSrcweir object. 72*cdf0e10cSrcweir */ 73*cdf0e10cSrcweir class PresenterScreenJob 74*cdf0e10cSrcweir : private ::boost::noncopyable, 75*cdf0e10cSrcweir private ::cppu::BaseMutex, 76*cdf0e10cSrcweir public PresenterScreenJobInterfaceBase 77*cdf0e10cSrcweir { 78*cdf0e10cSrcweir public: 79*cdf0e10cSrcweir static ::rtl::OUString getImplementationName_static (void); 80*cdf0e10cSrcweir static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void); 81*cdf0e10cSrcweir static css::uno::Reference<css::uno::XInterface> Create( 82*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext) 83*cdf0e10cSrcweir SAL_THROW((css::uno::Exception)); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir virtual void SAL_CALL disposing (void); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir // XJob 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir virtual css::uno::Any SAL_CALL execute( 90*cdf0e10cSrcweir const css::uno::Sequence<css::beans::NamedValue >& Arguments) 91*cdf0e10cSrcweir throw (css::lang::IllegalArgumentException, 92*cdf0e10cSrcweir css::uno::Exception, 93*cdf0e10cSrcweir css::uno::RuntimeException); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir private: 96*cdf0e10cSrcweir PresenterScreenJob (const css::uno::Reference<css::uno::XComponentContext>& rxContext); 97*cdf0e10cSrcweir virtual ~PresenterScreenJob (void); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir css::uno::Reference<css::uno::XComponentContext> mxComponentContext; 100*cdf0e10cSrcweir }; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir /** This is the bootstrap class of the presenter screen. It is registered 106*cdf0e10cSrcweir as drawing framework startup service. That means that every drawing 107*cdf0e10cSrcweir framework instance creates an instance of this class. 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir <p>A PresenterScreen object registers itself as listener for drawing 110*cdf0e10cSrcweir framework configuration changes. It waits for the full screen marker (a 111*cdf0e10cSrcweir top level resource) to appear in the current configuration. When that 112*cdf0e10cSrcweir happens the actual presenter screen is initialized. A new 113*cdf0e10cSrcweir PresenterController is created and takes over the task of controlling 114*cdf0e10cSrcweir the presenter screen.</p> 115*cdf0e10cSrcweir */ 116*cdf0e10cSrcweir class PresenterScreen 117*cdf0e10cSrcweir : private ::boost::noncopyable, 118*cdf0e10cSrcweir private ::cppu::BaseMutex, 119*cdf0e10cSrcweir public PresenterScreenInterfaceBase 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir public: 122*cdf0e10cSrcweir PresenterScreen ( 123*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 124*cdf0e10cSrcweir const css::uno::Reference<css::frame::XModel2>& rxModel); 125*cdf0e10cSrcweir virtual ~PresenterScreen (void); 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir virtual void SAL_CALL disposing (void); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir /** Make the presenter screen visible. 130*cdf0e10cSrcweir */ 131*cdf0e10cSrcweir void InitializePresenterScreen (void); 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir /** Do not call ShutdownPresenterScreen() directly. Call 134*cdf0e10cSrcweir RequestShutdownPresenterScreen() instead. It will issue an 135*cdf0e10cSrcweir asynchronous call to ShutdownPresenterScreen() when that is safe. 136*cdf0e10cSrcweir */ 137*cdf0e10cSrcweir void RequestShutdownPresenterScreen (void); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir // XEventListener 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir virtual void SAL_CALL disposing ( const css::lang::EventObject& rEvent) throw (css::uno::RuntimeException); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir private: 145*cdf0e10cSrcweir css::uno::Reference<css::frame::XModel2 > mxModel; 146*cdf0e10cSrcweir css::uno::Reference<css::frame::XController> mxController; 147*cdf0e10cSrcweir css::uno::WeakReference<css::drawing::framework::XConfigurationController> 148*cdf0e10cSrcweir mxConfigurationControllerWeak; 149*cdf0e10cSrcweir css::uno::WeakReference<css::uno::XComponentContext> mxContextWeak; 150*cdf0e10cSrcweir css::uno::WeakReference<css::presentation::XSlideShowController> mxSlideShowControllerWeak; 151*cdf0e10cSrcweir ::rtl::Reference<PresenterController> mpPresenterController; 152*cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XResourceId> mxSlideShowViewId; 153*cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XConfiguration> mxSavedConfiguration; 154*cdf0e10cSrcweir ::rtl::Reference<PresenterPaneContainer> mpPaneContainer; 155*cdf0e10cSrcweir sal_Int32 mnComponentIndex; 156*cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XResourceFactory> mxPaneFactory; 157*cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XResourceFactory> mxViewFactory; 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir class ViewDescriptor 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir public: 162*cdf0e10cSrcweir ::rtl::OUString msTitle; 163*cdf0e10cSrcweir ::rtl::OUString msAccessibleTitle; 164*cdf0e10cSrcweir bool mbIsOpaque; 165*cdf0e10cSrcweir }; 166*cdf0e10cSrcweir typedef ::std::map<rtl::OUString,ViewDescriptor> ViewDescriptorContainer; 167*cdf0e10cSrcweir ViewDescriptorContainer maViewDescriptors; 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir void ShutdownPresenterScreen (void); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir /** Create and initialize the factory for presenter view specific panes. 173*cdf0e10cSrcweir */ 174*cdf0e10cSrcweir void SetupPaneFactory ( 175*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir /** Create and initialize the factory for presenter view specific views. 178*cdf0e10cSrcweir */ 179*cdf0e10cSrcweir void SetupViewFactory ( 180*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext); 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir /** Read the current layout from the configuration and call 183*cdf0e10cSrcweir ProcessLayout to bring it on to the screen. 184*cdf0e10cSrcweir */ 185*cdf0e10cSrcweir void SetupConfiguration ( 186*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 187*cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir /** Read one layout from the configuration and make resource activation 190*cdf0e10cSrcweir requests to bring it on to the screen. When one layout references a 191*cdf0e10cSrcweir parent layout then this method calls itself recursively. 192*cdf0e10cSrcweir */ 193*cdf0e10cSrcweir void ProcessLayout ( 194*cdf0e10cSrcweir PresenterConfigurationAccess& rConfiguration, 195*cdf0e10cSrcweir const ::rtl::OUString& rsLayoutName, 196*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 197*cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir /** Called by ProcessLayout for a single entry of a Layouts 200*cdf0e10cSrcweir configuration list. 201*cdf0e10cSrcweir */ 202*cdf0e10cSrcweir void ProcessComponent ( 203*cdf0e10cSrcweir const ::rtl::OUString& rsKey, 204*cdf0e10cSrcweir const ::std::vector<css::uno::Any>& rValues, 205*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 206*cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId); 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir /** Read the view descriptions from the configuration. 209*cdf0e10cSrcweir */ 210*cdf0e10cSrcweir void ProcessViewDescriptions ( 211*cdf0e10cSrcweir PresenterConfigurationAccess& rConfiguration); 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir /** Called by ProcessViewDescriptions for a single entry. 214*cdf0e10cSrcweir */ 215*cdf0e10cSrcweir void ProcessViewDescription ( 216*cdf0e10cSrcweir const ::rtl::OUString& rsKey, 217*cdf0e10cSrcweir const ::std::vector<css::uno::Any>& rValues); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir void SetupView ( 220*cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 221*cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId, 222*cdf0e10cSrcweir const ::rtl::OUString& rsPaneURL, 223*cdf0e10cSrcweir const ::rtl::OUString& rsViewURL, 224*cdf0e10cSrcweir const PresenterPaneContainer::ViewInitializationFunction& rViewInitialization, 225*cdf0e10cSrcweir const double nLeft, 226*cdf0e10cSrcweir const double nTop, 227*cdf0e10cSrcweir const double nRight, 228*cdf0e10cSrcweir const double nBottom); 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir /** Return the screen number on which to display the presenter screen. 231*cdf0e10cSrcweir @return 232*cdf0e10cSrcweir Returns -1 when the presenter screen can or shall not be 233*cdf0e10cSrcweir displayed. 234*cdf0e10cSrcweir */ 235*cdf0e10cSrcweir sal_Int32 GetScreenNumber ( 236*cdf0e10cSrcweir const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const; 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir /** Create a resource id for the full screen background pane so that it 239*cdf0e10cSrcweir is displayed on another screen than the full screen presentation. 240*cdf0e10cSrcweir */ 241*cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XResourceId> GetMainPaneId ( 242*cdf0e10cSrcweir const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const; 243*cdf0e10cSrcweir }; 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir } } 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir #endif 248