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"
34 typedef ::std::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 // For a rationale for this hacky combination of user-provided dtor, defaulted copy
95 // ctor, and deleted copy assignment op, see the "TODO(Q1)" comment in
96 // CloningNodeCreator (slideshow/source/engine/animationnodes/animationnodefactory.cxx):
97 ShapeSubset(ShapeSubset
const &) = default;
98 void operator =(ShapeSubset
const &) = delete;
100 /** Get the actual subset shape.
102 If the subset is currently revoked, this method
103 returns the original shape.
105 AttributableShapeSharedPtr
const & getSubsetShape() const;
107 /** Enable the subset shape.
109 This method enables the subset. That means, on
110 successful completion of this method, the original
111 shape will cease to show the subset range, and
112 getSubsetShape() will return a valid shape.
114 void enableSubsetShape();
116 /** Disable the subset shape.
118 This method revokes the subset from the original
119 shape. That means, the original shape will again show
122 void disableSubsetShape();
124 /** Query whether this subset actually is none, but
125 contains the whole original shape's content
127 bool isFullSet() const;
129 /** Query subset this object represents
131 const DocTreeNode
& getSubset() const;
134 // default copy/assignment are okay
135 //ShapeSubset(const ShapeSubset&);
136 //ShapeSubset& operator=( const ShapeSubset& );
138 AttributableShapeSharedPtr
const mpOriginalShape
;
139 AttributableShapeSharedPtr mpSubsetShape
;
140 DocTreeNode
const maTreeNode
;
141 SubsettableShapeManagerSharedPtr mpShapeManager
;
146 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_SHAPESUBSET_HXX
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */