1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: crstate.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <com/sun/star/text/HoriOrientation.hpp>
34 #include <tools/gen.hxx>
35 #include <swtypes.hxx>
41 FILL_TAB
, // default, Auffuellen mit Tabulatoren
42 FILL_SPACE
, // ... mit Tabulatoren und Spaces
43 FILL_MARGIN
, // nur links, zentriert, rechts Ausrichten
44 FILL_INDENT
// durch linken Absatzeinzug
49 SwRect aCrsr
; // Position und Groesse des Shadowcursors
50 USHORT nParaCnt
; // Anzahl der einzufuegenden Absaetze
51 USHORT nTabCnt
; // Anzahl der Tabs bzw. Groesse des Einzugs
52 USHORT nSpaceCnt
; // Anzahl der einzufuegenden Leerzeichen
53 USHORT nColumnCnt
; // Anzahl der notwendigen Spaltenumbrueche
54 sal_Int16 eOrient
; // Absatzausrichtung
55 SwFillMode eMode
; // Gewuenschte Auffuellregel
56 SwFillCrsrPos( SwFillMode eMd
= FILL_TAB
) :
57 nParaCnt( 0 ), nTabCnt( 0 ), nSpaceCnt( 0 ), nColumnCnt( 0 ),
58 eOrient( com::sun::star::text::HoriOrientation::NONE
), eMode( eMd
)
62 // Multiportion types: two lines, bidirectional, 270 degrees rotation,
63 // ruby portion and 90 degrees rotation
72 SwRect aLine
; // Position and size of the line
73 SwRect aPortion
; // Position and size of the multi portion
74 SwRect aPortion2
; // needed for nested multi portions
75 BYTE nMultiType
; // Multiportion type
79 * SwSpecialPos. This structure is used to pass some additional information
80 * during the call of SwTxtFrm::GetCharRect(). An SwSpecialPos defines a position
81 * inside a portion which does not have a representation in the core string or
82 * which is only represented by one position, e.g., field portions,
83 * number portions, ergo sum and quo vadis portions.
85 * nCharOfst - The offset inside the special portion. Fields and its
86 * follow fields are treated as one long special portion.
87 * nLineOfst - The number of lines between the beginning of the special
88 * portion and nCharOfst. A line offset required to be
89 * nCharOfst relative to the beginning of the line.
90 * nExtendRange - Setting this identifies portions which are in front or
91 * behind the core string (number portion, quo vadis)
95 * Get the position of the second character inside a number portion:
96 * nCharOfst = 2; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_BEFORE;
97 * Call SwTxtFrm:::GetCharRect with core string position 0.
101 * Field A - Length = 5
102 * Follow field B - Length = 9
103 * Get the position of the third character in follow field B, core position
105 * nCharOfst = 7; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_NONE;
106 * Call SwTxtFrm:::GetCharRect with core string position 33.
109 #define SP_EXTEND_RANGE_NONE 0
110 #define SP_EXTEND_RANGE_BEFORE 1
111 #define SP_EXTEND_RANGE_BEHIND 2
115 xub_StrLen nCharOfst
;
120 SwSpecialPos() : nCharOfst(0), nLineOfst(0),
121 nExtendRange(SP_EXTEND_RANGE_NONE
)
125 // CrsrTravelling-Staties (fuer GetCrsrOfst)
129 MV_UPDOWN
, // Crsr Up/Down
130 MV_RIGHTMARGIN
, // an rechten Rand
131 MV_LEFTMARGIN
, // an linken Rand
132 MV_SETONLYTEXT
, // mit dem Cursr nur im Text bleiben
133 MV_TBLSEL
// nicht in wiederholte Headlines
136 // struct fuer spaetere Erweiterungen
137 struct SwCrsrMoveState
139 SwFillCrsrPos
*pFill
; // fuer das automatische Auffuellen mit Tabs etc.
140 Sw2LinesPos
*p2Lines
; // for selections inside/around 2line portions
141 SwSpecialPos
* pSpecialPos
; // for positions inside fields
142 Point aRealHeight
; // enthaelt dann die Position/Hoehe des Cursors
143 CrsrMoveState eState
;
144 BYTE nCursorBidiLevel
;
146 BOOL bRealHeight
:1; // Soll die reale Hoehe berechnet werden?
147 BOOL bFieldInfo
:1; // Sollen Felder erkannt werden?
148 BOOL bPosCorr
:1; // Point musste korrigiert werden
149 BOOL bFtnNoInfo
:1; // Fussnotennumerierung erkannt
150 BOOL bExactOnly
:1; // GetCrsrOfst nur nach Exakten Treffern
151 // suchen lassen, sprich niemals in das
152 // GetCntntPos laufen.
153 BOOL bFillRet
:1; // wird nur im FillModus temp. genutzt
154 BOOL bSetInReadOnly
:1; // ReadOnlyBereiche duerfen betreten werden
155 BOOL bRealWidth
:1; // Calculation of the width required
156 BOOL b2Lines
:1; // Check 2line portions and fill p2Lines
157 BOOL bNoScroll
:1; // No scrolling of undersized textframes
158 BOOL bPosMatchesBounds
:1; // GetCrsrOfst should not return the next
159 // position if screen position is inside second
160 // have of bound rect
162 BOOL bCntntCheck
:1; // --> FME 2005-05-13 #i43742# Cursor position over content? <--
166 cursor in front of label
168 BOOL bInFrontOfLabel
:1;
169 BOOL bInNumPortion
:1; // point is in number portion #i23726#
170 int nInNumPostionOffset
; // distance from number portion's start
172 SwCrsrMoveState( CrsrMoveState eSt
= MV_NONE
) :
177 nCursorBidiLevel( 0 ),
179 bRealHeight( FALSE
),
184 bSetInReadOnly( FALSE
),
188 bPosMatchesBounds( FALSE
),
189 bCntntCheck( FALSE
), // --> FME 2005-05-13 #i43742# <--
190 bInFrontOfLabel( FALSE
), // #i27615#
191 bInNumPortion(FALSE
), // #i26726#
192 nInNumPostionOffset(0) // #i26726#
194 SwCrsrMoveState( SwFillCrsrPos
*pInitFill
) :
197 eState( MV_SETONLYTEXT
),
198 nCursorBidiLevel( 0 ),
200 bRealHeight( FALSE
),
205 bSetInReadOnly( FALSE
),
209 bPosMatchesBounds( FALSE
),
210 bCntntCheck( FALSE
), // --> FME 2005-05-13 #i43742# <--
211 bInFrontOfLabel( FALSE
), // #i27615#
212 bInNumPortion(FALSE
), // #i23726#
213 nInNumPostionOffset(0) // #i23726#