LCOV - code coverage report
Current view: top level - libreoffice/sdext/source/presenter - PresenterScreen.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-12-27 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10