LCOV - code coverage report
Current view: top level - slideshow/source/inc - doctreenode.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 15 0.0 %
Date: 2014-11-03 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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_INC_DOCTREENODE_HXX
      21             : #define INCLUDED_SLIDESHOW_SOURCE_INC_DOCTREENODE_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : #include <vector>
      25             : 
      26             : 
      27             : /* Definition of DocTreeNode class */
      28             : 
      29             : namespace slideshow
      30             : {
      31             :     namespace internal
      32             :     {
      33             : 
      34             :         /** This class represents kind of a DOM tree node for shape
      35             :             text
      36             : 
      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.
      43             : 
      44             :             This class has nothing to do with the Draw document tree.
      45             :          */
      46             :         class DocTreeNode
      47             :         {
      48             :         public:
      49             :             /// Type of shape entity represented by this node
      50             :             enum NodeType
      51             :             {
      52             :                 NODETYPE_INVALID=0,
      53             : 
      54             :                 /// This node represents a full shape
      55             :                 NODETYPE_FORMATTING_SHAPE=1,
      56             :                 /// This node represents a line
      57             :                 NODETYPE_FORMATTING_LINE=2,
      58             : 
      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
      69             :             };
      70             : 
      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; }
      74             : 
      75             :             /** Create empty tree node
      76             :              */
      77           0 :             DocTreeNode() :
      78             :                 mnStartIndex(-1),
      79             :                 mnEndIndex(-1),
      80           0 :                 meType(NODETYPE_INVALID)
      81             :             {
      82           0 :             }
      83             : 
      84             :             /** Create tree node from start and end index.
      85             : 
      86             :                 Create a tree node for the given range and type.
      87             : 
      88             :                 @param nStartIndex
      89             :                 Start index
      90             : 
      91             :                 @param nEndIndex
      92             :                 End index (exclusive)
      93             : 
      94             :                 @param eType
      95             :                 Node type
      96             :              */
      97           0 :             DocTreeNode( sal_Int32 nStartIndex,
      98             :                          sal_Int32 nEndIndex,
      99             :                          NodeType  eType ) :
     100             :                 mnStartIndex(nStartIndex),
     101             :                 mnEndIndex(nEndIndex),
     102           0 :                 meType(eType)
     103             :             {
     104           0 :             }
     105             : 
     106           0 :             bool                isEmpty() const { return mnStartIndex == mnEndIndex; }
     107             : 
     108           0 :             sal_Int32           getStartIndex() const { return mnStartIndex; }
     109           0 :             sal_Int32           getEndIndex() const { return mnEndIndex; }
     110             :             void                setStartIndex( sal_Int32 nIndex ) { mnStartIndex = nIndex; }
     111           0 :             void                setEndIndex( sal_Int32 nIndex ) { mnEndIndex = nIndex; }
     112             : 
     113             :             NodeType            getType() const { return meType; }
     114             : 
     115           0 :             void                reset()
     116             :             {
     117           0 :                 mnStartIndex = -1;
     118           0 :                 mnEndIndex   = -1;
     119           0 :                 meType = NODETYPE_INVALID;
     120           0 :             }
     121             : 
     122             :         private:
     123             :             sal_Int32   mnStartIndex;
     124             :             sal_Int32   mnEndIndex;
     125             :             NodeType    meType;
     126             : 
     127             :         };
     128             : 
     129             :         typedef ::std::vector< DocTreeNode > VectorOfDocTreeNodes;
     130             :     }
     131             : }
     132             : 
     133             : #endif // INCLUDED_SLIDESHOW_SOURCE_INC_DOCTREENODE_HXX
     134             : 
     135             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10