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

Generated by: LCOV version 1.11