LCOV - code coverage report
Current view: top level - sdext/source/presenter - PresenterViewFactory.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 1 0.0 %
Date: 2014-11-03 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             :         opportunity 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             : 
     106             :     virtual void SAL_CALL disposing (void)
     107             :         throw (css::uno::RuntimeException) SAL_OVERRIDE;
     108             : 
     109             :     // XResourceFactory
     110             : 
     111             :     virtual css::uno::Reference<css::drawing::framework::XResource>
     112             :         SAL_CALL createResource (
     113             :             const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId)
     114             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     115             : 
     116             :     virtual void SAL_CALL
     117             :         releaseResource (
     118             :             const css::uno::Reference<css::drawing::framework::XResource>& rxPane)
     119             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             : 
     121             : private:
     122             :     css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
     123             :     css::uno::Reference<css::drawing::framework::XConfigurationController>
     124             :         mxConfigurationController;
     125             :     css::uno::WeakReference<css::frame::XController> mxControllerWeak;
     126             :     ::rtl::Reference<PresenterController> mpPresenterController;
     127             :     typedef ::std::pair<css::uno::Reference<css::drawing::framework::XView>,
     128             :         css::uno::Reference<css::drawing::framework::XPane> > ViewResourceDescriptor;
     129             :     typedef ::std::map<OUString, ViewResourceDescriptor> ResourceContainer;
     130             :     ::boost::scoped_ptr<ResourceContainer> mpResourceCache;
     131             : 
     132             :     PresenterViewFactory (
     133             :         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
     134             :         const css::uno::Reference<css::frame::XController>& rxController,
     135             :         const ::rtl::Reference<PresenterController>& rpPresenterController);
     136             : 
     137             :     void Register (const css::uno::Reference<css::frame::XController>& rxController);
     138             : 
     139             :     css::uno::Reference<css::drawing::framework::XView> CreateSlideShowView(
     140             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     141             : 
     142             :     css::uno::Reference<css::drawing::framework::XView> CreateSlidePreviewView(
     143             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     144             :         const css::uno::Reference<css::drawing::framework::XPane>& rxPane) const;
     145             : 
     146             :     css::uno::Reference<css::drawing::framework::XView> CreateToolBarView(
     147             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     148             : 
     149             :     css::uno::Reference<css::drawing::framework::XView> CreateNotesView(
     150             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     151             :         const css::uno::Reference<css::drawing::framework::XPane>& rxPane) const;
     152             : 
     153             :     css::uno::Reference<css::drawing::framework::XView> CreateSlideSorterView(
     154             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     155             : 
     156             :     css::uno::Reference<css::drawing::framework::XView> CreateHelpView(
     157             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     158             : 
     159             :     css::uno::Reference<css::drawing::framework::XResource> GetViewFromCache (
     160             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     161             :         const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane) const;
     162             :     css::uno::Reference<css::drawing::framework::XResource> CreateView(
     163             :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     164             :         const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane);
     165             : 
     166             :     void ThrowIfDisposed (void) const throw (css::lang::DisposedException);
     167             : };
     168             : 
     169             : } }
     170             : 
     171             : #endif
     172             : 
     173             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10