LCOV - code coverage report
Current view: top level - include/drawinglayer/primitive2d - animatedprimitive2d.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 5 0.0 %
Date: 2015-06-13 12:38:46 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             :             /** Override getDecomposition() here since the decompose
      92             :                 depends on the point in time, so the default implementation is
      93             :                 not useful here, it needs to be handled locally
      94             :              */
      95             :             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      96             :         };
      97             :     } // end of namespace primitive2d
      98             : } // end of namespace drawinglayer
      99             : 
     100             : 
     101             : 
     102             : namespace drawinglayer
     103             : {
     104             :     namespace primitive2d
     105             :     {
     106             :         /** AnimatedBlinkPrimitive2D class
     107             : 
     108             :             Basically the same mechanism as in AnimatedSwitchPrimitive2D, but the
     109             :             decomposition is specialized in delivering the children in the
     110             :             range [0.0.. 0.5] and an empty sequence else
     111             :          */
     112           0 :         class DRAWINGLAYER_DLLPUBLIC AnimatedBlinkPrimitive2D : public AnimatedSwitchPrimitive2D
     113             :         {
     114             :         protected:
     115             :         public:
     116             :             /// constructor
     117             :             AnimatedBlinkPrimitive2D(
     118             :                 const animation::AnimationEntry& rAnimationEntry,
     119             :                 const Primitive2DSequence& rChildren,
     120             :                 bool bIsTextAnimation);
     121             : 
     122             :             /// create local decomposition
     123             :             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     124             : 
     125             :             /// provide unique ID
     126             :             DeclPrimitive2DIDBlock()
     127             :         };
     128             :     } // end of namespace primitive2d
     129             : } // end of namespace drawinglayer
     130             : 
     131             : 
     132             : 
     133             : namespace drawinglayer
     134             : {
     135             :     namespace primitive2d
     136             :     {
     137             :         /** AnimatedInterpolatePrimitive2D class
     138             : 
     139             :             Specialized on multi-step animations based on matrix transformations. The
     140             :             Child sequelce will be embedded in a matrix transformation. That transformation
     141             :             will be linearly combined from the decomposed values and the animation value
     142             :             to allow a smooth animation.
     143             :          */
     144           0 :         class DRAWINGLAYER_DLLPUBLIC AnimatedInterpolatePrimitive2D : public AnimatedSwitchPrimitive2D
     145             :         {
     146             :         private:
     147             :             /// the transformations
     148             :             std::vector< basegfx::tools::B2DHomMatrixBufferedDecompose >        maMatrixStack;
     149             : 
     150             :         protected:
     151             :         public:
     152             :             /// constructor
     153             :             AnimatedInterpolatePrimitive2D(
     154             :                 const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack,
     155             :                 const animation::AnimationEntry& rAnimationEntry,
     156             :                 const Primitive2DSequence& rChildren,
     157             :                 bool bIsTextAnimation);
     158             : 
     159             :             /// create local decomposition
     160             :             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     161             : 
     162             :             /// provide unique ID
     163             :             DeclPrimitive2DIDBlock()
     164             :         };
     165             :     } // end of namespace primitive2d
     166             : } // end of namespace drawinglayer
     167             : 
     168             : 
     169             : 
     170             : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
     171             : 
     172             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11