1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19 #ifndef INCLUDED_SW_SOURCE_CORE_INC_SWFONT_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_SWFONT_HXX
21
22 #include <memory>
23 #include <i18nlangtag/lang.h>
24 #include <tools/color.hxx>
25 #include <tools/gen.hxx>
26 #include <svl/poolitem.hxx>
27 #include <editeng/svxfont.hxx>
28 #include <swtypes.hxx>
29 #include "drawfont.hxx"
30 #include <editeng/borderline.hxx>
31 #include <optional>
32 #include <o3tl/enumarray.hxx>
33
34 class SfxItemSet;
35 class SwAttrSet;
36 class SwDoCapitals; // DoCapitals
37 class SwScriptInfo; // GetTextSize_
38 class SwViewShell;
39 class IDocumentSettingAccess;
40 enum class SvxShadowItemSide;
41
42 const sal_Unicode CH_BLANK = ' '; // ' ' blank spaces
43 const sal_Unicode CH_BREAK = 0x0A;
44 const sal_Unicode CH_TAB = '\t'; // \t
45 constexpr OUStringChar CH_PAR = u'\u00B6'; // paragraph
46 const sal_Unicode CH_BULLET = 0xB7; // centered dot
47 const sal_Unicode CH_FULL_BLANK = 0x3000;
48 const sal_Unicode CH_NB_SPACE = 0xA0;
49 const sal_Unicode CH_SIX_PER_EM = 0x2006; // six-per-em space
50
51 Degree10 UnMapDirection( Degree10 nDir, const bool bVertFormat, const bool bVertFormatLRBT );
52
53 class SwSubFont final : public SvxFont
54 {
55 friend class SwFont;
56 const void* m_nFontCacheId; // "MagicNumber" within the font cache
57 Size m_aSize; // foreigners only see this size
58 sal_uInt16 m_nFontIndex; // index in the font cache
59 sal_uInt16 m_nOrgHeight; // height including escapement/proportion
60 sal_uInt16 m_nOrgAscent; // ascent including escapement/proportion
61 sal_uInt16 m_nProportionalWidth; // proportional width
62 bool m_bSmallCapsPercentage66;
63
64 sal_uInt16 CalcEscAscent( const sal_uInt16 nOldAscent ) const;
65 sal_uInt16 CalcEscHeight( const sal_uInt16 nOldHeight,
66 const sal_uInt16 nOldAscent ) const;
67 void CalcEsc( SwDrawTextInfo const & rInf, Point& rPos );
68
69 short CheckKerning_( );
70
71 bool ChgFnt( SwViewShell const *pSh, OutputDevice& rOut );
72 bool IsSymbol( SwViewShell const *pSh );
73 sal_uInt16 GetAscent( SwViewShell const *pSh, const OutputDevice& rOut );
74 sal_uInt16 GetHeight( SwViewShell const *pSh, const OutputDevice& rOut );
75 Size GetTextSize_( SwDrawTextInfo& rInf );
76 Size GetCapitalSize( SwDrawTextInfo& rInf );
77 void DrawText_( SwDrawTextInfo &rInf, const bool bGrey );
78 void DrawCapital( SwDrawTextInfo &rInf );
79 void DrawStretchCapital( SwDrawTextInfo &rInf );
80 void DoOnCapitals( SwDoCapitals &rDo );
81 void DrawStretchText_( SwDrawTextInfo &rInf );
82 TextFrameIndex GetModelPositionForViewPoint_( SwDrawTextInfo& rInf );
83 TextFrameIndex GetCapitalCursorOfst( SwDrawTextInfo& rInf );
84
85 inline void SetColor( const Color& rColor );
86 inline void SetFillColor( const Color& rColor );
87 inline void SetCharSet( const rtl_TextEncoding eCharSet );
88 inline void SetPitch( const FontPitch ePitch );
89 inline void SetAlign( const FontAlign eAlign );
90 inline void SetUnderline( const FontLineStyle eUnderline );
91 inline void SetOverline( const FontLineStyle eOverline );
92 inline void SetStrikeout( const FontStrikeout eStrikeout );
93 inline void SetItalic( const FontItalic eItalic );
94 inline void SetOutline( const bool bOutline );
95 inline void SetVertical( const Degree10 nDir, const bool bVertFormat );
96 inline void SetShadow( const bool bShadow );
97 inline void SetAutoKern( FontKerning nAutoKern );
98 inline void SetWordLineMode( const bool bWordLineMode );
99 inline void SetEmphasisMark( const FontEmphasisMark eValue );
100 inline void SetRelief( const FontRelief eNew );
101
102 // methods for sub-/superscript
103 inline void SetEscapement( const short nNewEsc );
104 inline void SetProportion( const sal_uInt8 nNewPropr );
105
106 inline void SetFamily( const FontFamily eFamily );
107 inline void SetName( const OUString& rName );
108 inline void SetStyleName( const OUString& rStyleName );
109 inline void SetSize( const Size& rSize );
110 inline void SetWeight( const FontWeight eWeight );
111 inline void SetLanguage( LanguageType eNewLang );
CheckKerning()112 short CheckKerning()
113 { return GetFixKerning() >= 0 ? GetFixKerning() : CheckKerning_( ); }
SetPropWidth(const sal_uInt16 nNew)114 void SetPropWidth( const sal_uInt16 nNew )
115 { m_nFontCacheId = nullptr; m_nProportionalWidth = nNew; }
116 public:
SwSubFont()117 SwSubFont() : m_aSize(0,0)
118 { m_nFontCacheId = nullptr; m_nFontIndex = m_nOrgHeight = m_nOrgAscent = 0; m_nProportionalWidth =100; m_bSmallCapsPercentage66 = false; }
GetPropWidth() const119 sal_uInt16 GetPropWidth() const { return m_nProportionalWidth; }
120 };
121
122 enum class SwFontScript
123 {
124 Latin, CJK, CTL, LAST = CTL
125 };
126
127 // mostly used as a "unknown script" marker
128 #define SW_SCRIPTS (SwFontScript(int(SwFontScript::LAST)+1))
129
130 class SwFont
131 {
132 // CJK == Chinese, Japanese, Korean
133 // CTL == Complex text layout ( Hebrew, Arabic )
134 o3tl::enumarray<SwFontScript, SwSubFont> m_aSub; // Latin-, CJK- and CTL-font
135
136 std::optional<Color>
137 mxBackColor; // background color (i.e. at character styles)
138 Color m_aHighlightColor; // highlight color
139 Color m_aUnderColor; // color of the underlining
140 Color m_aOverColor; // color of the overlining
141
142 // character borders
143 std::optional<editeng::SvxBorderLine> m_aTopBorder;
144 std::optional<editeng::SvxBorderLine> m_aBottomBorder;
145 std::optional<editeng::SvxBorderLine> m_aRightBorder;
146 std::optional<editeng::SvxBorderLine> m_aLeftBorder;
147
148 // border distance
149 sal_uInt16 m_nTopBorderDist;
150 sal_uInt16 m_nBottomBorderDist;
151 sal_uInt16 m_nRightBorderDist;
152 sal_uInt16 m_nLeftBorderDist;
153
154 Color m_aShadowColor;
155 sal_uInt16 m_nShadowWidth;
156 SvxShadowLocation m_aShadowLocation;
157
158 sal_uInt8 m_nToxCount; // counts the nesting depth of the Tox
159 sal_uInt8 m_nRefCount; // counts the nesting depth of the Refs
160 sal_uInt8 m_nMetaCount; // count META/METAFIELD
161 sal_uInt8 m_nInputFieldCount; // count INPUTFIELD
162
163 SwFontScript m_nActual; // actual font (Latin, CJK or CTL)
164
165 // switch for the font-extensions
166 bool m_bPaintBlank :1; // blanks not with DrawRect
167 bool m_bFontChg :1;
168 bool m_bOrgChg :1; // nOrgHeight/Ascent are invalid
169 bool m_bGreyWave :1; // for the extended TextInput: gray waveline
170
171 public:
172 SwFont( const SwAttrSet* pSet, const IDocumentSettingAccess* pIDocumentSettingAccess );
173 SwFont( const SwFont& rFont );
174
ChgFnt(SwViewShell const * pSh,OutputDevice & rOut)175 void ChgFnt( SwViewShell const *pSh, OutputDevice& rOut )
176 { m_bPaintBlank = m_aSub[m_nActual].ChgFnt( pSh, rOut ); }
177
178 ~SwFont();
179
180 SwFont& operator=( const SwFont &rFont );
181
GetActual() const182 SwFontScript GetActual() const { return m_nActual; }
183 inline void SetActual( SwFontScript nNew );
GetActualFont() const184 const SvxFont& GetActualFont() const { return m_aSub[m_nActual]; }
185
186 // gets a font cache id via SwFntAccess
187 void AllocFontCacheId( SwViewShell const *pSh, SwFontScript nWhich );
188 // set background color
189 void SetBackColor( std::optional<Color> xNewColor );
GetBackColor() const190 const std::optional<Color>& GetBackColor() const{ return mxBackColor; }
191 void SetHighlightColor( const Color& aNewColor );
GetHighlightColor() const192 const Color& GetHighlightColor() const { return m_aHighlightColor; }
193
CheckFontCacheId(SwViewShell const * pSh,SwFontScript nWhich)194 void CheckFontCacheId( SwViewShell const *pSh, SwFontScript nWhich )
195 { if( !m_aSub[ nWhich ].m_nFontCacheId ) AllocFontCacheId( pSh, nWhich ); }
GetFontCacheId(const void * & rnFontCacheId,sal_uInt16 & rIdx,SwFontScript nWhich)196 void GetFontCacheId( const void* &rnFontCacheId, sal_uInt16 &rIdx, SwFontScript nWhich )
197 { rnFontCacheId = m_aSub[nWhich].m_nFontCacheId; rIdx = m_aSub[nWhich].m_nFontIndex; }
SetFontCacheId(const void * nNewFontCacheId,const sal_uInt16 nIdx,SwFontScript nWhich)198 void SetFontCacheId( const void* nNewFontCacheId, const sal_uInt16 nIdx, SwFontScript nWhich )
199 { m_aSub[nWhich].m_nFontCacheId = nNewFontCacheId; m_aSub[nWhich].m_nFontIndex = nIdx; }
DifferentFontCacheId(const SwFont * pFnt,SwFontScript nWhich)200 bool DifferentFontCacheId( const SwFont* pFnt, SwFontScript nWhich )
201 { return m_aSub[nWhich].m_nFontCacheId != pFnt->m_aSub[nWhich].m_nFontCacheId ||
202 !m_aSub[nWhich].m_nFontCacheId || !pFnt->m_aSub[nWhich].m_nFontCacheId; }
203
GetSize(SwFontScript nWhich) const204 const Size &GetSize( SwFontScript nWhich ) const
205 { return m_aSub[nWhich].m_aSize; }
IsFntChg() const206 bool IsFntChg() const { return m_bFontChg; }
SetFntChg(const bool bNew)207 void SetFntChg( const bool bNew ) { m_bFontChg = bNew; }
208
209 // the encapsulated SV-Font-methods (set bFntChg to true)
210 inline void SetColor( const Color& rColor );
211 inline void SetFillColor( const Color& rColor );
212 inline void SetAlign( const FontAlign eAlign );
213 inline void SetUnderline( const FontLineStyle eUnderline );
SetUnderColor(const Color & rColor)214 void SetUnderColor( const Color &rColor ) { m_aUnderColor = rColor; }
215 inline void SetOverline( const FontLineStyle eOverline );
SetOverColor(const Color & rColor)216 void SetOverColor( const Color &rColor ) { m_aOverColor = rColor; }
217 inline void SetStrikeout( const FontStrikeout eStrikeout );
218 inline void SetOutline( const bool bOutline );
219 void SetVertical(Degree10 nDir, const bool bVertLayout = false,
220 const bool bVertLayoutLRBT = false);
221 inline void SetShadow( const bool bShadow );
222 inline void SetAutoKern( FontKerning nAutoKern );
223 inline void SetTransparent( const bool bTrans );
224 inline void SetWordLineMode( const bool bWordLineMode );
225 inline void SetFixKerning( const short nNewKern );
226 inline void SetCaseMap( const SvxCaseMap eNew );
227 inline void SetEmphasisMark( const FontEmphasisMark eValue );
228
229 // methods for sub-/superscript
230 inline void SetEscapement( const short nNewEsc );
231 inline void SetProportion( const sal_uInt8 nNewPropr );
232
233 inline void SetPropWidth( const sal_uInt16 nNew );
234
235 inline void SetFamily( const FontFamily eFamily, const SwFontScript nWhich );
236 inline void SetName( const OUString& rName, const SwFontScript nWhich );
237 inline void SetStyleName( const OUString& rStyleName, const SwFontScript nWhich );
238 inline void SetSize( const Size& rSize, const SwFontScript nWhich );
239 inline void SetWeight( const FontWeight eWeight, const SwFontScript nWhich );
240 inline void SetItalic( const FontItalic eItalic, const SwFontScript nWhich );
241 inline void SetLanguage( LanguageType eNewLang, const SwFontScript nWhich );
242 inline void SetCharSet( const rtl_TextEncoding eCharSet, const SwFontScript nWhich );
243 inline void SetPitch( const FontPitch ePitch, const SwFontScript nWhich );
244 inline void SetRelief( const FontRelief eNew );
245
246 // Get/Set-methods for the current setting
GetTox()247 sal_uInt8 &GetTox() { return m_nToxCount; }
IsTox() const248 bool IsTox() const { return ( 0 != m_nToxCount ); }
GetRef()249 sal_uInt8 &GetRef() { return m_nRefCount; }
IsRef() const250 bool IsRef() const { return ( 0 != m_nRefCount ); }
GetMeta()251 sal_uInt8 &GetMeta() { return m_nMetaCount; }
IsMeta() const252 bool IsMeta() const { return (0 != m_nMetaCount); }
GetInputField()253 sal_uInt8 &GetInputField() { return m_nInputFieldCount; }
IsInputField() const254 bool IsInputField() const { return (0 != m_nInputFieldCount); }
255 inline void SetGreyWave( const bool bNew );
IsGreyWave() const256 bool IsGreyWave() const { return m_bGreyWave; }
IsPaintBlank() const257 bool IsPaintBlank() const { return m_bPaintBlank; }
258
259 // setting of the base class font for SwTextCharFormat
260 void SetDiffFnt( const SfxItemSet* pSet,
261 const IDocumentSettingAccess* pIDocumentSettingAccess );
262
GetFnt(const SwFontScript nWhich) const263 const SvxFont &GetFnt( const SwFontScript nWhich ) const
264 { return m_aSub[nWhich]; };
265
IsSymbol(SwViewShell const * pSh)266 bool IsSymbol( SwViewShell const *pSh )
267 { return m_aSub[m_nActual].IsSymbol( pSh ); }
GetUnderline() const268 FontLineStyle GetUnderline() const { return m_aSub[m_nActual].GetUnderline(); }
GetUnderColor() const269 const Color& GetUnderColor() const { return m_aUnderColor; }
GetOverline() const270 FontLineStyle GetOverline() const { return m_aSub[m_nActual].GetOverline(); }
GetOverColor() const271 const Color& GetOverColor() const { return m_aOverColor; }
GetStrikeout() const272 FontStrikeout GetStrikeout() const { return m_aSub[m_nActual].GetStrikeout(); }
GetColor() const273 const Color& GetColor() const { return m_aSub[m_nActual].GetColor(); }
IsWordLineMode() const274 bool IsWordLineMode() const { return m_aSub[m_nActual].IsWordLineMode(); }
GetEscapement() const275 short GetEscapement() const { return m_aSub[m_nActual].GetEscapement(); }
GetCaseMap() const276 SvxCaseMap GetCaseMap() const { return m_aSub[m_nActual].GetCaseMap(); }
GetPropr() const277 sal_uInt8 GetPropr() const { return m_aSub[m_nActual].GetPropr(); }
GetItalic() const278 FontItalic GetItalic() const { return m_aSub[m_nActual].GetItalic(); }
GetLanguage() const279 LanguageType GetLanguage() const { return m_aSub[m_nActual].GetLanguage(); }
GetHeight() const280 tools::Long GetHeight() const { return m_aSub[m_nActual].GetFontSize().Height(); }
GetWeight() const281 FontWeight GetWeight() const { return m_aSub[m_nActual].GetWeight(); }
GetEmphasisMark() const282 FontEmphasisMark GetEmphasisMark() const
283 { return m_aSub[m_nActual].GetEmphasisMark(); }
284 Degree10 GetOrientation(const bool bVertLayout = false,
285 const bool bVertFormatLRBT = false) const;
286
GetName(const SwFontScript nWhich) const287 const OUString& GetName( const SwFontScript nWhich ) const
288 { return m_aSub[nWhich].GetFamilyName(); }
GetLanguage(const SwFontScript nWhich) const289 LanguageType GetLanguage( const SwFontScript nWhich ) const
290 { return m_aSub[nWhich].GetLanguage(); }
GetCharSet(const SwFontScript nWhich) const291 rtl_TextEncoding GetCharSet( const SwFontScript nWhich ) const
292 { return m_aSub[nWhich].GetCharSet(); }
GetHeight(const SwFontScript nWhich) const293 tools::Long GetHeight( const SwFontScript nWhich ) const
294 { return m_aSub[nWhich].GetFontSize().Height(); }
295
296 // makes the logical font be effective in the OutputDevice
297 void ChgPhysFnt( SwViewShell const *pSh, OutputDevice& rOut );
298
299 TextFrameIndex GetCapitalBreak( SwViewShell const* pSh, const OutputDevice* pOut,
300 const SwScriptInfo* pScript, const OUString& rText,
301 tools::Long nTextWidth, TextFrameIndex nIdx, TextFrameIndex nLen);
302
DoOnCapitals(SwDoCapitals & rDo)303 void DoOnCapitals( SwDoCapitals &rDo )
304 { m_aSub[m_nActual].DoOnCapitals( rDo ); }
305
GetTextSize_(SwDrawTextInfo & rInf)306 Size GetTextSize_( SwDrawTextInfo& rInf )
307 { rInf.SetFont( this ); return m_aSub[m_nActual].GetTextSize_( rInf ); }
308
309 TextFrameIndex GetTextBreak( SwDrawTextInfo const & rInf, tools::Long nTextWidth );
310
GetModelPositionForViewPoint_(SwDrawTextInfo & rInf)311 TextFrameIndex GetModelPositionForViewPoint_( SwDrawTextInfo& rInf )
312 { return m_aSub[m_nActual].GetModelPositionForViewPoint_( rInf ); }
313
DrawText_(SwDrawTextInfo & rInf)314 void DrawText_( SwDrawTextInfo &rInf )
315 { m_aSub[m_nActual].DrawText_( rInf, IsGreyWave() ); }
316
DrawStretchText_(SwDrawTextInfo & rInf)317 void DrawStretchText_( SwDrawTextInfo &rInf )
318 { m_aSub[m_nActual].DrawStretchText_( rInf ); }
319
CheckKerning()320 short CheckKerning()
321 { return m_aSub[m_nActual].CheckKerning(); }
322
GetAscent(SwViewShell const * pSh,const OutputDevice & rOut)323 sal_uInt16 GetAscent( SwViewShell const *pSh, const OutputDevice& rOut )
324 { return m_aSub[m_nActual].GetAscent( pSh, rOut ); }
GetHeight(SwViewShell const * pSh,const OutputDevice & rOut)325 sal_uInt16 GetHeight( SwViewShell const *pSh, const OutputDevice& rOut )
326 { return m_aSub[m_nActual].GetHeight( pSh, rOut ); }
327
Invalidate()328 void Invalidate()
329 { m_bFontChg = m_bOrgChg = true; }
330
331 void SetTopBorder( const editeng::SvxBorderLine* pTopBorder );
332 void SetBottomBorder( const editeng::SvxBorderLine* pBottomBorder );
333 void SetRightBorder( const editeng::SvxBorderLine* pRightBorder );
334 void SetLeftBorder( const editeng::SvxBorderLine* pLeftBorder );
335
GetTopBorder() const336 const std::optional<editeng::SvxBorderLine>& GetTopBorder() const { return m_aTopBorder; }
GetBottomBorder() const337 const std::optional<editeng::SvxBorderLine>& GetBottomBorder() const { return m_aBottomBorder; }
GetRightBorder() const338 const std::optional<editeng::SvxBorderLine>& GetRightBorder() const { return m_aRightBorder; }
GetLeftBorder() const339 const std::optional<editeng::SvxBorderLine>& GetLeftBorder() const { return m_aLeftBorder; }
340
341 // Get absolute border correspond to the layout verticality and orientation.
342 const std::optional<editeng::SvxBorderLine>&
343 GetAbsTopBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const;
344 const std::optional<editeng::SvxBorderLine>&
345 GetAbsBottomBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const;
346 const std::optional<editeng::SvxBorderLine>&
347 GetAbsRightBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const;
348 const std::optional<editeng::SvxBorderLine>&
349 GetAbsLeftBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const;
350
351 void SetTopBorderDist( const sal_uInt16 nTopDist );
352 void SetBottomBorderDist( const sal_uInt16 nBottomDist );
353 void SetRightBorderDist( const sal_uInt16 nRightDist );
354 void SetLeftBorderDist( const sal_uInt16 nLeftDist );
355
GetTopBorderDist() const356 sal_uInt16 GetTopBorderDist() const { return m_nTopBorderDist; }
GetBottomBorderDist() const357 sal_uInt16 GetBottomBorderDist() const { return m_nBottomBorderDist; }
GetRightBorderDist() const358 sal_uInt16 GetRightBorderDist() const { return m_nRightBorderDist; }
GetLeftBorderDist() const359 sal_uInt16 GetLeftBorderDist() const { return m_nLeftBorderDist; }
360
361 // Return with the whole space which border holed (border width, spacing and shadow width)
362 sal_uInt16 GetTopBorderSpace() const;
363 sal_uInt16 GetBottomBorderSpace() const;
364 sal_uInt16 GetRightBorderSpace() const;
365 sal_uInt16 GetLeftBorderSpace() const;
366
367 /// Check whether font has any border on any side
368 bool HasBorder() const;
369
370 void SetShadowColor( const Color& rColor );
371 void SetShadowWidth( const sal_uInt16 nWidth );
372 void SetShadowLocation( const SvxShadowLocation aLocation );
373
GetShadowColor() const374 const Color& GetShadowColor() const { return m_aShadowColor; }
GetShadowWidth() const375 sal_uInt16 GetShadowWidth() const { return m_nShadowWidth; }
GetShadowLocation() const376 SvxShadowLocation GetShadowLocation() const { return m_aShadowLocation; }
377
378 /**
379 * Get the absolute shadow location dependent from orientation.
380 *
381 * @param[in] bVertLayout true, if the container layout is vertical
382 * false, otherwise
383 * @param[in] bVertLayoutLRBT true if the container layout is vertical
384 * (bottom to top, left to right), false otherwise
385 * @return absolute location
386 **/
387 SvxShadowLocation GetAbsShadowLocation(const bool bVertLayout,
388 const bool bVertLayoutLRBT) const;
389
390 /**
391 * Calculate the shadow space on the specified side dependent from
392 * the orientation and connection with neighbours.
393 * @see shaditem.hxx for integer constants of sides
394 *
395 * @param[in] nShadow specify the side
396 * @param[in] bVertLayout true, if the container layout is vertical
397 * false, otherwise
398 * @param[in] bVertLayoutLRBT true if the container layout is vertical
399 * (bottom to top, left to right), false otherwise
400 * @param[in] bSkipLeft relative left shadow space is skipped
401 * @param[in] bSkipRight relative right shadow space is skipped
402 * @return the shadow space
403 **/
404 sal_uInt16 CalcShadowSpace(
405 const SvxShadowItemSide nShadow, const bool bVertLayout, const bool bVertLayoutLRBT,
406 const bool bSkipLeft, const bool bSkipRight ) const;
407
408 void dumpAsXml( xmlTextWriterPtr writer ) const;
409 };
410
SetColor(const Color & rColor)411 inline void SwFont::SetColor( const Color& rColor )
412 {
413 m_bFontChg = true;
414 m_aSub[SwFontScript::Latin].SetColor( rColor );
415 m_aSub[SwFontScript::CJK].SetColor( rColor );
416 m_aSub[SwFontScript::CTL].SetColor( rColor );
417 }
418
419 // encapsulated SV-Font-method
SetColor(const Color & rColor)420 inline void SwSubFont::SetColor( const Color& rColor )
421 {
422 m_nFontCacheId = nullptr;
423 Font::SetColor( rColor );
424 }
425
426 // encapsulated SV-Font-method
SetFillColor(const Color & rColor)427 inline void SwSubFont::SetFillColor( const Color& rColor )
428 {
429 m_nFontCacheId = nullptr;
430 Font::SetFillColor( rColor );
431 }
432
SetFillColor(const Color & rColor)433 inline void SwFont::SetFillColor( const Color& rColor )
434 {
435 m_bFontChg = true;
436 m_aSub[SwFontScript::Latin].SetFillColor( rColor );
437 m_aSub[SwFontScript::CJK].SetFillColor( rColor );
438 m_aSub[SwFontScript::CTL].SetFillColor( rColor );
439 }
440
441 // encapsulated SV-Font-method
SetFamily(const FontFamily eFamily)442 inline void SwSubFont::SetFamily( const FontFamily eFamily )
443 {
444 m_nFontCacheId = nullptr;
445 Font::SetFamily( eFamily );
446 }
447
SetFamily(const FontFamily eFamily,const SwFontScript nWhich)448 inline void SwFont::SetFamily( const FontFamily eFamily, const SwFontScript nWhich )
449 {
450 m_bFontChg = true;
451 m_aSub[nWhich].SetFamily( eFamily );
452 }
453
454 // encapsulated SV-Font-method
SetName(const OUString & rName)455 inline void SwSubFont::SetName( const OUString& rName )
456 {
457 m_nFontCacheId = nullptr;
458 Font::SetFamilyName( rName );
459 }
460
SetName(const OUString & rName,const SwFontScript nWhich)461 inline void SwFont::SetName( const OUString& rName, const SwFontScript nWhich )
462 {
463 m_bFontChg = true;
464 m_aSub[nWhich].SetName( rName );
465 }
466
467 // encapsulated SV-Font-method
SetStyleName(const OUString & rStyleName)468 inline void SwSubFont::SetStyleName( const OUString& rStyleName )
469 {
470 m_nFontCacheId = nullptr;
471 Font::SetStyleName( rStyleName );
472 }
473
SetStyleName(const OUString & rStyle,const SwFontScript nWhich)474 inline void SwFont::SetStyleName( const OUString& rStyle, const SwFontScript nWhich )
475 {
476 m_bFontChg = true;
477 m_aSub[nWhich].SetStyleName( rStyle );
478 }
479
480 // encapsulated SV-Font-method
SetCharSet(const rtl_TextEncoding eCharSet)481 inline void SwSubFont::SetCharSet( const rtl_TextEncoding eCharSet )
482 {
483 m_nFontCacheId = nullptr;
484 Font::SetCharSet( eCharSet );
485 }
486
SetCharSet(const rtl_TextEncoding eCharSet,const SwFontScript nWhich)487 inline void SwFont::SetCharSet( const rtl_TextEncoding eCharSet, const SwFontScript nWhich )
488 {
489 m_bFontChg = true;
490 m_aSub[nWhich].SetCharSet( eCharSet );
491 }
492
493 // encapsulated SV-Font-method
SetPitch(const FontPitch ePitch)494 inline void SwSubFont::SetPitch( const FontPitch ePitch )
495 {
496 m_nFontCacheId = nullptr;
497 Font::SetPitch( ePitch );
498 }
499
500 // encapsulated SV-Font-method
SetPitch(const FontPitch ePitch,const SwFontScript nWhich)501 inline void SwFont::SetPitch( const FontPitch ePitch, const SwFontScript nWhich )
502 {
503 m_bFontChg = true;
504 m_aSub[nWhich].SetPitch( ePitch );
505 }
506
507 // encapsulated SV-Font-method
SetAlign(const FontAlign eAlign)508 inline void SwSubFont::SetAlign( const FontAlign eAlign )
509 {
510 m_nFontCacheId = nullptr;
511 Font::SetAlignment( eAlign );
512 }
513
SetAlign(const FontAlign eAlign)514 inline void SwFont::SetAlign( const FontAlign eAlign )
515 {
516 m_bFontChg = true;
517 m_aSub[SwFontScript::Latin].SetAlign( eAlign );
518 m_aSub[SwFontScript::CJK].SetAlign( eAlign );
519 m_aSub[SwFontScript::CTL].SetAlign( eAlign );
520 }
521
522 // encapsulated SV-Font-method
SetWeight(const FontWeight eWeight)523 inline void SwSubFont::SetWeight( const FontWeight eWeight )
524 {
525 m_nFontCacheId = nullptr;
526 Font::SetWeight( eWeight );
527 }
528
SetWeight(const FontWeight eWeight,const SwFontScript nWhich)529 inline void SwFont::SetWeight( const FontWeight eWeight, const SwFontScript nWhich )
530 {
531 m_bFontChg = true;
532 m_aSub[nWhich].SetWeight( eWeight );
533 }
534
535 // encapsulated SV-Font-method
SetUnderline(const FontLineStyle eUnderline)536 inline void SwSubFont::SetUnderline( const FontLineStyle eUnderline )
537 {
538 m_nFontCacheId = nullptr;
539 Font::SetUnderline( eUnderline );
540 }
541
SetUnderline(const FontLineStyle eUnderline)542 inline void SwFont::SetUnderline( const FontLineStyle eUnderline )
543 {
544 m_bFontChg = true;
545 m_aSub[SwFontScript::Latin].SetUnderline( eUnderline );
546 m_aSub[SwFontScript::CJK].SetUnderline( eUnderline );
547 m_aSub[SwFontScript::CTL].SetUnderline( eUnderline );
548 }
549
550 // encapsulated SV-Font-method
SetOverline(const FontLineStyle eOverline)551 inline void SwSubFont::SetOverline( const FontLineStyle eOverline )
552 {
553 m_nFontCacheId = nullptr;
554 Font::SetOverline( eOverline );
555 }
556
SetOverline(const FontLineStyle eOverline)557 inline void SwFont::SetOverline( const FontLineStyle eOverline )
558 {
559 m_bFontChg = true;
560 m_aSub[SwFontScript::Latin].SetOverline( eOverline );
561 m_aSub[SwFontScript::CJK].SetOverline( eOverline );
562 m_aSub[SwFontScript::CTL].SetOverline( eOverline );
563 }
564
565 // encapsulated SV-Font-method
SetStrikeout(const FontStrikeout eStrikeout)566 inline void SwSubFont::SetStrikeout( const FontStrikeout eStrikeout )
567 {
568 m_nFontCacheId = nullptr;
569 Font::SetStrikeout( eStrikeout );
570 }
571
SetStrikeout(const FontStrikeout eStrikeout)572 inline void SwFont::SetStrikeout( const FontStrikeout eStrikeout )
573 {
574 m_bFontChg = true;
575 m_aSub[SwFontScript::Latin].SetStrikeout( eStrikeout );
576 m_aSub[SwFontScript::CJK].SetStrikeout( eStrikeout );
577 m_aSub[SwFontScript::CTL].SetStrikeout( eStrikeout );
578 }
579
580 // encapsulated SV-Font-method
SetItalic(const FontItalic eItalic)581 inline void SwSubFont::SetItalic( const FontItalic eItalic )
582 {
583 m_nFontCacheId = nullptr;
584 Font::SetItalic( eItalic );
585 }
586
SetItalic(const FontItalic eItalic,const SwFontScript nWhich)587 inline void SwFont::SetItalic( const FontItalic eItalic, const SwFontScript nWhich )
588 {
589 m_bFontChg = true;
590 m_aSub[nWhich].SetItalic( eItalic );
591 }
592
593 // encapsulated SV-Font-method
SetOutline(const bool bOutline)594 inline void SwSubFont::SetOutline( const bool bOutline )
595 {
596 m_nFontCacheId = nullptr;
597 Font::SetOutline( bOutline );
598 }
599
SetOutline(const bool bOutline)600 inline void SwFont::SetOutline( const bool bOutline )
601 {
602 m_bFontChg = true;
603 m_aSub[SwFontScript::Latin].SetOutline( bOutline );
604 m_aSub[SwFontScript::CJK].SetOutline( bOutline );
605 m_aSub[SwFontScript::CTL].SetOutline( bOutline );
606 }
607
608 // encapsulated SV-Font-method
SetShadow(const bool bShadow)609 inline void SwSubFont::SetShadow( const bool bShadow )
610 {
611 m_nFontCacheId = nullptr;
612 Font::SetShadow( bShadow );
613 }
614
SetShadow(const bool bShadow)615 inline void SwFont::SetShadow( const bool bShadow )
616 {
617 m_bFontChg = true;
618 m_aSub[SwFontScript::Latin].SetShadow( bShadow );
619 m_aSub[SwFontScript::CJK].SetShadow( bShadow );
620 m_aSub[SwFontScript::CTL].SetShadow( bShadow );
621 }
622
623 // encapsulated SV-Font-method
SetAutoKern(FontKerning nAutoKern)624 inline void SwSubFont::SetAutoKern( FontKerning nAutoKern )
625 {
626 m_nFontCacheId = nullptr;
627 Font::SetKerning( nAutoKern );
628 }
629
SetAutoKern(FontKerning nAutoKern)630 inline void SwFont::SetAutoKern( FontKerning nAutoKern )
631 {
632 m_bFontChg = true;
633 m_aSub[SwFontScript::CJK].SetAutoKern( nAutoKern );
634 if( nAutoKern != FontKerning::NONE )
635 nAutoKern = FontKerning::FontSpecific;
636 m_aSub[SwFontScript::Latin].SetAutoKern( nAutoKern );
637 m_aSub[SwFontScript::CTL].SetAutoKern( nAutoKern );
638 }
639
SetTransparent(const bool bTrans)640 inline void SwFont::SetTransparent( const bool bTrans )
641 {
642 m_aSub[SwFontScript::Latin].SetTransparent( bTrans );
643 m_aSub[SwFontScript::CJK].SetTransparent( bTrans );
644 m_aSub[SwFontScript::CTL].SetTransparent( bTrans );
645 }
646
SetFixKerning(const short nNewKern)647 inline void SwFont::SetFixKerning( const short nNewKern )
648 {
649 m_aSub[SwFontScript::Latin].SetFixKerning( nNewKern );
650 m_aSub[SwFontScript::CJK].SetFixKerning( nNewKern );
651 m_aSub[SwFontScript::CTL].SetFixKerning( nNewKern );
652 }
653
SetCaseMap(const SvxCaseMap eNew)654 inline void SwFont::SetCaseMap( const SvxCaseMap eNew )
655 {
656 m_aSub[SwFontScript::Latin].SetCaseMap( eNew );
657 m_aSub[SwFontScript::CJK].SetCaseMap( eNew );
658 m_aSub[SwFontScript::CTL].SetCaseMap( eNew );
659 }
660
661 // encapsulated SV-Font-method
SetWordLineMode(const bool bWordLineMode)662 inline void SwSubFont::SetWordLineMode( const bool bWordLineMode )
663 {
664 m_nFontCacheId = nullptr;
665 Font::SetWordLineMode( bWordLineMode );
666 }
667
SetWordLineMode(const bool bWordLineMode)668 inline void SwFont::SetWordLineMode( const bool bWordLineMode )
669 {
670 m_bFontChg = true;
671 m_aSub[SwFontScript::Latin].SetWordLineMode( bWordLineMode );
672 m_aSub[SwFontScript::CJK].SetWordLineMode( bWordLineMode );
673 m_aSub[SwFontScript::CTL].SetWordLineMode( bWordLineMode );
674 }
675 // encapsulated SV-Font-method
SetEmphasisMark(const FontEmphasisMark eValue)676 inline void SwSubFont::SetEmphasisMark( const FontEmphasisMark eValue )
677 {
678 m_nFontCacheId = nullptr;
679 Font::SetEmphasisMark( eValue );
680 }
681
SetEmphasisMark(const FontEmphasisMark eValue)682 inline void SwFont::SetEmphasisMark( const FontEmphasisMark eValue )
683 {
684 m_bFontChg = true;
685 m_aSub[SwFontScript::Latin].SetEmphasisMark( eValue );
686 m_aSub[SwFontScript::CJK].SetEmphasisMark( eValue );
687 m_aSub[SwFontScript::CTL].SetEmphasisMark( eValue );
688 }
689
SetPropWidth(const sal_uInt16 nNew)690 inline void SwFont::SetPropWidth( const sal_uInt16 nNew )
691 {
692 if( nNew != m_aSub[SwFontScript::Latin].GetPropWidth() )
693 {
694 m_bFontChg = true;
695 m_aSub[SwFontScript::Latin].SetPropWidth( nNew );
696 m_aSub[SwFontScript::CJK].SetPropWidth( nNew );
697 m_aSub[SwFontScript::CTL].SetPropWidth( nNew );
698 }
699 }
700
701 // encapsulated SV-Font-method
SetRelief(const FontRelief eNew)702 inline void SwSubFont::SetRelief( const FontRelief eNew )
703 {
704 m_nFontCacheId = nullptr;
705 Font::SetRelief( eNew );
706 }
707
SetRelief(const FontRelief eNew)708 inline void SwFont::SetRelief( const FontRelief eNew )
709 {
710 if( eNew != m_aSub[SwFontScript::Latin].GetRelief() )
711 {
712 m_bFontChg = true;
713 m_aSub[SwFontScript::Latin].SetRelief( eNew );
714 m_aSub[SwFontScript::CJK].SetRelief( eNew );
715 m_aSub[SwFontScript::CTL].SetRelief( eNew );
716 }
717 }
718
719 // overloaded font-method
SetSize(const Size & rSize)720 inline void SwSubFont::SetSize( const Size& rSize )
721 {
722 m_aSize = rSize;
723 if ( GetPropr() == 100 )
724 Font::SetFontSize( m_aSize );
725 else
726 {
727 Font::SetFontSize( Size(
728 m_aSize.Width() * GetPropr() / 100,
729 m_aSize.Height() * GetPropr() / 100 ) );
730 }
731 m_nFontCacheId = nullptr;
732 }
733
SetSize(const Size & rSize,const SwFontScript nWhich)734 inline void SwFont::SetSize( const Size& rSize, const SwFontScript nWhich )
735 {
736 if( m_aSub[nWhich].m_aSize != rSize )
737 {
738 m_aSub[nWhich].SetSize( rSize );
739 m_bFontChg = true;
740 m_bOrgChg = true;
741 }
742 }
743
SetActual(SwFontScript nNew)744 inline void SwFont::SetActual( SwFontScript nNew )
745 {
746 if ( m_nActual != nNew )
747 {
748 m_bFontChg = true;
749 m_bOrgChg = true;
750 m_nActual = nNew;
751 }
752 }
753
SetProportion(const sal_uInt8 nNewPropr)754 inline void SwSubFont::SetProportion( const sal_uInt8 nNewPropr )
755 {
756 m_nFontCacheId = nullptr;
757 Font::SetFontSize( Size( m_aSize.Width() * nNewPropr / 100,
758 m_aSize.Height() * nNewPropr / 100 ) );
759 SvxFont::SetPropr( nNewPropr );
760 }
761
SetProportion(const sal_uInt8 nNewPropr)762 inline void SwFont::SetProportion( const sal_uInt8 nNewPropr )
763 {
764 if( nNewPropr != m_aSub[SwFontScript::Latin].GetPropr() )
765 {
766 m_bFontChg = true;
767 m_bOrgChg = true;
768
769 m_aSub[SwFontScript::Latin].SetProportion( nNewPropr );
770 m_aSub[SwFontScript::CJK].SetProportion( nNewPropr );
771 m_aSub[SwFontScript::CTL].SetProportion( nNewPropr );
772 }
773 }
774
SetEscapement(const short nNewEsc)775 inline void SwSubFont::SetEscapement( const short nNewEsc )
776 {
777 m_nFontCacheId = nullptr;
778 SvxFont::SetEscapement( nNewEsc );
779 }
780
SetEscapement(const short nNewEsc)781 inline void SwFont::SetEscapement( const short nNewEsc )
782 {
783 if( nNewEsc != m_aSub[SwFontScript::Latin].GetEscapement() )
784 {
785 // these have to be set, otherwise nOrgHeight and nOrgAscent will not
786 // be calculated
787 m_bFontChg = true;
788 m_bOrgChg = true;
789
790 m_aSub[SwFontScript::Latin].SetEscapement( nNewEsc );
791 m_aSub[SwFontScript::CJK].SetEscapement( nNewEsc );
792 m_aSub[SwFontScript::CTL].SetEscapement( nNewEsc );
793 }
794 }
795
SetLanguage(LanguageType eNewLang)796 inline void SwSubFont::SetLanguage( LanguageType eNewLang )
797 {
798 m_nFontCacheId = nullptr;
799 if( eNewLang == LANGUAGE_SYSTEM )
800 eNewLang = GetAppLanguage();
801 SvxFont::SetLanguage( eNewLang );
802 }
803
SetLanguage(const LanguageType eNewLang,const SwFontScript nWhich)804 inline void SwFont::SetLanguage( const LanguageType eNewLang, const SwFontScript nWhich )
805 {
806 m_aSub[nWhich].SetLanguage( eNewLang );
807 if( SwFontScript::CJK == nWhich )
808 {
809 m_aSub[SwFontScript::Latin].SetCJKContextLanguage( eNewLang );
810 m_aSub[SwFontScript::CJK].SetCJKContextLanguage( eNewLang );
811 m_aSub[SwFontScript::CTL].SetCJKContextLanguage( eNewLang );
812 }
813 }
814
SetGreyWave(const bool bNew)815 inline void SwFont::SetGreyWave( const bool bNew )
816 {
817 m_bGreyWave = bNew;
818 }
819
SetVertical(const Degree10 nDir,const bool bVertFormat)820 inline void SwSubFont::SetVertical( const Degree10 nDir, const bool bVertFormat )
821 {
822 m_nFontCacheId = nullptr;
823 Font::SetVertical( bVertFormat );
824 Font::SetOrientation( nDir );
825 }
826
SetTopBorderDist(const sal_uInt16 nTopDist)827 inline void SwFont::SetTopBorderDist( const sal_uInt16 nTopDist )
828 {
829 m_nTopBorderDist = nTopDist;
830 m_bFontChg = true;
831 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
832 }
833
SetBottomBorderDist(const sal_uInt16 nBottomDist)834 inline void SwFont::SetBottomBorderDist( const sal_uInt16 nBottomDist )
835 {
836 m_nBottomBorderDist = nBottomDist;
837 m_bFontChg = true;
838 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
839 }
840
SetRightBorderDist(const sal_uInt16 nRightDist)841 inline void SwFont::SetRightBorderDist( const sal_uInt16 nRightDist )
842 {
843 m_nRightBorderDist = nRightDist;
844 m_bFontChg = true;
845 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
846 }
847
SetLeftBorderDist(const sal_uInt16 nLeftDist)848 inline void SwFont::SetLeftBorderDist( const sal_uInt16 nLeftDist )
849 {
850 m_nLeftBorderDist = nLeftDist;
851 m_bFontChg = true;
852 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
853 }
854
GetTopBorderSpace() const855 inline sal_uInt16 SwFont::GetTopBorderSpace() const
856 {
857 sal_uInt16 nRet = 0;
858 if( m_aTopBorder )
859 {
860 nRet += m_aTopBorder->GetScaledWidth() + m_nTopBorderDist;
861 }
862 if( m_aShadowLocation == SvxShadowLocation::TopLeft ||
863 m_aShadowLocation == SvxShadowLocation::TopRight )
864 {
865 nRet += m_nShadowWidth;
866 }
867 return nRet;
868 }
869
GetBottomBorderSpace() const870 inline sal_uInt16 SwFont::GetBottomBorderSpace() const
871 {
872 sal_uInt16 nRet = 0;
873 if( m_aBottomBorder )
874 {
875 nRet += m_aBottomBorder->GetScaledWidth() + m_nBottomBorderDist;
876 }
877 if( m_aShadowLocation == SvxShadowLocation::BottomLeft ||
878 m_aShadowLocation == SvxShadowLocation::BottomRight )
879 {
880 nRet += m_nShadowWidth;
881 }
882 return nRet;
883 }
884
GetRightBorderSpace() const885 inline sal_uInt16 SwFont::GetRightBorderSpace() const
886 {
887 sal_uInt16 nRet = 0;
888 if( m_aRightBorder )
889 {
890 nRet += m_aRightBorder->GetScaledWidth() + m_nRightBorderDist;
891 }
892 if( m_aShadowLocation == SvxShadowLocation::TopRight ||
893 m_aShadowLocation == SvxShadowLocation::BottomRight )
894 {
895 nRet += m_nShadowWidth;
896 }
897 return nRet;
898 }
899
GetLeftBorderSpace() const900 inline sal_uInt16 SwFont::GetLeftBorderSpace() const
901 {
902 sal_uInt16 nRet = 0;
903 if( m_aLeftBorder )
904 {
905 nRet += m_aLeftBorder->GetScaledWidth() + m_nLeftBorderDist;
906 }
907 if( m_aShadowLocation == SvxShadowLocation::TopLeft ||
908 m_aShadowLocation == SvxShadowLocation::BottomLeft )
909 {
910 nRet += m_nShadowWidth;
911 }
912 return nRet;
913 }
914
HasBorder() const915 inline bool SwFont::HasBorder() const
916 {
917 return m_aTopBorder || m_aBottomBorder || m_aLeftBorder || m_aRightBorder;
918 }
919
SetShadowColor(const Color & rColor)920 inline void SwFont::SetShadowColor( const Color& rColor )
921 {
922 m_aShadowColor = rColor;
923 m_bFontChg = true;
924 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
925 }
926
SetShadowWidth(const sal_uInt16 nWidth)927 inline void SwFont::SetShadowWidth( const sal_uInt16 nWidth )
928 {
929 m_nShadowWidth = nWidth;
930 m_bFontChg = true;
931 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
932 }
933
SetShadowLocation(const SvxShadowLocation aLocation)934 inline void SwFont::SetShadowLocation( const SvxShadowLocation aLocation )
935 {
936 m_aShadowLocation = aLocation;
937 m_bFontChg = true;
938 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
939 }
940
SetHighlightColor(const Color & aNewColor)941 inline void SwFont::SetHighlightColor( const Color& aNewColor )
942 {
943 m_aHighlightColor = aNewColor;
944 m_bFontChg = true;
945 m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
946 }
947
948 // Used for the "continuous underline" feature.
949 class SwUnderlineFont
950 {
951 Point m_aPos;
952 TextFrameIndex m_nEnd;
953 std::unique_ptr<SwFont> m_pFont;
954
955 public:
956 // sets the font which should paint the common baseline,
957 // index where continuous underline ends,
958 // and the starting point of the common baseline
959 SwUnderlineFont(SwFont& rFnt, TextFrameIndex nEnd, const Point& rPoint);
960 ~SwUnderlineFont();
961
GetFont()962 SwFont& GetFont()
963 {
964 OSL_ENSURE( m_pFont, "No underline font" );
965 return *m_pFont;
966 }
GetPos() const967 const Point& GetPos() const { return m_aPos; }
GetEnd() const968 TextFrameIndex GetEnd() const { return m_nEnd; }
969 // the x coordinate of the starting point has to be set for each portion
SetPos(const Point & rPoint)970 void SetPos( const Point& rPoint ) { m_aPos = rPoint; }
971 };
972
973 #ifdef DBG_UTIL
974
975 class SvStatistics
976 {
977 public:
978 sal_uInt16 nGetTextSize;
979 sal_uInt16 nDrawText;
980 sal_uInt16 nGetStretchTextSize;
981 sal_uInt16 nDrawStretchText;
982 sal_uInt16 nChangeFont;
983
SvStatistics()984 SvStatistics()
985 { nGetTextSize = nDrawText = nGetStretchTextSize = nDrawStretchText = nChangeFont = 0; }
986 };
987
988 // global variable, implemented in swfont.cxx
989 extern SvStatistics g_SvStat;
990
991 #define SV_STAT(nWhich) ++(g_SvStat.nWhich);
992
993
994 #else
995 #define SV_STAT(nWhich)
996 #endif /* DBG_UTIL */
997
998 #endif
999
1000 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1001