1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: doctreenode.hxx,v $
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>
38 /* Definition of DocTreeNode class */
45 /** This class represents kind of a DOM tree node for shape
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.
60 /// Type of shape entity represented by this node
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
91 meType(NODETYPE_INVALID
)
95 /** Create tree node from start and end index.
97 Create a tree node for the given range and type.
103 End index (exclusive)
108 DocTreeNode( sal_Int32 nStartIndex
,
111 mnStartIndex(nStartIndex
),
112 mnEndIndex(nEndIndex
),
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
; }
130 meType
= NODETYPE_INVALID
;
134 sal_Int32 mnStartIndex
;
135 sal_Int32 mnEndIndex
;
140 typedef ::std::vector
< DocTreeNode
> VectorOfDocTreeNodes
;
144 #endif /* INCLUDED_SLIDESHOW_DOCTREENODE_HXX */