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