update dev300-m58
[ooovba.git] / slideshow / source / inc / doctreenode.hxx
blob6b6b1e7d08742f064235f8c34d865bf1f5b021f2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: doctreenode.hxx,v $
10 * $Revision: 1.8 $
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_DOCTREENODE_HXX
32 #define INCLUDED_SLIDESHOW_DOCTREENODE_HXX
34 #include <sal/types.h>
35 #include <vector>
38 /* Definition of DocTreeNode class */
40 namespace slideshow
42 namespace internal
45 /** This class represents kind of a DOM tree node for shape
46 text
48 In order to animate subsets of shape text, we need
49 information about the logical and formatting structure of
50 that text (lines, paragraphs, words etc.). This is
51 represented in a tree structure, with DocTreeNodes as the
52 nodes. Instances of this class can be queried from the
53 DocTreeNodeSupplier interface.
55 This class has nothing to do with the Draw document tree.
57 class DocTreeNode
59 public:
60 /// Type of shape entity represented by this node
61 enum NodeType
63 NODETYPE_INVALID=0,
65 /// This node represents a full shape
66 NODETYPE_FORMATTING_SHAPE=1,
67 /// This node represents a line
68 NODETYPE_FORMATTING_LINE=2,
70 /// This node represents a full shape
71 NODETYPE_LOGICAL_SHAPE=128,
72 /// This node represents a paragraph
73 NODETYPE_LOGICAL_PARAGRAPH=129,
74 /// This node represents a sentence
75 NODETYPE_LOGICAL_SENTENCE=130,
76 /// This node represents a word
77 NODETYPE_LOGICAL_WORD=131,
78 /// This node represents a character
79 NODETYPE_LOGICAL_CHARACTER_CELL=132
82 // classificators for above text entity types
83 static bool isLogicalNodeType( NodeType eType ) { return eType > 127; }
84 static bool isFormattingNodeType( NodeType eType ) { return eType > 0 && eType < 128; }
86 /** Create empty tree node
88 DocTreeNode() :
89 mnStartIndex(-1),
90 mnEndIndex(-1),
91 meType(NODETYPE_INVALID)
95 /** Create tree node from start and end index.
97 Create a tree node for the given range and type.
99 @param nStartIndex
100 Start index
102 @param nEndIndex
103 End index (exclusive)
105 @param eType
106 Node type
108 DocTreeNode( sal_Int32 nStartIndex,
109 sal_Int32 nEndIndex,
110 NodeType eType ) :
111 mnStartIndex(nStartIndex),
112 mnEndIndex(nEndIndex),
113 meType(eType)
117 bool isEmpty() const { return mnStartIndex == mnEndIndex; }
119 sal_Int32 getStartIndex() const { return mnStartIndex; }
120 sal_Int32 getEndIndex() const { return mnEndIndex; }
121 void setStartIndex( sal_Int32 nIndex ) { mnStartIndex = nIndex; }
122 void setEndIndex( sal_Int32 nIndex ) { mnEndIndex = nIndex; }
124 NodeType getType() const { return meType; }
126 void reset()
128 mnStartIndex = -1;
129 mnEndIndex = -1;
130 meType = NODETYPE_INVALID;
133 private:
134 sal_Int32 mnStartIndex;
135 sal_Int32 mnEndIndex;
136 NodeType meType;
140 typedef ::std::vector< DocTreeNode > VectorOfDocTreeNodes;
144 #endif /* INCLUDED_SLIDESHOW_DOCTREENODE_HXX */