merge the formfield patch from ooo-build
[ooovba.git] / sw / source / core / inc / swfont.hxx
blob68d031dab555b93c8455c67ede296eaffc86c801
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: swfont.hxx,v $
10 * $Revision: 1.37.210.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 _SWFONT_HXX
31 #define _SWFONT_HXX
33 #include <i18npool/lang.h>
34 #include <tools/color.hxx>
35 #ifndef _TOOLS_STREAM_HXX //autogen
36 #include <tools/stream.hxx>
37 #endif
38 #include <svx/svxfont.hxx>
39 #include <swtypes.hxx>
40 #include <drawfont.hxx> // SwDrawTextInfo
42 class SfxItemSet;
43 class SwAttrSet;
44 class SwDoCapitals; // DoCapitals
45 class SwDrawTextInfo; // _DrawText
46 class SwScriptInfo; // _GetTxtSize
47 class ViewShell;
48 class IDocumentSettingAccess;
50 const xub_Unicode CH_BLANK = ' '; // ' ' Leerzeichen
51 const xub_Unicode CH_BREAK = 0x0A; //
52 const xub_Unicode CH_TAB = '\t'; // \t
53 const xub_Unicode CH_PAR = 0xB6; // Paragraph
54 const xub_Unicode CH_BULLET = 0xB7; // mittiger Punkt
56 class SwSubFont : public SvxFont
58 friend class SwFont;
59 const void *pMagic; // "MagicNumber" innerhalb des Fontcaches
60 Size aSize; // Fremde kriegen nur diese Size zu sehen
61 USHORT nFntIndex; // Index im Fontcache
62 USHORT nOrgHeight; // Hoehe inkl. Escapement/Proportion
63 USHORT nOrgAscent; // Ascent inkl. Escapement/Proportion
64 USHORT nPropWidth; // proportional width
65 inline SwSubFont() : aSize(0,0)
66 { pMagic = NULL; nFntIndex = nOrgHeight = nOrgAscent = 0; nPropWidth =100; }
68 USHORT CalcEscAscent( const USHORT nOldAscent ) const;
69 USHORT CalcEscHeight( const USHORT nOldHeight,
70 const USHORT nOldAscent ) const;
71 void CalcEsc( SwDrawTextInfo& rInf, Point& rPos );
73 inline void CopyMagic( const SwSubFont& rFnt )
74 { pMagic = rFnt.pMagic; nFntIndex = rFnt.nFntIndex; }
76 BOOL operator==( const SwFont &rFnt ) const;
77 SwSubFont& operator=( const SwSubFont &rFont );
79 short _CheckKerning( );
81 BOOL ChgFnt( ViewShell *pSh, OutputDevice& rOut );
82 BOOL IsSymbol( ViewShell *pSh );
83 USHORT GetAscent( ViewShell *pSh, const OutputDevice& rOut );
84 USHORT GetHeight( ViewShell *pSh, const OutputDevice& rOut );
85 Size _GetTxtSize( SwDrawTextInfo& rInf );
86 Size GetCapitalSize( SwDrawTextInfo& rInf );
87 void _DrawText( SwDrawTextInfo &rInf, const BOOL bGrey );
88 void DrawCapital( SwDrawTextInfo &rInf );
89 void DrawStretchCapital( SwDrawTextInfo &rInf );
90 void DoOnCapitals( SwDoCapitals &rDo );
91 void _DrawStretchText( SwDrawTextInfo &rInf );
92 xub_StrLen _GetCrsrOfst( SwDrawTextInfo& rInf );
93 xub_StrLen GetCapitalCrsrOfst( SwDrawTextInfo& rInf );
95 inline void SetColor( const Color& rColor );
96 inline void SetFillColor( const Color& rColor );
97 inline void SetCharSet( const CharSet eCharSet );
98 inline void SetPitch( const FontPitch ePitch );
99 inline void SetAlign( const FontAlign eAlign );
100 inline void SetUnderline( const FontUnderline eUnderline );
101 inline void SetOverline( const FontUnderline eOverline );
102 inline void SetStrikeout( const FontStrikeout eStrikeout );
103 inline void SetItalic( const FontItalic eItalic );
104 inline void SetOutline( const BOOL bOutline );
105 inline void SetVertical( const USHORT nDir, const BOOL bVertFormat );
106 inline void SetShadow( const BOOL bShadow );
107 inline void SetAutoKern( const BYTE nAutoKern );
108 inline void SetWordLineMode( const BOOL bWordLineMode );
109 inline void SetEmphasisMark( const FontEmphasisMark eValue );
110 inline void SetRelief( const FontRelief eNew );
112 // Methoden fuer die Hoch-/Tiefstellung
113 inline void SetEscapement( const short nNewEsc );
114 inline void SetProportion( const BYTE nNewPropr );
116 inline void SetFamily( const FontFamily eFamily );
117 inline void SetName( const XubString& rName );
118 inline void SetStyleName( const XubString& rStyleName );
119 inline void SetSize( const Size& rSize );
120 inline void SetWeight( const FontWeight eWeight );
121 inline void SetLanguage( LanguageType eNewLang );
122 inline short CheckKerning()
123 { return GetFixKerning() >= 0 ? GetFixKerning() : _CheckKerning( ); }
124 inline void SetPropWidth( const USHORT nNew )
125 { pMagic = 0; nPropWidth = nNew; }
126 public:
127 USHORT GetPropWidth() const { return nPropWidth; }
130 #define SW_LATIN 0
131 #define SW_CJK 1
132 #define SW_CTL 2
133 #define SW_SCRIPTS 3
135 class SwFont
136 { // CJK == Chinese, Japanese, Korean
137 // CTL == Complex text layout ( Hebrew, Arabic )
138 SwSubFont aSub[SW_SCRIPTS]; // Latin-, CJK- and CTL-font
139 Color* pBackColor; // background color (i.e. at character styles)
140 Color aUnderColor; // color of the underlining
141 Color aOverColor; // color of the overlining
142 BYTE nToxCnt; // Zaehlt die Schachtelungstiefe der Tox
143 BYTE nRefCnt; // Zaehlt die Schachtelungstiefe der Refs
144 BYTE m_nMetaCount; // count META/METAFIELD
145 BYTE nActual; // actual font (Latin, CJK or CTL)
147 // Schalter fuer die Font-Extensions
148 BOOL bNoHyph :1; // SwTxtNoHyphenHere: keine Trennstelle
149 BOOL bBlink :1; // blinkender Font
150 BOOL bPaintBlank :1; // Blanks nicht mit DrawRect
151 BOOL bFntChg :1;
152 BOOL bOrgChg :1; // nOrgHeight/Ascent sind invalid
153 BOOL bURL :1;
154 BOOL bPaintWrong :1; // Flag fuer Rechtschreibfehler
155 BOOL bGreyWave :1; // Fuers extended TextInput: Graue Wellenlinie
156 BOOL bNoColReplace :1; // Replacement without colormanipulation
158 BOOL operator==( const SwFont &rFnt ) const;
160 protected:
161 inline SwFont() { pBackColor = NULL; nActual = SW_LATIN; }
163 public:
164 SwFont( const SwAttrSet* pSet, const IDocumentSettingAccess* pIDocumentSettingAccess );
165 SwFont( const SwFont& rFont );
167 inline void ChgFnt( ViewShell *pSh, OutputDevice& rOut )
168 { bPaintBlank = aSub[nActual].ChgFnt( pSh, rOut ); }
170 ~SwFont(){ delete pBackColor; }
172 SwFont& operator=( const SwFont &rFont );
174 inline BYTE GetActual() const { return nActual; }
175 inline void SetActual( BYTE nNew );
176 inline const SvxFont& GetActualFont() const { return aSub[nActual]; }
178 // holt sich eine MagicNumber ueber SwFntAccess
179 void GoMagic( ViewShell *pSh, BYTE nWhich );
180 // set background color
181 void SetBackColor( Color* pNewColor );
182 inline const Color* GetBackColor() const{ return pBackColor; }
184 inline void ChkMagic( ViewShell *pSh, BYTE nWhich )
185 { if( !aSub[ nWhich ].pMagic ) GoMagic( pSh, nWhich ); }
186 // uebernimmt die MagicNumber eines (hoffentlich ident.) Kollegen
187 inline void CopyMagic( const SwFont* pFnt, BYTE nWhich )
188 { aSub[nWhich].CopyMagic( pFnt->aSub[nWhich] ); }
189 inline void GetMagic( const void* &rMagic, USHORT &rIdx, BYTE nWhich )
190 { rMagic = aSub[nWhich].pMagic; rIdx = aSub[nWhich].nFntIndex; }
191 inline void SetMagic( const void* pNew, const USHORT nIdx, BYTE nWhich )
192 { aSub[nWhich].pMagic = pNew; aSub[nWhich].nFntIndex = nIdx; }
193 inline BOOL DifferentMagic( const SwFont* pFnt, BYTE nWhich )
194 { return aSub[nWhich].pMagic != pFnt->aSub[nWhich].pMagic ||
195 !aSub[nWhich].pMagic || !pFnt->aSub[nWhich].pMagic; }
197 inline const Size &GetSize( BYTE nWhich ) const
198 { return aSub[nWhich].aSize; }
199 inline BOOL IsFntChg() const { return bFntChg; }
200 inline void SetFntChg( const BOOL bNew ) { bFntChg = bNew; }
202 // die gekapselten SV-Font-Methoden (setzen bFntChg auf TRUE)
203 inline void SetColor( const Color& rColor );
204 inline void SetFillColor( const Color& rColor );
205 inline void SetAlign( const FontAlign eAlign );
206 inline void SetUnderline( const FontUnderline eUnderline );
207 inline void SetUnderColor( const Color &rColor ) { aUnderColor = rColor; }
208 inline void SetOverline( const FontUnderline eOverline );
209 inline void SetOverColor( const Color &rColor ) { aOverColor = rColor; }
210 inline void SetStrikeout( const FontStrikeout eStrikeout );
211 inline void SetOutline( const BOOL bOutline );
212 void SetVertical( USHORT nDir, const BOOL nVertLayout = FALSE );
213 inline void SetShadow( const BOOL bShadow );
214 inline void SetAutoKern( BYTE nAutoKern );
215 inline void SetTransparent( const BOOL bTrans );
216 inline void SetWordLineMode( const BOOL bWordLineMode );
217 inline void SetFixKerning( const short nNewKern );
218 inline void SetCaseMap( const SvxCaseMap eNew );
219 inline void SetEmphasisMark( const FontEmphasisMark eValue );
221 // Methoden fuer die Hoch-/Tiefstellung
222 inline void SetEscapement( const short nNewEsc );
223 inline void SetProportion( const BYTE nNewPropr );
225 inline void SetPropWidth( const USHORT nNew );
227 inline void SetFamily( const FontFamily eFamily, const BYTE nWhich );
228 inline void SetName( const XubString& rName, const BYTE nWhich );
229 inline void SetStyleName( const XubString& rStyleName, const BYTE nWhich );
230 inline void SetSize( const Size& rSize, const BYTE nWhich );
231 inline void SetWeight( const FontWeight eWeight, const BYTE nWhich );
232 inline void SetItalic( const FontItalic eItalic, const BYTE nWhich );
233 inline void SetLanguage( LanguageType eNewLang, const BYTE nWhich );
234 inline void SetCharSet( const CharSet eCharSet, const BYTE nWhich );
235 inline void SetPitch( const FontPitch ePitch, const BYTE nWhich );
236 inline void SetRelief( const FontRelief eNew );
238 // Get/Set-Methoden fuer die aktuelle Einstellung
239 inline void SetNoHyph( const BOOL bNew );
240 inline BOOL IsNoHyph() const { return bNoHyph; }
241 inline void SetBlink( const BOOL bBlink );
242 inline BOOL IsBlink() const { return bBlink; }
243 inline BYTE &GetTox() { return nToxCnt; }
244 inline BYTE GetTox() const { return nToxCnt; }
245 inline BOOL IsTox() const { return ( 0 != nToxCnt ); }
246 inline BYTE &GetRef() { return nRefCnt; }
247 inline BYTE GetRef() const { return nRefCnt; }
248 inline BOOL IsRef() const { return ( 0 != nRefCnt ); }
249 inline BYTE &GetMeta() { return m_nMetaCount; }
250 inline BYTE GetMeta() const { return m_nMetaCount; }
251 inline bool IsMeta() const { return (0 != m_nMetaCount); }
252 inline void SetURL( const BOOL bURL );
253 inline BOOL IsURL() const { return bURL; }
254 inline void SetGreyWave( const BOOL bNew );
255 inline BOOL IsGreyWave() const { return bGreyWave; }
256 inline void SetNoCol( const BOOL bNew );
257 inline BOOL IsNoCol() const { return bNoColReplace; }
259 inline void SetPaintBlank( const BOOL bNew );
260 inline BOOL IsPaintBlank() const { return bPaintBlank; }
261 inline void SetPaintWrong( const BOOL bNew );
262 inline BOOL IsPaintWrong() const { return bPaintWrong; }
264 // Setzen der Basisklasse Font fuer SwTxtCharFmt
265 void SetDiffFnt( const SfxItemSet* pSet,
266 const IDocumentSettingAccess* pIDocumentSettingAccess );
268 inline const SvxFont &GetFnt( const BYTE nWhich ) const
269 { return aSub[nWhich]; };
271 BOOL IsSymbol( ViewShell *pSh )
272 { return aSub[nActual].IsSymbol( pSh ); }
273 FontUnderline GetUnderline() const { return aSub[nActual].GetUnderline(); }
274 const Color& GetUnderColor() const { return aUnderColor; }
275 FontUnderline GetOverline() const { return aSub[nActual].GetOverline(); }
276 const Color& GetOverColor() const { return aOverColor; }
277 short GetFixKerning() const { return aSub[nActual].GetFixKerning(); }
278 FontStrikeout GetStrikeout() const { return aSub[nActual].GetStrikeout(); }
279 const Color& GetColor() const { return aSub[nActual].GetColor(); }
280 BOOL IsShadow() const { return aSub[nActual].IsShadow(); }
281 BOOL IsWordLineMode() const { return aSub[nActual].IsWordLineMode(); }
282 BOOL IsOutline() const { return aSub[nActual].IsOutline(); }
283 BOOL IsKerning() const { return aSub[nActual].IsKerning(); }
284 short GetEscapement() const { return aSub[nActual].GetEscapement(); }
285 SvxCaseMap GetCaseMap() const { return aSub[nActual].GetCaseMap(); }
286 BYTE GetPropr() const { return aSub[nActual].GetPropr(); }
287 FontItalic GetItalic() const { return aSub[nActual].GetItalic(); }
288 LanguageType GetLanguage() const { return aSub[nActual].GetLanguage(); }
289 FontAlign GetAlign() const { return aSub[nActual].GetAlign(); }
290 const XubString& GetName() const { return aSub[nActual].GetName(); }
291 const XubString& GetStyleName() const {return aSub[nActual].GetStyleName();}
292 FontFamily GetFamily() const { return aSub[nActual].GetFamily(); }
293 FontPitch GetPitch() const { return aSub[nActual].GetPitch(); }
294 rtl_TextEncoding GetCharSet() const { return aSub[nActual].GetCharSet(); }
295 long GetHeight() const { return aSub[nActual].GetSize().Height(); }
296 FontWeight GetWeight() const { return aSub[nActual].GetWeight(); }
297 FontEmphasisMark GetEmphasisMark() const
298 { return aSub[nActual].GetEmphasisMark(); }
299 USHORT GetPropWidth() const { return aSub[nActual].GetPropWidth(); }
300 USHORT GetOrientation( const BOOL nVertLayout = FALSE ) const;
302 inline const XubString& GetName( const BYTE nWhich ) const
303 { return aSub[nWhich].GetName(); }
304 inline LanguageType GetLanguage( const BYTE nWhich ) const
305 { return aSub[nWhich].GetLanguage(); }
306 inline const XubString& GetStyleName( const BYTE nWhich ) const
307 { return aSub[nWhich].GetStyleName(); }
308 inline FontFamily GetFamily( const BYTE nWhich ) const
309 { return aSub[nWhich].GetFamily(); }
310 inline FontItalic GetItalic( const BYTE nWhich ) const
311 { return aSub[nWhich].GetItalic(); }
312 inline FontPitch GetPitch( const BYTE nWhich ) const
313 { return aSub[nWhich].GetPitch(); }
314 inline rtl_TextEncoding GetCharSet( const BYTE nWhich ) const
315 { return aSub[nWhich].GetCharSet(); }
316 inline long GetHeight( const BYTE nWhich ) const
317 { return aSub[nWhich].GetSize().Height(); }
318 inline FontWeight GetWeight( const BYTE nWhich ) const
319 { return aSub[nWhich].GetWeight(); }
320 inline FontEmphasisMark GetEmphasisMark( const BYTE nWhich ) const
321 { return aSub[nWhich].GetEmphasisMark(); }
323 // Macht den logischen Font im OutputDevice wirksam.
324 void ChgPhysFnt( ViewShell *pSh, OutputDevice& rOut );
326 Size GetCapitalSize( SwDrawTextInfo& rInf )
327 { return aSub[nActual].GetCapitalSize( rInf ); }
329 xub_StrLen GetCapitalBreak( ViewShell* pSh, const OutputDevice* pOut,
330 const SwScriptInfo* pScript, const XubString& rTxt,
331 long nTextWidth, xub_StrLen* pExtra, const xub_StrLen nIdx,
332 const xub_StrLen nLen );
334 xub_StrLen GetCapitalCrsrOfst( SwDrawTextInfo& rInf )
335 { return aSub[nActual].GetCapitalCrsrOfst( rInf ); }
337 void DrawCapital( SwDrawTextInfo &rInf )
338 { aSub[nActual].DrawCapital( rInf ); }
340 void DrawStretchCapital( SwDrawTextInfo &rInf )
341 { aSub[nActual].DrawStretchCapital( rInf ); }
343 void DoOnCapitals( SwDoCapitals &rDo )
344 { aSub[nActual].DoOnCapitals( rDo ); }
346 Size _GetTxtSize( SwDrawTextInfo& rInf )
347 { rInf.SetFont( this ); return aSub[nActual]._GetTxtSize( rInf ); }
349 xub_StrLen GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth );
351 xub_StrLen _GetCrsrOfst( SwDrawTextInfo& rInf )
352 { return aSub[nActual]._GetCrsrOfst( rInf ); }
354 inline void _DrawText( SwDrawTextInfo &rInf )
355 { aSub[nActual]._DrawText( rInf, IsGreyWave() ); }
357 inline void _DrawStretchText( SwDrawTextInfo &rInf )
358 { aSub[nActual]._DrawStretchText( rInf ); }
360 inline short CheckKerning()
361 { return aSub[nActual].CheckKerning(); }
363 inline USHORT GetAscent( ViewShell *pSh, const OutputDevice& rOut )
364 { return aSub[nActual].GetAscent( pSh, rOut ); }
365 inline USHORT GetHeight( ViewShell *pSh, const OutputDevice& rOut )
366 { return aSub[nActual].GetHeight( pSh, rOut ); }
368 inline void Invalidate()
369 { bFntChg = bOrgChg = TRUE; }
372 inline void SwFont::SetColor( const Color& rColor )
374 bFntChg = TRUE;
375 aSub[0].SetColor( rColor );
376 aSub[1].SetColor( rColor );
377 aSub[2].SetColor( rColor );
380 // gekapselte SV-Font-Methode
381 inline void SwSubFont::SetColor( const Color& rColor )
383 pMagic = 0;
384 Font::SetColor( rColor );
388 // gekapselte SV-Font-Methode
389 inline void SwSubFont::SetFillColor( const Color& rColor )
391 pMagic = 0;
392 Font::SetFillColor( rColor );
395 inline void SwFont::SetFillColor( const Color& rColor )
397 bFntChg = TRUE;
398 aSub[0].SetFillColor( rColor );
399 aSub[1].SetFillColor( rColor );
400 aSub[2].SetFillColor( rColor );
403 // gekapselte SV-Font-Methode
404 inline void SwSubFont::SetFamily( const FontFamily eFamily )
406 pMagic = 0;
407 Font::SetFamily( eFamily );
410 inline void SwFont::SetFamily( const FontFamily eFamily, const BYTE nWhich )
412 bFntChg = TRUE;
413 aSub[nWhich].SetFamily( eFamily );
416 // gekapselte SV-Font-Methode
417 inline void SwSubFont::SetName( const XubString& rName )
419 pMagic = 0;
420 Font::SetName( rName );
423 inline void SwFont::SetName( const XubString& rName, const BYTE nWhich )
425 bFntChg = TRUE;
426 aSub[nWhich].SetName( rName );
429 // gekapselte SV-Font-Methode
430 inline void SwSubFont::SetStyleName( const XubString& rStyleName )
432 pMagic = 0;
433 Font::SetStyleName( rStyleName );
436 inline void SwFont::SetStyleName( const XubString& rStyle, const BYTE nWhich )
438 bFntChg = TRUE;
439 aSub[nWhich].SetStyleName( rStyle );
442 // gekapselte SV-Font-Methode
443 inline void SwSubFont::SetCharSet( const CharSet eCharSet )
445 pMagic = 0;
446 Font::SetCharSet( eCharSet );
449 inline void SwFont::SetCharSet( const CharSet eCharSet, const BYTE nWhich )
451 bFntChg = TRUE;
452 aSub[nWhich].SetCharSet( eCharSet );
455 // gekapselte SV-Font-Methode
456 inline void SwSubFont::SetPitch( const FontPitch ePitch )
458 pMagic = 0;
459 Font::SetPitch( ePitch );
462 // gekapselte SV-Font-Methode
463 inline void SwFont::SetPitch( const FontPitch ePitch, const BYTE nWhich )
465 bFntChg = TRUE;
466 aSub[nWhich].SetPitch( ePitch );
469 // gekapselte SV-Font-Methode
470 inline void SwSubFont::SetAlign( const FontAlign eAlign )
472 pMagic = 0;
473 Font::SetAlign( eAlign );
476 inline void SwFont::SetAlign( const FontAlign eAlign )
478 bFntChg = TRUE;
479 aSub[0].SetAlign( eAlign );
480 aSub[1].SetAlign( eAlign );
481 aSub[2].SetAlign( eAlign );
484 // gekapselte SV-Font-Methode
485 inline void SwSubFont::SetWeight( const FontWeight eWeight )
487 pMagic = 0;
488 Font::SetWeight( eWeight );
491 inline void SwFont::SetWeight( const FontWeight eWeight, const BYTE nWhich )
493 bFntChg = TRUE;
494 aSub[nWhich].SetWeight( eWeight );
497 // gekapselte SV-Font-Methode
498 inline void SwSubFont::SetUnderline( const FontUnderline eUnderline )
500 pMagic = 0;
501 Font::SetUnderline( eUnderline );
504 inline void SwFont::SetUnderline( const FontUnderline eUnderline )
506 bFntChg = TRUE;
507 aSub[0].SetUnderline( eUnderline );
508 aSub[1].SetUnderline( eUnderline );
509 aSub[2].SetUnderline( eUnderline );
512 // gekapselte SV-Font-Methode
513 inline void SwSubFont::SetOverline( const FontUnderline eOverline )
515 pMagic = 0;
516 Font::SetOverline( eOverline );
519 inline void SwFont::SetOverline( const FontUnderline eOverline )
521 bFntChg = TRUE;
522 aSub[0].SetOverline( eOverline );
523 aSub[1].SetOverline( eOverline );
524 aSub[2].SetOverline( eOverline );
527 // gekapselte SV-Font-Methode
528 inline void SwSubFont::SetStrikeout( const FontStrikeout eStrikeout )
530 pMagic = 0;
531 Font::SetStrikeout( eStrikeout );
534 inline void SwFont::SetStrikeout( const FontStrikeout eStrikeout )
536 bFntChg = TRUE;
537 aSub[0].SetStrikeout( eStrikeout );
538 aSub[1].SetStrikeout( eStrikeout );
539 aSub[2].SetStrikeout( eStrikeout );
542 // gekapselte SV-Font-Methode
543 inline void SwSubFont::SetItalic( const FontItalic eItalic )
545 pMagic = 0;
546 Font::SetItalic( eItalic );
549 inline void SwFont::SetItalic( const FontItalic eItalic, const BYTE nWhich )
551 bFntChg = TRUE;
552 aSub[nWhich].SetItalic( eItalic );
555 // gekapselte SV-Font-Methode
556 inline void SwSubFont::SetOutline( const BOOL bOutline )
558 pMagic = 0;
559 Font::SetOutline( bOutline );
562 inline void SwFont::SetOutline( const BOOL bOutline )
564 bFntChg = TRUE;
565 aSub[0].SetOutline( bOutline );
566 aSub[1].SetOutline( bOutline );
567 aSub[2].SetOutline( bOutline );
570 // gekapselte SV-Font-Methode
571 inline void SwSubFont::SetShadow( const BOOL bShadow )
573 pMagic = 0;
574 Font::SetShadow( bShadow );
577 inline void SwFont::SetShadow( const BOOL bShadow )
579 bFntChg = TRUE;
580 aSub[0].SetShadow( bShadow );
581 aSub[1].SetShadow( bShadow );
582 aSub[2].SetShadow( bShadow );
585 // gekapselte SV-Font-Methode
586 inline void SwSubFont::SetAutoKern( const BYTE nAutoKern )
588 pMagic = 0;
589 Font::SetKerning( nAutoKern );
592 inline void SwFont::SetAutoKern( BYTE nAutoKern )
594 bFntChg = TRUE;
595 aSub[1].SetAutoKern( nAutoKern );
596 if( nAutoKern )
597 nAutoKern = KERNING_FONTSPECIFIC;
598 aSub[0].SetAutoKern( nAutoKern );
599 aSub[2].SetAutoKern( nAutoKern );
602 inline void SwFont::SetTransparent( const BOOL bTrans )
604 aSub[0].SetTransparent( bTrans );
605 aSub[1].SetTransparent( bTrans );
606 aSub[2].SetTransparent( bTrans );
609 inline void SwFont::SetFixKerning( const short nNewKern )
611 aSub[SW_LATIN].SetFixKerning( nNewKern );
612 aSub[SW_CJK].SetFixKerning( nNewKern );
613 aSub[SW_CTL].SetFixKerning( nNewKern );
616 inline void SwFont::SetCaseMap( const SvxCaseMap eNew )
618 aSub[SW_LATIN].SetCaseMap( eNew );
619 aSub[SW_CJK].SetCaseMap( eNew );
620 aSub[SW_CTL].SetCaseMap( eNew );
623 // gekapselte SV-Font-Methode
624 inline void SwSubFont::SetWordLineMode( const BOOL bWordLineMode )
626 pMagic = 0;
627 Font::SetWordLineMode( bWordLineMode );
630 inline void SwFont::SetWordLineMode( const BOOL bWordLineMode )
632 bFntChg = TRUE;
633 aSub[0].SetWordLineMode( bWordLineMode );
634 aSub[1].SetWordLineMode( bWordLineMode );
635 aSub[2].SetWordLineMode( bWordLineMode );
637 // gekapselte SV-Font-Methode
638 inline void SwSubFont::SetEmphasisMark( const FontEmphasisMark eValue )
640 pMagic = 0;
641 Font::SetEmphasisMark( eValue );
644 inline void SwFont::SetEmphasisMark( const FontEmphasisMark eValue )
646 bFntChg = TRUE;
647 aSub[0].SetEmphasisMark( eValue );
648 aSub[1].SetEmphasisMark( eValue );
649 aSub[2].SetEmphasisMark( eValue );
652 inline void SwFont::SetPropWidth( const USHORT nNew )
654 if( nNew != aSub[0].GetPropWidth() )
656 bFntChg = TRUE;
657 aSub[0].SetPropWidth( nNew );
658 aSub[1].SetPropWidth( nNew );
659 aSub[2].SetPropWidth( nNew );
663 // gekapselte SV-Font-Methode
664 inline void SwSubFont::SetRelief( const FontRelief eNew )
666 pMagic = 0;
667 Font::SetRelief( eNew );
670 inline void SwFont::SetRelief( const FontRelief eNew )
672 if( eNew != aSub[0].GetRelief() )
674 bFntChg = TRUE;
675 aSub[0].SetRelief( eNew );
676 aSub[1].SetRelief( eNew );
677 aSub[2].SetRelief( eNew );
681 // ueberladene Font-Methode
682 inline void SwSubFont::SetSize( const Size& rSize )
684 aSize = rSize;
685 if ( GetPropr() == 100 )
686 Font::SetSize( aSize );
687 else
689 Font::SetSize( Size(
690 (long) aSize.Width() * GetPropr() / 100L,
691 (long) aSize.Height() * GetPropr() / 100L ) );
693 pMagic = 0;
696 inline void SwFont::SetSize( const Size& rSize, const BYTE nWhich )
698 if( aSub[nWhich].aSize != rSize )
700 aSub[nWhich].SetSize( rSize );
701 bFntChg = TRUE;
702 bOrgChg = TRUE;
706 inline void SwFont::SetActual( BYTE nNew )
708 if ( nActual != nNew )
710 bFntChg = TRUE;
711 bOrgChg = TRUE;
712 nActual = nNew;
716 inline void SwSubFont::SetProportion( const BYTE nNewPropr )
718 pMagic = 0;
719 Font::SetSize( Size( (long) aSize.Width() * nNewPropr / 100L,
720 (long) aSize.Height() * nNewPropr / 100L ) );
721 SvxFont::SetPropr( nNewPropr );
724 inline void SwFont::SetProportion( const BYTE nNewPropr )
726 if( nNewPropr != aSub[0].GetPropr() )
728 bFntChg = TRUE;
729 bOrgChg = TRUE;
731 aSub[0].SetProportion( nNewPropr );
732 aSub[1].SetProportion( nNewPropr );
733 aSub[2].SetProportion( nNewPropr );
737 inline void SwSubFont::SetEscapement( const short nNewEsc )
739 pMagic = 0;
740 SvxFont::SetEscapement( nNewEsc );
743 inline void SwFont::SetEscapement( const short nNewEsc )
745 if( nNewEsc != aSub[0].GetEscapement() )
747 // these have to be set, otherwise nOrgHeight and nOrgAscent will not
748 // be calculated
749 bFntChg = TRUE;
750 bOrgChg = TRUE;
752 aSub[0].SetEscapement( nNewEsc );
753 aSub[1].SetEscapement( nNewEsc );
754 aSub[2].SetEscapement( nNewEsc );
758 inline void SwSubFont::SetLanguage( LanguageType eNewLang )
760 if( eNewLang == LANGUAGE_SYSTEM )
761 eNewLang = (LanguageType)GetAppLanguage();
762 SvxFont::SetLanguage( eNewLang );
765 inline void SwFont::SetLanguage( const LanguageType eNewLang, const BYTE nWhich )
767 aSub[nWhich].SetLanguage( eNewLang );
768 if( SW_CJK == nWhich )
770 aSub[SW_LATIN].SetCJKContextLanguage( eNewLang );
771 aSub[SW_CJK].SetCJKContextLanguage( eNewLang );
772 aSub[SW_CTL].SetCJKContextLanguage( eNewLang );
776 inline void SwFont::SetPaintBlank( const BOOL bNew )
778 bPaintBlank = bNew;
781 inline void SwFont::SetPaintWrong( const BOOL bNew )
783 bPaintWrong = bNew;
786 inline void SwFont::SetNoHyph( const BOOL bNew )
788 bNoHyph = bNew;
791 inline void SwFont::SetBlink( const BOOL bNew )
793 bBlink = bNew;
796 inline void SwFont::SetURL( const BOOL bNew )
798 bURL = bNew;
801 inline void SwFont::SetGreyWave( const BOOL bNew )
803 bGreyWave = bNew;
806 inline void SwFont::SetNoCol( const BOOL bNew )
808 bNoColReplace = bNew;
811 inline void SwSubFont::SetVertical( const USHORT nDir, const BOOL bVertFormat )
813 pMagic = 0;
814 Font::SetVertical( bVertFormat );
815 Font::SetOrientation( nDir );
819 /*************************************************************************
820 * class SwUnderlineFont
822 * Used for the "continuous underline" feature.
823 *************************************************************************/
825 class SwUnderlineFont
827 Point aPos;
828 SwFont* pFnt;
830 public:
831 // sets the font which should paint the common baseline
832 // and the starting point of the common baseline
833 SwUnderlineFont( SwFont& rFnt, const Point& rPoint );
834 ~SwUnderlineFont();
836 SwFont& GetFont()
838 ASSERT( pFnt, "No underline font" )
839 return *pFnt;
841 const Point& GetPos() const { return aPos; }
842 // the x coordinate of the starting point has to be set for each portion
843 void SetPos( const Point& rPoint ) { aPos = rPoint; }
847 /*************************************************************************
848 * class SvStatistics
849 *************************************************************************/
851 #ifdef PRODUCT
852 #define SV_STAT(nWhich)
853 #else
855 class SvStatistics
857 public:
858 USHORT nGetTextSize;
859 USHORT nDrawText;
860 USHORT nGetStretchTextSize;
861 USHORT nDrawStretchText;
862 USHORT nChangeFont;
863 USHORT nGetFontMetric;
865 inline void Reset()
867 nGetTextSize = nDrawText = nGetStretchTextSize =
868 nDrawStretchText = nChangeFont = nGetFontMetric = 0;
871 inline SvStatistics() { Reset(); }
873 inline void PrintOn( SvStream &rOS ) const; //$ ostream
874 inline BOOL IsEmpty() const
876 return !( nGetTextSize || nDrawText ||
877 nDrawStretchText || nChangeFont || nGetFontMetric );
881 // globale Variable, implementiert in swfont.cxx
882 extern SvStatistics aSvStat;
884 #define SV_STAT(nWhich) ++(aSvStat.nWhich);
886 inline void SvStatistics::PrintOn( SvStream &rOS ) const //$ ostream
888 if( IsEmpty() )
889 return;
891 rOS << "{ SV called:" << '\n';
892 if( nGetTextSize )
893 rOS << "\tnGetTextSize: " << nGetTextSize << '\n'; if( nDrawText )
894 rOS << "\tnDrawText: " << nDrawText << '\n'; if( nGetStretchTextSize )
895 rOS << "\tnGetStretchTextSize: " << nGetStretchTextSize << '\n'; if( nDrawStretchText )
896 rOS << "\tnDrawStretchText: " << nDrawStretchText << '\n'; if( nChangeFont )
897 rOS << "\tnChangeFont: " << nChangeFont << '\n'; if( nGetFontMetric )
898 rOS << "\tnGetFontMetric: " << nGetFontMetric << '\n'; rOS << "}" << '\n'; }
899 #endif /* PRODUCT */
901 #endif