build fix
[LibreOffice.git] / slideshow / source / inc / doctreenode.hxx
blob584832cc3b9d69aab63de867e6757082d6542c52
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_DOCTREENODE_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_INC_DOCTREENODE_HXX
23 #include <sal/types.h>
24 #include <vector>
27 /* Definition of DocTreeNode class */
29 namespace slideshow
31 namespace internal
34 /** This class represents kind of a DOM tree node for shape
35 text
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.
46 class DocTreeNode
48 public:
49 /// Type of shape entity represented by this node
50 enum NodeType
52 NODETYPE_INVALID=0,
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 /** Create empty tree node
73 DocTreeNode() :
74 mnStartIndex(-1),
75 mnEndIndex(-1),
76 meType(NODETYPE_INVALID)
80 /** Create tree node from start and end index.
82 Create a tree node for the given range and type.
84 @param nStartIndex
85 Start index
87 @param nEndIndex
88 End index (exclusive)
90 @param eType
91 Node type
93 DocTreeNode( sal_Int32 nStartIndex,
94 sal_Int32 nEndIndex,
95 NodeType eType ) :
96 mnStartIndex(nStartIndex),
97 mnEndIndex(nEndIndex),
98 meType(eType)
102 bool isEmpty() const { return mnStartIndex == mnEndIndex; }
104 sal_Int32 getStartIndex() const { return mnStartIndex; }
105 sal_Int32 getEndIndex() const { return mnEndIndex; }
106 void setEndIndex( sal_Int32 nIndex ) { mnEndIndex = nIndex; }
108 void reset()
110 mnStartIndex = -1;
111 mnEndIndex = -1;
112 meType = NODETYPE_INVALID;
115 private:
116 sal_Int32 mnStartIndex;
117 sal_Int32 mnEndIndex;
118 NodeType meType;
122 typedef ::std::vector< DocTreeNode > VectorOfDocTreeNodes;
126 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_DOCTREENODE_HXX
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */