LCOV - code coverage report
Current view: top level - slideshow/source/engine/shapes - externalshapebase.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 64 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 27 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             : 
      21             : // must be first
      22             : #include <canvas/debug.hxx>
      23             : #include <tools/diagnose_ex.h>
      24             : #include <canvas/verbosetrace.hxx>
      25             : 
      26             : #include <comphelper/anytostring.hxx>
      27             : #include <cppuhelper/exc_hlp.hxx>
      28             : 
      29             : #include "externalshapebase.hxx"
      30             : #include "eventmultiplexer.hxx"
      31             : #include "vieweventhandler.hxx"
      32             : #include "intrinsicanimationeventhandler.hxx"
      33             : #include "tools.hxx"
      34             : 
      35             : #include <boost/noncopyable.hpp>
      36             : 
      37             : 
      38             : using namespace ::com::sun::star;
      39             : 
      40             : 
      41             : namespace slideshow
      42             : {
      43             :     namespace internal
      44             :     {
      45           0 :         class ExternalShapeBase::ExternalShapeBaseListener : public ViewEventHandler,
      46             :                                                              public IntrinsicAnimationEventHandler,
      47             :                                                              private boost::noncopyable
      48             :         {
      49             :         public:
      50           0 :             explicit ExternalShapeBaseListener( ExternalShapeBase& rBase ) :
      51           0 :                 mrBase( rBase )
      52           0 :             {}
      53             : 
      54             : 
      55             :         private:
      56             :             // ViewEventHandler
      57             : 
      58             : 
      59           0 :             virtual void viewAdded( const UnoViewSharedPtr& ) SAL_OVERRIDE {}
      60           0 :             virtual void viewRemoved( const UnoViewSharedPtr& ) SAL_OVERRIDE {}
      61           0 :             virtual void viewChanged( const UnoViewSharedPtr& rView ) SAL_OVERRIDE
      62             :             {
      63           0 :                 mrBase.implViewChanged(rView);
      64           0 :             }
      65           0 :             virtual void viewsChanged() SAL_OVERRIDE
      66             :             {
      67           0 :                 mrBase.implViewsChanged();
      68           0 :             }
      69             : 
      70             : 
      71             :             // IntrinsicAnimationEventHandler
      72             : 
      73             : 
      74           0 :             virtual bool enableAnimations() SAL_OVERRIDE
      75             :             {
      76           0 :                 return mrBase.implStartIntrinsicAnimation();
      77             :             }
      78           0 :             virtual bool disableAnimations() SAL_OVERRIDE
      79             :             {
      80           0 :                 return mrBase.implEndIntrinsicAnimation();
      81             :             }
      82             : 
      83             :             ExternalShapeBase& mrBase;
      84             :         };
      85             : 
      86             : 
      87           0 :         ExternalShapeBase::ExternalShapeBase( const uno::Reference< drawing::XShape >&  xShape,
      88             :                                               double                                    nPrio,
      89             :                                               const SlideShowContext&                   rContext ) :
      90             :             mxComponentContext( rContext.mxComponentContext ),
      91             :             mxShape( xShape ),
      92           0 :             mpListener( new ExternalShapeBaseListener(*this) ),
      93             :             mpShapeManager( rContext.mpSubsettableShapeManager ),
      94             :             mrEventMultiplexer( rContext.mrEventMultiplexer ),
      95             :             mnPriority( nPrio ), // TODO(F1): When ZOrder someday becomes usable: make this ( getAPIShapePrio( xShape ) ),
      96           0 :             maBounds( getAPIShapeBounds( xShape ) )
      97             :         {
      98           0 :             ENSURE_OR_THROW( mxShape.is(), "ExternalShapeBase::ExternalShapeBase(): Invalid XShape" );
      99             : 
     100           0 :             mpShapeManager->addIntrinsicAnimationHandler( mpListener );
     101           0 :             mrEventMultiplexer.addViewHandler( mpListener );
     102           0 :         }
     103             : 
     104             : 
     105             : 
     106           0 :         ExternalShapeBase::~ExternalShapeBase()
     107             :         {
     108             :             try
     109             :             {
     110           0 :                 mrEventMultiplexer.removeViewHandler( mpListener );
     111           0 :                 mpShapeManager->removeIntrinsicAnimationHandler( mpListener );
     112             :             }
     113           0 :             catch (uno::Exception &)
     114             :             {
     115             :                 OSL_FAIL( OUStringToOString(
     116             :                                 comphelper::anyToString(
     117             :                                     cppu::getCaughtException() ),
     118             :                                 RTL_TEXTENCODING_UTF8 ).getStr() );
     119             :             }
     120           0 :         }
     121             : 
     122             : 
     123             : 
     124           0 :         uno::Reference< drawing::XShape > ExternalShapeBase::getXShape() const
     125             :         {
     126           0 :             return mxShape;
     127             :         }
     128             : 
     129             : 
     130             : 
     131           0 :         void ExternalShapeBase::play()
     132             :         {
     133           0 :             implStartIntrinsicAnimation();
     134           0 :         }
     135             : 
     136             : 
     137             : 
     138           0 :         void ExternalShapeBase::stop()
     139             :         {
     140           0 :             implEndIntrinsicAnimation();
     141           0 :         }
     142             : 
     143             : 
     144             : 
     145           0 :         void ExternalShapeBase::pause()
     146             :         {
     147           0 :             implPauseIntrinsicAnimation();
     148           0 :         }
     149             : 
     150             : 
     151             : 
     152           0 :         bool ExternalShapeBase::isPlaying() const
     153             :         {
     154           0 :             return implIsIntrinsicAnimationPlaying();
     155             :         }
     156             : 
     157             : 
     158             : 
     159           0 :         void ExternalShapeBase::setMediaTime(double fTime)
     160             :         {
     161           0 :             implSetIntrinsicAnimationTime(fTime);
     162           0 :         }
     163             : 
     164             : 
     165             : 
     166           0 :         bool ExternalShapeBase::update() const
     167             :         {
     168           0 :             return render();
     169             :         }
     170             : 
     171             : 
     172             : 
     173           0 :         bool ExternalShapeBase::render() const
     174             :         {
     175           0 :             if( maBounds.getRange().equalZero() )
     176             :             {
     177             :                 // zero-sized shapes are effectively invisible,
     178             :                 // thus, we save us the rendering...
     179           0 :                 return true;
     180             :             }
     181             : 
     182           0 :             return implRender( maBounds );
     183             :         }
     184             : 
     185             : 
     186             : 
     187           0 :         bool ExternalShapeBase::isContentChanged() const
     188             :         {
     189           0 :             return true;
     190             :         }
     191             : 
     192             : 
     193             : 
     194           0 :         ::basegfx::B2DRectangle ExternalShapeBase::getBounds() const
     195             :         {
     196           0 :             return maBounds;
     197             :         }
     198             : 
     199             : 
     200             : 
     201           0 :         ::basegfx::B2DRectangle ExternalShapeBase::getDomBounds() const
     202             :         {
     203           0 :             return maBounds;
     204             :         }
     205             : 
     206             : 
     207             : 
     208           0 :         ::basegfx::B2DRectangle ExternalShapeBase::getUpdateArea() const
     209             :         {
     210           0 :             return maBounds;
     211             :         }
     212             : 
     213             : 
     214             : 
     215           0 :         bool ExternalShapeBase::isVisible() const
     216             :         {
     217           0 :             return true;
     218             :         }
     219             : 
     220             : 
     221             : 
     222           0 :         double ExternalShapeBase::getPriority() const
     223             :         {
     224           0 :             return mnPriority;
     225             :         }
     226             : 
     227             : 
     228             : 
     229           0 :         bool ExternalShapeBase::isBackgroundDetached() const
     230             :         {
     231             :             // external shapes always have their own window/surface
     232           0 :             return true;
     233             :         }
     234             : 
     235             :     }
     236             : }
     237             : 
     238             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11