LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/vcl - textdata.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 23 31 74.2 %
Date: 2012-08-25 Functions: 27 34 79.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 42 16.7 %

           Branch data     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 _TEXTDATA_HXX
      21                 :            : #define _TEXTDATA_HXX
      22                 :            : 
      23                 :            : #include <vcl/dllapi.h>
      24                 :            : #include <svl/brdcst.hxx>
      25                 :            : #include <svl/smplhint.hxx>
      26                 :            : #include <tools/string.hxx>
      27                 :            : 
      28                 :            : // Fuer Notify, wenn alle Absaetze geloescht wurden...
      29                 :            : #define TEXT_PARA_ALL               0xFFFFFFFF
      30                 :            : 
      31                 :            : class TextPaM
      32                 :            : {
      33                 :            : private:
      34                 :            :     sal_uLong           mnPara;
      35                 :            :     sal_uInt16          mnIndex;
      36                 :            : 
      37                 :            : public:
      38                 :        668 :                     TextPaM()                               { mnPara = 0, mnIndex = 0; }
      39                 :        308 :                     TextPaM( sal_uLong nPara, sal_uInt16 nIndex )   { mnPara = nPara, mnIndex = nIndex; }
      40                 :            : 
      41                 :       1028 :     sal_uLong           GetPara() const     { return mnPara; }
      42                 :       1194 :     sal_uLong&          GetPara()           { return mnPara; }
      43                 :            : 
      44                 :        720 :     sal_uInt16          GetIndex() const    { return mnIndex; }
      45                 :        592 :     sal_uInt16&         GetIndex()          { return mnIndex; }
      46                 :            : 
      47                 :            :     inline sal_Bool     operator == ( const TextPaM& rPaM ) const;
      48                 :            :     inline sal_Bool     operator != ( const TextPaM& rPaM ) const;
      49                 :            :     inline sal_Bool     operator < ( const TextPaM& rPaM ) const;
      50                 :            :     inline sal_Bool     operator > ( const TextPaM& rPaM ) const;
      51                 :            : };
      52                 :            : 
      53                 :       1833 : inline sal_Bool TextPaM::operator == ( const TextPaM& rPaM ) const
      54                 :            : {
      55 [ +  - ][ +  - ]:       1833 :     return ( ( mnPara == rPaM.mnPara ) && ( mnIndex == rPaM.mnIndex ) ) ? sal_True : sal_False;
      56                 :            : }
      57                 :            : 
      58                 :        885 : inline sal_Bool TextPaM::operator != ( const TextPaM& rPaM ) const
      59                 :            : {
      60                 :        885 :     return !( *this == rPaM );
      61                 :            : }
      62                 :            : 
      63                 :          0 : inline sal_Bool TextPaM::operator < ( const TextPaM& rPaM ) const
      64                 :            : {
      65                 :            :     return ( ( mnPara < rPaM.mnPara ) ||
      66 [ #  # ][ #  # ]:          0 :              ( ( mnPara == rPaM.mnPara ) && mnIndex < rPaM.mnIndex ) ) ? sal_True : sal_False;
                 [ #  # ]
      67                 :            : }
      68                 :            : 
      69                 :          0 : inline sal_Bool TextPaM::operator > ( const TextPaM& rPaM ) const
      70                 :            : {
      71                 :            :     return ( ( mnPara > rPaM.mnPara ) ||
      72 [ #  # ][ #  # ]:          0 :              ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex ) ) ? sal_True : sal_False;
                 [ #  # ]
      73                 :            : }
      74                 :            : 
      75                 :            : class VCL_DLLPUBLIC TextSelection
      76                 :            : {
      77                 :            : private:
      78                 :            :     TextPaM         maStartPaM;
      79                 :            :     TextPaM         maEndPaM;
      80                 :            : 
      81                 :            : public:
      82                 :            :                     TextSelection();
      83                 :            :                     TextSelection( const TextPaM& rPaM );
      84                 :            :                     TextSelection( const TextPaM& rStart, const TextPaM& rEnd );
      85                 :            : 
      86                 :          0 :     const TextPaM&  GetStart() const    { return maStartPaM; }
      87                 :        436 :     TextPaM&        GetStart()          { return maStartPaM; }
      88                 :            : 
      89                 :         52 :     const TextPaM&  GetEnd() const      { return maEndPaM; }
      90                 :        526 :     TextPaM&        GetEnd()            { return maEndPaM; }
      91                 :            : 
      92                 :            :     void            Justify();
      93                 :            : 
      94                 :        885 :     sal_Bool            HasRange() const    { return maStartPaM != maEndPaM; }
      95                 :            : 
      96                 :            :     inline sal_Bool     operator == ( const TextSelection& rSel ) const;
      97                 :            :     inline sal_Bool     operator != ( const TextSelection& rSel ) const;
      98                 :            : };
      99                 :            : 
     100                 :        474 : inline sal_Bool TextSelection::operator == ( const TextSelection& rSel ) const
     101                 :            : {
     102 [ +  - ][ +  - ]:        474 :     return ( ( maStartPaM == rSel.maStartPaM ) && ( maEndPaM == rSel.maEndPaM ) );
     103                 :            : }
     104                 :            : 
     105                 :        474 : inline sal_Bool TextSelection::operator != ( const TextSelection& rSel ) const
     106                 :            : {
     107                 :        474 :     return !( *this == rSel );
     108                 :            : }
     109                 :            : 
     110                 :            : #define TEXT_HINT_PARAINSERTED              1
     111                 :            : #define TEXT_HINT_PARAREMOVED               2
     112                 :            : #define TEXT_HINT_PARACONTENTCHANGED        3
     113                 :            : #define TEXT_HINT_TEXTHEIGHTCHANGED         4
     114                 :            : #define TEXT_HINT_FORMATPARA                5
     115                 :            : #define TEXT_HINT_TEXTFORMATTED             6
     116                 :            : #define TEXT_HINT_MODIFIED                  7
     117                 :            : #define TEXT_HINT_BLOCKNOTIFICATION_START   8
     118                 :            : #define TEXT_HINT_BLOCKNOTIFICATION_END     9
     119                 :            : #define TEXT_HINT_INPUT_START               10
     120                 :            : #define TEXT_HINT_INPUT_END                 11
     121                 :            : 
     122                 :            : #define TEXT_HINT_VIEWSCROLLED          100
     123                 :            : #define TEXT_HINT_VIEWSELECTIONCHANGED  101
     124                 :            : 
     125         [ -  + ]:       2025 : class VCL_DLLPUBLIC TextHint : public SfxSimpleHint
     126                 :            : {
     127                 :            : private:
     128                 :            :     sal_uLong   mnValue;
     129                 :            : 
     130                 :            : public:
     131                 :            :             TYPEINFO();
     132                 :            :             TextHint( sal_uLong nId );
     133                 :            :             TextHint( sal_uLong nId, sal_uLong nValue );
     134                 :            : 
     135                 :          0 :     sal_uLong   GetValue() const        { return mnValue; }
     136                 :            :     void    SetValue( sal_uLong n )     { mnValue = n; }
     137                 :            : };
     138                 :            : 
     139                 :            : struct TEIMEInfos
     140                 :            : {
     141                 :            :     String  aOldTextAfterStartPos;
     142                 :            :     sal_uInt16* pAttribs;
     143                 :            :     TextPaM aPos;
     144                 :            :     sal_uInt16  nLen;
     145                 :            :     sal_Bool    bCursor;
     146                 :            :     sal_Bool    bWasCursorOverwrite;
     147                 :            : 
     148                 :            :             TEIMEInfos( const TextPaM& rPos, const String& rOldTextAfterStartPos );
     149                 :            :             ~TEIMEInfos();
     150                 :            : 
     151                 :            :     void    CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL );
     152                 :            :     void    DestroyAttribs();
     153                 :            : };
     154                 :            : 
     155                 :            : // -----------------  Wrapper for old Tools List -------------------
     156                 :            : 
     157                 :            : #include <vector>
     158                 :            : #include <algorithm>
     159                 :            : 
     160                 :        616 : template <class T> class ToolsList : public ::std::vector< T >
     161                 :            : {
     162                 :            : public:
     163                 :       3796 :     sal_uLong           Count() const { return static_cast<sal_uLong>(::std::vector< T >::size()); }
     164 [ #  # ][ #  # ]:          0 :     sal_uLong           GetPos( T pObject ) const { return ( ::std::find( this->begin(), this->end(), pObject ) ) - this->begin(); }
     165                 :       8886 :     T               GetObject( sal_uLong nIndex ) const { return (*this)[nIndex]; }
     166 [ +  - ][ +  - ]:        436 :     void            Insert( T pObject, sal_uLong nPos ) { ::std::vector< T >::insert( this->begin()+nPos, pObject ); }
         [ #  # ][ #  # ]
     167 [ #  # ][ #  # ]:          0 :     void            Remove( sal_uLong nPos ) { ::std::vector< T >::erase( this->begin()+nPos ); }
         [ #  # ][ #  # ]
     168                 :            : };
     169                 :            : 
     170                 :            : #endif // _TEXTDATA_HXX
     171                 :            : 
     172                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10