1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: action.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CPPCANVAS_ACTION_HXX
32 #define _CPPCANVAS_ACTION_HXX
34 #include <sal/types.h>
36 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
37 #include <boost/shared_ptr.hpp>
47 /* Definition of Action interface */
53 /** Interface for internal render actions
55 This interface is implemented by all objects generated
56 from the metafile renderer, and corresponds roughly to the
62 /** Used for rendering action subsets
64 There are several cases where an Action might have
65 subsettable content, e.g. text, or referenced
66 metafiles, like the transparent action.
68 Generally, at the metafile renderer, all actions are
69 'flattened' out, i.e. a meta action rendering the
70 string "Hello" counts five indices, and a transparent
71 action containing a metafile with 100 actions counts
72 at least 100 indices (contained transparency or text
73 actions recursively add to this value). From the
74 outside, the subset to render is referenced via this
79 /** Denotes start of the subset.
81 The index given here specifies the first subaction
84 sal_Int32 mnSubsetBegin
;
86 /** Denotes end of the subset
88 The index given here specifies the first subaction
89 <em>not<em> to render, i.e. one action behind the
92 sal_Int32 mnSubsetEnd
;
97 /** Render this action to the associated canvas
99 @param rTransformation
100 Transformation matrix to apply before rendering
102 @return true, if rendering was successful. If
103 rendering failed, false is returned.
105 virtual bool render( const ::basegfx::B2DHomMatrix
& rTransformation
) const = 0;
107 /** Render the given part of the action to the associated
110 @param rTransformation
111 Transformation matrix to apply before rendering
114 Subset of the action to render. See Subset description
117 @return true, if rendering was successful. If the
118 specified subset is invalid for this action, or if
119 rendering failed for other reasons, false is returned.
121 virtual bool render( const ::basegfx::B2DHomMatrix
& rTransformation
,
122 const Subset
& rSubset
) const = 0;
124 /** Query bounds of this action on the associated canvas
126 @param rTransformation
127 Transformation matrix to apply
129 @return the bounds for this action in device
132 virtual ::basegfx::B2DRange
getBounds( const ::basegfx::B2DHomMatrix
& rTransformation
) const = 0;
134 /** Query bounds for the given part of the action on the
137 @param rTransformation
138 Transformation matrix to apply.
141 Subset of the action to query. See Subset description
144 @return the bounds for the given subset in device
147 virtual ::basegfx::B2DRange
getBounds( const ::basegfx::B2DHomMatrix
& rTransformation
,
148 const Subset
& rSubset
) const = 0;
150 /** Query action count.
152 This method returns the number of subset actions
153 contained in this action. The render( Subset ) method
154 must accept subset ranges up to the value returned
157 @return the number of subset actions
159 virtual sal_Int32
getActionCount() const = 0;
162 typedef ::boost::shared_ptr
< Action
> ActionSharedPtr
;
167 #endif /* _CPPCANVAS_ACTION_HXX */