LCOV - code coverage report
Current view: top level - vcl/source/edit - textdoc.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 17 0.0 %
Date: 2014-04-14 Functions: 0 13 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_VCL_SOURCE_EDIT_TEXTDOC_HXX
      21             : #define INCLUDED_VCL_SOURCE_EDIT_TEXTDOC_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <vcl/textdata.hxx>
      25             : #include <vcl/txtattr.hxx>
      26             : #include <vector>
      27             : 
      28           0 : class TextCharAttribs : public std::vector<TextCharAttrib*> {
      29             : public:
      30           0 :     ~TextCharAttribs()
      31           0 :     {
      32           0 :         for( iterator it = begin(); it != end(); ++it )
      33           0 :             delete *it;
      34           0 :     }
      35             : };
      36             : 
      37             : class TextCharAttribList : private TextCharAttribs
      38             : {
      39             : private:
      40             :     bool            mbHasEmptyAttribs;
      41             : 
      42             :                     TextCharAttribList( const TextCharAttribList& ) : TextCharAttribs() {}
      43             : 
      44             : public:
      45             :                     TextCharAttribList();
      46             :                     ~TextCharAttribList();
      47             : 
      48             :     void            Clear( bool bDestroyAttribs );
      49           0 :     sal_uInt16          Count() const               { return TextCharAttribs::size(); }
      50             : 
      51           0 :     TextCharAttrib* GetAttrib( sal_uInt16 n ) const { return TextCharAttribs::operator[]( n ); }
      52           0 :     void            RemoveAttrib( sal_uInt16 n )    { TextCharAttribs::erase( begin() + n ); }
      53             : 
      54             :     void            InsertAttrib( TextCharAttrib* pAttrib );
      55             : 
      56             :     void            DeleteEmptyAttribs();
      57             :     void            ResortAttribs();
      58             : 
      59             :     bool            HasEmptyAttribs() const { return mbHasEmptyAttribs; }
      60           0 :     bool&           HasEmptyAttribs()       { return mbHasEmptyAttribs; }
      61             : 
      62             :     TextCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos );
      63             :     TextCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_uInt16 nFromPos, sal_uInt16 nMaxPos = 0xFFFF ) const;
      64             :     TextCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos );
      65             :     bool            HasAttrib( sal_uInt16 nWhich ) const;
      66             :     bool            HasBoundingAttrib( sal_uInt16 nBound );
      67             : };
      68             : 
      69           0 : class TextNode
      70             : {
      71             : private:
      72             :     OUString            maText;
      73             :     TextCharAttribList  maCharAttribs;
      74             : 
      75             :                         TextNode( const TextNode& ) {;}
      76             : protected:
      77             :     void                ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNewChars );
      78             :     void                CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDelChars );
      79             : 
      80             : public:
      81             :                         TextNode( const OUString& rText );
      82             : 
      83           0 :     const OUString&     GetText() const         { return maText; }
      84             : 
      85           0 :     const TextCharAttribList&   GetCharAttribs() const  { return maCharAttribs; }
      86           0 :     TextCharAttribList&         GetCharAttribs()        { return maCharAttribs; }
      87             : 
      88             :     void                InsertText( sal_uInt16 nPos, const OUString& rText );
      89             :     void                InsertText( sal_uInt16 nPos, sal_Unicode c );
      90             :     void                RemoveText( sal_uInt16 nPos, sal_uInt16 nChars );
      91             : 
      92             :     TextNode*           Split( sal_uInt16 nPos, bool bKeepEndigAttribs );
      93             :     void                Append( const TextNode& rNode );
      94             : };
      95             : 
      96             : class TextDoc
      97             : {
      98             : private:
      99             :     ToolsList<TextNode*> maTextNodes;
     100             :     sal_uInt16              mnLeftMargin;
     101             : 
     102             : protected:
     103             :     void                DestroyTextNodes();
     104             : 
     105             : public:
     106             :                         TextDoc();
     107             :                         ~TextDoc();
     108             : 
     109             :     void                Clear();
     110             : 
     111           0 :     ToolsList<TextNode*>&       GetNodes()              { return maTextNodes; }
     112             :     const ToolsList<TextNode*>& GetNodes() const        { return maTextNodes; }
     113             : 
     114             :     TextPaM             RemoveChars( const TextPaM& rPaM, sal_uInt16 nChars );
     115             :     TextPaM             InsertText( const TextPaM& rPaM, sal_Unicode c );
     116             :     TextPaM             InsertText( const TextPaM& rPaM, const OUString& rStr );
     117             : 
     118             :     TextPaM             InsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs );
     119             :     TextPaM             ConnectParagraphs( TextNode* pLeft, TextNode* pRight );
     120             : 
     121             :     sal_uLong           GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel = NULL ) const;
     122             :     OUString            GetText( const sal_Unicode* pSep ) const;
     123             :     OUString            GetText( sal_uLong nPara ) const;
     124             : 
     125           0 :     void                SetLeftMargin( sal_uInt16 n )   { mnLeftMargin = n; }
     126           0 :     sal_uInt16          GetLeftMargin() const       { return mnLeftMargin; }
     127             : 
     128             :     bool            IsValidPaM( const TextPaM& rPaM );
     129             : };
     130             : 
     131             : #endif // INCLUDED_VCL_SOURCE_EDIT_TEXTDOC_HXX
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10