update dev300-m58
[ooovba.git] / sw / inc / crstate.hxx
blob7f1a1741d1e819d31211e9ec6f063f869d38aea2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: crstate.hxx,v $
10 * $Revision: 1.17 $
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 ************************************************************************/
30 #ifndef _CRSTATE_HXX
31 #define _CRSTATE_HXX
33 #include <com/sun/star/text/HoriOrientation.hpp>
34 #include <tools/gen.hxx>
35 #include <swtypes.hxx>
36 #include <swrect.hxx>
39 enum SwFillMode
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
47 struct SwFillCrsrPos
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
64 #define MT_TWOLINE 0
65 #define MT_BIDI 1
66 #define MT_ROT_270 3
67 #define MT_RUBY 4
68 #define MT_ROT_90 7
70 struct Sw2LinesPos
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
78 /**
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)
93 * Examples 1)
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.
99 * Example 2)
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
104 * of field A is 33.
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
113 struct SwSpecialPos
115 xub_StrLen nCharOfst;
116 USHORT nLineOfst;
117 BYTE nExtendRange;
119 // #i27615#
120 SwSpecialPos() : nCharOfst(0), nLineOfst(0),
121 nExtendRange(SP_EXTEND_RANGE_NONE)
125 // CrsrTravelling-Staties (fuer GetCrsrOfst)
126 enum CrsrMoveState
128 MV_NONE, // default
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;
145 BOOL bStop :1;
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? <--
164 // #i27615#
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 ) :
173 pFill( NULL ),
174 p2Lines( NULL ),
175 pSpecialPos( NULL ),
176 eState( eSt ),
177 nCursorBidiLevel( 0 ),
178 bStop( FALSE ),
179 bRealHeight( FALSE ),
180 bFieldInfo( FALSE ),
181 bPosCorr( FALSE ),
182 bFtnNoInfo( FALSE ),
183 bExactOnly( FALSE ),
184 bSetInReadOnly( FALSE ),
185 bRealWidth( FALSE ),
186 b2Lines( FALSE ),
187 bNoScroll( 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 ) :
195 pFill( pInitFill ),
196 pSpecialPos( NULL ),
197 eState( MV_SETONLYTEXT ),
198 nCursorBidiLevel( 0 ),
199 bStop( FALSE ),
200 bRealHeight( FALSE ),
201 bFieldInfo( FALSE ),
202 bPosCorr( FALSE ),
203 bFtnNoInfo( FALSE ),
204 bExactOnly( FALSE ),
205 bSetInReadOnly( FALSE ),
206 bRealWidth( FALSE ),
207 b2Lines( FALSE ),
208 bNoScroll( FALSE ),
209 bPosMatchesBounds( FALSE ),
210 bCntntCheck( FALSE ), // --> FME 2005-05-13 #i43742# <--
211 bInFrontOfLabel( FALSE ), // #i27615#
212 bInNumPortion(FALSE), // #i23726#
213 nInNumPostionOffset(0) // #i23726#
218 #endif