LibreOffice Module svx (master)  1
fntctrl.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 <sfx2/dialoghelper.hxx>
21 #include <sfx2/viewsh.hxx>
22 #include <sfx2/printer.hxx>
23 #include <vcl/metric.hxx>
24 #include <vcl/svapp.hxx>
25 #include <vcl/settings.hxx>
26 #include <unicode/uchar.h>
27 #include <com/sun/star/uno/Reference.h>
28 #include <com/sun/star/i18n/BreakIterator.hpp>
30 
31 #include <com/sun/star/i18n/ScriptType.hpp>
32 
33 #include <vector>
34 #include <deque>
35 #include <optional>
36 #include <svtools/colorcfg.hxx>
37 #include <svtools/sampletext.hxx>
38 
39 #include <svx/fntctrl.hxx>
40 #include <svx/svxids.hrc>
41 
42 // Item set includes
43 #include <svl/itemset.hxx>
44 #include <svl/itempool.hxx>
45 #include <svl/stritem.hxx>
46 #include <svl/languageoptions.hxx>
47 
48 #include <editeng/colritem.hxx>
49 #include <editeng/fontitem.hxx>
50 #include <editeng/editids.hrc>
51 #include <editeng/postitem.hxx>
52 #include <editeng/udlnitem.hxx>
54 #include <editeng/contouritem.hxx>
55 #include <editeng/wghtitem.hxx>
56 #include <editeng/fhgtitem.hxx>
57 #include <editeng/shdditem.hxx>
59 #include <editeng/wrlmitem.hxx>
60 #include <editeng/cmapitem.hxx>
61 #include <editeng/kernitem.hxx>
62 #include <editeng/brushitem.hxx>
66 #include <editeng/langitem.hxx>
67 
68 //TODO: remove this and calculate off the actual size of text, not
69 //an arbitrary number of characters
70 #define TEXT_WIDTH 80
71 
72 using namespace ::com::sun::star::uno;
73 using namespace ::com::sun::star::lang;
74 using ::com::sun::star::i18n::XBreakIterator;
75 using ::com::sun::star::i18n::BreakIterator;
76 
77 
78 // small helper functions to set fonts
79 
80 namespace
81 {
82 void scaleFontWidth(vcl::Font& rFont, vcl::RenderContext const & rRenderContext,tools::Long& n100PercentFont)
83 {
84  rFont.SetAverageFontWidth(0);
85  n100PercentFont = rRenderContext.GetFontMetric(rFont).GetAverageFontWidth();
86 }
87 
88 void initFont(vcl::Font& rFont)
89 {
90  rFont.SetTransparent(true);
92 }
93 
94 void setFontSize(vcl::Font& rFont)
95 {
96  Size aSize(rFont.GetFontSize());
97  aSize.setHeight( (aSize.Height() * 3) / 5 );
98  aSize.setWidth( (aSize.Width() * 3) / 5 );
99  rFont.SetFontSize(aSize);
100 }
101 
102 void calcFontHeightAnyAscent(vcl::RenderContext& rRenderContext, const vcl::Font& rFont, tools::Long& nHeight, tools::Long& nAscent)
103 {
104  if (!nHeight)
105  {
106  rRenderContext.SetFont(rFont);
107  FontMetric aMetric(rRenderContext.GetFontMetric());
108  nHeight = aMetric.GetLineHeight();
109  nAscent = aMetric.GetAscent();
110  }
111 }
112 
113 void setFont(const SvxFont& rNewFont, SvxFont& rImplFont)
114 {
115  rImplFont = rNewFont;
116  rImplFont.SetTransparent(true);
117  rImplFont.SetAlignment(ALIGN_BASELINE);
118 }
119 
120 /*
121  * removes line feeds and carriage returns from string
122  * returns if param is empty
123  */
124 bool CleanAndCheckEmpty(OUString& rText)
125 {
126  bool bEmpty = true;
127  for (sal_Int32 i = 0; i < rText.getLength(); ++i)
128  {
129  if (0xa == rText[i] || 0xd == rText[i])
130  rText = rText.replaceAt(i, 1, " ");
131  else
132  bEmpty = false;
133  }
134  return bEmpty;
135 }
136 } // end anonymous namespace
137 
139 {
140  friend class SvxFontPrevWindow;
141 
145 
146  Reference <XBreakIterator> mxBreak;
147  std::vector<tools::Long> maTextWidth;
148  std::deque<sal_Int32> maScriptChg;
149  std::vector<sal_uInt16> maScriptType;
152  OUString maText;
153  OUString maScriptText;
154  std::optional<Color> mxColor;
155  std::optional<Color> mxBackColor;
156  std::optional<Color> mxTextLineColor;
157  std::optional<Color> mxOverlineColor;
161 
162  tools::Long mn100PercentFontWidth; // initial -1 -> not set yet
165  sal_uInt16 mnFontWidthScale;
166 
167  bool mbSelection : 1;
168  bool mbGetSelection : 1;
169  bool mbTwoLines : 1;
171  bool mbTextInited : 1;
172 
175 
176 
177 public:
179  mpPrinter(nullptr),
180  mbDelPrinter(false),
181  mnAscent(0),
182  mcStartBracket(0),
183  mcEndBracket(0),
184  mnFontWidthScale(100),
185  mbSelection(false),
186  mbGetSelection(false),
187  mbTwoLines(false),
188  mbUseFontNameAsText(false),
189  mbTextInited(false)
190  {
191  SvtLanguageOptions aLanguageOptions;
192  m_bCJKEnabled = aLanguageOptions.IsAnyEnabled();
193  m_bCTLEnabled = aLanguageOptions.IsCTLFontEnabled();
196  }
197 
199  {
200  if (mbDelPrinter)
201  mpPrinter.disposeAndClear();
202  }
203 
204  void CheckScript();
205  Size CalcTextSize(vcl::RenderContext& rRenderContext, OutputDevice const * pPrinter, const SvxFont& rFont);
206  void DrawPrev(vcl::RenderContext& rRenderContext, Printer* pPrinter, Point& rPt, const SvxFont& rFont);
207 
208  bool SetFontWidthScale(sal_uInt16 nScaleInPercent);
209  inline void Invalidate100PercentFontWidth();
210  inline bool Is100PercentFontWidthValid() const;
211  void ScaleFontWidth(vcl::RenderContext const & rRenderContext);
212  // scales rNonCJKFont and aCJKFont depending on nFontWidthScale and
213  // sets the 100%-Font-Widths
214 };
215 
217 {
219 }
220 
222 {
224  ( mn100PercentFontWidth != -1 && mn100PercentFontWidthCJK != -1 ) ||
225  ( mn100PercentFontWidth == -1 && mn100PercentFontWidthCTL == -1 ) ||
227  "*FontPrevWin_Impl::Is100PercentFontWidthValid(): 100PercentFontWidth's not synchronous" );
228  return mn100PercentFontWidth != -1;
229 }
230 
231 /*
232  * evaluates the scripttypes of the actual string.
233  * Afterwards the positions of script change are notified in aScriptChg,
234  * the scripttypes in aScriptType.
235  * The aTextWidth array will be filled with zero.
236  */
238 {
239  assert(!maText.isEmpty()); // must have a preview text here!
240  if (maText == maScriptText)
241  {
242  return; // already initialized
243  }
244 
246 
247  maScriptChg.clear();
248  maScriptType.clear();
249  maTextWidth.clear();
250 
251  if (!mxBreak.is())
252  {
253  Reference<XComponentContext> xContext = ::comphelper::getProcessComponentContext();
254  mxBreak = BreakIterator::create(xContext);
255  }
256 
257  sal_uInt16 nScript = 0;
258  sal_Int32 nChg = 0;
259 
260  while (nChg < maText.getLength())
261  {
262  nScript = mxBreak->getScriptType(maText, nChg);
263  nChg = mxBreak->endOfScript(maText, nChg, nScript);
264  if (nChg < maText.getLength() && nChg > 0 &&
265  (css::i18n::ScriptType::WEAK ==
266  mxBreak->getScriptType(maText, nChg - 1)))
267  {
268  int8_t nType = u_charType(maText[nChg]);
269  if (nType == U_NON_SPACING_MARK || nType == U_ENCLOSING_MARK ||
270  nType == U_COMBINING_SPACING_MARK)
271  {
272  maScriptChg.push_back(nChg - 1);
273  }
274  else
275  {
276  maScriptChg.push_back(nChg);
277  }
278  }
279  else
280  {
281  maScriptChg.push_back(nChg);
282  }
283  maScriptType.push_back(nScript);
284  maTextWidth.push_back(0);
285  }
286 }
287 
288 /*
289  * Size FontPrevWin_Impl::CalcTextSize(..)
290  * fills the aTextWidth array with the text width of every part
291  * of the actual string without a script change inside.
292  * For Latin parts the given rFont will be used,
293  * for Asian parts the aCJKFont.
294  * The returned size contains the whole string.
295  * The member nAscent is calculated to the maximal ascent of all used fonts.
296  */
297 
298 Size FontPrevWin_Impl::CalcTextSize(vcl::RenderContext& rRenderContext, OutputDevice const * _pPrinter, const SvxFont& rInFont)
299 {
300  sal_uInt16 nScript;
301  sal_uInt16 nIdx = 0;
302  sal_Int32 nStart = 0;
303  sal_Int32 nEnd;
304  size_t nCnt = maScriptChg.size();
305 
306  if (nCnt)
307  {
308  nEnd = maScriptChg[nIdx];
309  nScript = maScriptType[nIdx];
310  }
311  else
312  {
313  nEnd = maText.getLength();
314  nScript = css::i18n::ScriptType::LATIN;
315  }
316  tools::Long nTxtWidth = 0;
317  tools::Long nCJKHeight = 0;
318  tools::Long nCTLHeight = 0;
319  tools::Long nHeight = 0;
320  mnAscent = 0;
321  tools::Long nCJKAscent = 0;
322  tools::Long nCTLAscent = 0;
323 
324  do
325  {
326  const SvxFont& rFont = (nScript == css::i18n::ScriptType::ASIAN) ?
327  maCJKFont :
328  ((nScript == css::i18n::ScriptType::COMPLEX) ?
329  maCTLFont :
330  rInFont);
331  tools::Long nWidth = rFont.GetTextSize(_pPrinter, maText, nStart, nEnd - nStart).Width();
332  if (nIdx >= maTextWidth.size())
333  break;
334 
335  maTextWidth[nIdx++] = nWidth;
336  nTxtWidth += nWidth;
337 
338  switch (nScript)
339  {
340  case css::i18n::ScriptType::ASIAN:
341  calcFontHeightAnyAscent(rRenderContext, maCJKFont, nCJKHeight, nCJKAscent);
342  break;
343  case css::i18n::ScriptType::COMPLEX:
344  calcFontHeightAnyAscent(rRenderContext, maCTLFont, nCTLHeight, nCTLAscent);
345  break;
346  default:
347  calcFontHeightAnyAscent(rRenderContext, rFont, nHeight, mnAscent);
348  }
349 
350  if (nEnd < maText.getLength() && nIdx < nCnt)
351  {
352  nStart = nEnd;
353  nEnd = maScriptChg[nIdx];
354  nScript = maScriptType[nIdx];
355  }
356  else
357  break;
358  }
359  while(true);
360 
361  nHeight -= mnAscent;
362  nCJKHeight -= nCJKAscent;
363  nCTLHeight -= nCTLAscent;
364 
365  if (nHeight < nCJKHeight)
366  nHeight = nCJKHeight;
367 
368  if (mnAscent < nCJKAscent)
369  mnAscent = nCJKAscent;
370 
371  if (nHeight < nCTLHeight)
372  nHeight = nCTLHeight;
373 
374  if (mnAscent < nCTLAscent)
375  mnAscent = nCTLAscent;
376 
377  nHeight += mnAscent;
378 
379  Size aTxtSize(nTxtWidth, nHeight);
380  return aTxtSize;
381 }
382 
383 /*
384  * void FontPrevWin_Impl::DrawPrev(..)
385  * calls SvxFont::DrawPrev(..) for every part of the string without a script
386  * change inside, for Asian parts the aCJKFont will be used, otherwise the
387  * given rFont.
388  */
389 
390 void FontPrevWin_Impl::DrawPrev(vcl::RenderContext& rRenderContext, Printer* _pPrinter, Point &rPt, const SvxFont& rInFont)
391 {
392  vcl::Font aOldFont = _pPrinter->GetFont();
393  sal_uInt16 nScript;
394  sal_uInt16 nIdx = 0;
395  sal_Int32 nStart = 0;
396  sal_Int32 nEnd;
397  size_t nCnt = maScriptChg.size();
398  if (nCnt)
399  {
400  nEnd = maScriptChg[nIdx];
401  nScript = maScriptType[nIdx];
402  }
403  else
404  {
405  nEnd = maText.getLength();
406  nScript = css::i18n::ScriptType::LATIN;
407  }
408  do
409  {
410  const SvxFont& rFont = (nScript == css::i18n::ScriptType::ASIAN)
411  ? maCJKFont
412  : ((nScript == css::i18n::ScriptType::COMPLEX)
413  ? maCTLFont
414  : rInFont);
415  _pPrinter->SetFont(rFont);
416 
417  rFont.DrawPrev(&rRenderContext, _pPrinter, rPt, maText, nStart, nEnd - nStart);
418 
419  rPt.AdjustX(maTextWidth[nIdx++] );
420  if (nEnd < maText.getLength() && nIdx < nCnt)
421  {
422  nStart = nEnd;
423  nEnd = maScriptChg[nIdx];
424  nScript = maScriptType[nIdx];
425  }
426  else
427  break;
428  }
429  while(true);
430  _pPrinter->SetFont(aOldFont);
431 }
432 
433 
434 bool FontPrevWin_Impl::SetFontWidthScale(sal_uInt16 nScale)
435 {
436  if (mnFontWidthScale != nScale)
437  {
438  mnFontWidthScale = nScale;
439  return true;
440  }
441 
442  return false;
443 }
444 
446 {
448  {
449  scaleFontWidth(maFont, rOutDev, mn100PercentFontWidth);
450  scaleFontWidth(maCJKFont, rOutDev, mn100PercentFontWidthCJK);
451  scaleFontWidth(maCTLFont, rOutDev, mn100PercentFontWidthCTL);
452  }
453 
454  maFont.SetAverageFontWidth(mn100PercentFontWidth * mnFontWidthScale / 100);
455  maCJKFont.SetAverageFontWidth(mn100PercentFontWidthCJK * mnFontWidthScale / 100);
456  maCTLFont.SetAverageFontWidth(mn100PercentFontWidthCTL * mnFontWidthScale / 100);
457 }
458 
459 static bool GetWhich (const SfxItemSet& rSet, sal_uInt16 nSlot, sal_uInt16& rWhich)
460 {
461  rWhich = rSet.GetPool()->GetWhich(nSlot);
462  return rSet.GetItemState(rWhich) >= SfxItemState::DEFAULT;
463 }
464 
465 static void SetPrevFont(const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont)
466 {
467  sal_uInt16 nWhich;
468  if (GetWhich(rSet, nSlot, nWhich))
469  {
470  const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(rSet.Get(nWhich));
471  rFont.SetFamily(rFontItem.GetFamily());
472  rFont.SetFamilyName(rFontItem.GetFamilyName());
473  rFont.SetPitch(rFontItem.GetPitch());
474  rFont.SetCharSet(rFontItem.GetCharSet());
475  rFont.SetStyleName(rFontItem.GetStyleName());
476  }
477 }
478 
479 static void SetPrevFontStyle( const SfxItemSet& rSet, sal_uInt16 nPosture, sal_uInt16 nWeight, SvxFont& rFont )
480 {
481  sal_uInt16 nWhich;
482  if( GetWhich( rSet, nPosture, nWhich ) )
483  {
484  const SvxPostureItem& rItem = static_cast<const SvxPostureItem&>( rSet.Get( nWhich ) );
485  rFont.SetItalic( rItem.GetValue() != ITALIC_NONE ? ITALIC_NORMAL : ITALIC_NONE );
486  }
487 
488  if( GetWhich( rSet, nWeight, nWhich ) )
489  {
490  const SvxWeightItem& rItem = static_cast<const SvxWeightItem&>( rSet.Get( nWhich ) );
491  rFont.SetWeight( rItem.GetValue() != WEIGHT_NORMAL ? WEIGHT_BOLD : WEIGHT_NORMAL );
492  }
493 }
494 
495 static void SetPrevFontEscapement(SvxFont& rFont, sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc)
496 {
497  rFont.SetPropr(nProp);
498  rFont.SetProprRel(nEscProp);
499  rFont.SetEscapement(nEsc);
500 }
501 
503 {
504  rRenderContext.SetTextColor( svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
505  rRenderContext.SetBackground( svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor );
506 }
507 
509 {
510  CustomWidgetController::SetDrawingArea(pDrawingArea);
511  Size aPrefSize(getPreviewStripSize(pDrawingArea->get_ref_device()));
512  pDrawingArea->set_size_request(aPrefSize.Width(), aPrefSize.Height());
513 
514  pImpl.reset(new FontPrevWin_Impl);
516 
517  if (pSh)
518  pImpl->mpPrinter = pSh->GetPrinter();
519 
520  if (!pImpl->mpPrinter)
521  {
522  pImpl->mpPrinter = VclPtr<Printer>::Create();
523  pImpl->mbDelPrinter = true;
524  }
525  initFont(pImpl->maFont);
526  initFont(pImpl->maCJKFont);
527  initFont(pImpl->maCTLFont);
528 
529  Invalidate();
530 }
531 
533 {
534 }
535 
537 {
538 }
539 
541 {
542  return pImpl->maCTLFont;
543 }
544 
546 {
547  return pImpl->maCJKFont;
548 }
549 
551 {
552  pImpl->Invalidate100PercentFontWidth(); // because the user might change the size
553  return pImpl->maFont;
554 }
555 
557 {
558  return pImpl->maFont;
559 }
560 
561 void SvxFontPrevWindow::SetPreviewText( const OUString& rString )
562 {
563  pImpl->maText = rString;
564  pImpl->mbTextInited = true;
565 }
566 
568 {
569  pImpl->mbUseFontNameAsText = true;
570 }
571 
572 void SvxFontPrevWindow::SetFont( const SvxFont& rNormalOutFont, const SvxFont& rCJKOutFont, const SvxFont& rCTLFont )
573 {
574  setFont(rNormalOutFont, pImpl->maFont);
575  setFont(rCJKOutFont, pImpl->maCJKFont);
576  setFont(rCTLFont, pImpl->maCTLFont);
577 
578  pImpl->Invalidate100PercentFontWidth();
579  Invalidate();
580 }
581 
583 {
584  pImpl->mxColor = rColor;
585  Invalidate();
586 }
587 
589 {
590  pImpl->mxColor.reset();
591  Invalidate();
592 }
593 
595 {
596  pImpl->mxTextLineColor = rColor;
597  Invalidate();
598 }
599 
601 {
602  pImpl->mxOverlineColor = rColor;
603  Invalidate();
604 }
605 
607 {
608  rRenderContext.Push(PushFlags::ALL);
609  rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip));
610 
611  ApplySettings(rRenderContext);
612 
613  Printer* pPrinter = pImpl->mpPrinter;
614  const SvxFont& rFont = pImpl->maFont;
615  const SvxFont& rCJKFont = pImpl->maCJKFont;
616  const SvxFont& rCTLFont = pImpl->maCTLFont;
617 
618  if (!IsEnabled())
619  {
620  const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
621  const Size aLogSize(rRenderContext.GetOutputSize());
622 
623  tools::Rectangle aRect(Point(0, 0), aLogSize);
624  rRenderContext.SetLineColor();
625  rRenderContext.SetFillColor(rStyleSettings.GetWindowColor());
626  rRenderContext.DrawRect(aRect);
627  }
628  else
629  {
630  if (!pImpl->mbSelection && !pImpl->mbTextInited)
631  {
632  using namespace css::i18n::ScriptType;
633 
635 
636  if (pSh && !pImpl->mbGetSelection && !pImpl->mbUseFontNameAsText)
637  {
638  pImpl->maText = pSh->GetSelectionText();
639  pImpl->mbGetSelection = true;
640  pImpl->mbSelection = !CleanAndCheckEmpty(pImpl->maText);
641  }
642 
643  if (!pImpl->mbSelection || pImpl->mbUseFontNameAsText)
644  {
645  //If we're showing multiple sample texts, then they're all
646  //sample texts. If only showing Latin, continue to use
647  //the fontname as the preview
648  if ((pImpl->m_bCJKEnabled) || (pImpl->m_bCTLEnabled))
649  pImpl->maText = makeRepresentativeTextForFont(LATIN, rFont);
650  else
651  pImpl->maText = rFont.GetFamilyName();
652 
653  if (pImpl->m_bCJKEnabled)
654  {
655  if (!pImpl->maText.isEmpty())
656  pImpl->maText += " ";
657  pImpl->maText += makeRepresentativeTextForFont(ASIAN, rCJKFont);
658 
659  }
660  if (pImpl->m_bCTLEnabled)
661  {
662  if (!pImpl->maText.isEmpty())
663  pImpl->maText += " ";
664  pImpl->maText += makeRepresentativeTextForFont(COMPLEX, rCTLFont);
665  }
666  }
667 
668  if (pImpl->maText.isEmpty())
669  { // fdo#58427: still no text? let's try that one...
670  pImpl->maText = makeRepresentativeTextForFont(LATIN, rFont);
671  }
672 
673  bool bEmpty = CleanAndCheckEmpty(pImpl->maText);
674  if (bEmpty)
675  pImpl->maText = OUString();
676 
677  if (pImpl->maText.getLength() > (TEXT_WIDTH - 1))
678  {
679  const sal_Int32 nSpaceIdx = pImpl->maText.indexOf(" ", TEXT_WIDTH);
680  if (nSpaceIdx != -1)
681  pImpl->maText = pImpl->maText.copy(0, nSpaceIdx);
682  else
683  pImpl->maText = pImpl->maText.copy(0, (TEXT_WIDTH - 1));
684  }
685  }
686 
687  // calculate text width scaling
688  pImpl->ScaleFontWidth(rRenderContext);
689 
690  pImpl->CheckScript();
691  Size aTxtSize = pImpl->CalcTextSize(rRenderContext, pPrinter, rFont);
692 
693  const Size aLogSize(rRenderContext.GetOutputSize());
694 
695  tools::Long nX = aLogSize.Width() / 2 - aTxtSize.Width() / 2;
696  tools::Long nY = aLogSize.Height() / 2 - aTxtSize.Height() / 2;
697 
698  if (nY + pImpl->mnAscent > aLogSize.Height())
699  nY = aLogSize.Height() - pImpl->mnAscent;
700 
701  if (pImpl->mxBackColor)
702  {
703  tools::Rectangle aRect(Point(0, 0), aLogSize);
704  Color aLineCol = rRenderContext.GetLineColor();
705  Color aFillCol = rRenderContext.GetFillColor();
706  rRenderContext.SetLineColor();
707  rRenderContext.SetFillColor(*pImpl->mxBackColor);
708  rRenderContext.DrawRect(aRect);
709  rRenderContext.SetLineColor(aLineCol);
710  rRenderContext.SetFillColor(aFillCol);
711  }
712  if (pImpl->mxColor)
713  {
714  tools::Rectangle aRect(Point(nX, nY), aTxtSize);
715  Color aLineCol = rRenderContext.GetLineColor();
716  Color aFillCol = rRenderContext.GetFillColor();
717  rRenderContext.SetLineColor();
718  rRenderContext.SetFillColor(*pImpl->mxColor);
719  rRenderContext.DrawRect(aRect);
720  rRenderContext.SetLineColor(aLineCol);
721  rRenderContext.SetFillColor(aFillCol);
722  }
723 
724  if (pImpl->mxTextLineColor)
725  {
726  rRenderContext.SetTextLineColor(*pImpl->mxTextLineColor);
727  }
728 
729  if (pImpl->mxOverlineColor)
730  {
731  rRenderContext.SetOverlineColor(*pImpl->mxOverlineColor);
732  }
733 
734  tools::Long nStdAscent = pImpl->mnAscent;
735  nY += nStdAscent;
736 
737  if (IsTwoLines())
738  {
739  SvxFont aSmallFont(rFont);
740  Size aOldSize = pImpl->maCJKFont.GetFontSize();
741  setFontSize(aSmallFont);
742  setFontSize(pImpl->maCJKFont);
743 
744  tools::Long nStartBracketWidth = 0;
745  tools::Long nEndBracketWidth = 0;
746  tools::Long nTextWidth = 0;
747  if (pImpl->mcStartBracket)
748  {
749  OUString sBracket(pImpl->mcStartBracket);
750  nStartBracketWidth = rFont.GetTextSize(pPrinter, sBracket).Width();
751  }
752  if (pImpl->mcEndBracket)
753  {
754  OUString sBracket(pImpl->mcEndBracket);
755  nEndBracketWidth = rFont.GetTextSize(pPrinter, sBracket).Width();
756  }
757  nTextWidth = pImpl->CalcTextSize(rRenderContext, pPrinter, aSmallFont).Width();
758  tools::Long nResultWidth = nStartBracketWidth;
759  nResultWidth += nEndBracketWidth;
760  nResultWidth += nTextWidth;
761 
762  tools::Long _nX = (aLogSize.Width() - nResultWidth) / 2;
763  rRenderContext.DrawLine(Point(0, nY), Point(_nX, nY));
764  rRenderContext.DrawLine(Point(_nX + nResultWidth, nY), Point(aLogSize.Width(), nY));
765 
766  tools::Long nSmallAscent = pImpl->mnAscent;
767  tools::Long nOffset = (nStdAscent - nSmallAscent) / 2;
768 
769  if (pImpl->mcStartBracket)
770  {
771  OUString sBracket(pImpl->mcStartBracket);
772  rFont.DrawPrev(&rRenderContext, pPrinter, Point(_nX, nY - nOffset - 4), sBracket);
773  _nX += nStartBracketWidth;
774  }
775 
776  Point aTmpPoint1(_nX, nY - nSmallAscent - 2);
777  Point aTmpPoint2(_nX, nY);
778  pImpl->DrawPrev(rRenderContext, pPrinter, aTmpPoint1, aSmallFont);
779  pImpl->DrawPrev(rRenderContext, pPrinter, aTmpPoint2, aSmallFont);
780 
781  _nX += nTextWidth;
782  if (pImpl->mcEndBracket)
783  {
784  Point aTmpPoint( _nX + 1, nY - nOffset - 4);
785  OUString sBracket(pImpl->mcEndBracket);
786  rFont.DrawPrev(&rRenderContext, pPrinter, aTmpPoint, sBracket);
787  }
788  pImpl->maCJKFont.SetFontSize(aOldSize);
789  }
790  else
791  {
792 
793  Color aLineCol = rRenderContext.GetLineColor();
794 
795  rRenderContext.SetLineColor(rFont.GetColor());
796  rRenderContext.DrawLine(Point(0, nY), Point(nX, nY));
797  rRenderContext.DrawLine(Point(nX + aTxtSize.Width(), nY), Point(aLogSize.Width(), nY));
798  rRenderContext.SetLineColor(aLineCol);
799 
800  Point aTmpPoint(nX, nY);
801  pImpl->DrawPrev(rRenderContext, pPrinter, aTmpPoint, rFont);
802  }
803  }
804  rRenderContext.Pop();
805 }
806 
808 {
809  return pImpl->mbTwoLines;
810 }
811 
813 {
814  pImpl->mbTwoLines = bSet;
815 }
816 
818 {
819  pImpl->mcStartBracket = cStart;
820  pImpl->mcEndBracket = cEnd;
821 }
822 
824 {
825  if (pImpl->SetFontWidthScale(n))
826  Invalidate();
827 }
828 
830 {
831  Color aColor(COL_AUTO);
832  if ( pImpl->mxBackColor ) aColor = *pImpl->mxBackColor;
833  const bool bIsDark(aColor.IsDark());
834 
835  aColor = pImpl->maFont.GetColor();
836  if (aColor == COL_AUTO)
837  pImpl->maFont.SetColor( bIsDark ? COL_WHITE : COL_BLACK );
838  aColor = pImpl->maCJKFont.GetColor();
839  if (aColor == COL_AUTO)
840  pImpl->maCJKFont.SetColor( bIsDark ? COL_WHITE : COL_BLACK );
841  aColor = pImpl->maCTLFont.GetColor();
842  if (aColor == COL_AUTO)
843  pImpl->maCTLFont.SetColor( bIsDark ? COL_WHITE : COL_BLACK );
844 }
845 
846 void SvxFontPrevWindow::SetFontSize( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont )
847 {
848  sal_uInt16 nWhich;
849  tools::Long nH;
850  if (GetWhich(rSet, nSlot, nWhich))
851  {
852  nH = OutputDevice::LogicToLogic(static_cast<const SvxFontHeightItem&>(rSet.Get(nWhich)).GetHeight(),
853  rSet.GetPool()->GetMetric(nWhich),
854  MapUnit::MapTwip);
855  }
856  else
857  nH = 240;// as default 12pt
858 
859  rFont.SetFontSize(Size(0, nH));
860 }
861 
862 void SvxFontPrevWindow::SetFontLang(const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont)
863 {
864  sal_uInt16 nWhich;
865  LanguageType nLang;
866  if( GetWhich( rSet, nSlot, nWhich ) )
867  nLang = static_cast<const SvxLanguageItem&>(rSet.Get(nWhich)).GetLanguage();
868  else
869  nLang = LANGUAGE_NONE;
870  rFont.SetLanguage(nLang);
871 }
872 
873 void SvxFontPrevWindow::SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBackgroundToCharacter)
874 {
875  sal_uInt16 nWhich;
876  SvxFont& rFont = GetFont();
877  SvxFont& rCJKFont = GetCJKFont();
878  SvxFont& rCTLFont = GetCTLFont();
879 
880  // Preview string
881  if( GetWhich( rSet, SID_CHAR_DLG_PREVIEW_STRING, nWhich ) )
882  {
883  const SfxStringItem& rItem = static_cast<const SfxStringItem&>( rSet.Get( nWhich ) );
884  const OUString& aString = rItem.GetValue();
885  if( !aString.isEmpty() )
886  SetPreviewText( aString );
887  else
889  }
890 
891  // Underline
892  FontLineStyle eUnderline;
893  if( GetWhich( rSet, SID_ATTR_CHAR_UNDERLINE, nWhich ) )
894  {
895  const SvxUnderlineItem& rItem = static_cast<const SvxUnderlineItem&>( rSet.Get( nWhich ) );
896  eUnderline = rItem.GetValue();
897  }
898  else
899  eUnderline = LINESTYLE_NONE;
900 
901  rFont.SetUnderline( eUnderline );
902  rCJKFont.SetUnderline( eUnderline );
903  rCTLFont.SetUnderline( eUnderline );
904 
905  // Overline
906  FontLineStyle eOverline;
907  if( GetWhich( rSet, SID_ATTR_CHAR_OVERLINE, nWhich ) )
908  {
909  const SvxOverlineItem& rItem = static_cast<const SvxOverlineItem&>( rSet.Get( nWhich ) );
910  eOverline = rItem.GetValue();
911  }
912  else
913  eOverline = LINESTYLE_NONE;
914 
915  rFont.SetOverline( eOverline );
916  rCJKFont.SetOverline( eOverline );
917  rCTLFont.SetOverline( eOverline );
918 
919  // Strikeout
920  FontStrikeout eStrikeout;
921  if( GetWhich( rSet, SID_ATTR_CHAR_STRIKEOUT, nWhich ) )
922  {
923  const SvxCrossedOutItem& rItem = static_cast<const SvxCrossedOutItem&>( rSet.Get( nWhich ) );
924  eStrikeout = rItem.GetValue();
925  }
926  else
927  eStrikeout = STRIKEOUT_NONE;
928 
929  rFont.SetStrikeout( eStrikeout );
930  rCJKFont.SetStrikeout( eStrikeout );
931  rCTLFont.SetStrikeout( eStrikeout );
932 
933  // WordLineMode
934  if( GetWhich( rSet, SID_ATTR_CHAR_WORDLINEMODE, nWhich ) )
935  {
936  const SvxWordLineModeItem& rItem = static_cast<const SvxWordLineModeItem&>( rSet.Get( nWhich ) );
937  rFont.SetWordLineMode( rItem.GetValue() );
938  rCJKFont.SetWordLineMode( rItem.GetValue() );
939  rCTLFont.SetWordLineMode( rItem.GetValue() );
940  }
941 
942  // Emphasis
943  if( GetWhich( rSet, SID_ATTR_CHAR_EMPHASISMARK, nWhich ) )
944  {
945  const SvxEmphasisMarkItem& rItem = static_cast<const SvxEmphasisMarkItem&>( rSet.Get( nWhich ) );
946  FontEmphasisMark eMark = rItem.GetEmphasisMark();
947  rFont.SetEmphasisMark( eMark );
948  rCJKFont.SetEmphasisMark( eMark );
949  rCTLFont.SetEmphasisMark( eMark );
950  }
951 
952  // Relief
953  if( GetWhich( rSet, SID_ATTR_CHAR_RELIEF, nWhich ) )
954  {
955  const SvxCharReliefItem& rItem = static_cast<const SvxCharReliefItem&>( rSet.Get( nWhich ) );
956  FontRelief eFontRelief = rItem.GetValue();
957  rFont.SetRelief( eFontRelief );
958  rCJKFont.SetRelief( eFontRelief );
959  rCTLFont.SetRelief( eFontRelief );
960  }
961 
962  // Effects
963  if( GetWhich( rSet, SID_ATTR_CHAR_CASEMAP, nWhich ) )
964  {
965  const SvxCaseMapItem& rItem = static_cast<const SvxCaseMapItem&>( rSet.Get( nWhich ) );
966  SvxCaseMap eCaseMap = rItem.GetValue();
967  rFont.SetCaseMap( eCaseMap );
968  rCJKFont.SetCaseMap( eCaseMap );
969  // #i78474# small caps do not exist in CTL fonts
970  rCTLFont.SetCaseMap( eCaseMap == SvxCaseMap::SmallCaps ? SvxCaseMap::NotMapped : eCaseMap );
971  }
972 
973  // Outline
974  if( GetWhich( rSet, SID_ATTR_CHAR_CONTOUR, nWhich ) )
975  {
976  const SvxContourItem& rItem = static_cast<const SvxContourItem&>( rSet.Get( nWhich ) );
977  bool bOutline = rItem.GetValue();
978  rFont.SetOutline( bOutline );
979  rCJKFont.SetOutline( bOutline );
980  rCTLFont.SetOutline( bOutline );
981  }
982 
983  // Shadow
984  if( GetWhich( rSet, SID_ATTR_CHAR_SHADOWED, nWhich ) )
985  {
986  const SvxShadowedItem& rItem = static_cast<const SvxShadowedItem&>( rSet.Get( nWhich ) );
987  bool bShadow = rItem.GetValue();
988  rFont.SetShadow( bShadow );
989  rCJKFont.SetShadow( bShadow );
990  rCTLFont.SetShadow( bShadow );
991  }
992 
993  // Background
994  bool bTransparent;
995  if( GetWhich( rSet, bPreviewBackgroundToCharacter ? SID_ATTR_BRUSH : SID_ATTR_BRUSH_CHAR, nWhich ) )
996  {
997  const SvxBrushItem& rBrush = static_cast<const SvxBrushItem&>( rSet.Get( nWhich ) );
998  const Color& rColor = rBrush.GetColor();
999  bTransparent = rColor.IsTransparent();
1000  rFont.SetFillColor( rColor );
1001  rCJKFont.SetFillColor( rColor );
1002  rCTLFont.SetFillColor( rColor );
1003  }
1004  else
1005  bTransparent = true;
1006 
1007  rFont.SetTransparent( bTransparent );
1008  rCJKFont.SetTransparent( bTransparent );
1009  rCTLFont.SetTransparent( bTransparent );
1010 
1011  // Font
1012  SetPrevFont( rSet, SID_ATTR_CHAR_FONT, rFont );
1013  SetPrevFont( rSet, SID_ATTR_CHAR_CJK_FONT, rCJKFont );
1014  SetPrevFont( rSet, SID_ATTR_CHAR_CTL_FONT, rCTLFont );
1015 
1016  // Style
1017  SetPrevFontStyle( rSet, SID_ATTR_CHAR_POSTURE, SID_ATTR_CHAR_WEIGHT, rFont );
1018  SetPrevFontStyle( rSet, SID_ATTR_CHAR_CJK_POSTURE, SID_ATTR_CHAR_CJK_WEIGHT, rCJKFont );
1019  SetPrevFontStyle( rSet, SID_ATTR_CHAR_CTL_POSTURE, SID_ATTR_CHAR_CTL_WEIGHT, rCTLFont );
1020 
1021  // Size
1022  SetFontSize( rSet, SID_ATTR_CHAR_FONTHEIGHT, rFont );
1023  SetFontSize( rSet, SID_ATTR_CHAR_CJK_FONTHEIGHT, rCJKFont );
1024  SetFontSize( rSet, SID_ATTR_CHAR_CTL_FONTHEIGHT, rCTLFont );
1025 
1026  // Language
1027  SetFontLang( rSet, SID_ATTR_CHAR_LANGUAGE, rFont );
1028  SetFontLang( rSet, SID_ATTR_CHAR_CJK_LANGUAGE, rCJKFont );
1029  SetFontLang( rSet, SID_ATTR_CHAR_CTL_LANGUAGE, rCTLFont );
1030 
1031  // Color
1032  if( GetWhich( rSet, SID_ATTR_CHAR_COLOR, nWhich ) )
1033  {
1034  const SvxColorItem& rItem = static_cast<const SvxColorItem&>( rSet.Get( nWhich ) );
1035  Color aCol( rItem.GetValue() );
1036  rFont.SetColor( aCol );
1037 
1038  rCJKFont.SetColor( aCol );
1039  rCTLFont.SetColor( aCol );
1040 
1041  AutoCorrectFontColor(); // handle color COL_AUTO
1042  }
1043 
1044  // Kerning
1045  if( GetWhich( rSet, SID_ATTR_CHAR_KERNING, nWhich ) )
1046  {
1047  const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>( rSet.Get( nWhich ) );
1048  short nKern = static_cast<short>(OutputDevice::LogicToLogic(rItem.GetValue(), rSet.GetPool()->GetMetric(nWhich), MapUnit::MapTwip));
1049  rFont.SetFixKerning( nKern );
1050  rCJKFont.SetFixKerning( nKern );
1051  rCTLFont.SetFixKerning( nKern );
1052  }
1053 
1054  // Escapement
1055  const sal_uInt8 nProp = 100;
1056  short nEsc;
1057  sal_uInt8 nEscProp;
1058  if( GetWhich( rSet, SID_ATTR_CHAR_ESCAPEMENT, nWhich ) )
1059  {
1060  const SvxEscapementItem& rItem = static_cast<const SvxEscapementItem&>( rSet.Get( nWhich ) );
1061  nEsc = rItem.GetEsc();
1062  nEscProp = rItem.GetProportionalHeight();
1063 
1064  if( nEsc == DFLT_ESC_AUTO_SUPER )
1065  nEsc = DFLT_ESC_SUPER;
1066  else if( nEsc == DFLT_ESC_AUTO_SUB )
1067  nEsc = DFLT_ESC_SUB;
1068  }
1069  else
1070  {
1071  nEsc = 0;
1072  nEscProp = 100;
1073  }
1074  SetPrevFontEscapement( rFont, nProp, nEscProp, nEsc );
1075  SetPrevFontEscapement( rCJKFont, nProp, nEscProp, nEsc );
1076  SetPrevFontEscapement( rCTLFont, nProp, nEscProp, nEsc );
1077 
1078  // Font width scale
1079  if( GetWhich( rSet, SID_ATTR_CHAR_SCALEWIDTH, nWhich ) )
1080  {
1081  const SvxCharScaleWidthItem&rItem = static_cast<const SvxCharScaleWidthItem&>( rSet.Get( nWhich ) );
1082  SetFontWidthScale( rItem.GetValue() );
1083  }
1084 
1085  Invalidate();
1086 }
1087 
1088 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void CheckScript()
Definition: fntctrl.cxx:237
Size GetTextSize(const OutputDevice *pOut, const OUString &rTxt, const sal_Int32 nIdx=0, const sal_Int32 nLen=SAL_MAX_INT32) const
#define LANGUAGE_NONE
void SetPropr(const sal_uInt8 nNewPropr)
SvxFont & GetCTLFont()
Definition: fntctrl.cxx:540
void SetFontSize(const Size &)
void SetFontNameAsPreviewText()
Definition: fntctrl.cxx:567
VclPtr< Printer > mpPrinter
Definition: fntctrl.cxx:143
void SetAverageFontWidth(tools::Long nWidth)
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
SvxCaseMap
bool IsTransparent() const
std::vector< sal_uInt16 > maScriptType
Definition: fntctrl.cxx:149
long Long
sal_uInt8 & GetProportionalHeight()
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
FontEmphasisMark
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
SvxFont & GetCJKFont()
Definition: fntctrl.cxx:545
SvxFont maCTLFont
Definition: fntctrl.cxx:151
#define ASIAN
#define DFLT_ESC_AUTO_SUB
virtual OUString GetSelectionText(bool bCompleteWords=false)
FontPitch GetPitch() const
void SetMapMode()
FontFamily GetFamily() const
bool IsTwoLines() const
Definition: fntctrl.cxx:807
std::optional< Color > mxColor
Definition: fntctrl.cxx:154
WEIGHT_BOLD
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
sal_Unicode mcStartBracket
Definition: fntctrl.cxx:159
sal_uInt16 sal_Unicode
void SetBackground()
void DrawPrev(OutputDevice *pOut, Printer *pPrinter, const Point &rPos, const OUString &rTxt, const sal_Int32 nIdx=0, const sal_Int32 nLen=SAL_MAX_INT32) const
void ScaleFontWidth(vcl::RenderContext const &rRenderContext)
Definition: fntctrl.cxx:445
LINESTYLE_NONE
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
const vcl::Font & GetFont() const
void SetTextLineColor(const Color &rColor)
Definition: fntctrl.cxx:594
rtl_TextEncoding GetCharSet() const
OUString maScriptText
Definition: fntctrl.cxx:153
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: fntctrl.cxx:508
void SetFont(const SvxFont &rNormalFont, const SvxFont &rCJKFont, const SvxFont &rCTLFont)
Definition: fntctrl.cxx:572
void SetFixKerning(const short nNewKern)
Size getPreviewStripSize(const OutputDevice &rReference)
static SfxViewShell * Current()
#define DFLT_ESC_AUTO_SUPER
FontEmphasisMark GetEmphasisMark() const
FontMetric GetFontMetric() const
SvxFont & GetFont()
Definition: fntctrl.cxx:550
virtual OutputDevice & get_ref_device()=0
std::deque< sal_Int32 > maScriptChg
Definition: fntctrl.cxx:148
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SetTextLineColor()
void DrawRect(const tools::Rectangle &rRect)
const OUString & GetStyleName() const
void DrawPrev(vcl::RenderContext &rRenderContext, Printer *pPrinter, Point &rPt, const SvxFont &rFont)
Definition: fntctrl.cxx:390
const Color & GetColor() const
std::optional< Color > mxTextLineColor
Definition: fntctrl.cxx:156
std::optional< Color > mxOverlineColor
Definition: fntctrl.cxx:157
void SetAlignment(FontAlign)
void SetLineColor()
OUString maText
Definition: fntctrl.cxx:152
ALIGN_BASELINE
void Invalidate100PercentFontWidth()
Definition: fntctrl.cxx:216
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
int i
bool IsDark() const
LanguageType GetLanguage(SwWrtShell &rSh, sal_uInt16 nLangWhichId)
static bool GetWhich(const SfxItemSet &rSet, sal_uInt16 nSlot, sal_uInt16 &rWhich)
Definition: fntctrl.cxx:459
const OUString & GetValue() const
Size GetOutputSize() const
static void SetPrevFont(const SfxItemSet &rSet, sal_uInt16 nSlot, SvxFont &rFont)
Definition: fntctrl.cxx:465
void SetFillColor()
tools::Long Width() const
WEIGHT_NORMAL
const Color & GetLineColor() const
void SetTextColor(const Color &rColor)
bool Is100PercentFontWidthValid() const
Definition: fntctrl.cxx:221
const Size & GetFontSize() const
static SVX_DLLPRIVATE void ApplySettings(vcl::RenderContext &rRenderContext)
Definition: fntctrl.cxx:502
void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
Definition: fntctrl.cxx:606
void SetOverlineColor()
ITALIC_NONE
SvxFont maFont
Definition: fntctrl.cxx:142
bool SetFontWidthScale(sal_uInt16 nScaleInPercent)
Definition: fntctrl.cxx:434
SfxItemPool * GetPool() const
void SetTwoLines(bool bSet)
Definition: fntctrl.cxx:812
Size CalcTextSize(vcl::RenderContext &rRenderContext, OutputDevice const *pPrinter, const SvxFont &rFont)
Definition: fntctrl.cxx:298
sal_uInt16 mnFontWidthScale
Definition: fntctrl.cxx:165
const OUString & GetFamilyName() const
void SetCaseMap(const SvxCaseMap eNew)
std::vector< tools::Long > maTextWidth
Definition: fntctrl.cxx:147
tools::Long mn100PercentFontWidthCTL
Definition: fntctrl.cxx:164
void SetBrackets(sal_Unicode cStart, sal_Unicode cEnd)
Definition: fntctrl.cxx:817
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
#define DFLT_ESC_SUB
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
ITALIC_NORMAL
unsigned char sal_uInt8
bool mbUseFontNameAsText
Definition: fntctrl.cxx:170
void SetFont(const vcl::Font &rNewFont)
void SetTransparent(bool bTransparent)
Reference< XBreakIterator > mxBreak
Definition: fntctrl.cxx:146
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
static SVX_DLLPRIVATE void SetFontSize(const SfxItemSet &rSet, sal_uInt16 nSlot, SvxFont &rFont)
Definition: fntctrl.cxx:846
bool IsCTLFontEnabled() const
void SetColor(const Color &rColor)
Definition: fntctrl.cxx:582
static void SetPrevFontEscapement(SvxFont &rFont, sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc)
Definition: fntctrl.cxx:495
#define DFLT_ESC_SUPER
static VclPtr< reference_type > Create(Arg &&...arg)
tools::Long mn100PercentFontWidthCJK
Definition: fntctrl.cxx:163
bool IsAnyEnabled() const
tools::Long Height() const
static SVX_DLLPRIVATE void SetFontLang(const SfxItemSet &rSet, sal_uInt16 nSlot, SvxFont &rFont)
Definition: fntctrl.cxx:862
QPRO_FUNC_TYPE nType
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
const Color & GetWindowColor() const
sal_Unicode mcEndBracket
Definition: fntctrl.cxx:160
virtual SfxPrinter * GetPrinter(bool bCreate=false)
SvxFont maCJKFont
Definition: fntctrl.cxx:150
void setHeight(tools::Long nHeight)
void SetProprRel(const sal_uInt8 nNewPropr)
#define TEXT_WIDTH
Definition: fntctrl.cxx:70
void SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBackgroundToCharacter)
Definition: fntctrl.cxx:873
static void SetPrevFontStyle(const SfxItemSet &rSet, sal_uInt16 nPosture, sal_uInt16 nWeight, SvxFont &rFont)
Definition: fntctrl.cxx:479
tools::Long mnAscent
Definition: fntctrl.cxx:158
tools::Long mn100PercentFontWidth
Definition: fntctrl.cxx:162
void AutoCorrectFontColor()
Definition: fntctrl.cxx:829
OUString makeRepresentativeTextForFont(sal_Int16 nScriptType, const vcl::Font &rFont)
std::unique_ptr< FontPrevWin_Impl > pImpl
Definition: fntctrl.hxx:34
STRIKEOUT_NONE
FontLineStyle
virtual void set_size_request(int nWidth, int nHeight)=0
void Push(PushFlags nFlags=PushFlags::ALL)
void SetEscapement(const short nNewEsc)
tools::Long GetAverageFontWidth() const
void SetPreviewText(const OUString &rString)
Definition: fntctrl.cxx:561
FontStrikeout
#define COMPLEX
std::optional< Color > mxBackColor
Definition: fntctrl.cxx:155
FontRelief
tools::Long GetLineHeight() const
void SetFontWidthScale(sal_uInt16 nScaleInPercent)
Definition: fntctrl.cxx:823
const Color & GetValue() const
const Color & GetFillColor() const
void SetOverlineColor(const Color &rColor)
Definition: fntctrl.cxx:600
virtual ~SvxFontPrevWindow() override
Definition: fntctrl.cxx:536