xref: /AOO41X/main/sw/source/core/text/porfld.hxx (revision 4d7c9de063a797b8b4f3d45e3561e82ad1f8ef1f)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _PORFLD_HXX
24cdf0e10cSrcweir #define _PORFLD_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "swtypes.hxx"
27cdf0e10cSrcweir #include "porexp.hxx"
28cdf0e10cSrcweir #include <fmtornt.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir class SwFont;
31cdf0e10cSrcweir class SvxBrushItem;
32cdf0e10cSrcweir class SwFmtVertOrient;
33cdf0e10cSrcweir class SwFrm;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir /*************************************************************************
36cdf0e10cSrcweir  *                      class SwFldPortion
37cdf0e10cSrcweir  *************************************************************************/
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class SwFldPortion : public SwExpandPortion
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 	friend class SwTxtFormatter;
42cdf0e10cSrcweir protected:
43cdf0e10cSrcweir 	XubString  aExpand;            // das expandierte Feld
44cdf0e10cSrcweir 	SwFont  *pFnt;              // Fuer mehrzeilige Felder
45cdf0e10cSrcweir 	xub_StrLen nNextOffset;		// Offset des Follows im Originalstring
46cdf0e10cSrcweir     xub_StrLen nNextScriptChg;
47cdf0e10cSrcweir 	KSHORT  nViewWidth;         // Screenbreite fuer leere Felder
48cdf0e10cSrcweir 	sal_Bool bFollow : 1;           // 2. oder weiterer Teil eines Feldes
49cdf0e10cSrcweir 	sal_Bool bLeft : 1;				// wird von SwNumberPortion benutzt
50cdf0e10cSrcweir 	sal_Bool bHide : 1;             // wird von SwNumberPortion benutzt
51cdf0e10cSrcweir 	sal_Bool bCenter : 1; 			// wird von SwNumberPortion benutzt
52cdf0e10cSrcweir 	sal_Bool bHasFollow : 1; 		// geht in der naechsten Zeile weiter
53cdf0e10cSrcweir 	sal_Bool bAnimated : 1; 		// wird von SwGrfNumPortion benutzt
54cdf0e10cSrcweir 	sal_Bool bNoPaint : 1; 			// wird von SwGrfNumPortion benutzt
55cdf0e10cSrcweir 	sal_Bool bReplace : 1; 			// wird von SwGrfNumPortion benutzt
56cdf0e10cSrcweir     const sal_Bool bPlaceHolder : 1;
57cdf0e10cSrcweir     sal_Bool m_bNoLength : 1;       // HACK for meta suffix (no CH_TXTATR)
58cdf0e10cSrcweir 
SetFont(SwFont * pNew)59cdf0e10cSrcweir 	inline void SetFont( SwFont *pNew ) { pFnt = pNew; }
IsNoLength() const60cdf0e10cSrcweir     inline bool IsNoLength() const  { return m_bNoLength; }
SetNoLength()61cdf0e10cSrcweir     inline void SetNoLength()       { m_bNoLength = sal_True; }
62cdf0e10cSrcweir 
63cdf0e10cSrcweir public:
64cdf0e10cSrcweir     SwFldPortion( const SwFldPortion& rFld );
65cdf0e10cSrcweir     SwFldPortion( const XubString &rExpand, SwFont *pFnt = 0, sal_Bool bPlaceHolder = sal_False );
66cdf0e10cSrcweir 	~SwFldPortion();
67cdf0e10cSrcweir 
68*ca62e2c2SSteve Yin 	sal_uInt16 m_nAttrFldType;
69cdf0e10cSrcweir 	void TakeNextOffset( const SwFldPortion* pFld );
70cdf0e10cSrcweir 	void CheckScript( const SwTxtSizeInfo &rInf );
HasFont() const71cdf0e10cSrcweir 	inline sal_Bool HasFont() const { return 0 != pFnt; }
72cdf0e10cSrcweir     // --> OD 2008-06-05 #i89179# - made public
GetFont() const73cdf0e10cSrcweir     inline const SwFont *GetFont() const { return pFnt; }
74cdf0e10cSrcweir     // <--
75cdf0e10cSrcweir 
GetExp() const76cdf0e10cSrcweir 	inline const XubString &GetExp() const { return aExpand; }
77cdf0e10cSrcweir 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
78cdf0e10cSrcweir 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
79cdf0e10cSrcweir 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	// leere Felder sind auch erlaubt
82cdf0e10cSrcweir 	virtual SwLinePortion *Compress();
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
85cdf0e10cSrcweir 
IsFollow() const86cdf0e10cSrcweir 	inline sal_Bool IsFollow() const { return bFollow; }
SetFollow(sal_Bool bNew)87cdf0e10cSrcweir 	inline void SetFollow( sal_Bool bNew ) { bFollow = bNew; }
88cdf0e10cSrcweir 
IsLeft() const89cdf0e10cSrcweir 	inline sal_Bool IsLeft() const { return bLeft; }
SetLeft(sal_Bool bNew)90cdf0e10cSrcweir 	inline void SetLeft( sal_Bool bNew ) { bLeft = bNew; }
91cdf0e10cSrcweir 
IsHide() const92cdf0e10cSrcweir 	inline sal_Bool IsHide() const { return bHide; }
SetHide(sal_Bool bNew)93cdf0e10cSrcweir 	inline void SetHide( sal_Bool bNew ) { bHide = bNew; }
94cdf0e10cSrcweir 
IsCenter() const95cdf0e10cSrcweir 	inline sal_Bool IsCenter() const { return bCenter; }
SetCenter(sal_Bool bNew)96cdf0e10cSrcweir 	inline void SetCenter( sal_Bool bNew ) { bCenter = bNew; }
97cdf0e10cSrcweir 
HasFollow() const98cdf0e10cSrcweir 	inline sal_Bool HasFollow() const { return bHasFollow; }
SetHasFollow(sal_Bool bNew)99cdf0e10cSrcweir 	inline void SetHasFollow( sal_Bool bNew ) { bHasFollow = bNew; }
100cdf0e10cSrcweir 
GetNextOffset() const101cdf0e10cSrcweir 	inline xub_StrLen GetNextOffset() const { return nNextOffset; }
SetNextOffset(xub_StrLen nNew)102cdf0e10cSrcweir 	inline void SetNextOffset( xub_StrLen nNew ) { nNextOffset = nNew; }
103cdf0e10cSrcweir 
GetNextScriptChg() const104cdf0e10cSrcweir     inline xub_StrLen GetNextScriptChg() const { return nNextScriptChg; }
SetNextScriptChg(xub_StrLen nNew)105cdf0e10cSrcweir     inline void SetNextScriptChg( xub_StrLen nNew ) { nNextScriptChg = nNew; }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     // Felder-Cloner fuer SplitGlue
108cdf0e10cSrcweir 	virtual SwFldPortion *Clone( const XubString &rExpand ) const;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	// Extra-GetTxtSize wegen pFnt
111cdf0e10cSrcweir 	virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     // Accessibility: pass information about this portion to the PortionHandler
114cdf0e10cSrcweir     virtual void HandlePortion( SwPortionHandler& rPH ) const;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	OUTPUT_OPERATOR
117cdf0e10cSrcweir };
118cdf0e10cSrcweir 
119cdf0e10cSrcweir /*************************************************************************
120cdf0e10cSrcweir  *                      class SwHiddenPortion
121cdf0e10cSrcweir  *************************************************************************/
122cdf0e10cSrcweir // Unterscheidung nur fuer's Painten/verstecken.
123cdf0e10cSrcweir 
124cdf0e10cSrcweir class SwHiddenPortion : public SwFldPortion
125cdf0e10cSrcweir {
126cdf0e10cSrcweir public:
SwHiddenPortion(const XubString & rExpand,SwFont * pFntL=0)127cdf0e10cSrcweir     inline SwHiddenPortion( const XubString &rExpand, SwFont *pFntL = 0 )
128cdf0e10cSrcweir          : SwFldPortion( rExpand, pFntL )
129cdf0e10cSrcweir 		{ SetLen(1); SetWhichPor( POR_HIDDEN ); }
130cdf0e10cSrcweir 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
131cdf0e10cSrcweir 	virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	// Felder-Cloner fuer SplitGlue
134cdf0e10cSrcweir 	virtual SwFldPortion *Clone( const XubString &rExpand ) const;
135cdf0e10cSrcweir 	OUTPUT_OPERATOR
136cdf0e10cSrcweir };
137cdf0e10cSrcweir 
138cdf0e10cSrcweir /*************************************************************************
139cdf0e10cSrcweir  *                      class SwNumberPortion
140cdf0e10cSrcweir  *************************************************************************/
141cdf0e10cSrcweir 
142cdf0e10cSrcweir class SwNumberPortion : public SwFldPortion
143cdf0e10cSrcweir {
144cdf0e10cSrcweir protected:
145cdf0e10cSrcweir 	KSHORT  nFixWidth;      // vgl. Glues
146cdf0e10cSrcweir 	KSHORT  nMinDist;		// minimaler Abstand zum Text
147cdf0e10cSrcweir     // --> OD 2008-01-23 #newlistlevelattrs#
148cdf0e10cSrcweir     bool    mbLabelAlignmentPosAndSpaceModeActive;
149cdf0e10cSrcweir     // <--
150cdf0e10cSrcweir 
151cdf0e10cSrcweir public:
152cdf0e10cSrcweir     // --> OD 2008-01-23 #newlistlevelattrs#
153cdf0e10cSrcweir     SwNumberPortion( const XubString &rExpand,
154cdf0e10cSrcweir                      SwFont *pFnt,
155cdf0e10cSrcweir                      const sal_Bool bLeft,
156cdf0e10cSrcweir                      const sal_Bool bCenter,
157cdf0e10cSrcweir                      const KSHORT nMinDst,
158cdf0e10cSrcweir                      const bool bLabelAlignmentPosAndSpaceModeActive );
159cdf0e10cSrcweir     // <--
160cdf0e10cSrcweir 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
161cdf0e10cSrcweir 	virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const;
162cdf0e10cSrcweir 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 	// Felder-Cloner fuer SplitGlue
165cdf0e10cSrcweir 	virtual SwFldPortion *Clone( const XubString &rExpand ) const;
166cdf0e10cSrcweir 	virtual void FormatEOL( SwTxtFormatInfo &rInf );
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	OUTPUT_OPERATOR
169cdf0e10cSrcweir };
170cdf0e10cSrcweir 
171cdf0e10cSrcweir /*************************************************************************
172cdf0e10cSrcweir  *                      class SwBulletPortion
173cdf0e10cSrcweir  *************************************************************************/
174cdf0e10cSrcweir 
175cdf0e10cSrcweir class SwBulletPortion : public SwNumberPortion
176cdf0e10cSrcweir {
177cdf0e10cSrcweir public:
178cdf0e10cSrcweir     SwBulletPortion( const xub_Unicode cCh,
179cdf0e10cSrcweir                      const XubString& rBulletFollowedBy,
180cdf0e10cSrcweir                      SwFont *pFnt,
181cdf0e10cSrcweir                      const sal_Bool bLeft,
182cdf0e10cSrcweir                      const sal_Bool bCenter,
183cdf0e10cSrcweir                      const KSHORT nMinDst,
184cdf0e10cSrcweir                      const bool bLabelAlignmentPosAndSpaceModeActive );
185cdf0e10cSrcweir 	OUTPUT_OPERATOR
186cdf0e10cSrcweir };
187cdf0e10cSrcweir 
188cdf0e10cSrcweir /*************************************************************************
189cdf0e10cSrcweir  *                      class SwBmpBulletPortion
190cdf0e10cSrcweir  *************************************************************************/
191cdf0e10cSrcweir 
192cdf0e10cSrcweir class SwGrfNumPortion : public SwNumberPortion
193cdf0e10cSrcweir {
194cdf0e10cSrcweir 	SvxBrushItem* pBrush;
195cdf0e10cSrcweir 	long			nId;	//fuer StopAnimation
196cdf0e10cSrcweir 	SwTwips			nYPos;	//Enthaelt _immer_ die aktuelle RelPos.
197cdf0e10cSrcweir 	SwTwips			nGrfHeight;
198cdf0e10cSrcweir     sal_Int16       eOrient;
199cdf0e10cSrcweir public:
200cdf0e10cSrcweir     SwGrfNumPortion( SwFrm *pFrm,
201cdf0e10cSrcweir                      const XubString& rGraphicFollowedBy,
202cdf0e10cSrcweir                      const SvxBrushItem* pGrfBrush,
203cdf0e10cSrcweir                      const SwFmtVertOrient* pGrfOrient,
204cdf0e10cSrcweir                      const Size& rGrfSize,
205cdf0e10cSrcweir                      const sal_Bool bLeft,
206cdf0e10cSrcweir                      const sal_Bool bCenter,
207cdf0e10cSrcweir                      const KSHORT nMinDst,
208cdf0e10cSrcweir                      const bool bLabelAlignmentPosAndSpaceModeActive );
209cdf0e10cSrcweir 	~SwGrfNumPortion();
210cdf0e10cSrcweir 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
211cdf0e10cSrcweir 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 	void SetBase( long nLnAscent, long nLnDescent,
214cdf0e10cSrcweir 		long nFlyAscent, long nFlyDescent );
215cdf0e10cSrcweir 
216cdf0e10cSrcweir     void StopAnimation( OutputDevice* pOut );
217cdf0e10cSrcweir 
IsAnimated() const218cdf0e10cSrcweir 	inline sal_Bool IsAnimated() const { return bAnimated; }
SetAnimated(sal_Bool bNew)219cdf0e10cSrcweir 	inline void SetAnimated( sal_Bool bNew ) { bAnimated = bNew; }
DontPaint() const220cdf0e10cSrcweir 	inline sal_Bool DontPaint() const { return bNoPaint; }
SetNoPaint(sal_Bool bNew)221cdf0e10cSrcweir 	inline void SetNoPaint( sal_Bool bNew ) { bNoPaint = bNew; }
SetRelPos(SwTwips nNew)222cdf0e10cSrcweir 	inline void SetRelPos( SwTwips nNew ) { nYPos = nNew; }
SetId(long nNew) const223cdf0e10cSrcweir 	inline void SetId( long nNew ) const
224cdf0e10cSrcweir 		{ ((SwGrfNumPortion*)this)->nId = nNew; }
GetRelPos() const225cdf0e10cSrcweir 	inline SwTwips GetRelPos() const { return nYPos; }
GetGrfHeight() const226cdf0e10cSrcweir 	inline SwTwips GetGrfHeight() const { return nGrfHeight; }
GetId() const227cdf0e10cSrcweir 	inline SwTwips GetId() const { return nId; }
GetOrient() const228cdf0e10cSrcweir     inline sal_Int16 GetOrient() const { return eOrient; }
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 	OUTPUT_OPERATOR
231cdf0e10cSrcweir };
232cdf0e10cSrcweir 
233cdf0e10cSrcweir /*************************************************************************
234cdf0e10cSrcweir  *                      class SwCombinedPortion
235cdf0e10cSrcweir  * Used in for asian layout specialities to display up to six characters
236cdf0e10cSrcweir  * in 2 rows and 2-3 columns.
237cdf0e10cSrcweir  * e.g.
238cdf0e10cSrcweir  *
239cdf0e10cSrcweir  *       A..  A..  A.B  A.B   A.B.C   A.B.C
240cdf0e10cSrcweir  *       ...  ..B  .C.  C.D   .D.E.   D.E.F
241cdf0e10cSrcweir  *************************************************************************/
242cdf0e10cSrcweir 
243cdf0e10cSrcweir class SwCombinedPortion : public SwFldPortion
244cdf0e10cSrcweir {
245cdf0e10cSrcweir 	sal_uInt16 aPos[6];		// up to six X positions
246cdf0e10cSrcweir 	sal_uInt16 aWidth[3];	// one width for every scripttype
247cdf0e10cSrcweir 	sal_uInt8 aScrType[6];	// scripttype of every character
248cdf0e10cSrcweir 	sal_uInt16 nUpPos;		// the Y position of the upper baseline
249cdf0e10cSrcweir 	sal_uInt16 nLowPos;		// the Y position of the lower baseline
250cdf0e10cSrcweir 	sal_uInt8 nProportion;	// relative font height
251cdf0e10cSrcweir public:
252cdf0e10cSrcweir 	SwCombinedPortion( const XubString &rExpand );
253cdf0e10cSrcweir 	virtual void Paint( const SwTxtPaintInfo &rInf ) const;
254cdf0e10cSrcweir 	virtual sal_Bool Format( SwTxtFormatInfo &rInf );
255cdf0e10cSrcweir 	virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
256cdf0e10cSrcweir 	OUTPUT_OPERATOR
257cdf0e10cSrcweir };
258cdf0e10cSrcweir 
259cdf0e10cSrcweir 
260cdf0e10cSrcweir CLASSIO( SwHiddenPortion )
261cdf0e10cSrcweir CLASSIO( SwNumberPortion )
262cdf0e10cSrcweir CLASSIO( SwBulletPortion )
263cdf0e10cSrcweir CLASSIO( SwGrfNumPortion )
264cdf0e10cSrcweir CLASSIO( SwCombinedPortion )
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 
267cdf0e10cSrcweir #endif
268