LCOV - code coverage report
Current view: top level - include/drawinglayer/primitive2d - animatedprimitive2d.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 5 0.0 %
Date: 2014-11-03 Functions: 0 7 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_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
      21             : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : 
      25             : #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
      26             : #include <basegfx/matrix/b2dhommatrix.hxx>
      27             : #include <basegfx/matrix/b2dhommatrixtools.hxx>
      28             : 
      29             : 
      30             : // predefines
      31             : namespace drawinglayer { namespace animation {
      32             :     class AnimationEntry;
      33             : }}
      34             : 
      35             : 
      36             : 
      37             : namespace drawinglayer
      38             : {
      39             :     namespace primitive2d
      40             :     {
      41             :         /** AnimatedSwitchPrimitive2D class
      42             : 
      43             :             This is the basic class for simple, animated primitives. The basic idea
      44             :             is to have an animation definition (AnimationEntry) who's basic
      45             :             functionality is to return a state value for any given animation time in
      46             :             the range of [0.0 .. 1.0]. Depending on the state, the decomposition
      47             :             calculates an index, which of the members of the child vector is to
      48             :             be visualized.
      49             : 
      50             :             An example: For blinking, the Child vector should exist of two entries;
      51             :             for values of [0.0 .. 0.5] the first, else the last entry will be used.
      52             :             This mechanism is not limited to two entries, though.
      53             :          */
      54             :         class DRAWINGLAYER_DLLPUBLIC AnimatedSwitchPrimitive2D : public GroupPrimitive2D
      55             :         {
      56             :         private:
      57             :             /**
      58             :                 The animation definition which allows translation of a point in time
      59             :                 to an animation state [0.0 .. 1.0]. This member contains a cloned
      60             :                 definition and is owned by this implementation.
      61             :              */
      62             :             animation::AnimationEntry*                      mpAnimationEntry;
      63             : 
      64             :             /// bitfield
      65             :             /** flag if this is a text or graphic animation. Necessary since SdrViews need to differentiate
      66             :                 between both types if they are on/off
      67             :              */
      68             :             bool                                            mbIsTextAnimation : 1;
      69             : 
      70             :         public:
      71             :             /// constructor
      72             :             AnimatedSwitchPrimitive2D(
      73             :                 const animation::AnimationEntry& rAnimationEntry,
      74             :                 const Primitive2DSequence& rChildren,
      75             :                 bool bIsTextAnimation);
      76             : 
      77             :             /// destructor - needed due to mpAnimationEntry
      78             :             virtual ~AnimatedSwitchPrimitive2D();
      79             : 
      80             :             /// data read access
      81           0 :             const animation::AnimationEntry& getAnimationEntry() const { return *mpAnimationEntry; }
      82           0 :             bool isTextAnimation() const { return mbIsTextAnimation; }
      83           0 :             bool isGraphicAnimation() const { return !isTextAnimation(); }
      84             : 
      85             :             /// compare operator
      86             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
      87             : 
      88             :             /// provide unique ID
      89             :             DeclPrimitive2DIDBlock()
      90             : 
      91             :             /** The getDecomposition is overloaded here since the decompose is dependent of the point in time,
      92             :                 so the default implementation is nut useful here, it needs to be handled locally
      93             :              */
      94             :             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      95             :         };
      96             :     } // end of namespace primitive2d
      97             : } // end of namespace drawinglayer
      98             : 
      99             : 
     100             : 
     101             : namespace drawinglayer
     102             : {
     103             :     namespace primitive2d
     104             :     {
     105             :         /** AnimatedBlinkPrimitive2D class
     106             : 
     107             :             Basically the same mechanism as in AnimatedSwitchPrimitive2D, but the
     108             :             decomposition is specialized in delivering the children in the
     109             :             range [0.0.. 0.5] and an empty sequence else
     110             :          */
     111           0 :         class DRAWINGLAYER_DLLPUBLIC AnimatedBlinkPrimitive2D : public AnimatedSwitchPrimitive2D
     112             :         {
     113             :         protected:
     114             :         public:
     115             :             /// constructor
     116             :             AnimatedBlinkPrimitive2D(
     117             :                 const animation::AnimationEntry& rAnimationEntry,
     118             :                 const Primitive2DSequence& rChildren,
     119             :                 bool bIsTextAnimation);
     120             : 
     121             :             /// create local decomposition
     122             :             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     123             : 
     124             :             /// provide unique ID
     125             :             DeclPrimitive2DIDBlock()
     126             :         };
     127             :     } // end of namespace primitive2d
     128             : } // end of namespace drawinglayer
     129             : 
     130             : 
     131             : 
     132             : namespace drawinglayer
     133             : {
     134             :     namespace primitive2d
     135             :     {
     136             :         /** AnimatedInterpolatePrimitive2D class
     137             : 
     138             :             Specialized on multi-step animations based on matrix transformations. The
     139             :             Child sequelce will be embedded in a matrix transformation. That transformation
     140             :             will be linearly combined from the decomposed values and the animation value
     141             :             to allow a smooth animation.
     142             :          */
     143           0 :         class DRAWINGLAYER_DLLPUBLIC AnimatedInterpolatePrimitive2D : public AnimatedSwitchPrimitive2D
     144             :         {
     145             :         private:
     146             :             /// the transformations
     147             :             std::vector< basegfx::tools::B2DHomMatrixBufferedDecompose >        maMatrixStack;
     148             : 
     149             :         protected:
     150             :         public:
     151             :             /// constructor
     152             :             AnimatedInterpolatePrimitive2D(
     153             :                 const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack,
     154             :                 const animation::AnimationEntry& rAnimationEntry,
     155             :                 const Primitive2DSequence& rChildren,
     156             :                 bool bIsTextAnimation);
     157             : 
     158             :             /// create local decomposition
     159             :             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     160             : 
     161             :             /// provide unique ID
     162             :             DeclPrimitive2DIDBlock()
     163             :         };
     164             :     } // end of namespace primitive2d
     165             : } // end of namespace drawinglayer
     166             : 
     167             : 
     168             : 
     169             : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
     170             : 
     171             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10