Bump version to 24.04.3.4
[LibreOffice.git] / slideshow / source / inc / shapesubset.hxx
blobe65c47f4ea352b7e03c3fa1a6c856596adce1373
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "subsettableshapemanager.hxx"
24 #include "doctreenode.hxx"
26 #include <memory>
28 namespace slideshow::internal
30 class ShapeSubset;
31 typedef ::std::shared_ptr< ShapeSubset > ShapeSubsetSharedPtr;
33 /* Definition of ShapeSubset class */
35 /** Subset RAII wrapper for shapes.
37 This class wraps the plain Shape with a wrapper for subset
38 functionality. Subsetting can be turned on and off. Note
39 that the reason to have shape subsetting RAII implemented
40 separately (i.e. not within the DrawShape) was that
41 subsetting (and de-subsetting) needs the
42 SubsettableShapeManager. And holding that at the DrawShape
43 creates one heck of a circular reference.
45 class ShapeSubset
47 public:
48 /** Create a subset directly from a Shape.
50 @param rOriginalShape
51 Original shape to subset
53 @param rTreeNode
54 Subset this object should represent
56 @param rShapeManager
57 Manager object, where subsets are
58 registered/unregistered
60 ShapeSubset( AttributableShapeSharedPtr xOriginalShape,
61 const DocTreeNode& rTreeNode,
62 SubsettableShapeManagerSharedPtr xSubsetManager );
64 /** Create a subset from another subset.
66 Note: if you want this subset to subtract from the
67 passed subset reference (and not from the original,
68 unsubsetted shape), the passed subset must be enabled
69 (enableSubsetShape() must have been called)
71 @param rOriginalSubset
72 Original subset, which to subset again.
74 @param rTreeNode
75 Subset of the original subset
77 ShapeSubset( const ShapeSubsetSharedPtr& rOriginalSubset,
78 const DocTreeNode& rTreeNode );
80 /** Create full set for the given shape.
82 @param rOriginalShape
83 Original shape, which will be represented as a whole
84 by this object
86 ShapeSubset( AttributableShapeSharedPtr xOriginalShape,
87 SubsettableShapeManagerSharedPtr xShapeManager );
89 ~ShapeSubset();
91 // For a rationale for this hacky combination of user-provided dtor, defaulted copy
92 // ctor, and deleted copy assignment op, see the "TODO(Q1)" comment in
93 // CloningNodeCreator (slideshow/source/engine/animationnodes/animationnodefactory.cxx):
94 ShapeSubset(ShapeSubset const &) = default;
95 void operator =(ShapeSubset const &) = delete;
97 /** Get the actual subset shape.
99 If the subset is currently revoked, this method
100 returns the original shape.
102 AttributableShapeSharedPtr const & getSubsetShape() const;
104 /** Enable the subset shape.
106 This method enables the subset. That means, on
107 successful completion of this method, the original
108 shape will cease to show the subset range, and
109 getSubsetShape() will return a valid shape.
111 void enableSubsetShape();
113 /** Disable the subset shape.
115 This method revokes the subset from the original
116 shape. That means, the original shape will again show
117 the hidden range.
119 void disableSubsetShape();
121 /** Query whether this subset actually is none, but
122 contains the whole original shape's content
124 bool isFullSet() const;
126 /** Query subset this object represents
128 const DocTreeNode& getSubset() const;
130 private:
131 // default copy/assignment are okay
132 //ShapeSubset(const ShapeSubset&);
133 //ShapeSubset& operator=( const ShapeSubset& );
135 AttributableShapeSharedPtr mpOriginalShape;
136 AttributableShapeSharedPtr mpSubsetShape;
137 DocTreeNode maTreeNode;
138 SubsettableShapeManagerSharedPtr mpShapeManager;
143 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_SHAPESUBSET_HXX
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */