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

Generated by: LCOV version 1.10