1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
30 FILL_TAB
, ///< default, fill with tabs
31 FILL_TAB_SPACE
, ///< fill with spaces and tabs
32 FILL_SPACE
, ///< fill with spaces
33 FILL_MARGIN
, ///< only align left, center, right
34 FILL_INDENT
///< by left paragraph indention
37 struct SwFillCursorPos
39 SwRect aCursor
; ///< position and size of the ShadowCursor
40 sal_uInt16 nParaCnt
; ///< number of paragraphs to insert
41 sal_uInt16 nTabCnt
; ///< number of tabs respectively size of indentation
42 sal_uInt16 nSpaceCnt
; ///< number of spaces to insert
43 sal_uInt16 nSpaceOnlyCnt
; ///< number of spaces to insert ("only spaces, no tabs" mode)
44 sal_uInt16 nColumnCnt
; ///< number of necessary column breaks
45 sal_Int16 eOrient
; ///< paragraph alignment
46 SwFillMode
const eMode
; ///< desired fill-up rule
47 SwFillCursorPos( SwFillMode eMd
) :
48 nParaCnt( 0 ), nTabCnt( 0 ), nSpaceCnt( 0 ), nSpaceOnlyCnt(0), nColumnCnt( 0 ),
49 eOrient( css::text::HoriOrientation::NONE
), eMode( eMd
)
53 // Multiportion types: two lines, bidirectional, 270 degrees rotation,
54 // ruby portion and 90 degrees rotation
55 enum class MultiPortionType
: sal_uInt8
66 SwRect aLine
; ///< Position and size of the line
67 SwRect aPortion
; ///< Position and size of the multi portion
68 SwRect aPortion2
; ///< needed for nested multi portions
69 MultiPortionType nMultiType
; ///< Multiportion type
73 * SwSpecialPos. This structure is used to pass some additional information
74 * during the call of SwTextFrame::GetCharRect(). An SwSpecialPos defines a position
75 * inside a portion which does not have a representation in the core string or
76 * which is only represented by one position, e.g., field portions,
77 * number portions, ergo sum and quo vadis portions.
79 * nCharOfst - The offset inside the special portion. Fields and its
80 * follow fields are treated as one long special portion.
81 * nLineOfst - The number of lines between the beginning of the special
82 * portion and nCharOfst. A line offset required to be
83 * nCharOfst relative to the beginning of the line.
84 * nExtendRange - Setting this identifies portions which are in front or
85 * behind the core string (number portion, quo vadis)
89 * Get the position of the second character inside a number portion:
90 * nCharOfst = 2; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_BEFORE;
91 * Call SwTextFrame:::GetCharRect with core string position 0.
95 * Field A - Length = 5
96 * Follow field B - Length = 9
97 * Get the position of the third character in follow field B, core position
99 * nCharOfst = 7; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_NONE;
100 * Call SwTextFrame:::GetCharRect with core string position 33.
103 enum class SwSPExtendRange
: sal_uInt8
111 sal_uInt16 nLineOfst
;
112 SwSPExtendRange nExtendRange
;
115 SwSpecialPos() : nCharOfst(0), nLineOfst(0),
116 nExtendRange(SwSPExtendRange::NONE
)
120 // CursorTravelling-States (for GetCursorOfst)
123 MV_NONE
, ///< default
124 MV_UPDOWN
, ///< Cursor Up/Down
125 MV_RIGHTMARGIN
, ///< at right margin
126 MV_LEFTMARGIN
, ///< at left margin
127 MV_SETONLYTEXT
, ///< stay with the cursor inside text
128 MV_TBLSEL
///< not in repeated headlines
131 // struct for later extensions
132 struct SwCursorMoveState
134 SwFillCursorPos
*m_pFill
; ///< for automatic filling with tabs etc
135 std::unique_ptr
<Sw2LinesPos
> m_p2Lines
; ///< for selections inside/around 2line portions
136 SwSpecialPos
* m_pSpecialPos
; ///< for positions inside fields
137 Point m_aRealHeight
; ///< contains then the position/height of the cursor
138 CursorMoveState m_eState
;
139 sal_uInt8 m_nCursorBidiLevel
;
141 bool m_bRealHeight
; ///< should the real height be calculated?
142 bool m_bFieldInfo
; ///< should be fields recognized?
143 bool m_bPosCorr
; ///< Point had to be corrected
144 bool m_bFootnoteNoInfo
; ///< recognized footnote numbering
145 bool m_bExactOnly
; /**< let GetCursorOfst look for exact matches only,
146 i.e. never let it run into GetContentPos */
147 bool m_bFillRet
; ///< only used temporary in FillMode
148 bool m_bSetInReadOnly
; ///< ReadOnly areas may be entered
149 bool m_bRealWidth
; ///< Calculation of the width required
150 bool m_b2Lines
; ///< Check 2line portions and fill p2Lines
151 bool m_bNoScroll
; ///< No scrolling of undersized textframes
152 bool m_bPosMatchesBounds
; /**< GetCursorOfst should not return the next
153 position if screen position is inside second
154 have of bound rect */
156 bool m_bContentCheck
; // #i43742# Cursor position over content?
160 cursor in front of label
162 bool m_bInFrontOfLabel
;
163 bool m_bInNumPortion
; ///< point is in number portion #i23726#
164 int m_nInNumPortionOffset
; ///< distance from number portion's start
166 SwCursorMoveState( CursorMoveState eSt
= MV_NONE
) :
168 m_pSpecialPos( nullptr ),
170 m_nCursorBidiLevel( 0 ),
172 m_bRealHeight( false ),
173 m_bFieldInfo( false ),
175 m_bFootnoteNoInfo( false ),
176 m_bExactOnly( false ),
178 m_bSetInReadOnly( false ),
179 m_bRealWidth( false ),
181 m_bNoScroll( false ),
182 m_bPosMatchesBounds( false ),
183 m_bContentCheck( false ), // #i43742#
184 m_bInFrontOfLabel( false ), // #i27615#
185 m_bInNumPortion(false), // #i26726#
186 m_nInNumPortionOffset(0) // #i26726#
188 SwCursorMoveState( SwFillCursorPos
*pInitFill
) :
189 m_pFill( pInitFill
),
190 m_pSpecialPos( nullptr ),
191 m_eState( MV_SETONLYTEXT
),
192 m_nCursorBidiLevel( 0 ),
194 m_bRealHeight( false ),
195 m_bFieldInfo( false ),
197 m_bFootnoteNoInfo( false ),
198 m_bExactOnly( false ),
200 m_bSetInReadOnly( false ),
201 m_bRealWidth( false ),
203 m_bNoScroll( false ),
204 m_bPosMatchesBounds( false ),
205 m_bContentCheck( false ), // #i43742#
206 m_bInFrontOfLabel( false ), // #i27615#
207 m_bInNumPortion(false), // #i23726#
208 m_nInNumPortionOffset(0) // #i23726#
214 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */