xref: /trunk/main/sw/inc/crstate.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _CRSTATE_HXX
28*cdf0e10cSrcweir #define _CRSTATE_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp>
31*cdf0e10cSrcweir #include <tools/gen.hxx>
32*cdf0e10cSrcweir #include <swtypes.hxx>
33*cdf0e10cSrcweir #include <swrect.hxx>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir enum SwFillMode
37*cdf0e10cSrcweir {
38*cdf0e10cSrcweir 	FILL_TAB,		// default, Auffuellen mit Tabulatoren
39*cdf0e10cSrcweir 	FILL_SPACE,		// ... mit Tabulatoren und Spaces
40*cdf0e10cSrcweir 	FILL_MARGIN,	// nur links, zentriert, rechts Ausrichten
41*cdf0e10cSrcweir 	FILL_INDENT     // durch linken Absatzeinzug
42*cdf0e10cSrcweir };
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir struct SwFillCrsrPos
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir 	SwRect aCrsr;			// Position und Groesse des Shadowcursors
47*cdf0e10cSrcweir 	sal_uInt16 nParaCnt;		// Anzahl der einzufuegenden Absaetze
48*cdf0e10cSrcweir 	sal_uInt16 nTabCnt;			// Anzahl der Tabs bzw. Groesse des Einzugs
49*cdf0e10cSrcweir 	sal_uInt16 nSpaceCnt;		// Anzahl der einzufuegenden Leerzeichen
50*cdf0e10cSrcweir 	sal_uInt16 nColumnCnt;		// Anzahl der notwendigen Spaltenumbrueche
51*cdf0e10cSrcweir     sal_Int16 eOrient;      // Absatzausrichtung
52*cdf0e10cSrcweir 	SwFillMode eMode;		// Gewuenschte Auffuellregel
53*cdf0e10cSrcweir 	SwFillCrsrPos( SwFillMode eMd = FILL_TAB ) :
54*cdf0e10cSrcweir 		nParaCnt( 0 ), nTabCnt( 0 ), nSpaceCnt( 0 ), nColumnCnt( 0 ),
55*cdf0e10cSrcweir         eOrient( com::sun::star::text::HoriOrientation::NONE ), eMode( eMd )
56*cdf0e10cSrcweir 	{}
57*cdf0e10cSrcweir };
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir // Multiportion types: two lines, bidirectional, 270 degrees rotation,
60*cdf0e10cSrcweir //                     ruby portion and 90 degrees rotation
61*cdf0e10cSrcweir #define MT_TWOLINE  0
62*cdf0e10cSrcweir #define MT_BIDI     1
63*cdf0e10cSrcweir #define MT_ROT_270  3
64*cdf0e10cSrcweir #define MT_RUBY     4
65*cdf0e10cSrcweir #define MT_ROT_90   7
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir struct Sw2LinesPos
68*cdf0e10cSrcweir {
69*cdf0e10cSrcweir 	SwRect aLine;			// Position and size of the line
70*cdf0e10cSrcweir 	SwRect aPortion;        // Position and size of the multi portion
71*cdf0e10cSrcweir     SwRect aPortion2;       // needed for nested multi portions
72*cdf0e10cSrcweir     sal_uInt8 nMultiType;        // Multiportion type
73*cdf0e10cSrcweir };
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir /**
76*cdf0e10cSrcweir  *  SwSpecialPos. This structure is used to pass some additional information
77*cdf0e10cSrcweir  *  during the call of SwTxtFrm::GetCharRect(). An SwSpecialPos defines a position
78*cdf0e10cSrcweir  *  inside a portion which does not have a representation in the core string or
79*cdf0e10cSrcweir  *  which is only represented by one position,  e.g., field portions,
80*cdf0e10cSrcweir  *  number portions, ergo sum and quo vadis portions.
81*cdf0e10cSrcweir  *
82*cdf0e10cSrcweir  *  nCharOfst       - The offset inside the special portion. Fields and its
83*cdf0e10cSrcweir  *                    follow fields are treated as one long special portion.
84*cdf0e10cSrcweir  *  nLineOfst       - The number of lines between the beginning of the special
85*cdf0e10cSrcweir  *                    portion and nCharOfst. A line offset required to be
86*cdf0e10cSrcweir  *                    nCharOfst relative to the beginning of the line.
87*cdf0e10cSrcweir  *  nExtendRange    - Setting this identifies portions which are in front or
88*cdf0e10cSrcweir  *                    behind the core string (number portion, quo vadis)
89*cdf0e10cSrcweir  *
90*cdf0e10cSrcweir  *  Examples 1)
91*cdf0e10cSrcweir  *
92*cdf0e10cSrcweir  *      Get the position of the second character inside a number portion:
93*cdf0e10cSrcweir  *          nCharOfst = 2; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_BEFORE;
94*cdf0e10cSrcweir  *          Call SwTxtFrm:::GetCharRect with core string position 0.
95*cdf0e10cSrcweir  *
96*cdf0e10cSrcweir  *  Example 2)
97*cdf0e10cSrcweir  *
98*cdf0e10cSrcweir  *      Field A - Length = 5
99*cdf0e10cSrcweir  *      Follow field B - Length = 9
100*cdf0e10cSrcweir  *      Get the position of the third character in follow field B, core position
101*cdf0e10cSrcweir  *      of field A is 33.
102*cdf0e10cSrcweir  *          nCharOfst = 7; nLineOfst = 0; nExtendRange = SP_EXTEND_RANGE_NONE;
103*cdf0e10cSrcweir  *          Call SwTxtFrm:::GetCharRect with core string position 33.
104*cdf0e10cSrcweir  */
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir #define SP_EXTEND_RANGE_NONE    0
107*cdf0e10cSrcweir #define SP_EXTEND_RANGE_BEFORE  1
108*cdf0e10cSrcweir #define SP_EXTEND_RANGE_BEHIND  2
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir struct SwSpecialPos
111*cdf0e10cSrcweir {
112*cdf0e10cSrcweir     xub_StrLen nCharOfst;
113*cdf0e10cSrcweir     sal_uInt16 nLineOfst;
114*cdf0e10cSrcweir     sal_uInt8 nExtendRange;
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     // #i27615#
117*cdf0e10cSrcweir     SwSpecialPos() : nCharOfst(0), nLineOfst(0),
118*cdf0e10cSrcweir                      nExtendRange(SP_EXTEND_RANGE_NONE)
119*cdf0e10cSrcweir     {}
120*cdf0e10cSrcweir };
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir // CrsrTravelling-Staties (fuer GetCrsrOfst)
123*cdf0e10cSrcweir enum CrsrMoveState
124*cdf0e10cSrcweir {
125*cdf0e10cSrcweir 	MV_NONE,			// default
126*cdf0e10cSrcweir 	MV_UPDOWN,			// Crsr Up/Down
127*cdf0e10cSrcweir 	MV_RIGHTMARGIN, 	// an rechten Rand
128*cdf0e10cSrcweir 	MV_LEFTMARGIN,		// an linken Rand
129*cdf0e10cSrcweir 	MV_SETONLYTEXT,		// mit dem Cursr nur im Text bleiben
130*cdf0e10cSrcweir 	MV_TBLSEL			// nicht in wiederholte Headlines
131*cdf0e10cSrcweir };
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir // struct fuer spaetere Erweiterungen
134*cdf0e10cSrcweir struct SwCrsrMoveState
135*cdf0e10cSrcweir {
136*cdf0e10cSrcweir 	SwFillCrsrPos	*pFill;		// fuer das automatische Auffuellen mit Tabs etc.
137*cdf0e10cSrcweir 	Sw2LinesPos		*p2Lines; 	// for selections inside/around 2line portions
138*cdf0e10cSrcweir     SwSpecialPos*   pSpecialPos; // for positions inside fields
139*cdf0e10cSrcweir 	Point aRealHeight;			// enthaelt dann die Position/Hoehe des Cursors
140*cdf0e10cSrcweir 	CrsrMoveState eState;
141*cdf0e10cSrcweir     sal_uInt8            nCursorBidiLevel;
142*cdf0e10cSrcweir 	sal_Bool bStop			:1;
143*cdf0e10cSrcweir 	sal_Bool bRealHeight	:1;		// Soll die reale Hoehe berechnet werden?
144*cdf0e10cSrcweir 	sal_Bool bFieldInfo		:1;		// Sollen Felder erkannt werden?
145*cdf0e10cSrcweir 	sal_Bool bPosCorr		:1;		// Point musste korrigiert werden
146*cdf0e10cSrcweir 	sal_Bool bFtnNoInfo		:1;		// Fussnotennumerierung erkannt
147*cdf0e10cSrcweir 	sal_Bool bExactOnly		:1;		// GetCrsrOfst nur nach Exakten Treffern
148*cdf0e10cSrcweir 								// suchen lassen, sprich niemals in das
149*cdf0e10cSrcweir 								// GetCntntPos laufen.
150*cdf0e10cSrcweir 	sal_Bool bFillRet		:1;		// wird nur im FillModus temp. genutzt
151*cdf0e10cSrcweir 	sal_Bool bSetInReadOnly :1;		// ReadOnlyBereiche duerfen betreten werden
152*cdf0e10cSrcweir 	sal_Bool bRealWidth		:1;		// Calculation of the width required
153*cdf0e10cSrcweir 	sal_Bool b2Lines		:1;		// Check 2line portions and fill p2Lines
154*cdf0e10cSrcweir     sal_Bool bNoScroll      :1;     // No scrolling of undersized textframes
155*cdf0e10cSrcweir     sal_Bool bPosMatchesBounds :1;  // GetCrsrOfst should not return the next
156*cdf0e10cSrcweir                                 // position if screen position is inside second
157*cdf0e10cSrcweir                                 // have of bound rect
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir     sal_Bool bCntntCheck :1; // --> FME 2005-05-13 #i43742# Cursor position over content? <--
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir     // #i27615#
162*cdf0e10cSrcweir     /**
163*cdf0e10cSrcweir        cursor in front of label
164*cdf0e10cSrcweir      */
165*cdf0e10cSrcweir     sal_Bool bInFrontOfLabel :1;
166*cdf0e10cSrcweir     sal_Bool bInNumPortion   :1;     // point is in number portion #i23726#
167*cdf0e10cSrcweir     int nInNumPostionOffset;     // distance from number portion's start
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir 	SwCrsrMoveState( CrsrMoveState eSt = MV_NONE ) :
170*cdf0e10cSrcweir 		pFill( NULL ),
171*cdf0e10cSrcweir 		p2Lines( NULL ),
172*cdf0e10cSrcweir         pSpecialPos( NULL ),
173*cdf0e10cSrcweir 		eState( eSt ),
174*cdf0e10cSrcweir         nCursorBidiLevel( 0 ),
175*cdf0e10cSrcweir 		bStop( sal_False ),
176*cdf0e10cSrcweir 		bRealHeight( sal_False ),
177*cdf0e10cSrcweir 		bFieldInfo( sal_False ),
178*cdf0e10cSrcweir 		bPosCorr( sal_False ),
179*cdf0e10cSrcweir 		bFtnNoInfo( sal_False ),
180*cdf0e10cSrcweir 		bExactOnly( sal_False ),
181*cdf0e10cSrcweir 		bSetInReadOnly( sal_False ),
182*cdf0e10cSrcweir 		bRealWidth( sal_False ),
183*cdf0e10cSrcweir         b2Lines( sal_False ),
184*cdf0e10cSrcweir         bNoScroll( sal_False ),
185*cdf0e10cSrcweir         bPosMatchesBounds( sal_False ),
186*cdf0e10cSrcweir         bCntntCheck( sal_False ), // --> FME 2005-05-13 #i43742# <--
187*cdf0e10cSrcweir         bInFrontOfLabel( sal_False ), // #i27615#
188*cdf0e10cSrcweir         bInNumPortion(sal_False), // #i26726#
189*cdf0e10cSrcweir         nInNumPostionOffset(0) // #i26726#
190*cdf0e10cSrcweir 	{}
191*cdf0e10cSrcweir 	SwCrsrMoveState( SwFillCrsrPos *pInitFill ) :
192*cdf0e10cSrcweir 		pFill( pInitFill ),
193*cdf0e10cSrcweir         pSpecialPos( NULL ),
194*cdf0e10cSrcweir 		eState( MV_SETONLYTEXT ),
195*cdf0e10cSrcweir         nCursorBidiLevel( 0 ),
196*cdf0e10cSrcweir 		bStop( sal_False ),
197*cdf0e10cSrcweir 		bRealHeight( sal_False ),
198*cdf0e10cSrcweir 		bFieldInfo( sal_False ),
199*cdf0e10cSrcweir 		bPosCorr( sal_False ),
200*cdf0e10cSrcweir 		bFtnNoInfo( sal_False ),
201*cdf0e10cSrcweir 		bExactOnly( sal_False ),
202*cdf0e10cSrcweir 		bSetInReadOnly( sal_False ),
203*cdf0e10cSrcweir 		bRealWidth( sal_False ),
204*cdf0e10cSrcweir         b2Lines( sal_False ),
205*cdf0e10cSrcweir         bNoScroll( sal_False ),
206*cdf0e10cSrcweir         bPosMatchesBounds( sal_False ),
207*cdf0e10cSrcweir         bCntntCheck( sal_False ), // --> FME 2005-05-13 #i43742# <--
208*cdf0e10cSrcweir         bInFrontOfLabel( sal_False ), // #i27615#
209*cdf0e10cSrcweir         bInNumPortion(sal_False), // #i23726#
210*cdf0e10cSrcweir         nInNumPostionOffset(0) // #i23726#
211*cdf0e10cSrcweir 	{}
212*cdf0e10cSrcweir };
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir #endif
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 
218