LCOV - code coverage report
Current view: top level - sw/inc - crstate.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 13 53.8 %
Date: 2012-08-25 Functions: 3 5 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _CRSTATE_HXX
      29                 :            : #define _CRSTATE_HXX
      30                 :            : 
      31                 :            : #include <com/sun/star/text/HoriOrientation.hpp>
      32                 :            : #include <tools/gen.hxx>
      33                 :            : #include <swtypes.hxx>
      34                 :            : #include <swrect.hxx>
      35                 :            : 
      36                 :            : 
      37                 :            : enum SwFillMode
      38                 :            : {
      39                 :            :     FILL_TAB,       ///< default, fill with tabs
      40                 :            :     FILL_SPACE,     ///< fill with spaces and tabs
      41                 :            :     FILL_MARGIN,    ///< only align left, center, right
      42                 :            :     FILL_INDENT     ///< by left paragraph indention
      43                 :            : };
      44                 :            : 
      45                 :            : struct SwFillCrsrPos
      46                 :            : {
      47                 :            :     SwRect aCrsr;           ///< position and size of the ShadowCursor
      48                 :            :     sal_uInt16 nParaCnt;        ///< number of paragraphs to insert
      49                 :            :     sal_uInt16 nTabCnt;         ///< number of tabs respectively size of indentation
      50                 :            :     sal_uInt16 nSpaceCnt;       ///< number of spaces to insert
      51                 :            :     sal_uInt16 nColumnCnt;      ///< number of necessary column breaks
      52                 :            :     sal_Int16  eOrient;      ///< paragraph alignment
      53                 :            :     SwFillMode eMode;       ///< desired fill-up rule
      54                 :          0 :     SwFillCrsrPos( SwFillMode eMd = FILL_TAB ) :
      55                 :            :         nParaCnt( 0 ), nTabCnt( 0 ), nSpaceCnt( 0 ), nColumnCnt( 0 ),
      56                 :          0 :         eOrient( com::sun::star::text::HoriOrientation::NONE ), eMode( eMd )
      57                 :          0 :     {}
      58                 :            : };
      59                 :            : 
      60                 :            : // Multiportion types: two lines, bidirectional, 270 degrees rotation,
      61                 :            : //                     ruby portion and 90 degrees rotation
      62                 :            : #define MT_TWOLINE  0
      63                 :            : #define MT_BIDI     1
      64                 :            : #define MT_ROT_270  3
      65                 :            : #define MT_RUBY     4
      66                 :            : #define MT_ROT_90   7
      67                 :            : 
      68                 :        140 : struct Sw2LinesPos
      69                 :            : {
      70                 :            :     SwRect aLine;           ///< Position and size of the line
      71                 :            :     SwRect aPortion;        ///< Position and size of the multi portion
      72                 :            :     SwRect aPortion2;       ///< needed for nested multi portions
      73                 :            :     sal_uInt8 nMultiType;        ///< Multiportion type
      74                 :            : };
      75                 :            : 
      76                 :            : /**
      77                 :            :  *  SwSpecialPos. This structure is used to pass some additional information
      78                 :            :  *  during the call of SwTxtFrm::GetCharRect(). An SwSpecialPos defines a position
      79                 :            :  *  inside a portion which does not have a representation in the core string or
      80                 :            :  *  which is only represented by one position,  e.g., field portions,
      81                 :            :  *  number portions, ergo sum and quo vadis portions.
      82                 :            :  *
      83                 :            :  *  nCharOfst       - The offset inside the special portion. Fields and its
      84                 :            :  *                    follow fields are treated as one long special portion.
      85                 :            :  *  nLineOfst       - The number of lines between the beginning of the special
      86                 :            :  *                    portion and nCharOfst. A line offset required to be
      87                 :            :  *                    nCharOfst relative to the beginning of the line.
      88                 :            :  *  nExtendRange    - Setting this identifies portions which are in front or
      89                 :            :  *                    behind the core string (number portion, quo vadis)
      90                 :            :  *
      91                 :            :  *  Examples 1)
      92                 :            :  *
      93                 :            :  *      Get the position of the second character inside a number portion:
      94                 :            :  *          nCharOfst = 2; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_BEFORE;
      95                 :            :  *          Call SwTxtFrm:::GetCharRect with core string position 0.
      96                 :            :  *
      97                 :            :  *  Example 2)
      98                 :            :  *
      99                 :            :  *      Field A - Length = 5
     100                 :            :  *      Follow field B - Length = 9
     101                 :            :  *      Get the position of the third character in follow field B, core position
     102                 :            :  *      of field A is 33.
     103                 :            :  *          nCharOfst = 7; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_NONE;
     104                 :            :  *          Call SwTxtFrm:::GetCharRect with core string position 33.
     105                 :            :  */
     106                 :            : 
     107                 :            : #define SP_EXTEND_RANGE_NONE    0
     108                 :            : #define SP_EXTEND_RANGE_BEFORE  1
     109                 :            : #define SP_EXTEND_RANGE_BEHIND  2
     110                 :            : 
     111                 :            : struct SwSpecialPos
     112                 :            : {
     113                 :            :     xub_StrLen nCharOfst;
     114                 :            :     sal_uInt16 nLineOfst;
     115                 :            :     sal_uInt8 nExtendRange;
     116                 :            : 
     117                 :            :     // #i27615#
     118                 :      69345 :     SwSpecialPos() : nCharOfst(0), nLineOfst(0),
     119                 :      69345 :                      nExtendRange(SP_EXTEND_RANGE_NONE)
     120                 :      69345 :     {}
     121                 :            : };
     122                 :            : 
     123                 :            : // CrsrTravelling-States (for GetCrsrOfst)
     124                 :            : enum CrsrMoveState
     125                 :            : {
     126                 :            :     MV_NONE,            ///< default
     127                 :            :     MV_UPDOWN,          ///< Crsr Up/Down
     128                 :            :     MV_RIGHTMARGIN,     ///< at right margin
     129                 :            :     MV_LEFTMARGIN,      ///< at left margin
     130                 :            :     MV_SETONLYTEXT,     ///< stay with the cursor inside text
     131                 :            :     MV_TBLSEL           ///< not in repeated headlines
     132                 :            : };
     133                 :            : 
     134                 :            : // struct for later extensions
     135                 :            : struct SwCrsrMoveState
     136                 :            : {
     137                 :            :     SwFillCrsrPos   *pFill;     ///< for automatic filling with tabs etc
     138                 :            :     Sw2LinesPos     *p2Lines;   ///< for selections inside/around 2line portions
     139                 :            :     SwSpecialPos*   pSpecialPos; ///< for positions inside fields
     140                 :            :     Point aRealHeight;          ///< contains then the position/height of the cursor
     141                 :            :     CrsrMoveState eState;
     142                 :            :     sal_uInt8            nCursorBidiLevel;
     143                 :            :     sal_Bool bStop;
     144                 :            :     sal_Bool bRealHeight;           ///< should the real height be calculated?
     145                 :            :     sal_Bool bFieldInfo;            ///< should be fields recognized?
     146                 :            :     sal_Bool bPosCorr;              ///< Point had to be corrected
     147                 :            :     sal_Bool bFtnNoInfo;            ///< recognized footnote numbering
     148                 :            :     sal_Bool bExactOnly;            /**< let GetCrsrOfst look for exact matches only,
     149                 :            :                                          i.e. never let it run into GetCntntPos */
     150                 :            :     sal_Bool bFillRet;              ///< only used temporary in FillMode
     151                 :            :     sal_Bool bSetInReadOnly;        ///< ReadOnly areas may be entered
     152                 :            :     sal_Bool bRealWidth;            ///< Calculation of the width required
     153                 :            :     sal_Bool b2Lines;               ///< Check 2line portions and fill p2Lines
     154                 :            :     sal_Bool bNoScroll;             ///< No scrolling of undersized textframes
     155                 :            :     sal_Bool bPosMatchesBounds;     /**< GetCrsrOfst should not return the next
     156                 :            :                                        position if screen position is inside second
     157                 :            :                                        have of bound rect */
     158                 :            : 
     159                 :            :     sal_Bool bCntntCheck;           // #i43742# Cursor position over content?
     160                 :            : 
     161                 :            :     // #i27615#
     162                 :            :     /**
     163                 :            :        cursor in front of label
     164                 :            :      */
     165                 :            :     sal_Bool bInFrontOfLabel;
     166                 :            :     sal_Bool bInNumPortion;         ///< point is in number portion #i23726#
     167                 :            :     int nInNumPostionOffset;        ///< distance from number portion's start
     168                 :            : 
     169                 :      70820 :     SwCrsrMoveState( CrsrMoveState eSt = MV_NONE ) :
     170                 :            :         pFill( NULL ),
     171                 :            :         p2Lines( NULL ),
     172                 :            :         pSpecialPos( NULL ),
     173                 :            :         eState( eSt ),
     174                 :            :         nCursorBidiLevel( 0 ),
     175                 :            :         bStop( sal_False ),
     176                 :            :         bRealHeight( sal_False ),
     177                 :            :         bFieldInfo( sal_False ),
     178                 :            :         bPosCorr( sal_False ),
     179                 :            :         bFtnNoInfo( sal_False ),
     180                 :            :         bExactOnly( sal_False ),
     181                 :            :         bSetInReadOnly( sal_False ),
     182                 :            :         bRealWidth( sal_False ),
     183                 :            :         b2Lines( sal_False ),
     184                 :            :         bNoScroll( sal_False ),
     185                 :            :         bPosMatchesBounds( sal_False ),
     186                 :            :         bCntntCheck( sal_False ), // #i43742#
     187                 :            :         bInFrontOfLabel( sal_False ), // #i27615#
     188                 :            :         bInNumPortion(sal_False), // #i26726#
     189                 :      70820 :         nInNumPostionOffset(0) // #i26726#
     190                 :      70820 :     {}
     191                 :          0 :     SwCrsrMoveState( SwFillCrsrPos *pInitFill ) :
     192                 :            :         pFill( pInitFill ),
     193                 :            :         pSpecialPos( NULL ),
     194                 :            :         eState( MV_SETONLYTEXT ),
     195                 :            :         nCursorBidiLevel( 0 ),
     196                 :            :         bStop( sal_False ),
     197                 :            :         bRealHeight( sal_False ),
     198                 :            :         bFieldInfo( sal_False ),
     199                 :            :         bPosCorr( sal_False ),
     200                 :            :         bFtnNoInfo( sal_False ),
     201                 :            :         bExactOnly( sal_False ),
     202                 :            :         bSetInReadOnly( sal_False ),
     203                 :            :         bRealWidth( sal_False ),
     204                 :            :         b2Lines( sal_False ),
     205                 :            :         bNoScroll( sal_False ),
     206                 :            :         bPosMatchesBounds( sal_False ),
     207                 :            :         bCntntCheck( sal_False ), // #i43742#
     208                 :            :         bInFrontOfLabel( sal_False ), // #i27615#
     209                 :            :         bInNumPortion(sal_False), // #i23726#
     210                 :          0 :         nInNumPostionOffset(0) // #i23726#
     211                 :          0 :     {}
     212                 :            : };
     213                 :            : 
     214                 :            : 
     215                 :            : #endif
     216                 :            : 
     217                 :            : 
     218                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10