update dev300-m58
[ooovba.git] / sw / source / core / text / porfld.hxx
blob084b02067293a8f497d2974990ede68cf2c695d4
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: porfld.hxx,v $
10 * $Revision: 1.16.100.1 $
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 _PORFLD_HXX
31 #define _PORFLD_HXX
33 #include "swtypes.hxx"
34 #include "porexp.hxx"
35 #include <fmtornt.hxx>
37 class SwFont;
38 class SvxBrushItem;
39 class SwFmtVertOrient;
40 class SwFrm;
42 /*************************************************************************
43 * class SwFldPortion
44 *************************************************************************/
46 class SwFldPortion : public SwExpandPortion
48 friend class SwTxtFormatter;
49 protected:
50 XubString aExpand; // das expandierte Feld
51 SwFont *pFnt; // Fuer mehrzeilige Felder
52 xub_StrLen nNextOffset; // Offset des Follows im Originalstring
53 xub_StrLen nNextScriptChg;
54 KSHORT nViewWidth; // Screenbreite fuer leere Felder
55 sal_Bool bFollow : 1; // 2. oder weiterer Teil eines Feldes
56 sal_Bool bLeft : 1; // wird von SwNumberPortion benutzt
57 sal_Bool bHide : 1; // wird von SwNumberPortion benutzt
58 sal_Bool bCenter : 1; // wird von SwNumberPortion benutzt
59 sal_Bool bHasFollow : 1; // geht in der naechsten Zeile weiter
60 sal_Bool bAnimated : 1; // wird von SwGrfNumPortion benutzt
61 sal_Bool bNoPaint : 1; // wird von SwGrfNumPortion benutzt
62 sal_Bool bReplace : 1; // wird von SwGrfNumPortion benutzt
63 sal_Bool bPlaceHolder : 1;
65 inline void SetFont( SwFont *pNew ) { pFnt = pNew; }
66 public:
67 SwFldPortion( const SwFldPortion& rFld );
68 SwFldPortion( const XubString &rExpand, SwFont *pFnt = 0, sal_Bool bPlaceHolder = sal_False );
69 ~SwFldPortion();
71 void TakeNextOffset( const SwFldPortion* pFld );
72 void CheckScript( const SwTxtSizeInfo &rInf );
73 inline sal_Bool HasFont() const { return 0 != pFnt; }
74 // --> OD 2008-06-05 #i89179# - made public
75 inline const SwFont *GetFont() const { return pFnt; }
76 // <--
78 inline const XubString &GetExp() const { return aExpand; }
79 virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
80 virtual sal_Bool Format( SwTxtFormatInfo &rInf );
81 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
83 // leere Felder sind auch erlaubt
84 virtual SwLinePortion *Compress();
86 virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
88 inline sal_Bool IsFollow() const { return bFollow; }
89 inline void SetFollow( sal_Bool bNew ) { bFollow = bNew; }
91 inline sal_Bool IsLeft() const { return bLeft; }
92 inline void SetLeft( sal_Bool bNew ) { bLeft = bNew; }
94 inline sal_Bool IsHide() const { return bHide; }
95 inline void SetHide( sal_Bool bNew ) { bHide = bNew; }
97 inline sal_Bool IsCenter() const { return bCenter; }
98 inline void SetCenter( sal_Bool bNew ) { bCenter = bNew; }
100 inline sal_Bool HasFollow() const { return bHasFollow; }
101 inline void SetHasFollow( sal_Bool bNew ) { bHasFollow = bNew; }
103 inline xub_StrLen GetNextOffset() const { return nNextOffset; }
104 inline void SetNextOffset( xub_StrLen nNew ) { nNextOffset = nNew; }
106 inline xub_StrLen GetNextScriptChg() const { return nNextScriptChg; }
107 inline void SetNextScriptChg( xub_StrLen nNew ) { nNextScriptChg = nNew; }
109 // Felder-Cloner fuer SplitGlue
110 virtual SwFldPortion *Clone( const XubString &rExpand ) const;
112 // Extra-GetTxtSize wegen pFnt
113 virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
115 // Accessibility: pass information about this portion to the PortionHandler
116 virtual void HandlePortion( SwPortionHandler& rPH ) const;
118 OUTPUT_OPERATOR
121 /*************************************************************************
122 * class SwHiddenPortion
123 *************************************************************************/
124 // Unterscheidung nur fuer's Painten/verstecken.
126 class SwHiddenPortion : public SwFldPortion
128 public:
129 inline SwHiddenPortion( const XubString &rExpand, SwFont *pFntL = 0 )
130 : SwFldPortion( rExpand, pFntL )
131 { SetLen(1); SetWhichPor( POR_HIDDEN ); }
132 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
133 virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
135 // Felder-Cloner fuer SplitGlue
136 virtual SwFldPortion *Clone( const XubString &rExpand ) const;
137 OUTPUT_OPERATOR
140 /*************************************************************************
141 * class SwNumberPortion
142 *************************************************************************/
144 class SwNumberPortion : public SwFldPortion
146 protected:
147 KSHORT nFixWidth; // vgl. Glues
148 KSHORT nMinDist; // minimaler Abstand zum Text
149 // --> OD 2008-01-23 #newlistlevelattrs#
150 bool mbLabelAlignmentPosAndSpaceModeActive;
151 // <--
153 public:
154 // --> OD 2008-01-23 #newlistlevelattrs#
155 SwNumberPortion( const XubString &rExpand,
156 SwFont *pFnt,
157 const sal_Bool bLeft,
158 const sal_Bool bCenter,
159 const KSHORT nMinDst,
160 const bool bLabelAlignmentPosAndSpaceModeActive );
161 // <--
162 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
163 virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const;
164 virtual sal_Bool Format( SwTxtFormatInfo &rInf );
166 // Felder-Cloner fuer SplitGlue
167 virtual SwFldPortion *Clone( const XubString &rExpand ) const;
168 virtual void FormatEOL( SwTxtFormatInfo &rInf );
170 OUTPUT_OPERATOR
173 /*************************************************************************
174 * class SwBulletPortion
175 *************************************************************************/
177 class SwBulletPortion : public SwNumberPortion
179 public:
180 // --> OD 2008-01-23 #newlistlevelattrs#
181 SwBulletPortion( const xub_Unicode cCh,
182 const XubString& rBulletFollowedBy,
183 SwFont *pFnt,
184 const sal_Bool bLeft,
185 const sal_Bool bCenter,
186 const KSHORT nMinDst,
187 const bool bLabelAlignmentPosAndSpaceModeActive );
188 // <--
189 OUTPUT_OPERATOR
192 /*************************************************************************
193 * class SwBmpBulletPortion
194 *************************************************************************/
196 class SwGrfNumPortion : public SwNumberPortion
198 SvxBrushItem* pBrush;
199 long nId; //fuer StopAnimation
200 SwTwips nYPos; //Enthaelt _immer_ die aktuelle RelPos.
201 SwTwips nGrfHeight;
202 sal_Int16 eOrient;
203 public:
204 // --> OD 2008-01-23 #newlistlevelattrs#
205 SwGrfNumPortion( SwFrm *pFrm,
206 const XubString& rGraphicFollowedBy,
207 const SvxBrushItem* pGrfBrush,
208 const SwFmtVertOrient* pGrfOrient,
209 const Size& rGrfSize,
210 const sal_Bool bLeft,
211 const sal_Bool bCenter,
212 const KSHORT nMinDst,
213 const bool bLabelAlignmentPosAndSpaceModeActive );
214 // <--
215 ~SwGrfNumPortion();
216 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
217 virtual sal_Bool Format( SwTxtFormatInfo &rInf );
219 void SetBase( long nLnAscent, long nLnDescent,
220 long nFlyAscent, long nFlyDescent );
222 void StopAnimation( OutputDevice* pOut );
224 inline sal_Bool IsAnimated() const { return bAnimated; }
225 inline void SetAnimated( sal_Bool bNew ) { bAnimated = bNew; }
226 inline sal_Bool DontPaint() const { return bNoPaint; }
227 inline void SetNoPaint( sal_Bool bNew ) { bNoPaint = bNew; }
228 inline void SetRelPos( SwTwips nNew ) { nYPos = nNew; }
229 inline void SetId( long nNew ) const
230 { ((SwGrfNumPortion*)this)->nId = nNew; }
231 inline SwTwips GetRelPos() const { return nYPos; }
232 inline SwTwips GetGrfHeight() const { return nGrfHeight; }
233 inline SwTwips GetId() const { return nId; }
234 inline sal_Int16 GetOrient() const { return eOrient; }
236 OUTPUT_OPERATOR
239 /*************************************************************************
240 * class SwCombinedPortion
241 * Used in for asian layout specialities to display up to six characters
242 * in 2 rows and 2-3 columns.
243 * e.g.
245 * A.. A.. A.B A.B A.B.C A.B.C
246 * ... ..B .C. C.D .D.E. D.E.F
247 *************************************************************************/
249 class SwCombinedPortion : public SwFldPortion
251 USHORT aPos[6]; // up to six X positions
252 USHORT aWidth[3]; // one width for every scripttype
253 BYTE aScrType[6]; // scripttype of every character
254 USHORT nUpPos; // the Y position of the upper baseline
255 USHORT nLowPos; // the Y position of the lower baseline
256 BYTE nProportion; // relative font height
257 public:
258 SwCombinedPortion( const XubString &rExpand );
259 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
260 virtual sal_Bool Format( SwTxtFormatInfo &rInf );
261 virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
262 OUTPUT_OPERATOR
266 CLASSIO( SwHiddenPortion )
267 CLASSIO( SwNumberPortion )
268 CLASSIO( SwBulletPortion )
269 CLASSIO( SwGrfNumPortion )
270 CLASSIO( SwCombinedPortion )
273 #endif