LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/inc - crstate.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 13 53.8 %
Date: 2013-07-09 Functions: 3 5 60.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             : #ifndef _CRSTATE_HXX
      20             : #define _CRSTATE_HXX
      21             : 
      22             : #include <com/sun/star/text/HoriOrientation.hpp>
      23             : #include <tools/gen.hxx>
      24             : #include <swtypes.hxx>
      25             : #include <swrect.hxx>
      26             : 
      27             : 
      28             : enum SwFillMode
      29             : {
      30             :     FILL_TAB,       ///< default, fill with tabs
      31             :     FILL_SPACE,     ///< fill with spaces and tabs
      32             :     FILL_MARGIN,    ///< only align left, center, right
      33             :     FILL_INDENT     ///< by left paragraph indention
      34             : };
      35             : 
      36             : struct SwFillCrsrPos
      37             : {
      38             :     SwRect aCrsr;           ///< position and size of the ShadowCursor
      39             :     sal_uInt16 nParaCnt;        ///< number of paragraphs to insert
      40             :     sal_uInt16 nTabCnt;         ///< number of tabs respectively size of indentation
      41             :     sal_uInt16 nSpaceCnt;       ///< number of spaces to insert
      42             :     sal_uInt16 nColumnCnt;      ///< number of necessary column breaks
      43             :     sal_Int16  eOrient;      ///< paragraph alignment
      44             :     SwFillMode eMode;       ///< desired fill-up rule
      45           0 :     SwFillCrsrPos( SwFillMode eMd = FILL_TAB ) :
      46             :         nParaCnt( 0 ), nTabCnt( 0 ), nSpaceCnt( 0 ), nColumnCnt( 0 ),
      47           0 :         eOrient( com::sun::star::text::HoriOrientation::NONE ), eMode( eMd )
      48           0 :     {}
      49             : };
      50             : 
      51             : // Multiportion types: two lines, bidirectional, 270 degrees rotation,
      52             : //                     ruby portion and 90 degrees rotation
      53             : #define MT_TWOLINE  0
      54             : #define MT_BIDI     1
      55             : #define MT_ROT_270  3
      56             : #define MT_RUBY     4
      57             : #define MT_ROT_90   7
      58             : 
      59          68 : struct Sw2LinesPos
      60             : {
      61             :     SwRect aLine;           ///< Position and size of the line
      62             :     SwRect aPortion;        ///< Position and size of the multi portion
      63             :     SwRect aPortion2;       ///< needed for nested multi portions
      64             :     sal_uInt8 nMultiType;        ///< Multiportion type
      65             : };
      66             : 
      67             : /**
      68             :  *  SwSpecialPos. This structure is used to pass some additional information
      69             :  *  during the call of SwTxtFrm::GetCharRect(). An SwSpecialPos defines a position
      70             :  *  inside a portion which does not have a representation in the core string or
      71             :  *  which is only represented by one position,  e.g., field portions,
      72             :  *  number portions, ergo sum and quo vadis portions.
      73             :  *
      74             :  *  nCharOfst       - The offset inside the special portion. Fields and its
      75             :  *                    follow fields are treated as one long special portion.
      76             :  *  nLineOfst       - The number of lines between the beginning of the special
      77             :  *                    portion and nCharOfst. A line offset required to be
      78             :  *                    nCharOfst relative to the beginning of the line.
      79             :  *  nExtendRange    - Setting this identifies portions which are in front or
      80             :  *                    behind the core string (number portion, quo vadis)
      81             :  *
      82             :  *  Examples 1)
      83             :  *
      84             :  *      Get the position of the second character inside a number portion:
      85             :  *          nCharOfst = 2; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_BEFORE;
      86             :  *          Call SwTxtFrm:::GetCharRect with core string position 0.
      87             :  *
      88             :  *  Example 2)
      89             :  *
      90             :  *      Field A - Length = 5
      91             :  *      Follow field B - Length = 9
      92             :  *      Get the position of the third character in follow field B, core position
      93             :  *      of field A is 33.
      94             :  *          nCharOfst = 7; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_NONE;
      95             :  *          Call SwTxtFrm:::GetCharRect with core string position 33.
      96             :  */
      97             : 
      98             : #define SP_EXTEND_RANGE_NONE    0
      99             : #define SP_EXTEND_RANGE_BEFORE  1
     100             : #define SP_EXTEND_RANGE_BEHIND  2
     101             : 
     102             : struct SwSpecialPos
     103             : {
     104             :     xub_StrLen nCharOfst;
     105             :     sal_uInt16 nLineOfst;
     106             :     sal_uInt8 nExtendRange;
     107             : 
     108             :     // #i27615#
     109       36474 :     SwSpecialPos() : nCharOfst(0), nLineOfst(0),
     110       36474 :                      nExtendRange(SP_EXTEND_RANGE_NONE)
     111       36474 :     {}
     112             : };
     113             : 
     114             : // CrsrTravelling-States (for GetCrsrOfst)
     115             : enum CrsrMoveState
     116             : {
     117             :     MV_NONE,            ///< default
     118             :     MV_UPDOWN,          ///< Crsr Up/Down
     119             :     MV_RIGHTMARGIN,     ///< at right margin
     120             :     MV_LEFTMARGIN,      ///< at left margin
     121             :     MV_SETONLYTEXT,     ///< stay with the cursor inside text
     122             :     MV_TBLSEL           ///< not in repeated headlines
     123             : };
     124             : 
     125             : // struct for later extensions
     126             : struct SwCrsrMoveState
     127             : {
     128             :     SwFillCrsrPos   *pFill;     ///< for automatic filling with tabs etc
     129             :     Sw2LinesPos     *p2Lines;   ///< for selections inside/around 2line portions
     130             :     SwSpecialPos*   pSpecialPos; ///< for positions inside fields
     131             :     Point aRealHeight;          ///< contains then the position/height of the cursor
     132             :     CrsrMoveState eState;
     133             :     sal_uInt8            nCursorBidiLevel;
     134             :     sal_Bool bStop;
     135             :     sal_Bool bRealHeight;           ///< should the real height be calculated?
     136             :     sal_Bool bFieldInfo;            ///< should be fields recognized?
     137             :     sal_Bool bPosCorr;              ///< Point had to be corrected
     138             :     sal_Bool bFtnNoInfo;            ///< recognized footnote numbering
     139             :     sal_Bool bExactOnly;            /**< let GetCrsrOfst look for exact matches only,
     140             :                                          i.e. never let it run into GetCntntPos */
     141             :     sal_Bool bFillRet;              ///< only used temporary in FillMode
     142             :     sal_Bool bSetInReadOnly;        ///< ReadOnly areas may be entered
     143             :     sal_Bool bRealWidth;            ///< Calculation of the width required
     144             :     sal_Bool b2Lines;               ///< Check 2line portions and fill p2Lines
     145             :     sal_Bool bNoScroll;             ///< No scrolling of undersized textframes
     146             :     sal_Bool bPosMatchesBounds;     /**< GetCrsrOfst should not return the next
     147             :                                        position if screen position is inside second
     148             :                                        have of bound rect */
     149             : 
     150             :     sal_Bool bCntntCheck;           // #i43742# Cursor position over content?
     151             : 
     152             :     // #i27615#
     153             :     /**
     154             :        cursor in front of label
     155             :      */
     156             :     sal_Bool bInFrontOfLabel;
     157             :     sal_Bool bInNumPortion;         ///< point is in number portion #i23726#
     158             :     int nInNumPostionOffset;        ///< distance from number portion's start
     159             : 
     160       37231 :     SwCrsrMoveState( CrsrMoveState eSt = MV_NONE ) :
     161             :         pFill( NULL ),
     162             :         p2Lines( NULL ),
     163             :         pSpecialPos( NULL ),
     164             :         eState( eSt ),
     165             :         nCursorBidiLevel( 0 ),
     166             :         bStop( sal_False ),
     167             :         bRealHeight( sal_False ),
     168             :         bFieldInfo( sal_False ),
     169             :         bPosCorr( sal_False ),
     170             :         bFtnNoInfo( sal_False ),
     171             :         bExactOnly( sal_False ),
     172             :         bSetInReadOnly( sal_False ),
     173             :         bRealWidth( sal_False ),
     174             :         b2Lines( sal_False ),
     175             :         bNoScroll( sal_False ),
     176             :         bPosMatchesBounds( sal_False ),
     177             :         bCntntCheck( sal_False ), // #i43742#
     178             :         bInFrontOfLabel( sal_False ), // #i27615#
     179             :         bInNumPortion(sal_False), // #i26726#
     180       37231 :         nInNumPostionOffset(0) // #i26726#
     181       37231 :     {}
     182           0 :     SwCrsrMoveState( SwFillCrsrPos *pInitFill ) :
     183             :         pFill( pInitFill ),
     184             :         pSpecialPos( NULL ),
     185             :         eState( MV_SETONLYTEXT ),
     186             :         nCursorBidiLevel( 0 ),
     187             :         bStop( sal_False ),
     188             :         bRealHeight( sal_False ),
     189             :         bFieldInfo( sal_False ),
     190             :         bPosCorr( sal_False ),
     191             :         bFtnNoInfo( sal_False ),
     192             :         bExactOnly( sal_False ),
     193             :         bSetInReadOnly( sal_False ),
     194             :         bRealWidth( sal_False ),
     195             :         b2Lines( sal_False ),
     196             :         bNoScroll( sal_False ),
     197             :         bPosMatchesBounds( sal_False ),
     198             :         bCntntCheck( sal_False ), // #i43742#
     199             :         bInFrontOfLabel( sal_False ), // #i27615#
     200             :         bInNumPortion(sal_False), // #i23726#
     201           0 :         nInNumPostionOffset(0) // #i23726#
     202           0 :     {}
     203             : };
     204             : 
     205             : 
     206             : #endif
     207             : 
     208             : 
     209             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10