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: shapesubset.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 INCLUDED_SLIDESHOW_SHAPESUBSET_HXX
32 #define INCLUDED_SLIDESHOW_SHAPESUBSET_HXX
34 #include "attributableshape.hxx"
35 #include "subsettableshapemanager.hxx"
36 #include "doctreenode.hxx"
38 #include <boost/shared_ptr.hpp>
45 typedef ::boost::shared_ptr
< ShapeSubset
> ShapeSubsetSharedPtr
;
47 /* Definition of ShapeSubset class */
49 /** Subset RAII wrapper for shapes.
51 This class wraps the plain Shape with a wrapper for subset
52 functionality. Subsetting can be turned on and off. Note
53 that the reason to have shape subsetting RAII implemented
54 separately (i.e. not within the DrawShape) was that
55 subsetting (and de-subsetting) needs the
56 SubsettableShapeManager. And holding that at the DrawShape
57 creates one heck of a circular reference.
62 /** Create a subset directly from a Shape.
65 Original shape to subset
68 Subset this object should represent
71 Manager object, where subsets are
72 registered/unregistered
74 ShapeSubset( const AttributableShapeSharedPtr
& rOriginalShape
,
75 const DocTreeNode
& rTreeNode
,
76 const SubsettableShapeManagerSharedPtr
& rSubsetManager
);
78 /** Create a subset from another subset.
80 Note: if you want this subset to subtract from the
81 passed subset reference (and not from the original,
82 unsubsetted shape), the passed subset must be enabled
83 (enableSubsetShape() must have been called)
85 @param rOriginalSubset
86 Original subset, which to subset again.
89 Subset of the original subset
91 ShapeSubset( const ShapeSubsetSharedPtr
& rOriginalSubset
,
92 const DocTreeNode
& rTreeNode
);
94 /** Create full set for the given shape.
97 Original shape, which will be represented as a whole
100 ShapeSubset( const AttributableShapeSharedPtr
& rOriginalShape
,
101 const SubsettableShapeManagerSharedPtr
& rShapeManager
);
105 /** Get the actual subset shape.
107 If the subset is currently revoked, this method
108 returns the original shape.
110 AttributableShapeSharedPtr
getSubsetShape() const;
112 /** Enable the subset shape.
114 This method enables the subset. That means, on
115 successful completion of this method, the original
116 shape will cease to show the subset range, and
117 getSubsetShape() will return a valid shape.
119 @return true, if subsetting was successfully enabled.
121 bool enableSubsetShape();
123 /** Disable the subset shape.
125 This method revokes the subset from the original
126 shape. That means, the original shape will again show
129 void disableSubsetShape();
131 /** Query whether this subset actually is none, but
132 contains the whole original shape's content
134 bool isFullSet() const;
136 /** Query subset this object represents
138 DocTreeNode
getSubset() const;
141 // default copy/assignment are okay
142 //ShapeSubset(const ShapeSubset&);
143 //ShapeSubset& operator=( const ShapeSubset& );
145 AttributableShapeSharedPtr mpOriginalShape
;
146 AttributableShapeSharedPtr mpSubsetShape
;
147 DocTreeNode maTreeNode
;
148 SubsettableShapeManagerSharedPtr mpShapeManager
;
153 #endif /* INCLUDED_SLIDESHOW_SHAPESUBSET_HXX */