LCOV - code coverage report
Current view: top level - sdext/source/presenter - PresenterViewFactory.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 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_PRESENTERVIEWFACTORY_HXX
      21             : #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERVIEWFACTORY_HXX
      22             : 
      23             : #include "PresenterController.hxx"
      24             : #include <cppuhelper/compbase1.hxx>
      25             : #include <cppuhelper/basemutex.hxx>
      26             : #include <com/sun/star/lang/XInitialization.hpp>
      27             : #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
      28             : #include <com/sun/star/drawing/framework/XResourceFactory.hpp>
      29             : #include <com/sun/star/drawing/framework/XView.hpp>
      30             : #include <com/sun/star/frame/XFrame.hpp>
      31             : #include <com/sun/star/uno/XComponentContext.hpp>
      32             : #include <rtl/ref.hxx>
      33             : #include <boost/scoped_ptr.hpp>
      34             : 
      35             : namespace sdext { namespace presenter {
      36             : 
      37             : namespace {
      38             :     typedef ::cppu::WeakComponentImplHelper1 <
      39             :         css::drawing::framework::XResourceFactory
      40             :     > PresenterViewFactoryInterfaceBase;
      41             : }
      42             : 
      43             : /** Base class for presenter views that allows the view factory to store
      44             :     them in a cache and reuse deactivated views.
      45             : */
      46             : class CachablePresenterView
      47             : {
      48             : public:
      49             :     virtual void ActivatePresenterView (void);
      50             : 
      51             :     /** Called when the view is put into a cache.  The view must not paint
      52             :         itself while being deactive.
      53             :     */
      54             :     virtual void DeactivatePresenterView (void);
      55             : 
      56             :     /** Called before the view is disposed.  This gives the view the
      57             :         oportunity to trigger actions that may lead to (synchronous)
      58             :         callbacks that do not result in DisposedExceptions.
      59             :     */
      60             :     virtual void ReleaseView (void);
      61             : 
      62             : protected:
      63             :     bool mbIsPresenterViewActive;
      64             : 
      65             :     CachablePresenterView (void);
      66             : 
      67           0 :     ~CachablePresenterView() {}
      68             : };
      69             : 
      70             : /** Factory of the presenter screen specific views.  The supported set of
      71             :     views includes:
      72             :         a life view of the current slide,
      73             :         a static preview of the next slide,
      74             :         the notes of the current slide,
      75             :         a tool bar
      76             : */
      77             : class PresenterViewFactory
      78             :     : public ::cppu::BaseMutex,
      79             :       public PresenterViewFactoryInterfaceBase
      80             : {
      81             : public:
      82             :     static const OUString msCurrentSlidePreviewViewURL;
      83             :     static const OUString msNextSlidePreviewViewURL;
      84             :     static const OUString msNotesViewURL;
      85             :     static const OUString msToolBarViewURL;
      86             :     static const OUString msSlideSorterURL;
      87             :     static const OUString msHelpViewURL;
      88             : 
      89             :     /** Create a new instance of this class and register it as resource
      90             :         factory in the drawing framework of the given controller.
      91             :         This registration keeps it alive.  When the drawing framework is
      92             :         shut down and releases its reference to the factory then the factory
      93             :         is destroyed.
      94             :     */
      95             :     static css::uno::Reference<css::drawing::framework::XResourceFactory> Create (
      96             :         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
      97             :         const css::uno::Reference<css::frame::XController>& rxController,
      98             :         const ::rtl::Reference<PresenterController>& rpPresenterController);
      99             :     virtual ~PresenterViewFactory (void);
     100             : 
     101             :     static OUString getImplementationName_static (void);
     102             :     static css::uno::Sequence< OUString > getSupportedServiceNames_static (void);
     103             :     static css::uno::Reference<css::uno::XInterface> Create(
     104             :         const css::uno::Reference<css::uno::XComponentContext>& rxContext)
     105             :         SAL_THROW((css::uno::Exception));
     106             : 
     107             :     virtual void SAL_CALL disposing (void)
     108             :         throw (css::uno::RuntimeException) SAL_OVERRIDE;
     109             : 
     110             :     // XResourceFactory
     111             : 
     112             :     virtual css::uno::Reference<css::drawing::framework::XResource>
     113             :         SAL_CALL createResource (
     114             :             const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId)
     115             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             : 
     117             :     virtual void SAL_CALL
     118             :         releaseResource (
     119             :             const css::uno::Reference<css::drawing::framework::XResource>& rxPane)
     120             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     121             : 
     122             : private:
     123             :     css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
     124             :     css::uno::Reference<css::drawing::framework::XConfigurationController>
     125             :         mxConfigurationController;
     126             :     css::uno::WeakReference<css::frame::XController> mxControllerWeak;
     127             :     ::rtl::Reference<PresenterController> mpPresenterController;
     128             :     typedef ::std::pair<css::uno::Reference<css::drawing::framework::XView>,
     129             :         css::uno::Reference<css::drawing::framework::XPane> > ViewResourceDescriptor;
     130             :     typedef ::std::map<OUString, ViewResourceDescriptor> ResourceContainer;
     131             :     ::boost::scoped_ptr<ResourceContainer> mpResourceCache;
     132             : 
     133             :     PresenterViewFactory (
     134             :         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
     135             :         const css::uno::Reference<css::frame::XController>& rxController,
     136             :         const ::rtl::Reference<PresenterController>& rpPresenterController);
     137             : 
     138             :     void Register (const css::uno::Reference<css::frame::XController>& rxController);
     139             : 
     140             :     css::uno::Reference<css::drawing::framework::XView> CreateSlideShowView(
     141             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     142             : 
     143             :     css::uno::Reference<css::drawing::framework::XView> CreateSlidePreviewView(
     144             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     145             :         const css::uno::Reference<css::drawing::framework::XPane>& rxPane) const;
     146             : 
     147             :     css::uno::Reference<css::drawing::framework::XView> CreateToolBarView(
     148             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     149             : 
     150             :     css::uno::Reference<css::drawing::framework::XView> CreateNotesView(
     151             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     152             :         const css::uno::Reference<css::drawing::framework::XPane>& rxPane) const;
     153             : 
     154             :     css::uno::Reference<css::drawing::framework::XView> CreateSlideSorterView(
     155             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     156             : 
     157             :     css::uno::Reference<css::drawing::framework::XView> CreateHelpView(
     158             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     159             : 
     160             :     css::uno::Reference<css::drawing::framework::XResource> GetViewFromCache (
     161             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     162             :         const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane) const;
     163             :     css::uno::Reference<css::drawing::framework::XResource> CreateView(
     164             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     165             :         const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane);
     166             : 
     167             :     void ThrowIfDisposed (void) const throw (::com::sun::star::lang::DisposedException);
     168             : };
     169             : 
     170             : } }
     171             : 
     172             : #endif
     173             : 
     174             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10