1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_ATTRIBUTABLESHAPE_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_INC_ATTRIBUTABLESHAPE_HXX
23 #include <boost/shared_ptr.hpp>
25 #include "animatableshape.hxx"
26 #include "shapeattributelayer.hxx"
27 #include "doctreenodesupplier.hxx"
33 // forward declaration necessary, because methods use AttributableShapeSharedPtr
34 class AttributableShape
;
36 typedef ::boost::shared_ptr
< AttributableShape
> AttributableShapeSharedPtr
;
38 /** Represents an animatable shape, that can have its
41 Over an animatable shape, this interface adds attribute
42 modification methods. Furthermore, the shape can be
43 queried for sub items, which in turn can be separated out
44 into own AttributableShapes.
46 class AttributableShape
: public AnimatableShape
49 // Attribute layer methods
52 /** Create a new shape attribute layer.
54 This method creates a new layer for shape attributes,
55 which lies atop of all previous attribute layers. That
56 is most typically used when a new SMIL animation
57 starts (which according to the spec always lies atop
58 of all previous animations). Thus, subsequent calls to
59 this method generate a sandwich of attribute layers,
60 which in total define the shape's attributes.
62 Please note that the attribute layers do <em>not</em>
63 contain the underlying XShape's attributes as
64 default. Instead, attributes not explicitly set by
65 animations remain in invalid state, allowing the
66 shape's paint method to determine whether they have to
67 override the underlying graphical shape
68 representation. XShape attributes must be passed
69 explicitly to animations which need them (e.g. 'by'
74 virtual ShapeAttributeLayerSharedPtr
createAttributeLayer() = 0;
76 /** Revoke a previously generated attribute layer.
78 This method revokes a previously generated attribute
79 layer, and removes the effect of that layer from this
80 shape. The layer need not be the current toplevel
81 layer, it can also be revoked from in between.
84 Layer to revoke. Must have been generated by
85 createAttributeLayer() at the same Shape.
87 @return true, if layer was successfully removed, false
88 otherwise (e.g. if the given layer was not generated
91 virtual bool revokeAttributeLayer( const ShapeAttributeLayerSharedPtr
& rLayer
) = 0;
93 /** Get the topmost shape attribute layer (if any).
95 This method returns the topmost layer for shape
96 attributes, i.e. the one which ultimately determines
99 Please note that the attribute layers do <em>not</em>
100 contain the underlying XShape's attributes as
101 default. Instead, attributes not explicitly set by
102 animations remain in invalid state, allowing the
103 shape's paint method to determine whether they have to
104 override the underlying graphical shape
105 representation. XShape attributes must be passed
106 explicitly to animations which need them (e.g. 'by'
109 @return the topmost layer
111 virtual ShapeAttributeLayerSharedPtr
getTopmostAttributeLayer() const = 0;
114 /** Change default shape visibility
116 This method hides or unhides a shape. Note that every
117 attribute layer generated for this shape is able to
118 override the setting given here, until it is revoked.
121 When true, shape will be visible, when false,
122 invisible (modulo attribute layer overrides).
124 virtual void setVisibility( bool bVisible
) = 0;
129 /** Retrieve interface for DocTreeNode creation.
131 This method provides the caller with a reference to
132 the DocTreeNodeSupplier interface, which can be used
133 to request specific tree nodes for this shape.
135 virtual const DocTreeNodeSupplier
& getTreeNodeSupplier() const = 0;
136 virtual DocTreeNodeSupplier
& getTreeNodeSupplier() = 0;
138 /** Query the subset this shape displays.
140 This method returns a tree node denoting the subset
141 displayed by this shape. If this shape is not a subset
142 shape, an empty tree node should be returned. If this
143 shape is a subset, and itself has subsetted children,
144 this method might return more than the shape is
145 actually displaying (because a single DocTreeNode is
146 not able to model holes in the range).
148 virtual DocTreeNode
getSubsetNode() const = 0;
150 /** Query a subset Shape, if already existent at this
153 This method returns a clone of this Shape, which
154 renders only the selected subset of itself, but only
155 if such a subset has been explicitly created before.
158 A DocTreeNode instance queried from this Shape, which
159 specifies the subset of the Shape to render.
161 @return a NULL Shape pointer, if no subset exists for
162 the given DocTreeNode.
164 virtual AttributableShapeSharedPtr
getSubset( const DocTreeNode
& rTreeNode
) const = 0;
166 /** Create a subset Shape
168 This method creates a clone of this Shape, which
169 renders only the selected subset of itself. Multiple
170 createSubset() calls for the same DocTreeNode will all
171 share the same subset shape.
173 The original shape (i.e. the one this method is called
174 on) will cease to display the selected subset
175 part. That is, together the shapes will display the
176 original content, but the content of all subset shapes
177 and their original shape will always be mutually
180 After deregistering the subset shape a matching number
181 of times via revokeSubset(), the original shape will
182 resume displaying the subsetted part.
184 @attention To maintain view integrity, this method
185 should only be called from the LayerManager
191 A DocTreeNode instance queried from this Shape, which
192 specifies the subset of the Shape to render
194 @return true, if the shape was newly created, and
195 false, if an already existing subset is returned.
197 virtual bool createSubset( AttributableShapeSharedPtr
& o_rSubset
,
198 const DocTreeNode
& rTreeNode
) = 0;
200 /** Revoke a previously generated shape subset.
202 After revoking a subset shape, the corresponding
203 subset part will become visible again on the original
206 @attention To maintain view integrity, this method
207 should only be called from the LayerManager
212 @return true, if the last client called
215 virtual bool revokeSubset( const AttributableShapeSharedPtr
& rShape
) = 0;
220 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_ATTRIBUTABLESHAPE_HXX
222 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */