update dev300-m58
[ooovba.git] / sw / source / core / inc / swfont.hxx
blob7b09d045a8c7dfab1faef6f6476b199ea8d15e76
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 nActual; // actual font (Latin, CJK or CTL)
146 // Schalter fuer die Font-Extensions
147 BOOL bNoHyph :1; // SwTxtNoHyphenHere: keine Trennstelle
148 BOOL bBlink :1; // blinkender Font
149 BOOL bPaintBlank :1; // Blanks nicht mit DrawRect
150 BOOL bFntChg :1;
151 BOOL bOrgChg :1; // nOrgHeight/Ascent sind invalid
152 BOOL bURL :1;
153 BOOL bPaintWrong :1; // Flag fuer Rechtschreibfehler
154 BOOL bGreyWave :1; // Fuers extended TextInput: Graue Wellenlinie
155 BOOL bNoColReplace :1; // Replacement without colormanipulation
157 BOOL operator==( const SwFont &rFnt ) const;
159 protected:
160 inline SwFont() { pBackColor = NULL; nActual = SW_LATIN; }
162 public:
163 SwFont( const SwAttrSet* pSet, const IDocumentSettingAccess* pIDocumentSettingAccess );
164 SwFont( const SwFont& rFont );
166 inline void ChgFnt( ViewShell *pSh, OutputDevice& rOut )
167 { bPaintBlank = aSub[nActual].ChgFnt( pSh, rOut ); }
169 ~SwFont(){ delete pBackColor; }
171 SwFont& operator=( const SwFont &rFont );
173 inline BYTE GetActual() const { return nActual; }
174 inline void SetActual( BYTE nNew );
175 inline const SvxFont& GetActualFont() const { return aSub[nActual]; }
177 // holt sich eine MagicNumber ueber SwFntAccess
178 void GoMagic( ViewShell *pSh, BYTE nWhich );
179 // set background color
180 void SetBackColor( Color* pNewColor );
181 inline const Color* GetBackColor() const{ return pBackColor; }
183 inline void ChkMagic( ViewShell *pSh, BYTE nWhich )
184 { if( !aSub[ nWhich ].pMagic ) GoMagic( pSh, nWhich ); }
185 // uebernimmt die MagicNumber eines (hoffentlich ident.) Kollegen
186 inline void CopyMagic( const SwFont* pFnt, BYTE nWhich )
187 { aSub[nWhich].CopyMagic( pFnt->aSub[nWhich] ); }
188 inline void GetMagic( const void* &rMagic, USHORT &rIdx, BYTE nWhich )
189 { rMagic = aSub[nWhich].pMagic; rIdx = aSub[nWhich].nFntIndex; }
190 inline void SetMagic( const void* pNew, const USHORT nIdx, BYTE nWhich )
191 { aSub[nWhich].pMagic = pNew; aSub[nWhich].nFntIndex = nIdx; }
192 inline BOOL DifferentMagic( const SwFont* pFnt, BYTE nWhich )
193 { return aSub[nWhich].pMagic != pFnt->aSub[nWhich].pMagic ||
194 !aSub[nWhich].pMagic || !pFnt->aSub[nWhich].pMagic; }
196 inline const Size &GetSize( BYTE nWhich ) const
197 { return aSub[nWhich].aSize; }
198 inline BOOL IsFntChg() const { return bFntChg; }
199 inline void SetFntChg( const BOOL bNew ) { bFntChg = bNew; }
201 // die gekapselten SV-Font-Methoden (setzen bFntChg auf TRUE)
202 inline void SetColor( const Color& rColor );
203 inline void SetFillColor( const Color& rColor );
204 inline void SetAlign( const FontAlign eAlign );
205 inline void SetUnderline( const FontUnderline eUnderline );
206 inline void SetUnderColor( const Color &rColor ) { aUnderColor = rColor; }
207 inline void SetOverline( const FontUnderline eOverline );
208 inline void SetOverColor( const Color &rColor ) { aOverColor = rColor; }
209 inline void SetStrikeout( const FontStrikeout eStrikeout );
210 inline void SetOutline( const BOOL bOutline );
211 void SetVertical( USHORT nDir, const BOOL nVertLayout = FALSE );
212 inline void SetShadow( const BOOL bShadow );
213 inline void SetAutoKern( BYTE nAutoKern );
214 inline void SetTransparent( const BOOL bTrans );
215 inline void SetWordLineMode( const BOOL bWordLineMode );
216 inline void SetFixKerning( const short nNewKern );
217 inline void SetCaseMap( const SvxCaseMap eNew );
218 inline void SetEmphasisMark( const FontEmphasisMark eValue );
220 // Methoden fuer die Hoch-/Tiefstellung
221 inline void SetEscapement( const short nNewEsc );
222 inline void SetProportion( const BYTE nNewPropr );
224 inline void SetPropWidth( const USHORT nNew );
226 inline void SetFamily( const FontFamily eFamily, const BYTE nWhich );
227 inline void SetName( const XubString& rName, const BYTE nWhich );
228 inline void SetStyleName( const XubString& rStyleName, const BYTE nWhich );
229 inline void SetSize( const Size& rSize, const BYTE nWhich );
230 inline void SetWeight( const FontWeight eWeight, const BYTE nWhich );
231 inline void SetItalic( const FontItalic eItalic, const BYTE nWhich );
232 inline void SetLanguage( LanguageType eNewLang, const BYTE nWhich );
233 inline void SetCharSet( const CharSet eCharSet, const BYTE nWhich );
234 inline void SetPitch( const FontPitch ePitch, const BYTE nWhich );
235 inline void SetRelief( const FontRelief eNew );
237 // Get/Set-Methoden fuer die aktuelle Einstellung
238 inline void SetNoHyph( const BOOL bNew );
239 inline BOOL IsNoHyph() const { return bNoHyph; }
240 inline void SetBlink( const BOOL bBlink );
241 inline BOOL IsBlink() const { return bBlink; }
242 inline BYTE &GetTox() { return nToxCnt; }
243 inline BYTE GetTox() const { return nToxCnt; }
244 inline BOOL IsTox() const { return ( 0 != nToxCnt ); }
245 inline BYTE &GetRef() { return nRefCnt; }
246 inline BYTE GetRef() const { return nRefCnt; }
247 inline BOOL IsRef() const { return ( 0 != nRefCnt ); }
248 inline void SetURL( const BOOL bURL );
249 inline BOOL IsURL() const { return bURL; }
250 inline void SetGreyWave( const BOOL bNew );
251 inline BOOL IsGreyWave() const { return bGreyWave; }
252 inline void SetNoCol( const BOOL bNew );
253 inline BOOL IsNoCol() const { return bNoColReplace; }
255 inline void SetPaintBlank( const BOOL bNew );
256 inline BOOL IsPaintBlank() const { return bPaintBlank; }
257 inline void SetPaintWrong( const BOOL bNew );
258 inline BOOL IsPaintWrong() const { return bPaintWrong; }
260 // Setzen der Basisklasse Font fuer SwTxtCharFmt
261 void SetDiffFnt( const SfxItemSet* pSet,
262 const IDocumentSettingAccess* pIDocumentSettingAccess );
264 inline const SvxFont &GetFnt( const BYTE nWhich ) const
265 { return aSub[nWhich]; };
267 BOOL IsSymbol( ViewShell *pSh )
268 { return aSub[nActual].IsSymbol( pSh ); }
269 FontUnderline GetUnderline() const { return aSub[nActual].GetUnderline(); }
270 const Color& GetUnderColor() const { return aUnderColor; }
271 FontUnderline GetOverline() const { return aSub[nActual].GetOverline(); }
272 const Color& GetOverColor() const { return aOverColor; }
273 short GetFixKerning() const { return aSub[nActual].GetFixKerning(); }
274 FontStrikeout GetStrikeout() const { return aSub[nActual].GetStrikeout(); }
275 const Color& GetColor() const { return aSub[nActual].GetColor(); }
276 BOOL IsShadow() const { return aSub[nActual].IsShadow(); }
277 BOOL IsWordLineMode() const { return aSub[nActual].IsWordLineMode(); }
278 BOOL IsOutline() const { return aSub[nActual].IsOutline(); }
279 BOOL IsKerning() const { return aSub[nActual].IsKerning(); }
280 short GetEscapement() const { return aSub[nActual].GetEscapement(); }
281 SvxCaseMap GetCaseMap() const { return aSub[nActual].GetCaseMap(); }
282 BYTE GetPropr() const { return aSub[nActual].GetPropr(); }
283 FontItalic GetItalic() const { return aSub[nActual].GetItalic(); }
284 LanguageType GetLanguage() const { return aSub[nActual].GetLanguage(); }
285 FontAlign GetAlign() const { return aSub[nActual].GetAlign(); }
286 const XubString& GetName() const { return aSub[nActual].GetName(); }
287 const XubString& GetStyleName() const {return aSub[nActual].GetStyleName();}
288 FontFamily GetFamily() const { return aSub[nActual].GetFamily(); }
289 FontPitch GetPitch() const { return aSub[nActual].GetPitch(); }
290 rtl_TextEncoding GetCharSet() const { return aSub[nActual].GetCharSet(); }
291 long GetHeight() const { return aSub[nActual].GetSize().Height(); }
292 FontWeight GetWeight() const { return aSub[nActual].GetWeight(); }
293 FontEmphasisMark GetEmphasisMark() const
294 { return aSub[nActual].GetEmphasisMark(); }
295 USHORT GetPropWidth() const { return aSub[nActual].GetPropWidth(); }
296 USHORT GetOrientation( const BOOL nVertLayout = FALSE ) const;
298 inline const XubString& GetName( const BYTE nWhich ) const
299 { return aSub[nWhich].GetName(); }
300 inline LanguageType GetLanguage( const BYTE nWhich ) const
301 { return aSub[nWhich].GetLanguage(); }
302 inline const XubString& GetStyleName( const BYTE nWhich ) const
303 { return aSub[nWhich].GetStyleName(); }
304 inline FontFamily GetFamily( const BYTE nWhich ) const
305 { return aSub[nWhich].GetFamily(); }
306 inline FontItalic GetItalic( const BYTE nWhich ) const
307 { return aSub[nWhich].GetItalic(); }
308 inline FontPitch GetPitch( const BYTE nWhich ) const
309 { return aSub[nWhich].GetPitch(); }
310 inline rtl_TextEncoding GetCharSet( const BYTE nWhich ) const
311 { return aSub[nWhich].GetCharSet(); }
312 inline long GetHeight( const BYTE nWhich ) const
313 { return aSub[nWhich].GetSize().Height(); }
314 inline FontWeight GetWeight( const BYTE nWhich ) const
315 { return aSub[nWhich].GetWeight(); }
316 inline FontEmphasisMark GetEmphasisMark( const BYTE nWhich ) const
317 { return aSub[nWhich].GetEmphasisMark(); }
319 // Macht den logischen Font im OutputDevice wirksam.
320 void ChgPhysFnt( ViewShell *pSh, OutputDevice& rOut );
322 Size GetCapitalSize( SwDrawTextInfo& rInf )
323 { return aSub[nActual].GetCapitalSize( rInf ); }
325 xub_StrLen GetCapitalBreak( ViewShell* pSh, const OutputDevice* pOut,
326 const SwScriptInfo* pScript, const XubString& rTxt,
327 long nTextWidth, xub_StrLen* pExtra, const xub_StrLen nIdx,
328 const xub_StrLen nLen );
330 xub_StrLen GetCapitalCrsrOfst( SwDrawTextInfo& rInf )
331 { return aSub[nActual].GetCapitalCrsrOfst( rInf ); }
333 void DrawCapital( SwDrawTextInfo &rInf )
334 { aSub[nActual].DrawCapital( rInf ); }
336 void DrawStretchCapital( SwDrawTextInfo &rInf )
337 { aSub[nActual].DrawStretchCapital( rInf ); }
339 void DoOnCapitals( SwDoCapitals &rDo )
340 { aSub[nActual].DoOnCapitals( rDo ); }
342 Size _GetTxtSize( SwDrawTextInfo& rInf )
343 { rInf.SetFont( this ); return aSub[nActual]._GetTxtSize( rInf ); }
345 xub_StrLen GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth );
347 xub_StrLen _GetCrsrOfst( SwDrawTextInfo& rInf )
348 { return aSub[nActual]._GetCrsrOfst( rInf ); }
350 inline void _DrawText( SwDrawTextInfo &rInf )
351 { aSub[nActual]._DrawText( rInf, IsGreyWave() ); }
353 inline void _DrawStretchText( SwDrawTextInfo &rInf )
354 { aSub[nActual]._DrawStretchText( rInf ); }
356 inline short CheckKerning()
357 { return aSub[nActual].CheckKerning(); }
359 inline USHORT GetAscent( ViewShell *pSh, const OutputDevice& rOut )
360 { return aSub[nActual].GetAscent( pSh, rOut ); }
361 inline USHORT GetHeight( ViewShell *pSh, const OutputDevice& rOut )
362 { return aSub[nActual].GetHeight( pSh, rOut ); }
364 inline void Invalidate()
365 { bFntChg = bOrgChg = TRUE; }
368 inline void SwFont::SetColor( const Color& rColor )
370 bFntChg = TRUE;
371 aSub[0].SetColor( rColor );
372 aSub[1].SetColor( rColor );
373 aSub[2].SetColor( rColor );
376 // gekapselte SV-Font-Methode
377 inline void SwSubFont::SetColor( const Color& rColor )
379 pMagic = 0;
380 Font::SetColor( rColor );
384 // gekapselte SV-Font-Methode
385 inline void SwSubFont::SetFillColor( const Color& rColor )
387 pMagic = 0;
388 Font::SetFillColor( rColor );
391 inline void SwFont::SetFillColor( const Color& rColor )
393 bFntChg = TRUE;
394 aSub[0].SetFillColor( rColor );
395 aSub[1].SetFillColor( rColor );
396 aSub[2].SetFillColor( rColor );
399 // gekapselte SV-Font-Methode
400 inline void SwSubFont::SetFamily( const FontFamily eFamily )
402 pMagic = 0;
403 Font::SetFamily( eFamily );
406 inline void SwFont::SetFamily( const FontFamily eFamily, const BYTE nWhich )
408 bFntChg = TRUE;
409 aSub[nWhich].SetFamily( eFamily );
412 // gekapselte SV-Font-Methode
413 inline void SwSubFont::SetName( const XubString& rName )
415 pMagic = 0;
416 Font::SetName( rName );
419 inline void SwFont::SetName( const XubString& rName, const BYTE nWhich )
421 bFntChg = TRUE;
422 aSub[nWhich].SetName( rName );
425 // gekapselte SV-Font-Methode
426 inline void SwSubFont::SetStyleName( const XubString& rStyleName )
428 pMagic = 0;
429 Font::SetStyleName( rStyleName );
432 inline void SwFont::SetStyleName( const XubString& rStyle, const BYTE nWhich )
434 bFntChg = TRUE;
435 aSub[nWhich].SetStyleName( rStyle );
438 // gekapselte SV-Font-Methode
439 inline void SwSubFont::SetCharSet( const CharSet eCharSet )
441 pMagic = 0;
442 Font::SetCharSet( eCharSet );
445 inline void SwFont::SetCharSet( const CharSet eCharSet, const BYTE nWhich )
447 bFntChg = TRUE;
448 aSub[nWhich].SetCharSet( eCharSet );
451 // gekapselte SV-Font-Methode
452 inline void SwSubFont::SetPitch( const FontPitch ePitch )
454 pMagic = 0;
455 Font::SetPitch( ePitch );
458 // gekapselte SV-Font-Methode
459 inline void SwFont::SetPitch( const FontPitch ePitch, const BYTE nWhich )
461 bFntChg = TRUE;
462 aSub[nWhich].SetPitch( ePitch );
465 // gekapselte SV-Font-Methode
466 inline void SwSubFont::SetAlign( const FontAlign eAlign )
468 pMagic = 0;
469 Font::SetAlign( eAlign );
472 inline void SwFont::SetAlign( const FontAlign eAlign )
474 bFntChg = TRUE;
475 aSub[0].SetAlign( eAlign );
476 aSub[1].SetAlign( eAlign );
477 aSub[2].SetAlign( eAlign );
480 // gekapselte SV-Font-Methode
481 inline void SwSubFont::SetWeight( const FontWeight eWeight )
483 pMagic = 0;
484 Font::SetWeight( eWeight );
487 inline void SwFont::SetWeight( const FontWeight eWeight, const BYTE nWhich )
489 bFntChg = TRUE;
490 aSub[nWhich].SetWeight( eWeight );
493 // gekapselte SV-Font-Methode
494 inline void SwSubFont::SetUnderline( const FontUnderline eUnderline )
496 pMagic = 0;
497 Font::SetUnderline( eUnderline );
500 inline void SwFont::SetUnderline( const FontUnderline eUnderline )
502 bFntChg = TRUE;
503 aSub[0].SetUnderline( eUnderline );
504 aSub[1].SetUnderline( eUnderline );
505 aSub[2].SetUnderline( eUnderline );
508 // gekapselte SV-Font-Methode
509 inline void SwSubFont::SetOverline( const FontUnderline eOverline )
511 pMagic = 0;
512 Font::SetOverline( eOverline );
515 inline void SwFont::SetOverline( const FontUnderline eOverline )
517 bFntChg = TRUE;
518 aSub[0].SetOverline( eOverline );
519 aSub[1].SetOverline( eOverline );
520 aSub[2].SetOverline( eOverline );
523 // gekapselte SV-Font-Methode
524 inline void SwSubFont::SetStrikeout( const FontStrikeout eStrikeout )
526 pMagic = 0;
527 Font::SetStrikeout( eStrikeout );
530 inline void SwFont::SetStrikeout( const FontStrikeout eStrikeout )
532 bFntChg = TRUE;
533 aSub[0].SetStrikeout( eStrikeout );
534 aSub[1].SetStrikeout( eStrikeout );
535 aSub[2].SetStrikeout( eStrikeout );
538 // gekapselte SV-Font-Methode
539 inline void SwSubFont::SetItalic( const FontItalic eItalic )
541 pMagic = 0;
542 Font::SetItalic( eItalic );
545 inline void SwFont::SetItalic( const FontItalic eItalic, const BYTE nWhich )
547 bFntChg = TRUE;
548 aSub[nWhich].SetItalic( eItalic );
551 // gekapselte SV-Font-Methode
552 inline void SwSubFont::SetOutline( const BOOL bOutline )
554 pMagic = 0;
555 Font::SetOutline( bOutline );
558 inline void SwFont::SetOutline( const BOOL bOutline )
560 bFntChg = TRUE;
561 aSub[0].SetOutline( bOutline );
562 aSub[1].SetOutline( bOutline );
563 aSub[2].SetOutline( bOutline );
566 // gekapselte SV-Font-Methode
567 inline void SwSubFont::SetShadow( const BOOL bShadow )
569 pMagic = 0;
570 Font::SetShadow( bShadow );
573 inline void SwFont::SetShadow( const BOOL bShadow )
575 bFntChg = TRUE;
576 aSub[0].SetShadow( bShadow );
577 aSub[1].SetShadow( bShadow );
578 aSub[2].SetShadow( bShadow );
581 // gekapselte SV-Font-Methode
582 inline void SwSubFont::SetAutoKern( const BYTE nAutoKern )
584 pMagic = 0;
585 Font::SetKerning( nAutoKern );
588 inline void SwFont::SetAutoKern( BYTE nAutoKern )
590 bFntChg = TRUE;
591 aSub[1].SetAutoKern( nAutoKern );
592 if( nAutoKern )
593 nAutoKern = KERNING_FONTSPECIFIC;
594 aSub[0].SetAutoKern( nAutoKern );
595 aSub[2].SetAutoKern( nAutoKern );
598 inline void SwFont::SetTransparent( const BOOL bTrans )
600 aSub[0].SetTransparent( bTrans );
601 aSub[1].SetTransparent( bTrans );
602 aSub[2].SetTransparent( bTrans );
605 inline void SwFont::SetFixKerning( const short nNewKern )
607 aSub[SW_LATIN].SetFixKerning( nNewKern );
608 aSub[SW_CJK].SetFixKerning( nNewKern );
609 aSub[SW_CTL].SetFixKerning( nNewKern );
612 inline void SwFont::SetCaseMap( const SvxCaseMap eNew )
614 aSub[SW_LATIN].SetCaseMap( eNew );
615 aSub[SW_CJK].SetCaseMap( eNew );
616 aSub[SW_CTL].SetCaseMap( eNew );
619 // gekapselte SV-Font-Methode
620 inline void SwSubFont::SetWordLineMode( const BOOL bWordLineMode )
622 pMagic = 0;
623 Font::SetWordLineMode( bWordLineMode );
626 inline void SwFont::SetWordLineMode( const BOOL bWordLineMode )
628 bFntChg = TRUE;
629 aSub[0].SetWordLineMode( bWordLineMode );
630 aSub[1].SetWordLineMode( bWordLineMode );
631 aSub[2].SetWordLineMode( bWordLineMode );
633 // gekapselte SV-Font-Methode
634 inline void SwSubFont::SetEmphasisMark( const FontEmphasisMark eValue )
636 pMagic = 0;
637 Font::SetEmphasisMark( eValue );
640 inline void SwFont::SetEmphasisMark( const FontEmphasisMark eValue )
642 bFntChg = TRUE;
643 aSub[0].SetEmphasisMark( eValue );
644 aSub[1].SetEmphasisMark( eValue );
645 aSub[2].SetEmphasisMark( eValue );
648 inline void SwFont::SetPropWidth( const USHORT nNew )
650 if( nNew != aSub[0].GetPropWidth() )
652 bFntChg = TRUE;
653 aSub[0].SetPropWidth( nNew );
654 aSub[1].SetPropWidth( nNew );
655 aSub[2].SetPropWidth( nNew );
659 // gekapselte SV-Font-Methode
660 inline void SwSubFont::SetRelief( const FontRelief eNew )
662 pMagic = 0;
663 Font::SetRelief( eNew );
666 inline void SwFont::SetRelief( const FontRelief eNew )
668 if( eNew != aSub[0].GetRelief() )
670 bFntChg = TRUE;
671 aSub[0].SetRelief( eNew );
672 aSub[1].SetRelief( eNew );
673 aSub[2].SetRelief( eNew );
677 // ueberladene Font-Methode
678 inline void SwSubFont::SetSize( const Size& rSize )
680 aSize = rSize;
681 if ( GetPropr() == 100 )
682 Font::SetSize( aSize );
683 else
685 Font::SetSize( Size(
686 (long) aSize.Width() * GetPropr() / 100L,
687 (long) aSize.Height() * GetPropr() / 100L ) );
689 pMagic = 0;
692 inline void SwFont::SetSize( const Size& rSize, const BYTE nWhich )
694 if( aSub[nWhich].aSize != rSize )
696 aSub[nWhich].SetSize( rSize );
697 bFntChg = TRUE;
698 bOrgChg = TRUE;
702 inline void SwFont::SetActual( BYTE nNew )
704 if ( nActual != nNew )
706 bFntChg = TRUE;
707 bOrgChg = TRUE;
708 nActual = nNew;
712 inline void SwSubFont::SetProportion( const BYTE nNewPropr )
714 pMagic = 0;
715 Font::SetSize( Size( (long) aSize.Width() * nNewPropr / 100L,
716 (long) aSize.Height() * nNewPropr / 100L ) );
717 SvxFont::SetPropr( nNewPropr );
720 inline void SwFont::SetProportion( const BYTE nNewPropr )
722 if( nNewPropr != aSub[0].GetPropr() )
724 bFntChg = TRUE;
725 bOrgChg = TRUE;
727 aSub[0].SetProportion( nNewPropr );
728 aSub[1].SetProportion( nNewPropr );
729 aSub[2].SetProportion( nNewPropr );
733 inline void SwSubFont::SetEscapement( const short nNewEsc )
735 pMagic = 0;
736 SvxFont::SetEscapement( nNewEsc );
739 inline void SwFont::SetEscapement( const short nNewEsc )
741 if( nNewEsc != aSub[0].GetEscapement() )
743 // these have to be set, otherwise nOrgHeight and nOrgAscent will not
744 // be calculated
745 bFntChg = TRUE;
746 bOrgChg = TRUE;
748 aSub[0].SetEscapement( nNewEsc );
749 aSub[1].SetEscapement( nNewEsc );
750 aSub[2].SetEscapement( nNewEsc );
754 inline void SwSubFont::SetLanguage( LanguageType eNewLang )
756 if( eNewLang == LANGUAGE_SYSTEM )
757 eNewLang = (LanguageType)GetAppLanguage();
758 SvxFont::SetLanguage( eNewLang );
761 inline void SwFont::SetLanguage( const LanguageType eNewLang, const BYTE nWhich )
763 aSub[nWhich].SetLanguage( eNewLang );
764 if( SW_CJK == nWhich )
766 aSub[SW_LATIN].SetCJKContextLanguage( eNewLang );
767 aSub[SW_CJK].SetCJKContextLanguage( eNewLang );
768 aSub[SW_CTL].SetCJKContextLanguage( eNewLang );
772 inline void SwFont::SetPaintBlank( const BOOL bNew )
774 bPaintBlank = bNew;
777 inline void SwFont::SetPaintWrong( const BOOL bNew )
779 bPaintWrong = bNew;
782 inline void SwFont::SetNoHyph( const BOOL bNew )
784 bNoHyph = bNew;
787 inline void SwFont::SetBlink( const BOOL bNew )
789 bBlink = bNew;
792 inline void SwFont::SetURL( const BOOL bNew )
794 bURL = bNew;
797 inline void SwFont::SetGreyWave( const BOOL bNew )
799 bGreyWave = bNew;
802 inline void SwFont::SetNoCol( const BOOL bNew )
804 bNoColReplace = bNew;
807 inline void SwSubFont::SetVertical( const USHORT nDir, const BOOL bVertFormat )
809 pMagic = 0;
810 Font::SetVertical( bVertFormat );
811 Font::SetOrientation( nDir );
815 /*************************************************************************
816 * class SwUnderlineFont
818 * Used for the "continuous underline" feature.
819 *************************************************************************/
821 class SwUnderlineFont
823 Point aPos;
824 SwFont* pFnt;
826 public:
827 // sets the font which should paint the common baseline
828 // and the starting point of the common baseline
829 SwUnderlineFont( SwFont& rFnt, const Point& rPoint );
830 ~SwUnderlineFont();
832 SwFont& GetFont()
834 ASSERT( pFnt, "No underline font" )
835 return *pFnt;
837 const Point& GetPos() const { return aPos; }
838 // the x coordinate of the starting point has to be set for each portion
839 void SetPos( const Point& rPoint ) { aPos = rPoint; }
843 /*************************************************************************
844 * class SvStatistics
845 *************************************************************************/
847 #ifdef PRODUCT
848 #define SV_STAT(nWhich)
849 #else
851 class SvStatistics
853 public:
854 USHORT nGetTextSize;
855 USHORT nDrawText;
856 USHORT nGetStretchTextSize;
857 USHORT nDrawStretchText;
858 USHORT nChangeFont;
859 USHORT nGetFontMetric;
861 inline void Reset()
863 nGetTextSize = nDrawText = nGetStretchTextSize =
864 nDrawStretchText = nChangeFont = nGetFontMetric = 0;
867 inline SvStatistics() { Reset(); }
869 inline void PrintOn( SvStream &rOS ) const; //$ ostream
870 inline BOOL IsEmpty() const
872 return !( nGetTextSize || nDrawText ||
873 nDrawStretchText || nChangeFont || nGetFontMetric );
877 // globale Variable, implementiert in swfont.cxx
878 extern SvStatistics aSvStat;
880 #define SV_STAT(nWhich) ++(aSvStat.nWhich);
882 inline void SvStatistics::PrintOn( SvStream &rOS ) const //$ ostream
884 if( IsEmpty() )
885 return;
887 rOS << "{ SV called:" << '\n';
888 if( nGetTextSize )
889 rOS << "\tnGetTextSize: " << nGetTextSize << '\n'; if( nDrawText )
890 rOS << "\tnDrawText: " << nDrawText << '\n'; if( nGetStretchTextSize )
891 rOS << "\tnGetStretchTextSize: " << nGetStretchTextSize << '\n'; if( nDrawStretchText )
892 rOS << "\tnDrawStretchText: " << nDrawStretchText << '\n'; if( nChangeFont )
893 rOS << "\tnChangeFont: " << nChangeFont << '\n'; if( nGetFontMetric )
894 rOS << "\tnGetFontMetric: " << nGetFontMetric << '\n'; rOS << "}" << '\n'; }
895 #endif /* PRODUCT */
897 #endif