LibreOffice Module sw (master)  1
swfont.cxx
Go to the documentation of this file.
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 
20 #include <hintids.hxx>
21 
22 #include <com/sun/star/i18n/ScriptType.hpp>
23 #include <vcl/outdev.hxx>
25 #include <editeng/unolingu.hxx>
26 #include <editeng/brushitem.hxx>
27 #include <editeng/wrlmitem.hxx>
28 #include <editeng/blinkitem.hxx>
29 #include <editeng/nhypitem.hxx>
30 #include <editeng/kernitem.hxx>
31 #include <editeng/cmapitem.hxx>
32 #include <editeng/langitem.hxx>
34 #include <editeng/autokernitem.hxx>
35 #include <editeng/shdditem.hxx>
37 #include <editeng/contouritem.hxx>
38 #include <editeng/colritem.hxx>
40 #include <editeng/udlnitem.hxx>
41 #include <editeng/wghtitem.hxx>
42 #include <editeng/postitem.hxx>
43 #include <editeng/fhgtitem.hxx>
44 #include <editeng/fontitem.hxx>
48 #include <editeng/twolinesitem.hxx>
50 #include <editeng/boxitem.hxx>
51 #include <editeng/shaditem.hxx>
53 #include <charatr.hxx>
54 #include <viewsh.hxx>
55 #include <swfont.hxx>
56 #include <fntcache.hxx>
57 #include <txtfrm.hxx>
58 #include <scriptinfo.hxx>
59 
60 #ifdef DBG_UTIL
61 // global Variable
63 #endif
64 
65 using namespace ::com::sun::star;
66 
67 // set background brush, depending on character formatting
68 void SwFont::SetBackColor( Color* pNewColor )
69 {
70  m_pBackColor.reset( pNewColor );
71  m_bFontChg = true;
72  m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
73 }
74 
76 {
77  if( pTopBorder )
78  m_aTopBorder = *pTopBorder;
79  else
80  {
81  m_aTopBorder.reset();
82  m_nTopBorderDist = 0;
83  }
84  m_bFontChg = true;
85  m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
86 }
87 
88 void SwFont::SetBottomBorder( const editeng::SvxBorderLine* pBottomBorder )
89 {
90  if( pBottomBorder )
91  m_aBottomBorder = *pBottomBorder;
92  else
93  {
94  m_aBottomBorder.reset();
96  }
97  m_bFontChg = true;
98  m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
99 }
100 
102 {
103  if( pRightBorder )
104  m_aRightBorder = *pRightBorder;
105  else
106  {
107  m_aRightBorder.reset();
108  m_nRightBorderDist = 0;
109  }
110  m_bFontChg = true;
111  m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
112 }
113 
115 {
116  if( pLeftBorder )
117  m_aLeftBorder = *pLeftBorder;
118  else
119  {
120  m_aLeftBorder.reset();
121  m_nLeftBorderDist = 0;
122  }
123  m_bFontChg = true;
124  m_aSub[SwFontScript::Latin].m_nFontCacheId = m_aSub[SwFontScript::CJK].m_nFontCacheId = m_aSub[SwFontScript::CTL].m_nFontCacheId = nullptr;
125 }
126 
128 SwFont::GetAbsTopBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
129 {
130  switch (GetOrientation(bVertLayout, bVertLayoutLRBT))
131  {
132  case 0 :
133  return m_aTopBorder;
134  break;
135  case 900 :
136  return m_aRightBorder;
137  break;
138  case 1800 :
139  return m_aBottomBorder;
140  break;
141  case 2700 :
142  return m_aLeftBorder;
143  break;
144  default :
145  assert(false);
146  return m_aTopBorder;
147  break;
148  }
149 }
150 
152 SwFont::GetAbsBottomBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
153 {
154  switch (GetOrientation(bVertLayout, bVertLayoutLRBT))
155  {
156  case 0 :
157  return m_aBottomBorder;
158  break;
159  case 900 :
160  return m_aLeftBorder;
161  break;
162  case 1800 :
163  return m_aTopBorder;
164  break;
165  case 2700 :
166  return m_aRightBorder;
167  break;
168  default :
169  assert(false);
170  return m_aBottomBorder;
171  break;
172  }
173 }
174 
176 SwFont::GetAbsLeftBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
177 {
178  switch (GetOrientation(bVertLayout, bVertLayoutLRBT))
179  {
180  case 0 :
181  return m_aLeftBorder;
182  break;
183  case 900 :
184  return m_aTopBorder;
185  break;
186  case 1800 :
187  return m_aRightBorder;
188  break;
189  case 2700 :
190  return m_aBottomBorder;
191  break;
192  default :
193  assert(false);
194  return m_aLeftBorder;
195  break;
196  }
197 }
198 
200 SwFont::GetAbsRightBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
201 {
202  switch (GetOrientation(bVertLayout, bVertLayoutLRBT))
203  {
204  case 0 :
205  return m_aRightBorder;
206  break;
207  case 900 :
208  return m_aBottomBorder;
209  break;
210  case 1800 :
211  return m_aLeftBorder;
212  break;
213  case 2700 :
214  return m_aTopBorder;
215  break;
216  default :
217  assert(false);
218  return m_aRightBorder;
219  break;
220  }
221 }
222 
224  const bool bVertLayoutLRBT) const
225 {
226  SvxShadowLocation aLocation = SvxShadowLocation::NONE;
227  switch (GetOrientation(bVertLayout, bVertLayoutLRBT))
228  {
229  case 0:
230  aLocation = m_aShadowLocation;
231  break;
232 
233  case 900:
234  switch ( m_aShadowLocation )
235  {
236  case SvxShadowLocation::TopLeft:
237  aLocation = SvxShadowLocation::BottomLeft;
238  break;
239  case SvxShadowLocation::TopRight:
240  aLocation = SvxShadowLocation::TopLeft;
241  break;
242  case SvxShadowLocation::BottomLeft:
243  aLocation = SvxShadowLocation::BottomRight;
244  break;
245  case SvxShadowLocation::BottomRight:
246  aLocation = SvxShadowLocation::TopRight;
247  break;
248  case SvxShadowLocation::NONE:
249  case SvxShadowLocation::End:
250  aLocation = m_aShadowLocation;
251  break;
252  }
253  break;
254 
255  case 1800:
256  switch ( m_aShadowLocation )
257  {
258  case SvxShadowLocation::TopLeft:
259  aLocation = SvxShadowLocation::BottomRight;
260  break;
261  case SvxShadowLocation::TopRight:
262  aLocation = SvxShadowLocation::BottomLeft;
263  break;
264  case SvxShadowLocation::BottomLeft:
265  aLocation = SvxShadowLocation::TopRight;
266  break;
267  case SvxShadowLocation::BottomRight:
268  aLocation = SvxShadowLocation::TopLeft;
269  break;
270  case SvxShadowLocation::NONE:
271  case SvxShadowLocation::End:
272  aLocation = m_aShadowLocation;
273  break;
274  }
275  break;
276 
277  case 2700:
278  switch ( m_aShadowLocation )
279  {
280  case SvxShadowLocation::TopLeft:
281  aLocation = SvxShadowLocation::TopRight;
282  break;
283  case SvxShadowLocation::TopRight:
284  aLocation = SvxShadowLocation::BottomRight;
285  break;
286  case SvxShadowLocation::BottomLeft:
287  aLocation = SvxShadowLocation::TopLeft;
288  break;
289  case SvxShadowLocation::BottomRight:
290  aLocation = SvxShadowLocation::BottomLeft;
291  break;
292  case SvxShadowLocation::NONE:
293  case SvxShadowLocation::End:
294  aLocation = m_aShadowLocation;
295  break;
296  }
297  break;
298 
299  default:
300  assert(false);
301  break;
302  }
303  return aLocation;
304 }
305 
306 sal_uInt16 SwFont::CalcShadowSpace(const SvxShadowItemSide nShadow, const bool bVertLayout,
307  const bool bVertLayoutLRBT, const bool bSkipLeft,
308  const bool bSkipRight) const
309 {
310  sal_uInt16 nSpace = 0;
311  const sal_uInt16 nOrient = GetOrientation(bVertLayout, bVertLayoutLRBT);
312  const SvxShadowLocation aLoc = GetAbsShadowLocation(bVertLayout, bVertLayoutLRBT);
313  switch( nShadow )
314  {
315  case SvxShadowItemSide::TOP:
316  if(( aLoc == SvxShadowLocation::TopLeft ||
317  aLoc == SvxShadowLocation::TopRight ) &&
318  ( nOrient == 0 || nOrient == 1800 ||
319  ( nOrient == 900 && !bSkipRight ) ||
320  ( nOrient == 2700 && !bSkipLeft )))
321  {
322  nSpace = m_nShadowWidth;
323  }
324  break;
325 
326  case SvxShadowItemSide::BOTTOM:
327  if(( aLoc == SvxShadowLocation::BottomLeft ||
328  aLoc == SvxShadowLocation::BottomRight ) &&
329  ( nOrient == 0 || nOrient == 1800 ||
330  ( nOrient == 900 && !bSkipLeft ) ||
331  ( nOrient == 2700 && !bSkipRight )))
332  {
333  nSpace = m_nShadowWidth;
334  }
335  break;
336 
337  case SvxShadowItemSide::LEFT:
338  if(( aLoc == SvxShadowLocation::TopLeft ||
339  aLoc == SvxShadowLocation::BottomLeft ) &&
340  ( nOrient == 900 || nOrient == 2700 ||
341  ( nOrient == 0 && !bSkipLeft ) ||
342  ( nOrient == 1800 && !bSkipRight )))
343  {
344  nSpace = m_nShadowWidth;
345  }
346  break;
347 
348  case SvxShadowItemSide::RIGHT:
349  if(( aLoc == SvxShadowLocation::TopRight ||
350  aLoc == SvxShadowLocation::BottomRight ) &&
351  ( nOrient == 900 || nOrient == 2700 ||
352  ( nOrient == 0 && !bSkipRight ) ||
353  ( nOrient == 1800 && !bSkipLeft )))
354  {
355  nSpace = m_nShadowWidth;
356  }
357  break;
358  default:
359  assert(false);
360  break;
361  }
362 
363  return nSpace;
364 }
365 
366 // maps directions for vertical layout
367 static sal_uInt16 MapDirection(sal_uInt16 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
368 {
369  if ( bVertFormat )
370  {
371  switch ( nDir )
372  {
373  case 0 :
374  if (bVertFormatLRBT)
375  nDir = 900;
376  else
377  nDir = 2700;
378  break;
379  case 900 :
380  nDir = 0;
381  break;
382  case 2700 :
383  nDir = 1800;
384  break;
385 #if OSL_DEBUG_LEVEL > 0
386  default :
387  OSL_FAIL( "Unsupported direction" );
388  break;
389 #endif
390  }
391  }
392  return nDir;
393 }
394 
395 // maps the absolute direction set at the font to its logical counterpart
396 // in the rotated environment
397 sal_uInt16 UnMapDirection(sal_uInt16 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
398 {
399  if (bVertFormatLRBT)
400  {
401  switch (nDir)
402  {
403  case 900:
404  nDir = 0;
405  break;
406  default:
407  SAL_WARN("sw.core", "unsupported direction for VertLRBT");
408  break;
409  }
410  return nDir;
411  }
412 
413  if ( bVertFormat )
414  {
415  switch ( nDir )
416  {
417  case 0 :
418  nDir = 900;
419  break;
420  case 1800 :
421  nDir = 2700;
422  break;
423  case 2700 :
424  nDir = 0;
425  break;
426 #if OSL_DEBUG_LEVEL > 0
427  default :
428  OSL_FAIL( "Unsupported direction" );
429  break;
430 #endif
431  }
432  }
433  return nDir;
434 }
435 
436 sal_uInt16 SwFont::GetOrientation(const bool bVertFormat, const bool bVertFormatLRBT) const
437 {
438  return UnMapDirection(m_aSub[m_nActual].GetOrientation(), bVertFormat, bVertFormatLRBT);
439 }
440 
441 void SwFont::SetVertical(sal_uInt16 nDir, const bool bVertFormat, const bool bVertLayoutLRBT)
442 {
443  // map direction if frame has vertical layout
444  nDir = MapDirection(nDir, bVertFormat, bVertLayoutLRBT);
445 
446  if( nDir != m_aSub[SwFontScript::Latin].GetOrientation() )
447  {
448  m_bFontChg = true;
449  m_aSub[SwFontScript::Latin].SetVertical( nDir, bVertFormat );
450  m_aSub[SwFontScript::CJK].SetVertical( nDir, bVertFormat );
451  m_aSub[SwFontScript::CTL].SetVertical( nDir, bVertFormat );
452  }
453 }
454 
455 /*
456  Escapement:
457  frEsc: Fraction, ratio of Escapements
458  Esc = resulting Escapement
459  A1 = original Ascent (nOrgAscent)
460  A2 = shrunk Ascent (nEscAscent)
461  Ax = resulting Ascent (GetAscent())
462  H1 = original Height (nOrgHeight)
463  H2 = shrunk Height (nEscHeight)
464  Hx = resulting Height (GetHeight())
465  Bx = resulting Baseline for Text (CalcPos())
466  (Attention: Y - A1!)
467 
468  Escapement:
469  Esc = H1 * frEsc;
470 
471  Superscript:
472  Ax = A2 + Esc;
473  Hx = H2 + Esc;
474  Bx = A1 - Esc;
475 
476  Subscript:
477  Ax = A1;
478  Hx = A1 + Esc + (H2 - A2);
479  Bx = A1 + Esc;
480 */
481 
482 // nEsc is the percentage
483 sal_uInt16 SwSubFont::CalcEscAscent( const sal_uInt16 nOldAscent ) const
484 {
487  {
488  const long nAscent = nOldAscent +
489  ( static_cast<long>(m_nOrgHeight) * GetEscapement() ) / 100;
490  if ( nAscent>0 )
491  return std::max<sal_uInt16>( nAscent, m_nOrgAscent );
492  }
493  return m_nOrgAscent;
494 }
495 
496 void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
497  const IDocumentSettingAccess *pIDocumentSettingAccess )
498 {
499  m_pBackColor.reset();
500 
501  if( pAttrSet )
502  {
503  const SfxPoolItem* pItem;
504  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_FONT,
505  true, &pItem ))
506  {
507  const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem);
508  m_aSub[SwFontScript::Latin].SetFamily( pFont->GetFamily() );
509  m_aSub[SwFontScript::Latin].Font::SetFamilyName( pFont->GetFamilyName() );
510  m_aSub[SwFontScript::Latin].Font::SetStyleName( pFont->GetStyleName() );
511  m_aSub[SwFontScript::Latin].Font::SetPitch( pFont->GetPitch() );
512  m_aSub[SwFontScript::Latin].Font::SetCharSet( pFont->GetCharSet() );
513  }
514  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_FONTSIZE,
515  true, &pItem ))
516  {
517  const SvxFontHeightItem *pHeight = static_cast<const SvxFontHeightItem *>(pItem);
518  m_aSub[SwFontScript::Latin].SvxFont::SetPropr( 100 );
519  m_aSub[SwFontScript::Latin].m_aSize = m_aSub[SwFontScript::Latin].Font::GetFontSize();
520  Size aTmpSize = m_aSub[SwFontScript::Latin].m_aSize;
521  aTmpSize.setHeight( pHeight->GetHeight() );
522  m_aSub[SwFontScript::Latin].SetSize( aTmpSize );
523  }
524  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_POSTURE,
525  true, &pItem ))
526  m_aSub[SwFontScript::Latin].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
527  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_WEIGHT,
528  true, &pItem ))
529  m_aSub[SwFontScript::Latin].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
530  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_LANGUAGE,
531  true, &pItem ))
532  m_aSub[SwFontScript::Latin].SetLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() );
533 
534  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_FONT,
535  true, &pItem ))
536  {
537  const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem);
538  m_aSub[SwFontScript::CJK].SetFamily( pFont->GetFamily() );
539  m_aSub[SwFontScript::CJK].Font::SetFamilyName( pFont->GetFamilyName() );
540  m_aSub[SwFontScript::CJK].Font::SetStyleName( pFont->GetStyleName() );
541  m_aSub[SwFontScript::CJK].Font::SetPitch( pFont->GetPitch() );
542  m_aSub[SwFontScript::CJK].Font::SetCharSet( pFont->GetCharSet() );
543  }
544  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_FONTSIZE,
545  true, &pItem ))
546  {
547  const SvxFontHeightItem *pHeight = static_cast<const SvxFontHeightItem *>(pItem);
548  m_aSub[SwFontScript::CJK].SvxFont::SetPropr( 100 );
549  m_aSub[SwFontScript::CJK].m_aSize = m_aSub[SwFontScript::CJK].Font::GetFontSize();
550  Size aTmpSize = m_aSub[SwFontScript::CJK].m_aSize;
551  aTmpSize.setHeight( pHeight->GetHeight() );
552  m_aSub[SwFontScript::CJK].SetSize( aTmpSize );
553  }
554  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_POSTURE,
555  true, &pItem ))
556  m_aSub[SwFontScript::CJK].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
557  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_WEIGHT,
558  true, &pItem ))
559  m_aSub[SwFontScript::CJK].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
560  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_LANGUAGE,
561  true, &pItem ))
562  {
563  LanguageType eNewLang = static_cast<const SvxLanguageItem*>(pItem)->GetLanguage();
564  m_aSub[SwFontScript::CJK].SetLanguage( eNewLang );
565  m_aSub[SwFontScript::Latin].SetCJKContextLanguage( eNewLang );
566  m_aSub[SwFontScript::CJK].SetCJKContextLanguage( eNewLang );
567  m_aSub[SwFontScript::CTL].SetCJKContextLanguage( eNewLang );
568  }
569 
570  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_FONT,
571  true, &pItem ))
572  {
573  const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem);
574  m_aSub[SwFontScript::CTL].SetFamily( pFont->GetFamily() );
575  m_aSub[SwFontScript::CTL].Font::SetFamilyName( pFont->GetFamilyName() );
576  m_aSub[SwFontScript::CTL].Font::SetStyleName( pFont->GetStyleName() );
577  m_aSub[SwFontScript::CTL].Font::SetPitch( pFont->GetPitch() );
578  m_aSub[SwFontScript::CTL].Font::SetCharSet( pFont->GetCharSet() );
579  }
580  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_FONTSIZE,
581  true, &pItem ))
582  {
583  const SvxFontHeightItem *pHeight = static_cast<const SvxFontHeightItem *>(pItem);
584  m_aSub[SwFontScript::CTL].SvxFont::SetPropr( 100 );
585  m_aSub[SwFontScript::CTL].m_aSize = m_aSub[SwFontScript::CTL].Font::GetFontSize();
586  Size aTmpSize = m_aSub[SwFontScript::CTL].m_aSize;
587  aTmpSize.setHeight( pHeight->GetHeight() );
588  m_aSub[SwFontScript::CTL].SetSize( aTmpSize );
589  }
590  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_POSTURE,
591  true, &pItem ))
592  m_aSub[SwFontScript::CTL].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
593  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_WEIGHT,
594  true, &pItem ))
595  m_aSub[SwFontScript::CTL].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
596  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_LANGUAGE,
597  true, &pItem ))
598  m_aSub[SwFontScript::CTL].SetLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() );
599 
600  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_UNDERLINE,
601  true, &pItem ))
602  {
603  SetUnderline( static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle() );
604  SetUnderColor( static_cast<const SvxUnderlineItem*>(pItem)->GetColor() );
605  }
606  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_OVERLINE,
607  true, &pItem ))
608  {
609  SetOverline( static_cast<const SvxOverlineItem*>(pItem)->GetLineStyle() );
610  SetOverColor( static_cast<const SvxOverlineItem*>(pItem)->GetColor() );
611  }
612  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CROSSEDOUT,
613  true, &pItem ))
614  SetStrikeout( static_cast<const SvxCrossedOutItem*>(pItem)->GetStrikeout() );
615  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_COLOR,
616  true, &pItem ))
617  SetColor( static_cast<const SvxColorItem*>(pItem)->GetValue() );
618  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_EMPHASIS_MARK,
619  true, &pItem ))
620  SetEmphasisMark( static_cast<const SvxEmphasisMarkItem*>(pItem)->GetEmphasisMark() );
621 
622  SetTransparent( true );
624  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CONTOUR,
625  true, &pItem ))
626  SetOutline( static_cast<const SvxContourItem*>(pItem)->GetValue() );
627  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_SHADOWED,
628  true, &pItem ))
629  SetShadow( static_cast<const SvxShadowedItem*>(pItem)->GetValue() );
630  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_RELIEF,
631  true, &pItem ))
632  SetRelief( static_cast<const SvxCharReliefItem*>(pItem)->GetValue() );
633  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_SHADOWED,
634  true, &pItem ))
635  SetPropWidth(static_cast<const SvxShadowedItem*>(pItem)->GetValue() ? 50 : 100 );
636  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_AUTOKERN,
637  true, &pItem ))
638  {
639  if( static_cast<const SvxAutoKernItem*>(pItem)->GetValue() )
640  {
641  SetAutoKern( ( !pIDocumentSettingAccess ||
642  !pIDocumentSettingAccess->get(DocumentSettingId::KERN_ASIAN_PUNCTUATION) ) ?
643  FontKerning::FontSpecific :
644  FontKerning::Asian );
645  }
646  else
647  SetAutoKern( FontKerning::NONE );
648  }
649  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_WORDLINEMODE,
650  true, &pItem ))
651  SetWordLineMode( static_cast<const SvxWordLineModeItem*>(pItem)->GetValue() );
652 
653  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_ESCAPEMENT,
654  true, &pItem ))
655  {
656  const SvxEscapementItem *pEsc = static_cast<const SvxEscapementItem *>(pItem);
657  SetEscapement( pEsc->GetEsc() );
658  if( m_aSub[SwFontScript::Latin].IsEsc() )
660  }
661  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CASEMAP,
662  true, &pItem ))
663  SetCaseMap( static_cast<const SvxCaseMapItem*>(pItem)->GetCaseMap() );
664  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_KERNING,
665  true, &pItem ))
666  SetFixKerning( static_cast<const SvxKerningItem*>(pItem)->GetValue() );
667  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_BLINK,
668  true, &pItem ))
669  SetBlink( static_cast<const SvxBlinkItem*>(pItem)->GetValue() );
670  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_ROTATE,
671  true, &pItem ))
672  SetVertical( static_cast<const SvxCharRotateItem*>(pItem)->GetValue() );
673  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_BACKGROUND,
674  true, &pItem ))
675  m_pBackColor.reset( new Color( static_cast<const SvxBrushItem*>(pItem)->GetColor() ) );
676  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_HIGHLIGHT,
677  true, &pItem ))
678  SetHighlightColor(static_cast<const SvxBrushItem*>(pItem)->GetColor());
679  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_BOX,
680  true, &pItem ))
681  {
682  const SvxBoxItem* pBoxItem = static_cast<const SvxBoxItem*>(pItem);
683  SetTopBorder(pBoxItem->GetTop());
684  SetBottomBorder(pBoxItem->GetBottom());
685  SetRightBorder(pBoxItem->GetRight());
686  SetLeftBorder(pBoxItem->GetLeft());
687  SetTopBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::TOP));
688  SetBottomBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::BOTTOM));
689  SetRightBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::RIGHT));
690  SetLeftBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::LEFT));
691  }
692  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_SHADOW,
693  true, &pItem ))
694  {
695  const SvxShadowItem* pShadowItem = static_cast<const SvxShadowItem*>(pItem);
696  SetShadowColor(pShadowItem->GetColor());
697  SetShadowWidth(pShadowItem->GetWidth());
698  SetShadowLocation(pShadowItem->GetLocation());
699  }
700  const SfxPoolItem* pTwoLinesItem = nullptr;
701  if( SfxItemState::SET ==
702  pAttrSet->GetItemState( RES_CHRATR_TWO_LINES, true, &pTwoLinesItem ))
703  if ( static_cast<const SvxTwoLinesItem*>(pTwoLinesItem)->GetValue() )
704  SetVertical( 0 );
705  }
706  else
707  {
708  Invalidate();
709  m_bBlink = false;
710  }
711  m_bPaintBlank = false;
712  OSL_ENSURE( m_aSub[SwFontScript::Latin].IsTransparent(), "SwFont: Transparent revolution" );
713 }
714 
715 SwFont::SwFont( const SwFont &rFont )
716  : m_aSub(rFont.m_aSub)
717 {
718  m_nActual = rFont.m_nActual;
719  m_pBackColor.reset( rFont.m_pBackColor ? new Color( *rFont.m_pBackColor ) : nullptr );
721  m_aTopBorder = rFont.m_aTopBorder;
732  m_aUnderColor = rFont.GetUnderColor();
733  m_aOverColor = rFont.GetOverColor();
734  m_nToxCount = 0;
735  m_nRefCount = 0;
736  m_nMetaCount = 0;
737  m_nInputFieldCount = 0;
738  m_bFontChg = rFont.m_bFontChg;
739  m_bOrgChg = rFont.m_bOrgChg;
741  m_bGreyWave = rFont.m_bGreyWave;
742  m_bBlink = rFont.m_bBlink;
743 }
744 
745 SwFont::SwFont( const SwAttrSet* pAttrSet,
746  const IDocumentSettingAccess* pIDocumentSettingAccess )
747  : m_aSub()
748 {
750  m_nToxCount = 0;
751  m_nRefCount = 0;
752  m_nMetaCount = 0;
753  m_nInputFieldCount = 0;
754  m_bPaintBlank = false;
755  m_bGreyWave = false;
756  m_bBlink = pAttrSet->GetBlink().GetValue();
757  m_bOrgChg = true;
758  {
759  const SvxFontItem& rFont = pAttrSet->GetFont();
760  m_aSub[SwFontScript::Latin].SetFamily( rFont.GetFamily() );
761  m_aSub[SwFontScript::Latin].SetFamilyName( rFont.GetFamilyName() );
762  m_aSub[SwFontScript::Latin].SetStyleName( rFont.GetStyleName() );
763  m_aSub[SwFontScript::Latin].SetPitch( rFont.GetPitch() );
764  m_aSub[SwFontScript::Latin].SetCharSet( rFont.GetCharSet() );
765  m_aSub[SwFontScript::Latin].SvxFont::SetPropr( 100 ); // 100% of FontSize
766  Size aTmpSize = m_aSub[SwFontScript::Latin].m_aSize;
767  aTmpSize.setHeight( pAttrSet->GetSize().GetHeight() );
768  m_aSub[SwFontScript::Latin].SetSize( aTmpSize );
769  m_aSub[SwFontScript::Latin].SetItalic( pAttrSet->GetPosture().GetPosture() );
770  m_aSub[SwFontScript::Latin].SetWeight( pAttrSet->GetWeight().GetWeight() );
771  m_aSub[SwFontScript::Latin].SetLanguage( pAttrSet->GetLanguage().GetLanguage() );
772  }
773 
774  {
775  const SvxFontItem& rFont = pAttrSet->GetCJKFont();
776  m_aSub[SwFontScript::CJK].SetFamily( rFont.GetFamily() );
777  m_aSub[SwFontScript::CJK].SetFamilyName( rFont.GetFamilyName() );
778  m_aSub[SwFontScript::CJK].SetStyleName( rFont.GetStyleName() );
779  m_aSub[SwFontScript::CJK].SetPitch( rFont.GetPitch() );
780  m_aSub[SwFontScript::CJK].SetCharSet( rFont.GetCharSet() );
781  m_aSub[SwFontScript::CJK].SvxFont::SetPropr( 100 ); // 100% of FontSize
782  Size aTmpSize = m_aSub[SwFontScript::CJK].m_aSize;
783  aTmpSize.setHeight( pAttrSet->GetCJKSize().GetHeight() );
784  m_aSub[SwFontScript::CJK].SetSize( aTmpSize );
785  m_aSub[SwFontScript::CJK].SetItalic( pAttrSet->GetCJKPosture().GetPosture() );
786  m_aSub[SwFontScript::CJK].SetWeight( pAttrSet->GetCJKWeight().GetWeight() );
787  LanguageType eNewLang = pAttrSet->GetCJKLanguage().GetLanguage();
788  m_aSub[SwFontScript::CJK].SetLanguage( eNewLang );
789  m_aSub[SwFontScript::Latin].SetCJKContextLanguage( eNewLang );
790  m_aSub[SwFontScript::CJK].SetCJKContextLanguage( eNewLang );
791  m_aSub[SwFontScript::CTL].SetCJKContextLanguage( eNewLang );
792  }
793 
794  {
795  const SvxFontItem& rFont = pAttrSet->GetCTLFont();
796  m_aSub[SwFontScript::CTL].SetFamily( rFont.GetFamily() );
797  m_aSub[SwFontScript::CTL].SetFamilyName( rFont.GetFamilyName() );
798  m_aSub[SwFontScript::CTL].SetStyleName( rFont.GetStyleName() );
799  m_aSub[SwFontScript::CTL].SetPitch( rFont.GetPitch() );
800  m_aSub[SwFontScript::CTL].SetCharSet( rFont.GetCharSet() );
801  m_aSub[SwFontScript::CTL].SvxFont::SetPropr( 100 ); // 100% of FontSize
802  Size aTmpSize = m_aSub[SwFontScript::CTL].m_aSize;
803  aTmpSize.setHeight( pAttrSet->GetCTLSize().GetHeight() );
804  m_aSub[SwFontScript::CTL].SetSize( aTmpSize );
805  m_aSub[SwFontScript::CTL].SetItalic( pAttrSet->GetCTLPosture().GetPosture() );
806  m_aSub[SwFontScript::CTL].SetWeight( pAttrSet->GetCTLWeight().GetWeight() );
807  m_aSub[SwFontScript::CTL].SetLanguage( pAttrSet->GetCTLLanguage().GetLanguage() );
808  }
809  if ( pAttrSet->GetCharHidden().GetValue() )
811  else
812  SetUnderline( pAttrSet->GetUnderline().GetLineStyle() );
813  SetUnderColor( pAttrSet->GetUnderline().GetColor() );
814  SetOverline( pAttrSet->GetOverline().GetLineStyle() );
815  SetOverColor( pAttrSet->GetOverline().GetColor() );
817  SetStrikeout( pAttrSet->GetCrossedOut().GetStrikeout() );
818  SetColor( pAttrSet->GetColor().GetValue() );
819  SetTransparent( true );
821  SetOutline( pAttrSet->GetContour().GetValue() );
822  SetShadow( pAttrSet->GetShadowed().GetValue() );
823  SetPropWidth( pAttrSet->GetCharScaleW().GetValue() );
824  SetRelief( pAttrSet->GetCharRelief().GetValue() );
825  if( pAttrSet->GetAutoKern().GetValue() )
826  {
827  SetAutoKern( ( !pIDocumentSettingAccess ||
828  !pIDocumentSettingAccess->get(DocumentSettingId::KERN_ASIAN_PUNCTUATION) ) ?
829  FontKerning::FontSpecific :
830  FontKerning::Asian );
831  }
832  else
833  SetAutoKern( FontKerning::NONE );
834  SetWordLineMode( pAttrSet->GetWordLineMode().GetValue() );
835  const SvxEscapementItem &rEsc = pAttrSet->GetEscapement();
836  SetEscapement( rEsc.GetEsc() );
837  if( m_aSub[SwFontScript::Latin].IsEsc() )
838  SetProportion( rEsc.GetProportionalHeight() );
839  SetCaseMap( pAttrSet->GetCaseMap().GetCaseMap() );
840  SetFixKerning( pAttrSet->GetKerning().GetValue() );
841  const SfxPoolItem* pItem;
842  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_BACKGROUND,
843  true, &pItem ))
844  m_pBackColor.reset( new Color( static_cast<const SvxBrushItem*>(pItem)->GetColor() ) );
845  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_HIGHLIGHT,
846  true, &pItem ))
847  SetHighlightColor(static_cast<const SvxBrushItem*>(pItem)->GetColor());
848  else
850  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_BOX,
851  true, &pItem ))
852  {
853  const SvxBoxItem* pBoxItem = static_cast<const SvxBoxItem*>(pItem);
854  SetTopBorder(pBoxItem->GetTop());
855  SetBottomBorder(pBoxItem->GetBottom());
856  SetRightBorder(pBoxItem->GetRight());
857  SetLeftBorder(pBoxItem->GetLeft());
858  SetTopBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::TOP));
859  SetBottomBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::BOTTOM));
860  SetRightBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::RIGHT));
861  SetLeftBorderDist(pBoxItem->GetDistance(SvxBoxItemLine::LEFT));
862  }
863  else
864  {
865  SetTopBorder(nullptr);
866  SetBottomBorder(nullptr);
867  SetRightBorder(nullptr);
868  SetLeftBorder(nullptr);
869  SetTopBorderDist(0);
873  }
874 
875  if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_SHADOW,
876  true, &pItem ))
877  {
878  const SvxShadowItem* pShadowItem = static_cast<const SvxShadowItem*>(pItem);
879  SetShadowColor(pShadowItem->GetColor());
880  SetShadowWidth(pShadowItem->GetWidth());
881  SetShadowLocation(pShadowItem->GetLocation());
882  }
883  else
884  {
886  SetShadowWidth(0);
887  SetShadowLocation(SvxShadowLocation::NONE);
888  }
889 
890  const SvxTwoLinesItem& rTwoLinesItem = pAttrSet->Get2Lines();
891  if ( ! rTwoLinesItem.GetValue() )
892  SetVertical( pAttrSet->GetCharRotate().GetValue() );
893  else
894  SetVertical( 0 );
895  if( pIDocumentSettingAccess && pIDocumentSettingAccess->get( DocumentSettingId::SMALL_CAPS_PERCENTAGE_66 ))
896  {
897  m_aSub[ SwFontScript::Latin ].m_bSmallCapsPercentage66 = true;
898  m_aSub[ SwFontScript::CJK ].m_bSmallCapsPercentage66 = true;
899  m_aSub[ SwFontScript::CTL ].m_bSmallCapsPercentage66 = true;
900  }
901 }
902 
904 {
905 }
906 
908 {
909  if (this != &rFont)
910  {
914  m_nActual = rFont.m_nActual;
915  m_pBackColor.reset( rFont.m_pBackColor ? new Color( *rFont.m_pBackColor ) : nullptr );
917  m_aTopBorder = rFont.m_aTopBorder;
928  m_aUnderColor = rFont.GetUnderColor();
929  m_aOverColor = rFont.GetOverColor();
930  m_nToxCount = 0;
931  m_nRefCount = 0;
932  m_nMetaCount = 0;
933  m_nInputFieldCount = 0;
934  m_bFontChg = rFont.m_bFontChg;
935  m_bOrgChg = rFont.m_bOrgChg;
937  m_bGreyWave = rFont.m_bGreyWave;
938  m_bBlink = rFont.m_bBlink;
939  }
940  return *this;
941 }
942 
944 {
945  SwFntAccess aFntAccess( m_aSub[nWhich].m_nFontCacheId, m_aSub[nWhich].m_nFontIndex,
946  &m_aSub[nWhich], pSh, true );
947 }
948 
950 {
951  SwFntAccess aFntAccess( m_nFontCacheId, m_nFontIndex, this, pSh, false );
952  return aFntAccess.Get()->IsSymbol();
953 }
954 
955 bool SwSubFont::ChgFnt( SwViewShell const *pSh, OutputDevice& rOut )
956 {
957  if ( pLastFont )
958  pLastFont->Unlock();
959  SwFntAccess aFntAccess( m_nFontCacheId, m_nFontIndex, this, pSh, true );
960  SV_STAT( nChangeFont );
961 
962  pLastFont = aFntAccess.Get();
963 
964  pLastFont->SetDevFont( pSh, rOut );
965 
966  pLastFont->Lock();
967  return LINESTYLE_NONE != GetUnderline() ||
968  LINESTYLE_NONE != GetOverline() ||
969  STRIKEOUT_NONE != GetStrikeout();
970 }
971 
972 void SwFont::ChgPhysFnt( SwViewShell const *pSh, OutputDevice& rOut )
973 {
974  if( m_bOrgChg && m_aSub[m_nActual].IsEsc() )
975  {
976  const sal_uInt8 nOldProp = m_aSub[m_nActual].GetPropr();
977  SetProportion( 100 );
978  ChgFnt( pSh, rOut );
979  SwFntAccess aFntAccess( m_aSub[m_nActual].m_nFontCacheId, m_aSub[m_nActual].m_nFontIndex,
980  &m_aSub[m_nActual], pSh );
981  m_aSub[m_nActual].m_nOrgHeight = aFntAccess.Get()->GetFontHeight( pSh, rOut );
982  m_aSub[m_nActual].m_nOrgAscent = aFntAccess.Get()->GetFontAscent( pSh, rOut );
983  SetProportion( nOldProp );
984  m_bOrgChg = false;
985  }
986 
987  if( m_bFontChg )
988  {
989  ChgFnt( pSh, rOut );
991  }
992  if( rOut.GetTextLineColor() != m_aUnderColor )
994  if( rOut.GetOverlineColor() != m_aOverColor )
996 }
997 
998 // Height = MaxAscent + MaxDescent
999 // MaxAscent = Max (T1_ascent, T2_ascent + (Esc * T1_height) );
1000 // MaxDescent = Max (T1_height-T1_ascent,
1001 // T2_height-T2_ascent - (Esc * T1_height)
1002 sal_uInt16 SwSubFont::CalcEscHeight( const sal_uInt16 nOldHeight,
1003  const sal_uInt16 nOldAscent ) const
1004 {
1007  {
1008  long nDescent = nOldHeight - nOldAscent -
1009  ( static_cast<long>(m_nOrgHeight) * GetEscapement() ) / 100;
1010  const sal_uInt16 nDesc = nDescent>0
1011  ? std::max<sal_uInt16>( nDescent, m_nOrgHeight - m_nOrgAscent)
1013  return ( nDesc + CalcEscAscent( nOldAscent ) );
1014  }
1015  return m_nOrgHeight;
1016 }
1017 
1019 {
1020  short nKernx = - short( Font::GetFontSize().Height() / 6 );
1021 
1022  if ( nKernx < GetFixKerning() )
1023  return GetFixKerning();
1024  return nKernx;
1025 }
1026 
1027 sal_uInt16 SwSubFont::GetAscent( SwViewShell const *pSh, const OutputDevice& rOut )
1028 {
1029  SwFntAccess aFntAccess( m_nFontCacheId, m_nFontIndex, this, pSh );
1030  const sal_uInt16 nAscent = aFntAccess.Get()->GetFontAscent( pSh, rOut );
1031  return GetEscapement() ? CalcEscAscent( nAscent ) : nAscent;
1032 }
1033 
1034 sal_uInt16 SwSubFont::GetHeight( SwViewShell const *pSh, const OutputDevice& rOut )
1035 {
1036  SV_STAT( nGetTextSize );
1037  SwFntAccess aFntAccess( m_nFontCacheId, m_nFontIndex, this, pSh );
1038  const sal_uInt16 nHeight = aFntAccess.Get()->GetFontHeight( pSh, rOut );
1039  if ( GetEscapement() )
1040  {
1041  const sal_uInt16 nAscent = aFntAccess.Get()->GetFontAscent( pSh, rOut );
1042  return CalcEscHeight( nHeight, nAscent ); // + nLeading;
1043  }
1044  return nHeight; // + nLeading;
1045 }
1046 
1048 {
1049  // Robust: the font is supposed to be set already, but better safe than
1050  // sorry...
1051  if ( !pLastFont || pLastFont->GetOwner() != reinterpret_cast<const void*>(m_nFontCacheId) ||
1052  !IsSameInstance( rInf.GetpOut()->GetFont() ) )
1053  ChgFnt( rInf.GetShell(), rInf.GetOut() );
1054 
1055  SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
1056 
1057  Size aTextSize;
1058  TextFrameIndex const nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING)
1059  ? TextFrameIndex(rInf.GetText().getLength())
1060  : rInf.GetLen();
1061  rInf.SetLen( nLn );
1062  if( IsCapital() && nLn )
1063  aTextSize = GetCapitalSize( rInf );
1064  else
1065  {
1066  SV_STAT( nGetTextSize );
1067  long nOldKern = rInf.GetKern();
1068  const OUString oldText = rInf.GetText();
1069  rInf.SetKern( CheckKerning() );
1070  if ( !IsCaseMap() )
1071  aTextSize = pLastFont->GetTextSize( rInf );
1072  else
1073  {
1074  const OUString aTmp = CalcCaseMap( rInf.GetText() );
1075  const OUString oldStr = rInf.GetText();
1076  bool bCaseMapLengthDiffers(aTmp.getLength() != oldStr.getLength());
1077 
1078  if(bCaseMapLengthDiffers && rInf.GetLen())
1079  {
1080  // If the length of the original string and the CaseMapped one
1081  // are different, it is necessary to handle the given text part as
1082  // a single snippet since its size may differ, too.
1083  TextFrameIndex const nOldIdx(rInf.GetIdx());
1084  TextFrameIndex const nOldLen(rInf.GetLen());
1085  const OUString aSnippet(oldStr.copy(sal_Int32(nOldIdx), sal_Int32(nOldLen)));
1086  const OUString aNewText(CalcCaseMap(aSnippet));
1087 
1088  rInf.SetText( aNewText );
1089  rInf.SetIdx( TextFrameIndex(0) );
1090  rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1091 
1092  aTextSize = pLastFont->GetTextSize( rInf );
1093 
1094  rInf.SetIdx( nOldIdx );
1095  rInf.SetLen( nOldLen );
1096  }
1097  else
1098  {
1099  rInf.SetText( aTmp );
1100  aTextSize = pLastFont->GetTextSize( rInf );
1101  }
1102 
1103  rInf.SetText(oldStr);
1104  }
1105  rInf.SetKern( nOldKern );
1106  rInf.SetText(oldText);
1107  // A word that's longer than one line, with escapement at the line
1108  // break, must report its effective height.
1109  if( GetEscapement() )
1110  {
1111  const sal_uInt16 nAscent = pLastFont->GetFontAscent( rInf.GetShell(),
1112  rInf.GetOut() );
1113  aTextSize.setHeight(
1114  static_cast<long>(CalcEscHeight( static_cast<sal_uInt16>(aTextSize.Height()), nAscent)) );
1115  }
1116  }
1117 
1118  if (TextFrameIndex(1) == rInf.GetLen()
1119  && CH_TXT_ATR_FIELDSTART == rInf.GetText()[sal_Int32(rInf.GetIdx())])
1120  {
1121  TextFrameIndex const nOldIdx(rInf.GetIdx());
1122  TextFrameIndex const nOldLen(rInf.GetLen());
1123  const OUString aNewText(CH_TXT_ATR_SUBST_FIELDSTART);
1124  rInf.SetText( aNewText );
1125  rInf.SetIdx( TextFrameIndex(0) );
1126  rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1127  aTextSize = pLastFont->GetTextSize( rInf );
1128  rInf.SetIdx( nOldIdx );
1129  rInf.SetLen( nOldLen );
1130  }
1131  else if (TextFrameIndex(1) == rInf.GetLen()
1132  && CH_TXT_ATR_FIELDEND == rInf.GetText()[sal_Int32(rInf.GetIdx())])
1133  {
1134  TextFrameIndex const nOldIdx(rInf.GetIdx());
1135  TextFrameIndex const nOldLen(rInf.GetLen());
1136  const OUString aNewText(CH_TXT_ATR_SUBST_FIELDEND);
1137  rInf.SetText( aNewText );
1138  rInf.SetIdx( TextFrameIndex(0) );
1139  rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1140  aTextSize = pLastFont->GetTextSize( rInf );
1141  rInf.SetIdx( nOldIdx );
1142  rInf.SetLen( nOldLen );
1143  }
1144 
1145  return aTextSize;
1146 }
1147 
1148 void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey )
1149 {
1150  rInf.SetGreyWave( bGrey );
1151  TextFrameIndex const nLn(rInf.GetText().getLength());
1152  if( !rInf.GetLen() || !nLn )
1153  return;
1154  if (TextFrameIndex(COMPLETE_STRING) == rInf.GetLen())
1155  rInf.SetLen( nLn );
1156 
1157  FontLineStyle nOldUnder = LINESTYLE_NONE;
1158  SwUnderlineFont* pUnderFnt = nullptr;
1159 
1160  if( rInf.GetUnderFnt() )
1161  {
1162  nOldUnder = GetUnderline();
1164  pUnderFnt = rInf.GetUnderFnt();
1165  }
1166 
1167  if( !pLastFont || pLastFont->GetOwner() != reinterpret_cast<const void*>(m_nFontCacheId) )
1168  ChgFnt( rInf.GetShell(), rInf.GetOut() );
1169 
1170  SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
1171 
1172  const Point aOldPos(rInf.GetPos());
1173  Point aPos( rInf.GetPos() );
1174 
1175  if( GetEscapement() )
1176  CalcEsc( rInf, aPos );
1177 
1178  rInf.SetPos( aPos );
1180 
1181  if( IsCapital() )
1182  DrawCapital( rInf );
1183  else
1184  {
1185  SV_STAT( nDrawText );
1186  if ( !IsCaseMap() )
1187  pLastFont->DrawText( rInf );
1188  else
1189  {
1190  const OUString oldStr = rInf.GetText();
1191  const OUString aString( CalcCaseMap(oldStr) );
1192  bool bCaseMapLengthDiffers(aString.getLength() != oldStr.getLength());
1193 
1194  if(bCaseMapLengthDiffers && rInf.GetLen())
1195  {
1196  // If the length of the original string and the CaseMapped one
1197  // are different, it is necessary to handle the given text part as
1198  // a single snippet since its size may differ, too.
1199  TextFrameIndex const nOldIdx(rInf.GetIdx());
1200  TextFrameIndex const nOldLen(rInf.GetLen());
1201  const OUString aSnippet(oldStr.copy(sal_Int32(nOldIdx), sal_Int32(nOldLen)));
1202  const OUString aNewText = CalcCaseMap(aSnippet);
1203 
1204  rInf.SetText( aNewText );
1205  rInf.SetIdx( TextFrameIndex(0) );
1206  rInf.SetLen( TextFrameIndex(aNewText.getLength()) );
1207 
1208  pLastFont->DrawText( rInf );
1209 
1210  rInf.SetIdx( nOldIdx );
1211  rInf.SetLen( nOldLen );
1212  }
1213  else
1214  {
1215  rInf.SetText( aString );
1216  pLastFont->DrawText( rInf );
1217  }
1218 
1219  rInf.SetText(oldStr);
1220  }
1221  }
1222 
1223  if( pUnderFnt && nOldUnder != LINESTYLE_NONE )
1224  {
1225  Size aFontSize = GetTextSize_( rInf );
1226  const OUString oldStr = rInf.GetText();
1227 
1228  TextFrameIndex const nOldIdx = rInf.GetIdx();
1229  TextFrameIndex const nOldLen = rInf.GetLen();
1230  long nSpace = 0;
1231  if( rInf.GetSpace() )
1232  {
1233  TextFrameIndex nTmpEnd = nOldIdx + nOldLen;
1234  if (nTmpEnd > TextFrameIndex(oldStr.getLength()))
1235  nTmpEnd = TextFrameIndex(oldStr.getLength());
1236 
1237  const SwScriptInfo* pSI = rInf.GetScriptInfo();
1238 
1239  const bool bAsianFont =
1240  ( rInf.GetFont() && SwFontScript::CJK == rInf.GetFont()->GetActual() );
1241  for (TextFrameIndex nTmp = nOldIdx; nTmp < nTmpEnd; ++nTmp)
1242  {
1243  if (CH_BLANK == oldStr[sal_Int32(nTmp)] || bAsianFont ||
1244  (nTmp + TextFrameIndex(1) < TextFrameIndex(oldStr.getLength())
1245  && pSI
1246  && i18n::ScriptType::ASIAN == pSI->ScriptType(nTmp + TextFrameIndex(1))))
1247  {
1248  ++nSpace;
1249  }
1250  }
1251 
1252  // if next portion if a hole portion we do not consider any
1253  // extra space added because the last character was ASIAN
1254  if ( nSpace && rInf.IsSpaceStop() && bAsianFont )
1255  --nSpace;
1256 
1257  nSpace *= rInf.GetSpace() / SPACING_PRECISION_FACTOR;
1258  }
1259 
1260  rInf.SetWidth( sal_uInt16(aFontSize.Width() + nSpace) );
1261  rInf.SetText( " " );
1262  rInf.SetIdx( TextFrameIndex(0) );
1263  rInf.SetLen( TextFrameIndex(2) );
1264  SetUnderline( nOldUnder );
1265  rInf.SetUnderFnt( nullptr );
1266 
1267  // set position for underline font
1268  rInf.SetPos( pUnderFnt->GetPos() );
1269 
1270  pUnderFnt->GetFont().DrawStretchText_( rInf );
1271 
1272  rInf.SetUnderFnt( pUnderFnt );
1273  rInf.SetText(oldStr);
1274  rInf.SetIdx( nOldIdx );
1275  rInf.SetLen( nOldLen );
1276  }
1277 
1278  rInf.SetPos(aOldPos);
1279 }
1280 
1282 {
1283  if( !rInf.GetLen() || !rInf.GetText().getLength() )
1284  return;
1285 
1286  FontLineStyle nOldUnder = LINESTYLE_NONE;
1287  SwUnderlineFont* pUnderFnt = nullptr;
1288 
1289  if( rInf.GetUnderFnt() )
1290  {
1291  nOldUnder = GetUnderline();
1293  pUnderFnt = rInf.GetUnderFnt();
1294  }
1295 
1296  if ( !pLastFont || pLastFont->GetOwner() != reinterpret_cast<const void*>(m_nFontCacheId) )
1297  ChgFnt( rInf.GetShell(), rInf.GetOut() );
1298 
1299  SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
1300 
1301  rInf.ApplyAutoColor();
1302 
1303  const Point aOldPos(rInf.GetPos());
1304  Point aPos( rInf.GetPos() );
1305 
1306  if( GetEscapement() )
1307  CalcEsc( rInf, aPos );
1308 
1310  rInf.SetPos( aPos );
1311 
1312  if( IsCapital() )
1313  DrawStretchCapital( rInf );
1314  else
1315  {
1316  SV_STAT( nDrawStretchText );
1317 
1318  if ( rInf.GetFrame() )
1319  {
1320  if ( rInf.GetFrame()->IsRightToLeft() )
1321  rInf.GetFrame()->SwitchLTRtoRTL( aPos );
1322 
1323  if ( rInf.GetFrame()->IsVertical() )
1324  rInf.GetFrame()->SwitchHorizontalToVertical( aPos );
1325 
1326  rInf.SetPos( aPos );
1327  }
1328 
1329  if ( !IsCaseMap() )
1330  rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(),
1331  rInf.GetText(), sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
1332  else
1333  rInf.GetOut().DrawStretchText( aPos, rInf.GetWidth(),
1334  CalcCaseMap(rInf.GetText()),
1335  sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
1336  }
1337 
1338  if( pUnderFnt && nOldUnder != LINESTYLE_NONE )
1339  {
1340  const OUString oldStr = rInf.GetText();
1341  TextFrameIndex const nOldIdx = rInf.GetIdx();
1342  TextFrameIndex const nOldLen = rInf.GetLen();
1343  rInf.SetText( " " );
1344  rInf.SetIdx( TextFrameIndex(0) );
1345  rInf.SetLen( TextFrameIndex(2) );
1346  SetUnderline( nOldUnder );
1347  rInf.SetUnderFnt( nullptr );
1348 
1349  // set position for underline font
1350  rInf.SetPos( pUnderFnt->GetPos() );
1351 
1352  pUnderFnt->GetFont().DrawStretchText_( rInf );
1353 
1354  rInf.SetUnderFnt( pUnderFnt );
1355  rInf.SetText(oldStr);
1356  rInf.SetIdx( nOldIdx );
1357  rInf.SetLen( nOldLen );
1358  }
1359 
1360  rInf.SetPos(aOldPos);
1361 }
1362 
1364 {
1365  if ( !pLastFont || pLastFont->GetOwner() != reinterpret_cast<const void*>(m_nFontCacheId) )
1366  ChgFnt( rInf.GetShell(), rInf.GetOut() );
1367 
1368  SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
1369 
1370  TextFrameIndex const nLn = rInf.GetLen() == TextFrameIndex(COMPLETE_STRING)
1371  ? TextFrameIndex(rInf.GetText().getLength())
1372  : rInf.GetLen();
1373  rInf.SetLen( nLn );
1374  TextFrameIndex nCursor(0);
1375  if( IsCapital() && nLn )
1376  nCursor = GetCapitalCursorOfst( rInf );
1377  else
1378  {
1379  const OUString oldText = rInf.GetText();
1380  long nOldKern = rInf.GetKern();
1381  rInf.SetKern( CheckKerning() );
1382  SV_STAT( nGetTextSize );
1383  if ( !IsCaseMap() )
1384  nCursor = pLastFont->GetCursorOfst( rInf );
1385  else
1386  {
1387  rInf.SetText( CalcCaseMap( rInf.GetText() ) );
1388  nCursor = pLastFont->GetCursorOfst( rInf );
1389  }
1390  rInf.SetKern( nOldKern );
1391  rInf.SetText(oldText);
1392  }
1393  return nCursor;
1394 }
1395 
1396 void SwSubFont::CalcEsc( SwDrawTextInfo const & rInf, Point& rPos )
1397 {
1398  long nOfst;
1399 
1400  bool bVert = false;
1401  bool bVertLRBT = false;
1402  if (rInf.GetFrame())
1403  {
1404  bVert = rInf.GetFrame()->IsVertical();
1405  bVertLRBT = rInf.GetFrame()->IsVertLRBT();
1406  }
1407  const sal_uInt16 nDir = UnMapDirection(GetOrientation(), bVert, bVertLRBT);
1408 
1409  switch ( GetEscapement() )
1410  {
1411  case DFLT_ESC_AUTO_SUB :
1412  nOfst = m_nOrgHeight - m_nOrgAscent -
1413  pLastFont->GetFontHeight( rInf.GetShell(), rInf.GetOut() ) +
1414  pLastFont->GetFontAscent( rInf.GetShell(), rInf.GetOut() );
1415 
1416  switch ( nDir )
1417  {
1418  case 0 :
1419  rPos.AdjustY(nOfst );
1420  break;
1421  case 900 :
1422  rPos.AdjustX(nOfst );
1423  break;
1424  case 2700 :
1425  rPos.AdjustX( -nOfst );
1426  break;
1427  }
1428 
1429  break;
1430  case DFLT_ESC_AUTO_SUPER :
1431  nOfst = pLastFont->GetFontAscent( rInf.GetShell(), rInf.GetOut() ) -
1432  m_nOrgAscent;
1433 
1434  switch ( nDir )
1435  {
1436  case 0 :
1437  rPos.AdjustY(nOfst );
1438  break;
1439  case 900 :
1440  rPos.AdjustX(nOfst );
1441  break;
1442  case 2700 :
1443  rPos.AdjustX( -nOfst );
1444  break;
1445  }
1446 
1447  break;
1448  default :
1449  nOfst = (static_cast<long>(m_nOrgHeight) * GetEscapement()) / 100;
1450 
1451  switch ( nDir )
1452  {
1453  case 0 :
1454  rPos.AdjustY( -nOfst );
1455  break;
1456  case 900 :
1457  rPos.AdjustX( -nOfst );
1458  break;
1459  case 2700 :
1460  rPos.AdjustX(nOfst );
1461  break;
1462  }
1463  }
1464 }
1465 
1466 // used during painting of small capitals
1467 void SwDrawTextInfo::Shift( sal_uInt16 nDir )
1468 {
1469 #ifdef DBG_UTIL
1470  OSL_ENSURE( m_bPos, "DrawTextInfo: Undefined Position" );
1471  OSL_ENSURE( m_bSize, "DrawTextInfo: Undefined Width" );
1472 #endif
1473 
1474  const bool bBidiPor = ( GetFrame() && GetFrame()->IsRightToLeft() ) !=
1475  ( ComplexTextLayoutFlags::Default != ( ComplexTextLayoutFlags::BiDiRtl & GetpOut()->GetLayoutMode() ) );
1476 
1477  bool bVert = false;
1478  bool bVertLRBT = false;
1479  if (GetFrame())
1480  {
1481  bVert = GetFrame()->IsVertical();
1482  bVertLRBT = GetFrame()->IsVertLRBT();
1483  }
1484  nDir = bBidiPor ? 1800 : UnMapDirection(nDir, bVert, bVertLRBT);
1485 
1486  switch ( nDir )
1487  {
1488  case 0 :
1489  m_aPos.AdjustX(GetSize().Width() );
1490  break;
1491  case 900 :
1492  OSL_ENSURE( m_aPos.Y() >= GetSize().Width(), "Going underground" );
1493  m_aPos.AdjustY( -(GetSize().Width()) );
1494  break;
1495  case 1800 :
1496  m_aPos.AdjustX( -(GetSize().Width()) );
1497  break;
1498  case 2700 :
1499  m_aPos.AdjustY(GetSize().Width() );
1500  break;
1501  }
1502 }
1503 
1508  : m_aPos( rPoint ), m_nEnd( nEnd ), m_pFont( &rFnt )
1509 {
1510 };
1511 
1513 {
1514 }
1515 
1517 long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
1518  const SwAttrSet &rSet,
1519  const vcl::RenderContext &rOut, sal_Int16 nScript)
1520 {
1521  SwFont aFont(&rSet, &rIDocumentSettingAccess);
1522  SwFontScript nActual;
1523  switch (nScript)
1524  {
1525  default:
1526  case i18n::ScriptType::LATIN:
1527  nActual = SwFontScript::Latin;
1528  break;
1529  case i18n::ScriptType::ASIAN:
1530  nActual = SwFontScript::CJK;
1531  break;
1532  case i18n::ScriptType::COMPLEX:
1533  nActual = SwFontScript::CTL;
1534  break;
1535  }
1536  aFont.SetActual(nActual);
1537 
1538  vcl::RenderContext &rMutableOut = const_cast<vcl::RenderContext &>(rOut);
1539  const vcl::Font aOldFont(rMutableOut.GetFont());
1540 
1541  rMutableOut.SetFont(aFont.GetActualFont());
1542  long nHeight = rMutableOut.GetTextHeight();
1543 
1544  rMutableOut.SetFont(aOldFont);
1545  return nHeight;
1546 }
1547 
1548 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetLeftBorderDist(const sal_uInt16 nLeftDist)
Definition: swfont.hxx:856
const SvxFontItem & GetCTLFont(bool=true) const
Definition: charatr.hxx:88
long Width() const
SwFntObj * pLastFont
Definition: fntcache.cxx:69
SwViewShell const * GetShell() const
Definition: drawfont.hxx:175
const SvxBlinkItem & GetBlink(bool=true) const
Definition: charatr.hxx:104
#define RES_CHRATR_WEIGHT
Definition: hintids.hxx:83
boost::optional< editeng::SvxBorderLine > m_aTopBorder
Definition: swfont.hxx:143
sal_uInt16 UnMapDirection(sal_uInt16 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
Definition: swfont.cxx:397
long GetSpace() const
Definition: drawfont.hxx:325
const SvxColorItem & GetColor(bool=true) const
Definition: charatr.hxx:90
boost::optional< editeng::SvxBorderLine > m_aRightBorder
Definition: swfont.hxx:145
const SvxFontHeightItem & GetSize(bool=true) const
Definition: charatr.hxx:78
#define RES_CHRATR_CJK_LANGUAGE
Definition: hintids.hxx:92
~SwFont()
Definition: swfont.cxx:903
void SetWordLineMode(const bool bWordLineMode)
Definition: swfont.hxx:671
TextFrameIndex GetCursorOfst_(SwDrawTextInfo &rInf)
Definition: swfont.cxx:1363
const SvxContourItem & GetContour(bool=true) const
Definition: charatr.hxx:68
sal_uInt16 GetAscent(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.cxx:1027
vcl::RenderContext * GetpOut() const
Definition: drawfont.hxx:185
const SvxCharRotateItem & GetCharRotate(bool=true) const
Definition: charatr.hxx:112
#define RES_CHRATR_FONTSIZE
Definition: hintids.hxx:76
#define CH_TXT_ATR_SUBST_FIELDSTART
Definition: hintids.hxx:54
SwFont * GetFont() const
Definition: drawfont.hxx:250
TextFrameIndex GetCapitalCursorOfst(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:377
void Lock()
Definition: swcache.cxx:477
bool GetValue() const
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:78
static sal_uInt16 MapDirection(sal_uInt16 nDir, const bool bVertFormat, const bool bVertFormatLRBT)
Definition: swfont.cxx:367
#define RES_CHRATR_RELIEF
Definition: hintids.hxx:104
const SvxUnderlineItem & GetUnderline(bool=true) const
Definition: charatr.hxx:72
long AdjustX(long nHorzMove)
sal_uInt16 m_nOrgAscent
Definition: swfont.hxx:60
const SvxOverlineItem & GetOverline(bool=true) const
Definition: charatr.hxx:74
const SvxPostureItem & GetCTLPosture(bool=true) const
Definition: charatr.hxx:54
const Color & GetTextLineColor() const
sal_uInt16 GetFontHeight(const SwViewShell *pSh, const OutputDevice &rOut)
Definition: fntcache.cxx:380
const Color & GetUnderColor() const
Definition: swfont.hxx:272
#define RES_CHRATR_CJK_POSTURE
Definition: hintids.hxx:93
const SvxShadowedItem & GetShadowed(bool=true) const
Definition: charatr.hxx:62
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
Definition: txtfrm.cxx:483
#define RES_CHRATR_WORDLINEMODE
Definition: hintids.hxx:84
#define CH_TXT_ATR_SUBST_FIELDEND
Definition: hintids.hxx:55
void SetKern(long nNew)
Definition: drawfont.hxx:495
sal_uInt8 & GetProportionalHeight()
bool ChgFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.cxx:955
void SetIdx(TextFrameIndex const nNew)
Definition: drawfont.hxx:456
const SvxLanguageItem & GetLanguage(bool=true) const
Definition: charatr.hxx:92
const SvxCrossedOutItem & GetCrossedOut(bool=true) const
Definition: charatr.hxx:76
void SetUnderline(const FontLineStyle eUnderline)
Definition: swfont.hxx:539
void SetBackColor(Color *pNewColor)
Definition: swfont.cxx:68
const SvxCharHiddenItem & GetCharHidden(bool=true) const
Definition: charatr.hxx:116
const SvxFont & GetActualFont() const
Definition: swfont.hxx:185
void SetGreyWave(bool bNew)
Definition: drawfont.hxx:562
void SetEmphasisMark(const FontEmphasisMark eValue)
Definition: swfont.hxx:685
const SvxLanguageItem & GetCJKLanguage(bool=true) const
Definition: charatr.hxx:94
sal_uInt16 GetFontAscent(const SwViewShell *pSh, const OutputDevice &rOut)
Definition: fntcache.cxx:343
#define RES_CHRATR_CJK_WEIGHT
Definition: hintids.hxx:94
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
void SetPos(const Point &rNew)
Definition: drawfont.hxx:397
#define RES_CHRATR_FONT
Definition: hintids.hxx:75
void CalcEsc(SwDrawTextInfo const &rInf, Point &rPos)
Definition: swfont.cxx:1396
sal_uInt16 GetWidth() const
Definition: drawfont.hxx:294
void SetWidth(sal_uInt16 nNew)
Definition: drawfont.hxx:482
#define RES_CHRATR_BLINK
Definition: hintids.hxx:86
#define DFLT_ESC_AUTO_SUB
#define RES_CHRATR_CJK_FONT
Definition: hintids.hxx:90
bool m_bPaintBlank
Definition: swfont.hxx:167
#define RES_CHRATR_CJK_FONTSIZE
Definition: hintids.hxx:91
void SetOutline(const bool bOutline)
Definition: swfont.hxx:603
const editeng::SvxBorderLine * GetRight() const
void SetPropWidth(const sal_uInt16 nNew)
Definition: swfont.hxx:693
Color m_aShadowColor
Definition: swfont.hxx:154
sal_uInt16 GetOrientation(const bool bVertLayout=false, const bool bVertFormatLRBT=false) const
Definition: swfont.cxx:436
FontPitch GetPitch() const
bool m_bFontChg
Definition: swfont.hxx:168
void SetBottomBorderDist(const sal_uInt16 nBottomDist)
Definition: swfont.hxx:842
sal_uInt16 m_nLeftBorderDist
Definition: swfont.hxx:152
bool IsCaseMap() const
FontFamily GetFamily() const
FontItalic GetPosture() const
#define RES_CHRATR_TWO_LINES
Definition: hintids.hxx:102
void DrawCapital(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:305
bool IsVertLRBT() const
Definition: frame.hxx:959
void SetColor(const Color &rColor)
Definition: swfont.hxx:414
const SwScriptInfo * GetScriptInfo() const
Definition: drawfont.hxx:190
const Color & GetOverlineColor() const
void SetShadow(const bool bShadow)
Definition: swfont.hxx:618
sal_uInt16 m_nShadowWidth
Definition: swfont.hxx:155
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
sal_uInt16 m_nRightBorderDist
Definition: swfont.hxx:151
const Color & GetColor() const
void DrawStretchText(const Point &rStartPt, sal_uLong nWidth, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1)
const SwTextFrame * GetFrame() const
Definition: drawfont.hxx:165
SvxShadowLocation GetLocation() const
const SvxFontHeightItem & GetCJKSize(bool=true) const
Definition: charatr.hxx:80
LINESTYLE_NONE
Color m_aOverColor
Definition: swfont.hxx:140
#define RES_CHRATR_CTL_FONTSIZE
Definition: hintids.hxx:96
const Color & GetOverColor() const
Definition: swfont.hxx:274
SwUnderlineFont(SwFont &rFnt, TextFrameIndex nEnd, const Point &rPoint)
Definition: swfont.cxx:1507
const vcl::Font & GetFont() const
void SetUnderFnt(SwUnderlineFont *pULFnt)
Definition: drawfont.hxx:541
rtl_TextEncoding GetCharSet() const
const SvxCaseMapItem & GetCaseMap(bool=true) const
Definition: charatr.hxx:100
const SvxFontHeightItem & GetCTLSize(bool=true) const
Definition: charatr.hxx:82
void DrawStretchText_(SwDrawTextInfo &rInf)
Definition: swfont.cxx:1281
TextFrameIndex GetCursorOfst(SwDrawTextInfo &rInf)
Definition: fntcache.cxx:2093
o3tl::enumarray< SwFontScript, SwSubFont > m_aSub
Definition: swfont.hxx:134
#define DFLT_ESC_AUTO_SUPER
SwFont(const SwAttrSet *pSet, const IDocumentSettingAccess *pIDocumentSettingAccess)
Definition: swfont.cxx:745
FontEmphasisMark GetEmphasisMark() const
bool IsSymbol() const
Definition: fntcache.hxx:125
sal_uInt16 m_nFontIndex
Definition: swfont.hxx:58
void SetShadowColor(const Color &rColor)
Definition: swfont.hxx:928
const SvxAutoKernItem & GetAutoKern(bool=true) const
Definition: charatr.hxx:64
long GetKern() const
Definition: drawfont.hxx:320
void SetUnderline(const FontLineStyle eUnderline)
Definition: swfont.hxx:545
void SetShadowLocation(const SvxShadowLocation aLocation)
Definition: swfont.hxx:942
#define RES_CHRATR_CASEMAP
Definition: hintids.hxx:69
SwUnderlineFont * GetUnderFnt() const
Definition: drawfont.hxx:258
void ChgPhysFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.cxx:972
sal_uInt16 GetHeight(SwViewShell const *pSh, const OutputDevice &rOut)
Definition: swfont.cxx:1034
void SetStrikeout(const FontStrikeout eStrikeout)
Definition: swfont.hxx:575
void SetAlign(const FontAlign eAlign)
Definition: swfont.hxx:517
SwFontScript GetActual() const
Definition: swfont.hxx:183
void SetLen(TextFrameIndex const nNew)
Definition: drawfont.hxx:461
void SetTextLineColor()
void Shift(sal_uInt16 nDir)
Definition: swfont.cxx:1467
void SetLeftBorder(const editeng::SvxBorderLine *pLeftBorder)
Definition: swfont.cxx:114
const OUString & GetText() const
Definition: drawfont.hxx:216
const OUString & GetStyleName() const
Color m_aHighlightColor
Definition: swfont.hxx:138
const SvxWeightItem & GetCTLWeight(bool=true) const
Definition: charatr.hxx:60
#define RES_CHRATR_COLOR
Definition: hintids.hxx:71
const Color & GetColor() const
const SvxCharScaleWidthItem & GetCharScaleW(bool=true) const
Definition: charatr.hxx:110
const editeng::SvxBorderLine * GetTop() const
bool ApplyAutoColor(vcl::Font *pFnt=nullptr)
Definition: fntcache.cxx:2582
ALIGN_BASELINE
void SetTransparent(const bool bTrans)
Definition: swfont.hxx:643
#define RES_CHRATR_OVERLINE
Definition: hintids.hxx:106
SvxShadowItemSide
void SetLanguage(LanguageType eNewLang, const SwFontScript nWhich)
Definition: swfont.hxx:807
#define RES_CHRATR_BACKGROUND
Definition: hintids.hxx:89
SwFontScript m_nActual
Definition: swfont.hxx:163
void SetRightBorder(const editeng::SvxBorderLine *pRightBorder)
Definition: swfont.cxx:101
const editeng::SvxBorderLine * GetLeft() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
sal_uInt8 m_nInputFieldCount
Definition: swfont.hxx:161
#define RES_CHRATR_CTL_FONT
Definition: hintids.hxx:95
long AdjustY(long nVertMove)
FontWeight GetWeight() const
void SetUnderColor(const Color &rColor)
Definition: swfont.hxx:215
void SetRightBorderDist(const sal_uInt16 nRightDist)
Definition: swfont.hxx:849
#define RES_CHRATR_BOX
Definition: hintids.hxx:108
void SetShadowWidth(const sal_uInt16 nWidth)
Definition: swfont.hxx:935
const Point & GetPos() const
Definition: swfont.hxx:975
void DrawStretchCapital(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:446
const SvxTwoLinesItem & Get2Lines(bool=true) const
Definition: charatr.hxx:108
void SetCaseMap(const SvxCaseMap eNew)
Definition: swfont.hxx:657
void DrawText_(SwDrawTextInfo &rInf, const bool bGrey)
Definition: swfont.cxx:1148
Size GetCapitalSize(SwDrawTextInfo &rInf)
Definition: fntcap.cxx:133
const sal_Unicode CH_BLANK
Definition: swfont.hxx:42
bool m_bOrgChg
Definition: swfont.hxx:169
SwFont & GetFont()
Definition: swfont.hxx:970
void SetRelief(const FontRelief eNew)
Definition: swfont.hxx:711
#define CH_TXT_ATR_FIELDSTART
Definition: hintids.hxx:52
sal_uInt8 m_nToxCount
Definition: swfont.hxx:158
const SvxFontItem & GetCJKFont(bool=true) const
Definition: charatr.hxx:86
void SetEscapement(const short nNewEsc)
Definition: swfont.hxx:784
Provides access to settings of a document.
#define RES_CHRATR_UNDERLINE
Definition: hintids.hxx:82
void DrawStretchText_(SwDrawTextInfo &rInf)
Definition: swfont.hxx:320
long AttrSetToLineHeight(const IDocumentSettingAccess &rIDocumentSettingAccess, const SwAttrSet &rSet, const vcl::RenderContext &rOut, sal_Int16 nScript)
Helper for filters to find true lineheight of a font.
Definition: swfont.cxx:1517
const SvxLanguageItem & GetCTLLanguage(bool=true) const
Definition: charatr.hxx:96
SvxCaseMap GetCaseMap() const
#define RES_CHRATR_ESCAPEMENT
Definition: hintids.hxx:74
void SetOverlineColor()
const SvxEscapementItem & GetEscapement(bool=true) const
Definition: charatr.hxx:98
const boost::optional< editeng::SvxBorderLine > & GetAbsBottomBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:152
const Color & GetColor() const
Definition: swfont.hxx:276
long GetTextHeight() const
void SetOverColor(const Color &rColor)
Definition: swfont.hxx:217
#define RES_CHRATR_CONTOUR
Definition: hintids.hxx:72
#define SV_STAT(nWhich)
Definition: swfont.hxx:999
sal_uInt16 m_nBottomBorderDist
Definition: swfont.hxx:150
const SvxEmphasisMarkItem & GetEmphasisMark(bool=true) const
Definition: charatr.hxx:106
void SetFixKerning(const short nNewKern)
Definition: swfont.hxx:650
#define RES_CHRATR_KERNING
Definition: hintids.hxx:77
const boost::optional< editeng::SvxBorderLine > & GetAbsTopBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:128
sal_uInt16 CalcShadowSpace(const SvxShadowItemSide nShadow, const bool bVertLayout, const bool bVertLayoutLRBT, const bool bSkipLeft, const bool bSkipRight) const
Calculate the shadow space on the specified side dependent from the orientation and connection with n...
Definition: swfont.cxx:306
void SetBottomBorder(const editeng::SvxBorderLine *pBottomBorder)
Definition: swfont.cxx:88
FontLineStyle GetLineStyle() const
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
Definition: txtfrm.cxx:693
Size GetTextSize_(SwDrawTextInfo &rInf)
Definition: swfont.cxx:1047
SwFont & operator=(const SwFont &rFont)
Definition: swfont.cxx:907
const OUString & GetFamilyName() const
#define RES_CHRATR_EMPHASIS_MARK
Definition: hintids.hxx:101
#define RES_CHRATR_SHADOW
Definition: hintids.hxx:109
#define RES_CHRATR_ROTATE
Definition: hintids.hxx:100
LanguageType GetLanguage() const
long GetSperren() const
Definition: drawfont.hxx:312
bool IsSymbol(SwViewShell const *pSh)
Definition: swfont.cxx:949
void SetDevFont(const SwViewShell *pSh, OutputDevice &rOut)
Definition: fntcache.cxx:643
LanguageType GetLanguage() const
Definition: swfont.hxx:282
SwFntObj * Get()
Definition: fntcache.hxx:157
std::unique_ptr< Color > m_pBackColor
Definition: swfont.hxx:137
sal_uInt32 GetHeight() const
const SvxWeightItem & GetCJKWeight(bool=true) const
Definition: charatr.hxx:58
const void * m_nFontCacheId
Definition: swfont.hxx:56
boost::optional< editeng::SvxBorderLine > m_aLeftBorder
Definition: swfont.hxx:146
boost::optional< editeng::SvxBorderLine > m_aBottomBorder
Definition: swfont.hxx:144
bool m_bBlink
Definition: swfont.hxx:166
bool IsCapital() const
#define RES_CHRATR_CTL_LANGUAGE
Definition: hintids.hxx:97
unsigned char sal_uInt8
sal_uInt16 CalcEscAscent(const sal_uInt16 nOldAscent) const
Definition: swfont.cxx:483
#define RES_CHRATR_POSTURE
Definition: hintids.hxx:79
#define RES_CHRATR_CTL_WEIGHT
Definition: hintids.hxx:99
#define RES_CHRATR_CTL_POSTURE
Definition: hintids.hxx:98
LINESTYLE_DOTTED
const SvxKerningItem & GetKerning(bool=true) const
Definition: charatr.hxx:70
void SetFont(const vcl::Font &rNewFont)
const Point & GetPos() const
Definition: drawfont.hxx:195
void SetTopBorder(const editeng::SvxBorderLine *pTopBorder)
Definition: swfont.cxx:75
TextFrameIndex GetLen() const
Definition: drawfont.hxx:268
sal_uInt8 m_nRefCount
Definition: swfont.hxx:159
const Size & GetSize() const
Definition: drawfont.hxx:242
void SetActual(SwFontScript nNew)
Definition: swfont.hxx:747
void SetBlink(const bool bBlink)
Definition: swfont.hxx:818
short CheckKerning_()
Definition: swfont.cxx:1018
OUString CalcCaseMap(const OUString &rTxt) const
bool IsRightToLeft() const
Definition: frame.hxx:963
short GetEscapement() const
#define RES_CHRATR_HIGHLIGHT
Definition: hintids.hxx:110
const SvxPostureItem & GetPosture(bool=true) const
Definition: charatr.hxx:50
SwFontScript
Definition: swfont.hxx:122
void Invalidate()
Definition: swfont.hxx:331
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
FontStrikeout GetStrikeout() const
vcl::RenderContext & GetOut() const
Definition: drawfont.hxx:180
const SvxWordLineModeItem & GetWordLineMode(bool=true) const
Definition: charatr.hxx:66
#define CH_TXT_ATR_FIELDEND
Definition: hintids.hxx:53
#define RES_CHRATR_SHADOWED
Definition: hintids.hxx:81
void Unlock()
Definition: swcache.cxx:483
SvStatistics g_SvStat
Definition: swfont.cxx:62
#define RES_CHRATR_AUTOKERN
Definition: hintids.hxx:85
const boost::optional< editeng::SvxBorderLine > & GetAbsLeftBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:176
void DrawText(SwDrawTextInfo &rInf)
Definition: fntcache.cxx:839
bool IsVertical() const
Definition: frame.hxx:949
#define SPACING_PRECISION_FACTOR
Definition: scriptinfo.hxx:37
#define SAL_WARN(area, stream)
#define RES_CHRATR_CROSSEDOUT
Definition: hintids.hxx:73
void SetText(const OUString &rNew)
Definition: drawfont.hxx:413
short GetFixKerning() const
void SetAutoKern(FontKerning nAutoKern)
Definition: swfont.hxx:633
TextFrameIndex GetIdx() const
Definition: drawfont.hxx:263
void SetDiffFnt(const SfxItemSet *pSet, const IDocumentSettingAccess *pIDocumentSettingAccess)
Definition: swfont.cxx:496
SvxShadowLocation m_aShadowLocation
Definition: swfont.hxx:156
bool IsSpaceStop() const
Definition: drawfont.hxx:372
sal_uInt16 CalcEscHeight(const sal_uInt16 nOldHeight, const sal_uInt16 nOldAscent) const
Definition: swfont.cxx:1002
sal_uInt16 m_nTopBorderDist
Definition: swfont.hxx:149
STRIKEOUT_NONE
void SetProportion(const sal_uInt8 nNewPropr)
Definition: swfont.hxx:765
SvxShadowLocation GetAbsShadowLocation(const bool bVertLayout, const bool bVertLayoutLRBT) const
Get the absolute shadow location dependent from orientation.
Definition: swfont.cxx:223
void SetVertical(sal_uInt16 nDir, const bool bVertLayout=false, const bool bVertLayoutLRBT=false)
Definition: swfont.cxx:441
void SetHighlightColor(const Color &aNewColor)
Definition: swfont.hxx:949
FontLineStyle
void ChgFnt(SwViewShell const *pSh, OutputDevice &rOut)
Definition: swfont.hxx:176
Color m_aUnderColor
Definition: swfont.hxx:139
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
sal_uInt16 m_nOrgHeight
Definition: swfont.hxx:59
const SvxWeightItem & GetWeight(bool=true) const
Definition: charatr.hxx:56
sal_uInt8 m_nMetaCount
Definition: swfont.hxx:160
void SetOverline(const FontLineStyle eOverline)
Definition: swfont.hxx:560
const editeng::SvxBorderLine * GetBottom() const
const SvxFontItem & GetFont(bool=true) const
Definition: charatr.hxx:84
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
void SetTopBorderDist(const sal_uInt16 nTopDist)
Definition: swfont.hxx:835
const SvxPostureItem & GetCJKPosture(bool=true) const
Definition: charatr.hxx:52
const SvxCharReliefItem & GetCharRelief(bool=true) const
Definition: charatr.hxx:114
long Y() const
const Color & GetValue() const
void AllocFontCacheId(SwViewShell const *pSh, SwFontScript nWhich)
Definition: swfont.cxx:943
const boost::optional< editeng::SvxBorderLine > & GetAbsRightBorder(const bool bVertLayout, const bool bVertLayoutLRBT) const
Definition: swfont.cxx:200
const void * GetOwner() const
Definition: swcache.hxx:167
Size GetTextSize(SwDrawTextInfo &rInf)
determine the TextSize (of the printer)
Definition: fntcache.cxx:1891
sal_uInt16 GetWidth() const
SvxShadowLocation
short CheckKerning()
Definition: swfont.hxx:112
void setHeight(long nHeight)
bool m_bGreyWave
Definition: swfont.hxx:170