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_SHAPESUBSET_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_INC_SHAPESUBSET_HXX
23 #include "attributableshape.hxx"
24 #include "subsettableshapemanager.hxx"
25 #include "doctreenode.hxx"
27 #include <boost/shared_ptr.hpp>
34 typedef ::boost::shared_ptr
< ShapeSubset
> ShapeSubsetSharedPtr
;
36 /* Definition of ShapeSubset class */
38 /** Subset RAII wrapper for shapes.
40 This class wraps the plain Shape with a wrapper for subset
41 functionality. Subsetting can be turned on and off. Note
42 that the reason to have shape subsetting RAII implemented
43 separately (i.e. not within the DrawShape) was that
44 subsetting (and de-subsetting) needs the
45 SubsettableShapeManager. And holding that at the DrawShape
46 creates one heck of a circular reference.
51 /** Create a subset directly from a Shape.
54 Original shape to subset
57 Subset this object should represent
60 Manager object, where subsets are
61 registered/unregistered
63 ShapeSubset( const AttributableShapeSharedPtr
& rOriginalShape
,
64 const DocTreeNode
& rTreeNode
,
65 const SubsettableShapeManagerSharedPtr
& rSubsetManager
);
67 /** Create a subset from another subset.
69 Note: if you want this subset to subtract from the
70 passed subset reference (and not from the original,
71 unsubsetted shape), the passed subset must be enabled
72 (enableSubsetShape() must have been called)
74 @param rOriginalSubset
75 Original subset, which to subset again.
78 Subset of the original subset
80 ShapeSubset( const ShapeSubsetSharedPtr
& rOriginalSubset
,
81 const DocTreeNode
& rTreeNode
);
83 /** Create full set for the given shape.
86 Original shape, which will be represented as a whole
89 ShapeSubset( const AttributableShapeSharedPtr
& rOriginalShape
,
90 const SubsettableShapeManagerSharedPtr
& rShapeManager
);
94 /** Get the actual subset shape.
96 If the subset is currently revoked, this method
97 returns the original shape.
99 AttributableShapeSharedPtr
getSubsetShape() const;
101 /** Enable the subset shape.
103 This method enables the subset. That means, on
104 successful completion of this method, the original
105 shape will cease to show the subset range, and
106 getSubsetShape() will return a valid shape.
108 @return true, if subsetting was successfully enabled.
110 bool enableSubsetShape();
112 /** Disable the subset shape.
114 This method revokes the subset from the original
115 shape. That means, the original shape will again show
118 void disableSubsetShape();
120 /** Query whether this subset actually is none, but
121 contains the whole original shape's content
123 bool isFullSet() const;
125 /** Query subset this object represents
127 DocTreeNode
getSubset() const;
130 // default copy/assignment are okay
131 //ShapeSubset(const ShapeSubset&);
132 //ShapeSubset& operator=( const ShapeSubset& );
134 AttributableShapeSharedPtr mpOriginalShape
;
135 AttributableShapeSharedPtr mpSubsetShape
;
136 DocTreeNode maTreeNode
;
137 SubsettableShapeManagerSharedPtr mpShapeManager
;
142 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_SHAPESUBSET_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */