LibreOffice Module slideshow (master) 1
drawshapesubsetting.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_DRAWSHAPESUBSETTING_HXX
21#define INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_DRAWSHAPESUBSETTING_HXX
22
23#include <doctreenode.hxx>
24#include <attributableshape.hxx>
25
26
27class GDIMetaFile;
28typedef ::std::shared_ptr< GDIMetaFile > GDIMetaFileSharedPtr;
29
30namespace slideshow::internal
31 {
36 {
37 public:
49
60 DrawShapeSubsetting( const DocTreeNode& rShapeSubset,
62
65
68
80 void reset( const ::std::shared_ptr< GDIMetaFile >& rMtf );
81
82 // Shape subsetting methods
83
84
86 const DocTreeNode& getSubsetNode () const;
87
89 AttributableShapeSharedPtr getSubsetShape ( const DocTreeNode& rTreeNode ) const;
90
92 void addSubsetShape ( const AttributableShapeSharedPtr& rShape );
93
110 bool revokeSubsetShape ( const AttributableShapeSharedPtr& rShape );
111
112
113 // Doc tree methods
114
115
117 sal_Int32 getNumberOfTreeNodes ( DocTreeNode::NodeType eNodeType ) const;
118
120 DocTreeNode getTreeNode ( sal_Int32 nNodeIndex,
121 DocTreeNode::NodeType eNodeType ) const;
122
124 sal_Int32 getNumberOfSubsetTreeNodes ( const DocTreeNode& rParentNode,
125 DocTreeNode::NodeType eNodeType ) const;
126
128 DocTreeNode getSubsetTreeNode ( const DocTreeNode& rParentNode,
129 sal_Int32 nNodeIndex,
130 DocTreeNode::NodeType eNodeType ) const;
131
132 // Helper
133
134
144
153 {
157
163 };
164
165 typedef ::std::vector< IndexClassificator > IndexClassificatorVector;
166
167 private:
176 {
180
183
184 sal_Int32 getHashValue() const
185 {
186 // TODO(Q3): That's a hack. We assume that start
187 // index will always be less than 65535 (if this
188 // assumption is violated, hash map performance
189 // will degrade severely)
191 }
192
194 bool operator<(const SubsetEntry& rOther) const
195 {
196 return getHashValue() < rOther.getHashValue();
197 }
198
199 };
200
201 typedef ::std::set< SubsetEntry > ShapeSet;
202
203 void ensureInitializedNodeTree() const;
204 void excludeSubset(sal_Int32 nExcludedStart, sal_Int32 nExcludedEnd);
205 void updateSubsets();
206 void initCurrentSubsets();
207 void reset();
208
209 static sal_Int32 implGetNumberOfTreeNodes( const IndexClassificatorVector::const_iterator& rBegin,
210 const IndexClassificatorVector::const_iterator& rEnd,
211 DocTreeNode::NodeType eNodeType );
212 DocTreeNode implGetTreeNode( const IndexClassificatorVector::const_iterator& rBegin,
213 const IndexClassificatorVector::const_iterator& rEnd,
214 sal_Int32 nNodeIndex,
215 DocTreeNode::NodeType eNodeType ) const;
216
218
220 ::std::shared_ptr< GDIMetaFile > mpMtf;
221
224
227
235
238 };
239
240}
241
242#endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_SHAPES_DRAWSHAPESUBSETTING_HXX
243
244/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class represents kind of a DOM tree node for shape text.
Definition: doctreenode.hxx:45
NodeType
Type of shape entity represented by this node.
Definition: doctreenode.hxx:49
This class encapsulates the subsetting aspects of a DrawShape.
void excludeSubset(sal_Int32 nExcludedStart, sal_Int32 nExcludedEnd)
DrawShapeSubsetting()
Create empty shape subset handling.
IndexClassificator
This enum classifies each action index in the metafile.
ShapeSet maSubsetShapes
the list of subset shapes spawned from this one.
void addSubsetShape(const AttributableShapeSharedPtr &rShape)
Add child subset shape (or increase use count, if already existent)
bool mbNodeTreeInitialized
Whether the shape's doc tree has been initialized successfully, or not.
sal_Int32 getNumberOfTreeNodes(DocTreeNode::NodeType eNodeType) const
Return overall number of nodes for given type.
const DocTreeNode & getSubsetNode() const
Return subset node for this shape.
sal_Int32 getNumberOfSubsetTreeNodes(const DocTreeNode &rParentNode, DocTreeNode::NodeType eNodeType) const
Return number of nodes of given type, below parent node.
DocTreeNode getSubsetTreeNode(const DocTreeNode &rParentNode, sal_Int32 nNodeIndex, DocTreeNode::NodeType eNodeType) const
Return tree node of given index and given type, relative to parent node.
DrawShapeSubsetting & operator=(const DrawShapeSubsetting &)=delete
Forbid copy assignment.
bool revokeSubsetShape(const AttributableShapeSharedPtr &rShape)
Revoke subset shape.
::std::shared_ptr< GDIMetaFile > mpMtf
Metafile to retrieve subset info from.
DocTreeNode maSubset
Subset of the metafile represented by this object.
DocTreeNode implGetTreeNode(const IndexClassificatorVector::const_iterator &rBegin, const IndexClassificatorVector::const_iterator &rEnd, sal_Int32 nNodeIndex, DocTreeNode::NodeType eNodeType) const
DrawShapeSubsetting(const DrawShapeSubsetting &)=delete
Forbid copy construction.
AttributableShapeSharedPtr getSubsetShape(const DocTreeNode &rTreeNode) const
Get subset shape for given node, if any.
static sal_Int32 implGetNumberOfTreeNodes(const IndexClassificatorVector::const_iterator &rBegin, const IndexClassificatorVector::const_iterator &rEnd, DocTreeNode::NodeType eNodeType)
const VectorOfDocTreeNodes & getActiveSubsets() const
Return a vector of currently active subsets.
VectorOfDocTreeNodes maCurrentSubsets
Current number of subsets to render (calculated from maSubset and mnMin/MaxSubsetActionIndex).
::std::vector< IndexClassificator > IndexClassificatorVector
DocTreeNode getTreeNode(sal_Int32 nNodeIndex, DocTreeNode::NodeType eNodeType) const
Return tree node of given index and given type.
::std::shared_ptr< GDIMetaFile > GDIMetaFileSharedPtr
::std::vector< DocTreeNode > VectorOfDocTreeNodes
std::shared_ptr< GDIMetaFile > GDIMetaFileSharedPtr
Definition: tools.hxx:63
::std::shared_ptr< AttributableShape > AttributableShapeSharedPtr
bool operator<(const SubsetEntry &rOther) const
The shape set is ordered according to this method.
int mnSubsetQueriedCount
Number of times this subset was queried, and not yet revoked.
#define SAL_MAX_INT16