LCOV - code coverage report
Current view: top level - cppcanvas/source/inc - action.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 3 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 _CPPCANVAS_ACTION_HXX
      21             : #define _CPPCANVAS_ACTION_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : 
      25             : #include <boost/shared_ptr.hpp>
      26             : 
      27             : namespace basegfx
      28             : {
      29             :     class B2DHomMatrix;
      30             :     class B2DRange;
      31             : }
      32             : 
      33             : 
      34             : /* Definition of Action interface */
      35             : 
      36             : namespace cppcanvas
      37             : {
      38             :     namespace internal
      39             :     {
      40             :         /** Interface for internal render actions
      41             : 
      42             :             This interface is implemented by all objects generated
      43             :             from the metafile renderer, and corresponds roughly to the
      44             :             VCL meta action.
      45             :          */
      46           0 :         class Action
      47             :         {
      48             :         public:
      49             :             /** Used for rendering action subsets
      50             : 
      51             :                 There are several cases where an Action might have
      52             :                 subsettable content, e.g. text, or referenced
      53             :                 metafiles, like the transparent action.
      54             : 
      55             :                 Generally, at the metafile renderer, all actions are
      56             :                 'flattened' out, i.e. a meta action rendering the
      57             :                 string "Hello" counts five indices, and a transparent
      58             :                 action containing a metafile with 100 actions counts
      59             :                 at least 100 indices (contained transparency or text
      60             :                 actions recursively add to this value). From the
      61             :                 outside, the subset to render is referenced via this
      62             :                 flat index range
      63             :              */
      64             :             struct Subset
      65             :             {
      66             :                 /** Denotes start of the subset.
      67             : 
      68             :                     The index given here specifies the first subaction
      69             :                     to render.
      70             :                  */
      71             :                 sal_Int32   mnSubsetBegin;
      72             : 
      73             :                 /** Denotes end of the subset
      74             : 
      75             :                     The index given here specifies the first subaction
      76             :                     <em>not<em> to render, i.e. one action behind the
      77             :                     subset to be rendered
      78             :                  */
      79             :                 sal_Int32   mnSubsetEnd;
      80             :             };
      81             : 
      82           0 :             virtual ~Action() {}
      83             : 
      84             :             /** Render this action to the associated canvas
      85             : 
      86             :                 @param rTransformation
      87             :                 Transformation matrix to apply before rendering
      88             : 
      89             :                 @return true, if rendering was successful. If
      90             :                 rendering failed, false is returned.
      91             :              */
      92             :             virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const = 0;
      93             : 
      94             :             /** Render the given part of the action to the associated
      95             :                 canvas.
      96             : 
      97             :                 @param rTransformation
      98             :                 Transformation matrix to apply before rendering
      99             : 
     100             :                 @param rSubset
     101             :                 Subset of the action to render. See Subset description
     102             :                 for index semantics.
     103             : 
     104             :                 @return true, if rendering was successful. If the
     105             :                 specified subset is invalid for this action, or if
     106             :                 rendering failed for other reasons, false is returned.
     107             :              */
     108             :             virtual bool renderSubset( const ::basegfx::B2DHomMatrix& rTransformation,
     109             :                                        const Subset&                  rSubset ) const = 0;
     110             : 
     111             :             /** Query bounds of this action on the associated canvas
     112             : 
     113             :                 @param rTransformation
     114             :                 Transformation matrix to apply
     115             : 
     116             :                 @return the bounds for this action in device
     117             :                 coordinate space.
     118             :              */
     119             :             virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const = 0;
     120             : 
     121             :             /** Query bounds for the given part of the action on the
     122             :                 associated canvas.
     123             : 
     124             :                 @param rTransformation
     125             :                 Transformation matrix to apply.
     126             : 
     127             :                 @param rSubset
     128             :                 Subset of the action to query. See Subset description
     129             :                 for index semantics.
     130             : 
     131             :                 @return the bounds for the given subset in device
     132             :                 coordinate space.
     133             :              */
     134             :             virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix&   rTransformation,
     135             :                                                    const Subset&                    rSubset ) const = 0;
     136             : 
     137             :             /** Query action count.
     138             : 
     139             :                 This method returns the number of subset actions
     140             :                 contained in this action. The render( Subset ) method
     141             :                 must accept subset ranges up to the value returned
     142             :                 here.
     143             : 
     144             :                 @return the number of subset actions
     145             :              */
     146             :             virtual sal_Int32 getActionCount() const = 0;
     147             :         };
     148             : 
     149             :         typedef ::boost::shared_ptr< Action > ActionSharedPtr;
     150             : 
     151             :     }
     152             : }
     153             : 
     154             : #endif /* _CPPCANVAS_ACTION_HXX */
     155             : 
     156             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10