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 : #define MT_TWOLINE 0
53 : #define MT_BIDI 1
54 : #define MT_ROT_270 3
55 : #define MT_RUBY 4
56 : #define MT_ROT_90 7
57 :
58 136 : struct Sw2LinesPos
59 : {
60 : SwRect aLine; ///< Position and size of the line
61 : SwRect aPortion; ///< Position and size of the multi portion
62 : SwRect aPortion2; ///< needed for nested multi portions
63 : sal_uInt8 nMultiType; ///< Multiportion type
64 : };
65 :
66 : /**
67 : * SwSpecialPos. This structure is used to pass some additional information
68 : * during the call of SwTxtFrm::GetCharRect(). An SwSpecialPos defines a position
69 : * inside a portion which does not have a representation in the core string or
70 : * which is only represented by one position, e.g., field portions,
71 : * number portions, ergo sum and quo vadis portions.
72 : *
73 : * nCharOfst - The offset inside the special portion. Fields and its
74 : * follow fields are treated as one long special portion.
75 : * nLineOfst - The number of lines between the beginning of the special
76 : * portion and nCharOfst. A line offset required to be
77 : * nCharOfst relative to the beginning of the line.
78 : * nExtendRange - Setting this identifies portions which are in front or
79 : * behind the core string (number portion, quo vadis)
80 : *
81 : * Examples 1)
82 : *
83 : * Get the position of the second character inside a number portion:
84 : * nCharOfst = 2; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_BEFORE;
85 : * Call SwTxtFrm:::GetCharRect with core string position 0.
86 : *
87 : * Example 2)
88 : *
89 : * Field A - Length = 5
90 : * Follow field B - Length = 9
91 : * Get the position of the third character in follow field B, core position
92 : * of field A is 33.
93 : * nCharOfst = 7; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_NONE;
94 : * Call SwTxtFrm:::GetCharRect with core string position 33.
95 : */
96 :
97 : #define SP_EXTEND_RANGE_NONE 0
98 : #define SP_EXTEND_RANGE_BEFORE 1
99 : #define SP_EXTEND_RANGE_BEHIND 2
100 :
101 : struct SwSpecialPos
102 : {
103 : sal_Int32 nCharOfst;
104 : sal_uInt16 nLineOfst;
105 : sal_uInt8 nExtendRange;
106 :
107 : // #i27615#
108 144246 : SwSpecialPos() : nCharOfst(0), nLineOfst(0),
109 144246 : nExtendRange(SP_EXTEND_RANGE_NONE)
110 144246 : {}
111 : };
112 :
113 : // CrsrTravelling-States (for GetCrsrOfst)
114 : enum CrsrMoveState
115 : {
116 : MV_NONE, ///< default
117 : MV_UPDOWN, ///< Crsr Up/Down
118 : MV_RIGHTMARGIN, ///< at right margin
119 : MV_LEFTMARGIN, ///< at left margin
120 : MV_SETONLYTEXT, ///< stay with the cursor inside text
121 : MV_TBLSEL ///< not in repeated headlines
122 : };
123 :
124 : // struct for later extensions
125 : struct SwCrsrMoveState
126 : {
127 : SwFillCrsrPos *pFill; ///< for automatic filling with tabs etc
128 : Sw2LinesPos *p2Lines; ///< for selections inside/around 2line portions
129 : SwSpecialPos* pSpecialPos; ///< for positions inside fields
130 : Point aRealHeight; ///< contains then the position/height of the cursor
131 : CrsrMoveState eState;
132 : sal_uInt8 nCursorBidiLevel;
133 : bool bStop;
134 : bool bRealHeight; ///< should the real height be calculated?
135 : bool bFieldInfo; ///< should be fields recognized?
136 : bool bPosCorr; ///< Point had to be corrected
137 : bool bFtnNoInfo; ///< recognized footnote numbering
138 : bool bExactOnly; /**< let GetCrsrOfst look for exact matches only,
139 : i.e. never let it run into GetCntntPos */
140 : bool bFillRet; ///< only used temporary in FillMode
141 : bool bSetInReadOnly; ///< ReadOnly areas may be entered
142 : bool bRealWidth; ///< Calculation of the width required
143 : bool b2Lines; ///< Check 2line portions and fill p2Lines
144 : bool bNoScroll; ///< No scrolling of undersized textframes
145 : bool bPosMatchesBounds; /**< GetCrsrOfst should not return the next
146 : position if screen position is inside second
147 : have of bound rect */
148 :
149 : bool bCntntCheck; // #i43742# Cursor position over content?
150 :
151 : // #i27615#
152 : /**
153 : cursor in front of label
154 : */
155 : bool bInFrontOfLabel;
156 : bool bInNumPortion; ///< point is in number portion #i23726#
157 : int nInNumPostionOffset; ///< distance from number portion's start
158 :
159 148909 : SwCrsrMoveState( CrsrMoveState eSt = MV_NONE ) :
160 : pFill( NULL ),
161 : p2Lines( NULL ),
162 : pSpecialPos( NULL ),
163 : eState( eSt ),
164 : nCursorBidiLevel( 0 ),
165 : bStop( false ),
166 : bRealHeight( false ),
167 : bFieldInfo( false ),
168 : bPosCorr( false ),
169 : bFtnNoInfo( false ),
170 : bExactOnly( false ),
171 : bFillRet( false ),
172 : bSetInReadOnly( false ),
173 : bRealWidth( false ),
174 : b2Lines( false ),
175 : bNoScroll( false ),
176 : bPosMatchesBounds( false ),
177 : bCntntCheck( false ), // #i43742#
178 : bInFrontOfLabel( false ), // #i27615#
179 : bInNumPortion(false), // #i26726#
180 148909 : nInNumPostionOffset(0) // #i26726#
181 148909 : {}
182 0 : SwCrsrMoveState( SwFillCrsrPos *pInitFill ) :
183 : pFill( pInitFill ),
184 : p2Lines( NULL ),
185 : pSpecialPos( NULL ),
186 : eState( MV_SETONLYTEXT ),
187 : nCursorBidiLevel( 0 ),
188 : bStop( false ),
189 : bRealHeight( false ),
190 : bFieldInfo( false ),
191 : bPosCorr( false ),
192 : bFtnNoInfo( false ),
193 : bExactOnly( false ),
194 : bFillRet( false ),
195 : bSetInReadOnly( false ),
196 : bRealWidth( false ),
197 : b2Lines( false ),
198 : bNoScroll( false ),
199 : bPosMatchesBounds( false ),
200 : bCntntCheck( false ), // #i43742#
201 : bInFrontOfLabel( false ), // #i27615#
202 : bInNumPortion(false), // #i23726#
203 0 : nInNumPostionOffset(0) // #i23726#
204 0 : {}
205 : };
206 :
207 : #endif
208 :
209 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|