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_DOCTREENODE_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_INC_DOCTREENODE_HXX
23 #include <sal/types.h>
27 /* Definition of DocTreeNode class */
34 /** This class represents kind of a DOM tree node for shape
37 In order to animate subsets of shape text, we need
38 information about the logical and formatting structure of
39 that text (lines, paragraphs, words etc.). This is
40 represented in a tree structure, with DocTreeNodes as the
41 nodes. Instances of this class can be queried from the
42 DocTreeNodeSupplier interface.
44 This class has nothing to do with the Draw document tree.
49 /// Type of shape entity represented by this node
54 /// This node represents a full shape
55 NODETYPE_FORMATTING_SHAPE
=1,
56 /// This node represents a line
57 NODETYPE_FORMATTING_LINE
=2,
59 /// This node represents a full shape
60 NODETYPE_LOGICAL_SHAPE
=128,
61 /// This node represents a paragraph
62 NODETYPE_LOGICAL_PARAGRAPH
=129,
63 /// This node represents a sentence
64 NODETYPE_LOGICAL_SENTENCE
=130,
65 /// This node represents a word
66 NODETYPE_LOGICAL_WORD
=131,
67 /// This node represents a character
68 NODETYPE_LOGICAL_CHARACTER_CELL
=132
71 // classificators for above text entity types
72 static bool isLogicalNodeType( NodeType eType
) { return eType
> 127; }
73 static bool isFormattingNodeType( NodeType eType
) { return eType
> 0 && eType
< 128; }
75 /** Create empty tree node
80 meType(NODETYPE_INVALID
)
84 /** Create tree node from start and end index.
86 Create a tree node for the given range and type.
97 DocTreeNode( sal_Int32 nStartIndex
,
100 mnStartIndex(nStartIndex
),
101 mnEndIndex(nEndIndex
),
106 bool isEmpty() const { return mnStartIndex
== mnEndIndex
; }
108 sal_Int32
getStartIndex() const { return mnStartIndex
; }
109 sal_Int32
getEndIndex() const { return mnEndIndex
; }
110 void setStartIndex( sal_Int32 nIndex
) { mnStartIndex
= nIndex
; }
111 void setEndIndex( sal_Int32 nIndex
) { mnEndIndex
= nIndex
; }
113 NodeType
getType() const { return meType
; }
119 meType
= NODETYPE_INVALID
;
123 sal_Int32 mnStartIndex
;
124 sal_Int32 mnEndIndex
;
129 typedef ::std::vector
< DocTreeNode
> VectorOfDocTreeNodes
;
133 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_DOCTREENODE_HXX
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */