LCOV - code coverage report
Current view: top level - sdext/source/presenter - PresenterViewFactory.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SDEXT_PRESENTER_VIEW_FACTORY_HXX
      30                 :            : #define SDEXT_PRESENTER_VIEW_FACTORY_HXX
      31                 :            : 
      32                 :            : #include "PresenterController.hxx"
      33                 :            : #include <cppuhelper/compbase1.hxx>
      34                 :            : #include <cppuhelper/basemutex.hxx>
      35                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      36                 :            : #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
      37                 :            : #include <com/sun/star/drawing/framework/XResourceFactory.hpp>
      38                 :            : #include <com/sun/star/drawing/framework/XView.hpp>
      39                 :            : #include <com/sun/star/frame/XFrame.hpp>
      40                 :            : #include <com/sun/star/uno/XComponentContext.hpp>
      41                 :            : #include <rtl/ref.hxx>
      42                 :            : #include <boost/scoped_ptr.hpp>
      43                 :            : 
      44                 :            : namespace css = ::com::sun::star;
      45                 :            : 
      46                 :            : namespace sdext { namespace presenter {
      47                 :            : 
      48                 :            : namespace {
      49                 :            :     typedef ::cppu::WeakComponentImplHelper1 <
      50                 :            :         css::drawing::framework::XResourceFactory
      51                 :            :     > PresenterViewFactoryInterfaceBase;
      52                 :            : }
      53                 :            : 
      54                 :            : /** Base class for presenter views that allows the view factory to store
      55                 :            :     them in a cache and reuse deactivated views.
      56                 :            : */
      57                 :            : class CachablePresenterView
      58                 :            : {
      59                 :            : public:
      60                 :            :     virtual void ActivatePresenterView (void);
      61                 :            : 
      62                 :            :     /** Called when the view is put into a cache.  The view must not paint
      63                 :            :         itself while being deactive.
      64                 :            :     */
      65                 :            :     virtual void DeactivatePresenterView (void);
      66                 :            : 
      67                 :            :     /** Called before the view is disposed.  This gives the view the
      68                 :            :         oportunity to trigger actions that may lead to (synchronous)
      69                 :            :         callbacks that do not result in DisposedExceptions.
      70                 :            :     */
      71                 :            :     virtual void ReleaseView (void);
      72                 :            : 
      73                 :            : protected:
      74                 :            :     bool mbIsPresenterViewActive;
      75                 :            : 
      76                 :            :     CachablePresenterView (void);
      77                 :            : 
      78                 :          0 :     ~CachablePresenterView() {}
      79                 :            : };
      80                 :            : 
      81                 :            : /** Factory of the presenter screen specific views.  The supported set of
      82                 :            :     views includes:
      83                 :            :         a life view of the current slide,
      84                 :            :         a static preview of the next slide,
      85                 :            :         the notes of the current slide,
      86                 :            :         a tool bar
      87                 :            : */
      88                 :            : class PresenterViewFactory
      89                 :            :     : public ::cppu::BaseMutex,
      90                 :            :       public PresenterViewFactoryInterfaceBase
      91                 :            : {
      92                 :            : public:
      93                 :            :     static const ::rtl::OUString msCurrentSlidePreviewViewURL;
      94                 :            :     static const ::rtl::OUString msNextSlidePreviewViewURL;
      95                 :            :     static const ::rtl::OUString msNotesViewURL;
      96                 :            :     static const ::rtl::OUString msToolBarViewURL;
      97                 :            :     static const ::rtl::OUString msSlideSorterURL;
      98                 :            :     static const ::rtl::OUString msHelpViewURL;
      99                 :            : 
     100                 :            :     /** Create a new instance of this class and register it as resource
     101                 :            :         factory in the drawing framework of the given controller.
     102                 :            :         This registration keeps it alive.  When the drawing framework is
     103                 :            :         shut down and releases its reference to the factory then the factory
     104                 :            :         is destroyed.
     105                 :            :     */
     106                 :            :     static css::uno::Reference<css::drawing::framework::XResourceFactory> Create (
     107                 :            :         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
     108                 :            :         const css::uno::Reference<css::frame::XController>& rxController,
     109                 :            :         const ::rtl::Reference<PresenterController>& rpPresenterController);
     110                 :            :     virtual ~PresenterViewFactory (void);
     111                 :            : 
     112                 :            :     static ::rtl::OUString getImplementationName_static (void);
     113                 :            :     static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void);
     114                 :            :     static css::uno::Reference<css::uno::XInterface> Create(
     115                 :            :         const css::uno::Reference<css::uno::XComponentContext>& rxContext)
     116                 :            :         SAL_THROW((css::uno::Exception));
     117                 :            : 
     118                 :            :     virtual void SAL_CALL disposing (void)
     119                 :            :         throw (css::uno::RuntimeException);
     120                 :            : 
     121                 :            :     // XResourceFactory
     122                 :            : 
     123                 :            :     virtual css::uno::Reference<css::drawing::framework::XResource>
     124                 :            :         SAL_CALL createResource (
     125                 :            :             const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId)
     126                 :            :         throw (css::uno::RuntimeException);
     127                 :            : 
     128                 :            :     virtual void SAL_CALL
     129                 :            :         releaseResource (
     130                 :            :             const css::uno::Reference<css::drawing::framework::XResource>& rxPane)
     131                 :            :         throw (css::uno::RuntimeException);
     132                 :            : 
     133                 :            : private:
     134                 :            :     css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
     135                 :            :     css::uno::Reference<css::drawing::framework::XConfigurationController>
     136                 :            :         mxConfigurationController;
     137                 :            :     css::uno::WeakReference<css::frame::XController> mxControllerWeak;
     138                 :            :     ::rtl::Reference<PresenterController> mpPresenterController;
     139                 :            :     typedef ::std::pair<css::uno::Reference<css::drawing::framework::XView>,
     140                 :            :         css::uno::Reference<css::drawing::framework::XPane> > ViewResourceDescriptor;
     141                 :            :     typedef ::std::map<rtl::OUString, ViewResourceDescriptor> ResourceContainer;
     142                 :            :     ::boost::scoped_ptr<ResourceContainer> mpResourceCache;
     143                 :            : 
     144                 :            :     PresenterViewFactory (
     145                 :            :         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
     146                 :            :         const css::uno::Reference<css::frame::XController>& rxController,
     147                 :            :         const ::rtl::Reference<PresenterController>& rpPresenterController);
     148                 :            : 
     149                 :            :     void Register (const css::uno::Reference<css::frame::XController>& rxController);
     150                 :            : 
     151                 :            :     css::uno::Reference<css::drawing::framework::XView> CreateSlideShowView(
     152                 :            :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     153                 :            : 
     154                 :            :     css::uno::Reference<css::drawing::framework::XView> CreateSlidePreviewView(
     155                 :            :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     156                 :            :         const css::uno::Reference<css::drawing::framework::XPane>& rxPane) const;
     157                 :            : 
     158                 :            :     css::uno::Reference<css::drawing::framework::XView> CreateToolBarView(
     159                 :            :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     160                 :            : 
     161                 :            :     css::uno::Reference<css::drawing::framework::XView> CreateNotesView(
     162                 :            :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     163                 :            :         const css::uno::Reference<css::drawing::framework::XPane>& rxPane) const;
     164                 :            : 
     165                 :            :     css::uno::Reference<css::drawing::framework::XView> CreateSlideSorterView(
     166                 :            :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     167                 :            : 
     168                 :            :     css::uno::Reference<css::drawing::framework::XView> CreateHelpView(
     169                 :            :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const;
     170                 :            : 
     171                 :            :     css::uno::Reference<css::drawing::framework::XResource> GetViewFromCache (
     172                 :            :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     173                 :            :         const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane) const;
     174                 :            :     css::uno::Reference<css::drawing::framework::XResource> CreateView(
     175                 :            :         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
     176                 :            :         const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane);
     177                 :            : 
     178                 :            :     void ThrowIfDisposed (void) const throw (::com::sun::star::lang::DisposedException);
     179                 :            : };
     180                 :            : 
     181                 :            : } }
     182                 :            : 
     183                 :            : #endif
     184                 :            : 
     185                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10