Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / sw / inc / crstate.hxx
blob8c361dee61fca378abca612daa83283a10594200
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_CRSTATE_HXX
20 #define INCLUDED_SW_INC_CRSTATE_HXX
22 #include <com/sun/star/text/HoriOrientation.hpp>
23 #include <tools/gen.hxx>
24 #include <swtypes.hxx>
25 #include <swrect.hxx>
27 enum SwFillMode
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
35 struct SwFillCursorPos
37 SwRect aCursor; ///< 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 SwFillCursorPos( SwFillMode eMd ) :
45 nParaCnt( 0 ), nTabCnt( 0 ), nSpaceCnt( 0 ), nColumnCnt( 0 ),
46 eOrient( css::text::HoriOrientation::NONE ), eMode( eMd )
50 // Multiportion types: two lines, bidirectional, 270 degrees rotation,
51 // ruby portion and 90 degrees rotation
52 enum class MultiPortionType : sal_uInt8
54 TWOLINE = 0,
55 BIDI = 1,
56 ROT_270 = 3,
57 RUBY = 4,
58 ROT_90 = 7,
61 struct Sw2LinesPos
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
69 /**
70 * SwSpecialPos. This structure is used to pass some additional information
71 * during the call of SwTextFrame::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.
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)
84 * Examples 1)
86 * Get the position of the second character inside a number portion:
87 * nCharOfst = 2; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_BEFORE;
88 * Call SwTextFrame:::GetCharRect with core string position 0.
90 * Example 2)
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 SwTextFrame:::GetCharRect with core string position 33.
100 enum class SwSPExtendRange : sal_uInt8
102 NONE, BEFORE, BEHIND
105 struct SwSpecialPos
107 sal_Int32 nCharOfst;
108 sal_uInt16 nLineOfst;
109 SwSPExtendRange nExtendRange;
111 // #i27615#
112 SwSpecialPos() : nCharOfst(0), nLineOfst(0),
113 nExtendRange(SwSPExtendRange::NONE)
117 // CursorTravelling-States (for GetCursorOfst)
118 enum CursorMoveState
120 MV_NONE, ///< default
121 MV_UPDOWN, ///< Cursor 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
128 // struct for later extensions
129 struct SwCursorMoveState
131 SwFillCursorPos *m_pFill; ///< for automatic filling with tabs etc
132 Sw2LinesPos *m_p2Lines; ///< for selections inside/around 2line portions
133 SwSpecialPos* m_pSpecialPos; ///< for positions inside fields
134 Point m_aRealHeight; ///< contains then the position/height of the cursor
135 CursorMoveState m_eState;
136 sal_uInt8 m_nCursorBidiLevel;
137 bool m_bStop;
138 bool m_bRealHeight; ///< should the real height be calculated?
139 bool m_bFieldInfo; ///< should be fields recognized?
140 bool m_bPosCorr; ///< Point had to be corrected
141 bool m_bFootnoteNoInfo; ///< recognized footnote numbering
142 bool m_bExactOnly; /**< let GetCursorOfst look for exact matches only,
143 i.e. never let it run into GetContentPos */
144 bool m_bFillRet; ///< only used temporary in FillMode
145 bool m_bSetInReadOnly; ///< ReadOnly areas may be entered
146 bool m_bRealWidth; ///< Calculation of the width required
147 bool m_b2Lines; ///< Check 2line portions and fill p2Lines
148 bool m_bNoScroll; ///< No scrolling of undersized textframes
149 bool m_bPosMatchesBounds; /**< GetCursorOfst should not return the next
150 position if screen position is inside second
151 have of bound rect */
153 bool m_bContentCheck; // #i43742# Cursor position over content?
155 // #i27615#
157 cursor in front of label
159 bool m_bInFrontOfLabel;
160 bool m_bInNumPortion; ///< point is in number portion #i23726#
161 int m_nInNumPortionOffset; ///< distance from number portion's start
163 SwCursorMoveState( CursorMoveState eSt = MV_NONE ) :
164 m_pFill( nullptr ),
165 m_p2Lines( nullptr ),
166 m_pSpecialPos( nullptr ),
167 m_eState( eSt ),
168 m_nCursorBidiLevel( 0 ),
169 m_bStop( false ),
170 m_bRealHeight( false ),
171 m_bFieldInfo( false ),
172 m_bPosCorr( false ),
173 m_bFootnoteNoInfo( false ),
174 m_bExactOnly( false ),
175 m_bFillRet( false ),
176 m_bSetInReadOnly( false ),
177 m_bRealWidth( false ),
178 m_b2Lines( false ),
179 m_bNoScroll( false ),
180 m_bPosMatchesBounds( false ),
181 m_bContentCheck( false ), // #i43742#
182 m_bInFrontOfLabel( false ), // #i27615#
183 m_bInNumPortion(false), // #i26726#
184 m_nInNumPortionOffset(0) // #i26726#
186 SwCursorMoveState( SwFillCursorPos *pInitFill ) :
187 m_pFill( pInitFill ),
188 m_p2Lines( nullptr ),
189 m_pSpecialPos( nullptr ),
190 m_eState( MV_SETONLYTEXT ),
191 m_nCursorBidiLevel( 0 ),
192 m_bStop( false ),
193 m_bRealHeight( false ),
194 m_bFieldInfo( false ),
195 m_bPosCorr( false ),
196 m_bFootnoteNoInfo( false ),
197 m_bExactOnly( false ),
198 m_bFillRet( false ),
199 m_bSetInReadOnly( false ),
200 m_bRealWidth( false ),
201 m_b2Lines( false ),
202 m_bNoScroll( false ),
203 m_bPosMatchesBounds( false ),
204 m_bContentCheck( false ), // #i43742#
205 m_bInFrontOfLabel( false ), // #i27615#
206 m_bInNumPortion(false), // #i23726#
207 m_nInNumPortionOffset(0) // #i23726#
211 #endif
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */