Bump for 3.6-28
[LibreOffice.git] / cppcanvas / source / inc / action.hxx
blobc961f82a900c09372a112fd91340214f9ce4bff9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
29 #ifndef _CPPCANVAS_ACTION_HXX
30 #define _CPPCANVAS_ACTION_HXX
32 #include <sal/types.h>
34 #include <boost/shared_ptr.hpp>
36 namespace basegfx
38 class B2DHomMatrix;
39 class B2DRange;
43 /* Definition of Action interface */
45 namespace cppcanvas
47 namespace internal
49 /** Interface for internal render actions
51 This interface is implemented by all objects generated
52 from the metafile renderer, and corresponds roughly to the
53 VCL meta action.
55 class Action
57 public:
58 /** Used for rendering action subsets
60 There are several cases where an Action might have
61 subsettable content, e.g. text, or referenced
62 metafiles, like the transparent action.
64 Generally, at the metafile renderer, all actions are
65 'flattened' out, i.e. a meta action rendering the
66 string "Hello" counts five indices, and a transparent
67 action containing a metafile with 100 actions counts
68 at least 100 indices (contained transparency or text
69 actions recursively add to this value). From the
70 outside, the subset to render is referenced via this
71 flat index range
73 struct Subset
75 /** Denotes start of the subset.
77 The index given here specifies the first subaction
78 to render.
80 sal_Int32 mnSubsetBegin;
82 /** Denotes end of the subset
84 The index given here specifies the first subaction
85 <em>not<em> to render, i.e. one action behind the
86 subset to be rendered
88 sal_Int32 mnSubsetEnd;
91 virtual ~Action() {}
93 /** Render this action to the associated canvas
95 @param rTransformation
96 Transformation matrix to apply before rendering
98 @return true, if rendering was successful. If
99 rendering failed, false is returned.
101 virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const = 0;
103 /** Render the given part of the action to the associated
104 canvas.
106 @param rTransformation
107 Transformation matrix to apply before rendering
109 @param rSubset
110 Subset of the action to render. See Subset description
111 for index semantics.
113 @return true, if rendering was successful. If the
114 specified subset is invalid for this action, or if
115 rendering failed for other reasons, false is returned.
117 virtual bool renderSubset( const ::basegfx::B2DHomMatrix& rTransformation,
118 const Subset& rSubset ) const = 0;
120 /** Query bounds of this action on the associated canvas
122 @param rTransformation
123 Transformation matrix to apply
125 @return the bounds for this action in device
126 coordinate space.
128 virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const = 0;
130 /** Query bounds for the given part of the action on the
131 associated canvas.
133 @param rTransformation
134 Transformation matrix to apply.
136 @param rSubset
137 Subset of the action to query. See Subset description
138 for index semantics.
140 @return the bounds for the given subset in device
141 coordinate space.
143 virtual ::basegfx::B2DRange getBounds( const ::basegfx::B2DHomMatrix& rTransformation,
144 const Subset& rSubset ) const = 0;
146 /** Query action count.
148 This method returns the number of subset actions
149 contained in this action. The render( Subset ) method
150 must accept subset ranges up to the value returned
151 here.
153 @return the number of subset actions
155 virtual sal_Int32 getActionCount() const = 0;
158 typedef ::boost::shared_ptr< Action > ActionSharedPtr;
163 #endif /* _CPPCANVAS_ACTION_HXX */
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */