LibreOffice Module cui (master)  1
chardlg.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 <vcl/svapp.hxx>
21 #include <vcl/idle.hxx>
22 #include <svtools/ctrltool.hxx>
23 #include <sfx2/objsh.hxx>
24 #include <svx/svxids.hrc>
25 #include <svtools/unitconv.hxx>
26 #include <svl/languageoptions.hxx>
27 #include <chardlg.hxx>
28 #include <editeng/fontitem.hxx>
29 #include <editeng/postitem.hxx>
30 #include <editeng/udlnitem.hxx>
32 #include <editeng/contouritem.hxx>
33 #include <editeng/langitem.hxx>
34 #include <editeng/wghtitem.hxx>
35 #include <editeng/fhgtitem.hxx>
36 #include <editeng/shdditem.hxx>
38 #include <editeng/wrlmitem.hxx>
39 #include <editeng/cmapitem.hxx>
40 #include <editeng/kernitem.hxx>
41 #include <editeng/flstitem.hxx>
42 #include <editeng/autokernitem.hxx>
43 #include <editeng/colritem.hxx>
44 #include <dialmgr.hxx>
45 #include <sfx2/htmlmode.hxx>
46 #include <cui/cuicharmap.hxx>
47 #include "chardlg.h"
50 #include <editeng/twolinesitem.hxx>
54 #include <officecfg/Office/Common.hxx>
55 #include <strings.hrc>
56 #include <twolines.hrc>
57 #include <svl/intitem.hxx>
58 #include <svx/flagsdef.hxx>
59 #include <FontFeaturesDialog.hxx>
60 #include <sal/log.hxx>
61 #include <osl/diagnose.h>
62 
63 using namespace ::com::sun::star;
64 
65 // static ----------------------------------------------------------------
66 
67 const sal_uInt16 SvxCharNamePage::pNameRanges[] =
68 {
69  SID_ATTR_CHAR_FONT,
70  SID_ATTR_CHAR_WEIGHT,
71  SID_ATTR_CHAR_FONTHEIGHT,
72  SID_ATTR_CHAR_FONTHEIGHT,
73  SID_ATTR_CHAR_COLOR,
74  SID_ATTR_CHAR_COLOR,
75  SID_ATTR_CHAR_LANGUAGE,
76  SID_ATTR_CHAR_LANGUAGE,
77  SID_ATTR_CHAR_CJK_FONT,
78  SID_ATTR_CHAR_CJK_WEIGHT,
79  SID_ATTR_CHAR_CTL_FONT,
80  SID_ATTR_CHAR_CTL_WEIGHT,
81  0
82 };
83 
84 const sal_uInt16 SvxCharEffectsPage::pEffectsRanges[] =
85 {
86  SID_ATTR_CHAR_SHADOWED,
87  SID_ATTR_CHAR_UNDERLINE,
88  SID_ATTR_CHAR_COLOR,
89  SID_ATTR_CHAR_COLOR,
90  SID_ATTR_CHAR_CASEMAP,
91  SID_ATTR_CHAR_CASEMAP,
92  SID_ATTR_FLASH,
93  SID_ATTR_FLASH,
94  SID_ATTR_CHAR_EMPHASISMARK,
95  SID_ATTR_CHAR_EMPHASISMARK,
96  SID_ATTR_CHAR_RELIEF,
97  SID_ATTR_CHAR_RELIEF,
98  SID_ATTR_CHAR_HIDDEN,
99  SID_ATTR_CHAR_HIDDEN,
100  SID_ATTR_CHAR_OVERLINE,
101  SID_ATTR_CHAR_OVERLINE,
102  0
103 };
104 
105 const sal_uInt16 SvxCharPositionPage::pPositionRanges[] =
106 {
107  SID_ATTR_CHAR_KERNING,
108  SID_ATTR_CHAR_KERNING,
109  SID_ATTR_CHAR_ESCAPEMENT,
110  SID_ATTR_CHAR_ESCAPEMENT,
111  SID_ATTR_CHAR_AUTOKERN,
112  SID_ATTR_CHAR_AUTOKERN,
113  SID_ATTR_CHAR_ROTATED,
114  SID_ATTR_CHAR_SCALEWIDTH,
115  SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
116  SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
117  0
118 };
119 
120 const sal_uInt16 SvxCharTwoLinesPage::pTwoLinesRanges[] =
121 {
122  SID_ATTR_CHAR_TWO_LINES,
123  SID_ATTR_CHAR_TWO_LINES,
124  0
125 };
126 
127 // C-Function ------------------------------------------------------------
128 
129 static bool StateToAttr( TriState aState )
130 {
131  return ( TRISTATE_TRUE == aState );
132 }
133 
134 namespace
135 {
136  void setPrevFontEscapement(SvxFont& _rFont,sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc )
137  {
138  _rFont.SetPropr( nProp );
139  _rFont.SetProprRel( nEscProp );
140  _rFont.SetEscapement( nEsc );
141  }
142 }
143 
145 {
146  return m_aPreviewWin.GetFont();
147 }
148 
150 {
151  return m_aPreviewWin.GetCJKFont();
152 }
153 
155 {
156  return m_aPreviewWin.GetCTLFont();
157 }
158 
159 SvxCharBasePage::SvxCharBasePage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet& rItemset)
160  : SfxTabPage(pPage, pController, rUIXMLDescription, rID, &rItemset)
161  , m_bPreviewBackgroundToCharacter( false )
162 {
163 }
164 
166 {
167 }
168 
170 {
172 }
173 
175 {
176  sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
177  if (rSet.GetItemState(nWhich)>=SfxItemState::DEFAULT)
178  {
179  const SvxCharScaleWidthItem &rItem = static_cast<const SvxCharScaleWidthItem&>( rSet.Get( nWhich ) );
180  m_aPreviewWin.SetFontWidthScale(rItem.GetValue());
181  }
182 }
183 
184 void SvxCharBasePage::SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc )
185 {
186  setPrevFontEscapement(GetPreviewFont(),nProp,nEscProp,nEsc);
187  setPrevFontEscapement(GetPreviewCJKFont(),nProp,nEscProp,nEsc);
188  setPrevFontEscapement(GetPreviewCTLFont(),nProp,nEscProp,nEsc);
189  m_aPreviewWin.Invalidate();
190 }
191 
192 
193 // SvxCharNamePage_Impl --------------------------------------------------
194 
196 {
198  OUString m_aNoStyleText;
199  std::unique_ptr<FontList> m_pFontList;
202 
204  : m_nExtraEntryPos(std::numeric_limits<int>::max())
205  , m_bInSearchMode(false)
206 
207  {
208  m_aUpdateIdle.SetPriority( TaskPriority::LOWEST );
209  }
210 };
211 
212 // class SvxCharNamePage -------------------------------------------------
213 
215  : SvxCharBasePage(pPage, pController, "cui/ui/charnamepage.ui", "CharNamePage", rInSet)
217  , m_xEastFrame(m_xBuilder->weld_widget("asian"))
218  , m_xEastFontNameFT(m_xBuilder->weld_label("eastfontnameft"))
219  , m_xEastFontNameLB(m_xBuilder->weld_combo_box("eastfontnamelb"))
220  , m_xEastFontStyleFT(m_xBuilder->weld_label("eaststyleft"))
221  , m_xEastFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("eaststylelb")))
222  , m_xEastFontSizeFT(m_xBuilder->weld_label("eastsizeft"))
223  , m_xEastFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("eastsizelb")))
224  , m_xEastFontLanguageFT(m_xBuilder->weld_label("eastlangft"))
225  , m_xEastFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("eastlanglb")))
226  , m_xEastFontTypeFT(m_xBuilder->weld_label("eastfontinfo"))
227  , m_xEastFontFeaturesButton(m_xBuilder->weld_button("east_features_button"))
228  , m_xCTLFrame(m_xBuilder->weld_widget("ctl"))
229  , m_xCTLFontNameFT(m_xBuilder->weld_label("ctlfontnameft"))
230  , m_xCTLFontNameLB(m_xBuilder->weld_combo_box("ctlfontnamelb"))
231  , m_xCTLFontStyleFT(m_xBuilder->weld_label("ctlstyleft"))
232  , m_xCTLFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("ctlstylelb")))
233  , m_xCTLFontSizeFT(m_xBuilder->weld_label("ctlsizeft"))
234  , m_xCTLFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("ctlsizelb")))
235  , m_xCTLFontLanguageFT(m_xBuilder->weld_label("ctllangft"))
236  , m_xCTLFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("ctllanglb")))
237  , m_xCTLFontTypeFT(m_xBuilder->weld_label("ctlfontinfo"))
238  , m_xCTLFontFeaturesButton(m_xBuilder->weld_button("ctl_features_button"))
239 {
240  m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin));
241 #ifdef IOS
242  m_xPreviewWin->hide();
243 #endif
244  m_pImpl->m_aNoStyleText = CuiResId( RID_SVXSTR_CHARNAME_NOSTYLE );
245 
246  SvtLanguageOptions aLanguageOptions;
247  bool bShowCJK = aLanguageOptions.IsCJKFontEnabled();
248  bool bShowCTL = aLanguageOptions.IsCTLFontEnabled();
249  bool bShowNonWestern = bShowCJK || bShowCTL;
250 
251  if (bShowNonWestern)
252  {
253  m_xWestFrame = m_xBuilder->weld_widget("western");
254  m_xWestFontNameFT = m_xBuilder->weld_label("westfontnameft-cjk");
255  m_xWestFontNameLB = m_xBuilder->weld_combo_box("westfontnamelb-cjk");
256  m_xWestFontStyleFT = m_xBuilder->weld_label("weststyleft-cjk");
257  m_xWestFontSizeFT = m_xBuilder->weld_label("westsizeft-cjk");
258 
259  m_xWestFontStyleLB.reset(new FontStyleBox(m_xBuilder->weld_combo_box("weststylelb-cjk")));
260  m_xWestFontSizeLB.reset(new FontSizeBox(m_xBuilder->weld_combo_box("westsizelb-cjk")));
261 
262  m_xWestFontLanguageFT = m_xBuilder->weld_label("westlangft-cjk");
263  m_xWestFontLanguageLB.reset(new SvxLanguageBox(m_xBuilder->weld_combo_box("westlanglb-cjk")));
264  m_xWestFontTypeFT = m_xBuilder->weld_label("westfontinfo-cjk");
265 
266  m_xWestFontFeaturesButton = m_xBuilder->weld_button("west_features_button-cjk");
267  }
268  else
269  {
270  m_xWestFrame = m_xBuilder->weld_widget("simple");
271  m_xWestFontNameFT = m_xBuilder->weld_label("westfontnameft-nocjk");
272  m_xWestFontStyleFT = m_xBuilder->weld_label("weststyleft-nocjk");
273  m_xWestFontSizeFT = m_xBuilder->weld_label("westsizeft-nocjk");
274 
275  m_xWestFontLanguageFT = m_xBuilder->weld_label("westlangft-nocjk");
276  m_xWestFontLanguageLB.reset(new SvxLanguageBox(m_xBuilder->weld_combo_box("westlanglb-nocjk")));
277  m_xWestFontTypeFT = m_xBuilder->weld_label("westfontinfo-nocjk");
278 
279  m_xWestFontFeaturesButton = m_xBuilder->weld_button("west_features_button-nocjk");
280 
281  std::unique_ptr<weld::EntryTreeView> xWestFontNameLB = m_xBuilder->weld_entry_tree_view("namegrid", "westfontname-nocjk", "westfontnamelb-nocjk");
282  std::unique_ptr<weld::EntryTreeView> xWestFontStyleLB = m_xBuilder->weld_entry_tree_view("stylegrid", "weststyle-nocjk", "weststylelb-nocjk");
283  std::unique_ptr<weld::EntryTreeView> xWestFontSizeLB = m_xBuilder->weld_entry_tree_view("sizegrid", "westsize-nocjk", "westsizelb-nocjk");
284 
285  // 7 lines in the treeview
286  xWestFontNameLB->set_height_request_by_rows(7);
287  xWestFontStyleLB->set_height_request_by_rows(7);
288  xWestFontSizeLB->set_height_request_by_rows(7);
289 
290  m_xWestFontNameLB = std::move(xWestFontNameLB);
291  m_xWestFontStyleLB.reset(new FontStyleBox(std::move(xWestFontStyleLB)));
292  m_xWestFontSizeLB.reset(new FontSizeBox(std::move(xWestFontSizeLB)));
293  }
294 
295  //In MacOSX the standard dialogs name font-name, font-style as
296  //Family, Typeface
297  //In GNOME the standard dialogs name font-name, font-style as
298  //Family, Style
299  //In Windows the standard dialogs name font-name, font-style as
300  //Font, Style
301 #ifdef _WIN32
302  OUString sFontFamilyString(CuiResId(RID_SVXSTR_CHARNAME_FONT));
303 #else
304  OUString sFontFamilyString(CuiResId(RID_SVXSTR_CHARNAME_FAMILY));
305 #endif
306  m_xWestFontNameFT->set_label(sFontFamilyString);
307  m_xEastFontNameFT->set_label(sFontFamilyString);
308  m_xCTLFontNameFT->set_label(sFontFamilyString);
309 
310 #ifdef MACOSX
311  OUString sFontStyleString(CuiResId(RID_SVXSTR_CHARNAME_TYPEFACE));
312 #else
313  OUString sFontStyleString(CuiResId(RID_SVXSTR_CHARNAME_STYLE));
314 #endif
315  m_xWestFontStyleFT->set_label(sFontStyleString);
316  m_xEastFontStyleFT->set_label(sFontStyleString);
317  m_xCTLFontStyleFT->set_label(sFontStyleString);
318 
319  m_xWestFrame->show();
320  m_xEastFrame->set_visible(bShowCJK);
321  m_xCTLFrame->set_visible(bShowCTL);
322 
323  m_xWestFontLanguageLB->SetLanguageList(SvxLanguageListFlags::WESTERN, true, false, true, true,
324  LANGUAGE_SYSTEM, css::i18n::ScriptType::LATIN);
325  m_xEastFontLanguageLB->SetLanguageList(SvxLanguageListFlags::CJK, true, false, true, true,
326  LANGUAGE_SYSTEM, css::i18n::ScriptType::ASIAN);
327  m_xCTLFontLanguageLB->SetLanguageList(SvxLanguageListFlags::CTL, true, false, true, true,
328  LANGUAGE_SYSTEM, css::i18n::ScriptType::COMPLEX);
329 
330  Initialize();
331 }
332 
334 {
335  m_pImpl.reset();
336  m_xCTLFontStyleLB.reset();
337  m_xEastFontLanguageLB.reset();
338  m_xWestFontStyleLB.reset();
339  m_xCTLFontSizeLB.reset();
340  m_xEastFontSizeLB.reset();
341  m_xWestFontSizeLB.reset();
342  m_xWestFontLanguageLB.reset();
343  m_xPreviewWin.reset();
344  m_xCTLFontLanguageLB.reset();
345  m_xEastFontLanguageLB.reset();
346 }
347 
349 {
350  // to handle the changes of the other pages
352 
353  Link<weld::ComboBox&,void> aLink = LINK(this, SvxCharNamePage, FontModifyComboBoxHdl_Impl);
354  m_xWestFontNameLB->connect_changed(aLink);
355  m_xWestFontStyleLB->connect_changed(aLink);
356  m_xWestFontSizeLB->connect_changed(aLink);
357  m_xWestFontLanguageLB->connect_changed(aLink);
358 
359  m_xWestFontFeaturesButton->connect_clicked(LINK(this, SvxCharNamePage, FontFeatureButtonClicked));
360 
361  m_xEastFontNameLB->connect_changed(aLink);
362  m_xEastFontStyleLB->connect_changed(aLink);
363  m_xEastFontSizeLB->connect_changed(aLink);
364  m_xEastFontLanguageLB->connect_changed(aLink);
365  m_xEastFontFeaturesButton->connect_clicked(LINK(this, SvxCharNamePage, FontFeatureButtonClicked));
366 
367  m_xCTLFontNameLB->connect_changed(aLink);
368  m_xCTLFontStyleLB->connect_changed(aLink);
369  m_xCTLFontSizeLB->connect_changed(aLink);
370  m_xCTLFontLanguageLB->connect_changed(aLink);
371  m_xCTLFontFeaturesButton->connect_clicked(LINK(this, SvxCharNamePage, FontFeatureButtonClicked));
372 
373  m_pImpl->m_aUpdateIdle.SetInvokeHandler( LINK( this, SvxCharNamePage, UpdateHdl_Impl ) );
374 }
375 
377 {
378  if ( !m_pImpl->m_pFontList )
379  {
381 
382  /* #110771# SvxFontListItem::GetFontList can return NULL */
383  if ( pDocSh )
384  {
385  const SfxPoolItem* pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
386  if ( pItem != nullptr )
387  {
388  DBG_ASSERT(nullptr != static_cast<const SvxFontListItem*>(pItem)->GetFontList(),
389  "Where is the font list?");
390  m_pImpl->m_pFontList = static_cast<const SvxFontListItem*>(pItem )->GetFontList()->Clone();
391  }
392  }
393  if(!m_pImpl->m_pFontList)
394  {
395  m_pImpl->m_pFontList.reset(new FontList( Application::GetDefaultDevice() ));
396  }
397  }
398 
399  return m_pImpl->m_pFontList.get();
400 }
401 
402 
403 namespace
404 {
405  FontMetric calcFontMetrics( SvxFont& _rFont,
406  SvxCharNamePage const * _pPage,
407  const weld::ComboBox* _pFontNameLB,
408  const FontStyleBox* _pFontStyleLB,
409  const FontSizeBox* _pFontSizeLB,
410  const SvxLanguageBox* _pLanguageLB,
411  const FontList* _pFontList,
412  sal_uInt16 _nFontWhich,
413  sal_uInt16 _nFontHeightWhich)
414  {
415  Size aSize = _rFont.GetFontSize();
416  aSize.setWidth( 0 );
417  FontMetric aFontMetrics;
418  OUString sFontName(_pFontNameLB->get_active_text());
419  bool bFontAvailable = _pFontList->IsAvailable( sFontName );
420  if (bFontAvailable || _pFontNameLB->get_value_changed_from_saved())
421  aFontMetrics = _pFontList->Get(sFontName, _pFontStyleLB->get_active_text());
422  else
423  {
424  //get the font from itemset
425  SfxItemState eState = _pPage->GetItemSet().GetItemState( _nFontWhich );
426  if ( eState >= SfxItemState::DEFAULT )
427  {
428  const SvxFontItem* pFontItem = static_cast<const SvxFontItem*>(&( _pPage->GetItemSet().Get( _nFontWhich ) ));
429  aFontMetrics.SetFamilyName(pFontItem->GetFamilyName());
430  aFontMetrics.SetStyleName(pFontItem->GetStyleName());
431  aFontMetrics.SetFamily(pFontItem->GetFamily());
432  aFontMetrics.SetPitch(pFontItem->GetPitch());
433  aFontMetrics.SetCharSet(pFontItem->GetCharSet());
434  }
435  }
436  if ( _pFontSizeLB->IsRelative() )
437  {
438  DBG_ASSERT( _pPage->GetItemSet().GetParent(), "No parent set" );
439  const SvxFontHeightItem& rOldItem = static_cast<const SvxFontHeightItem&>(_pPage->GetItemSet().GetParent()->Get( _nFontHeightWhich ));
440 
441  // old value, scaled
442  tools::Long nHeight;
443  if ( _pFontSizeLB->IsPtRelative() )
444  nHeight = rOldItem.GetHeight() + PointToTwips( static_cast<tools::Long>(_pFontSizeLB->get_value() / 10) );
445  else
446  nHeight = static_cast<tools::Long>(rOldItem.GetHeight() * _pFontSizeLB->get_value() / 100);
447 
448  // conversion twips for the example-window
449  aSize.setHeight(
450  ItemToControl( nHeight, _pPage->GetItemSet().GetPool()->GetMetric( _nFontHeightWhich ), FieldUnit::TWIP ) );
451  }
452  else if ( !_pFontSizeLB->get_active_text().isEmpty() )
453  aSize.setHeight( PointToTwips( static_cast<tools::Long>(_pFontSizeLB->get_value() / 10) ) );
454  else
455  aSize.setHeight( 200 ); // default 10pt
456  aFontMetrics.SetFontSize( aSize );
457 
458  _rFont.SetLanguage(_pLanguageLB->get_active_id());
459 
460  _rFont.SetFamily( aFontMetrics.GetFamilyType() );
461  _rFont.SetFamilyName( aFontMetrics.GetFamilyName() );
462  _rFont.SetStyleName( aFontMetrics.GetStyleName() );
463  _rFont.SetPitch( aFontMetrics.GetPitch() );
464  _rFont.SetCharSet( aFontMetrics.GetCharSet() );
465  _rFont.SetWeight( aFontMetrics.GetWeight() );
466  _rFont.SetItalic( aFontMetrics.GetItalic() );
467  _rFont.SetFontSize( aFontMetrics.GetFontSize() );
468 
469  return aFontMetrics;
470  }
471 }
472 
473 
475 {
476  SvxFont& rFont = GetPreviewFont();
477  SvxFont& rCJKFont = GetPreviewCJKFont();
478  SvxFont& rCTLFont = GetPreviewCTLFont();
479  // Font
480  const FontList* pFontList = GetFontList();
481 
482  FontMetric aWestFontMetric = calcFontMetrics(rFont, this, m_xWestFontNameLB.get(),
484  pFontList, GetWhich(SID_ATTR_CHAR_FONT),
485  GetWhich(SID_ATTR_CHAR_FONTHEIGHT));
486 
487  m_xWestFontTypeFT->set_label(pFontList->GetFontMapText(aWestFontMetric));
488 
489  FontMetric aEastFontMetric = calcFontMetrics(rCJKFont, this, m_xEastFontNameLB.get(),
491  pFontList, GetWhich(SID_ATTR_CHAR_CJK_FONT),
492  GetWhich(SID_ATTR_CHAR_CJK_FONTHEIGHT));
493 
494  m_xEastFontTypeFT->set_label(pFontList->GetFontMapText(aEastFontMetric));
495 
496  FontMetric aCTLFontMetric = calcFontMetrics(rCTLFont,
497  this, m_xCTLFontNameLB.get(), m_xCTLFontStyleLB.get(), m_xCTLFontSizeLB.get(),
498  m_xCTLFontLanguageLB.get(), pFontList, GetWhich(SID_ATTR_CHAR_CTL_FONT),
499  GetWhich(SID_ATTR_CHAR_CTL_FONTHEIGHT));
500 
501  m_xCTLFontTypeFT->set_label(pFontList->GetFontMapText(aCTLFontMetric));
502 
503  m_aPreviewWin.Invalidate();
504 }
505 
507 {
508  const FontList* pFontList = GetFontList();
509  DBG_ASSERT( pFontList, "no fontlist" );
510 
511  FontStyleBox* pStyleBox = nullptr;
512  OUString sFontName;
513 
514  if (m_xWestFontNameLB.get() == &rNameBox)
515  {
516  pStyleBox = m_xWestFontStyleLB.get();
517  sFontName = m_xWestFontNameLB->get_active_text();
518  }
519  else if (m_xEastFontNameLB.get() == &rNameBox)
520  {
521  pStyleBox = m_xEastFontStyleLB.get();
522  sFontName = m_xEastFontStyleLB->get_active_text();
523  }
524  else if (m_xCTLFontNameLB.get() == &rNameBox)
525  {
526  pStyleBox = m_xCTLFontStyleLB.get();
527  sFontName = m_xCTLFontNameLB->get_active_text();
528  }
529  else
530  {
531  SAL_WARN( "cui.tabpages", "invalid font name box" );
532  return;
533  }
534 
535  pStyleBox->Fill(sFontName, pFontList);
536 
537  if ( !m_pImpl->m_bInSearchMode )
538  return;
539 
540  // additional entries for the search:
541  // "not bold" and "not italic"
542  OUString aEntry = m_pImpl->m_aNoStyleText;
543  const char sS[] = "%1";
544  aEntry = aEntry.replaceFirst( sS, pFontList->GetBoldStr() );
545  m_pImpl->m_nExtraEntryPos = pStyleBox->get_count();
546  pStyleBox->append_text( aEntry );
547  aEntry = m_pImpl->m_aNoStyleText;
548  aEntry = aEntry.replaceFirst( sS, pFontList->GetItalicStr() );
549  pStyleBox->append_text(aEntry);
550 }
551 
553 {
554  const FontList* pFontList = GetFontList();
555  DBG_ASSERT( pFontList, "no fontlist" );
556 
557  FontStyleBox* pStyleBox = nullptr;
558  FontSizeBox* pSizeBox = nullptr;
559  OUString sFontName;
560 
561  if (m_xWestFontNameLB.get() == &rNameBox)
562  {
563  pStyleBox = m_xWestFontStyleLB.get();
564  pSizeBox = m_xWestFontSizeLB.get();
565  sFontName = m_xWestFontNameLB->get_active_text();
566  }
567  else if (m_xEastFontNameLB.get() == &rNameBox)
568  {
569  pStyleBox = m_xEastFontStyleLB.get();
570  pSizeBox = m_xEastFontSizeLB.get();
571  sFontName = m_xEastFontNameLB->get_active_text();
572  }
573  else if (m_xCTLFontNameLB.get() == &rNameBox)
574  {
575  pStyleBox = m_xCTLFontStyleLB.get();
576  pSizeBox = m_xCTLFontSizeLB.get();
577  sFontName = m_xCTLFontNameLB->get_active_text();
578  }
579  else
580  {
581  SAL_WARN( "cui.tabpages", "invalid font name box" );
582  return;
583  }
584 
585  FontMetric _aFontMetric(pFontList->Get(sFontName, pStyleBox->get_active_text()));
586  pSizeBox->Fill( &_aFontMetric, pFontList );
587 }
588 
589 namespace
590 {
591  void FillFontNames(weld::ComboBox& rBox, const FontList& rList)
592  {
593  // insert fonts
594  sal_uInt16 nFontCount = rList.GetFontNameCount();
595  std::vector<weld::ComboBoxEntry> aVector;
596  aVector.reserve(nFontCount);
597  for (sal_uInt16 i = 0; i < nFontCount; ++i)
598  {
599  const FontMetric& rFontMetric = rList.GetFontName(i);
600  aVector.emplace_back(rFontMetric.GetFamilyName());
601  }
602  rBox.insert_vector(aVector, false);
603  }
604 }
605 
607 {
608  weld::ComboBox* pNameBox = nullptr;
609  weld::Label* pStyleLabel = nullptr;
610  FontStyleBox* pStyleBox = nullptr;
611  weld::Label* pSizeLabel = nullptr;
612  FontSizeBox* pSizeBox = nullptr;
613  weld::Label* pLangFT = nullptr;
614  SvxLanguageBox* pLangBox = nullptr;
615  sal_uInt16 nWhich = 0;
616 
617  switch ( eLangGrp )
618  {
619  case Western :
620  pNameBox = m_xWestFontNameLB.get();
621  pStyleLabel = m_xWestFontStyleFT.get();
622  pStyleBox = m_xWestFontStyleLB.get();
623  pSizeLabel = m_xWestFontSizeFT.get();
624  pSizeBox = m_xWestFontSizeLB.get();
625  pLangFT = m_xWestFontLanguageFT.get();
626  pLangBox = m_xWestFontLanguageLB.get();
627  nWhich = GetWhich( SID_ATTR_CHAR_FONT );
628  break;
629 
630  case Asian :
631  pNameBox = m_xEastFontNameLB.get();
632  pStyleLabel = m_xEastFontStyleFT.get();
633  pStyleBox = m_xEastFontStyleLB.get();
634  pSizeLabel = m_xEastFontSizeFT.get();
635  pSizeBox = m_xEastFontSizeLB.get();
636  pLangFT = m_xEastFontLanguageFT.get();
637  pLangBox = m_xEastFontLanguageLB.get();
638  nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONT );
639  break;
640 
641  case Ctl :
642  pNameBox = m_xCTLFontNameLB.get();
643  pStyleLabel = m_xCTLFontStyleFT.get();
644  pStyleBox = m_xCTLFontStyleLB.get();
645  pSizeLabel = m_xCTLFontSizeFT.get();
646  pSizeBox = m_xCTLFontSizeLB.get();
647  pLangFT = m_xCTLFontLanguageFT.get();
648  pLangBox = m_xCTLFontLanguageLB.get();
649  nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONT );
650  break;
651  }
652 
653  const FontList* pFontList = GetFontList();
654  FillFontNames(*pNameBox, *pFontList);
655 
656  const SvxFontItem* pFontItem = nullptr;
657  SfxItemState eState = rSet.GetItemState( nWhich );
658 
659  if ( eState >= SfxItemState::DEFAULT )
660  {
661  pFontItem = static_cast<const SvxFontItem*>(&( rSet.Get( nWhich ) ));
662  const OUString &rName = pFontItem->GetFamilyName();
663  int nIndex = pNameBox->find_text(rName);
664  pNameBox->set_active(nIndex);
665  // tdf#122992 if it didn't exist in the list, set the entry text to it anyway
666  if (nIndex == -1)
667  pNameBox->set_entry_text(rName);
668  }
669  else
670  {
671  pNameBox->set_active_text( OUString() );
672  }
673 
674  FillStyleBox_Impl(*pNameBox);
675 
676  bool bStyle = false;
677  bool bStyleAvailable = true;
678  FontItalic eItalic = ITALIC_NONE;
679  FontWeight eWeight = WEIGHT_NORMAL;
680  switch ( eLangGrp )
681  {
682  case Western : nWhich = GetWhich( SID_ATTR_CHAR_POSTURE ); break;
683  case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_POSTURE ); break;
684  case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_POSTURE ); break;
685  }
686  eState = rSet.GetItemState( nWhich );
687 
688  if ( eState >= SfxItemState::DEFAULT )
689  {
690  const SvxPostureItem& rItem = static_cast<const SvxPostureItem&>(rSet.Get( nWhich ));
691  eItalic = rItem.GetValue();
692  bStyle = true;
693  }
694  bStyleAvailable = bStyleAvailable && (eState >= SfxItemState::DONTCARE);
695 
696  switch ( eLangGrp )
697  {
698  case Western : nWhich = GetWhich( SID_ATTR_CHAR_WEIGHT ); break;
699  case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_WEIGHT ); break;
700  case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_WEIGHT ); break;
701  }
702  eState = rSet.GetItemState( nWhich );
703 
704  if ( eState >= SfxItemState::DEFAULT )
705  {
706  const SvxWeightItem& rItem = static_cast<const SvxWeightItem&>(rSet.Get( nWhich ));
707  eWeight = rItem.GetValue();
708  }
709  else
710  bStyle = false;
711  bStyleAvailable = bStyleAvailable && (eState >= SfxItemState::DONTCARE);
712 
713  // currently chosen font
714  if ( bStyle && pFontItem )
715  {
716  FontMetric aFontMetric = pFontList->Get( pFontItem->GetFamilyName(), eWeight, eItalic );
717  pStyleBox->set_active_text( pFontList->GetStyleName( aFontMetric ) );
718  }
719  else if ( !m_pImpl->m_bInSearchMode || !bStyle )
720  {
721  pStyleBox->set_active_text( OUString() );
722  }
723  else if ( bStyle )
724  {
725  FontMetric aFontMetric = pFontList->Get( OUString(), eWeight, eItalic );
726  pStyleBox->set_active_text( pFontList->GetStyleName( aFontMetric ) );
727  }
728  if (!bStyleAvailable)
729  {
730  pStyleBox->set_sensitive(false);
731  pStyleLabel->set_sensitive(false);
732  }
733 
734  FillSizeBox_Impl(*pNameBox);
735  switch ( eLangGrp )
736  {
737  case Western : nWhich = GetWhich( SID_ATTR_CHAR_FONTHEIGHT ); break;
738  case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ); break;
739  case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ); break;
740  }
741  eState = rSet.GetItemState( nWhich );
742 
743  if ( pSizeBox->IsRelativeMode() )
744  {
745  MapUnit eUnit = rSet.GetPool()->GetMetric( nWhich );
746  const SvxFontHeightItem& rItem = static_cast<const SvxFontHeightItem&>(rSet.Get( nWhich ));
747 
748  if( rItem.GetProp() != 100 || MapUnit::MapRelative != rItem.GetPropUnit() )
749  {
750  bool bPtRel = MapUnit::MapPoint == rItem.GetPropUnit();
751  pSizeBox->SetPtRelative( bPtRel );
752  pSizeBox->set_value( bPtRel ? static_cast<short>(rItem.GetProp()) * 10 : rItem.GetProp() );
753  }
754  else
755  {
756  pSizeBox->SetRelative(false);
757  pSizeBox->set_value( CalcToPoint( rItem.GetHeight(), eUnit, 10 ) );
758  }
759  }
760  else if ( eState >= SfxItemState::DEFAULT )
761  {
762  MapUnit eUnit = rSet.GetPool()->GetMetric( nWhich );
763  const SvxFontHeightItem& rItem = static_cast<const SvxFontHeightItem&>(rSet.Get( nWhich ));
764  pSizeBox->set_value( CalcToPoint( rItem.GetHeight(), eUnit, 10 ) );
765  }
766  else
767  {
768  pSizeBox->set_active_or_entry_text(OUString());
769  if ( eState <= SfxItemState::READONLY )
770  {
771  pSizeBox->set_sensitive(false);
772  pSizeLabel->set_sensitive(false);
773  }
774  }
775 
776  switch ( eLangGrp )
777  {
778  case Western : nWhich = GetWhich( SID_ATTR_CHAR_LANGUAGE ); break;
779  case Asian : nWhich = GetWhich( SID_ATTR_CHAR_CJK_LANGUAGE ); break;
780  case Ctl : nWhich = GetWhich( SID_ATTR_CHAR_CTL_LANGUAGE ); break;
781  }
782  pLangBox->set_active(-1);
783  eState = rSet.GetItemState( nWhich );
784 
785  switch ( eState )
786  {
787  case SfxItemState::UNKNOWN:
788  pLangFT->hide();
789  pLangBox->hide();
790  break;
791 
792  case SfxItemState::DISABLED:
793  case SfxItemState::READONLY:
794  pLangFT->set_sensitive(false);
795  pLangBox->set_sensitive(false);
796  break;
797 
798  case SfxItemState::DEFAULT:
799  case SfxItemState::SET:
800  {
801  const SvxLanguageItem& rItem = static_cast<const SvxLanguageItem&>(rSet.Get( nWhich ));
802  LanguageType eLangType = rItem.GetValue();
803  DBG_ASSERT( eLangType != LANGUAGE_SYSTEM, "LANGUAGE_SYSTEM not allowed" );
804  if (eLangType != LANGUAGE_DONTKNOW)
805  pLangBox->set_active_id(eLangType);
806  break;
807  }
808  case SfxItemState::DONTCARE:
809  break;
810  }
811 
812  OUString sMapText(pFontList->GetFontMapText(
813  pFontList->Get(pNameBox->get_active_text(), pStyleBox->get_active_text())));
814 
815  switch (eLangGrp)
816  {
817  case Western:
818  m_xWestFontTypeFT->set_label(sMapText);
819  break;
820  case Asian:
821  m_xEastFontTypeFT->set_label(sMapText);
822  break;
823  case Ctl:
824  m_xCTLFontTypeFT->set_label(sMapText);
825  break;
826  }
827 
828  // save these settings
829  pNameBox->save_value();
830  pStyleBox->save_value();
831  pSizeBox->save_value();
832  pLangBox->save_active_id();
833 }
834 
836 {
837  bool bModified = false;
838 
839  weld::ComboBox* pNameBox = nullptr;
840  FontStyleBox* pStyleBox = nullptr;
841  FontSizeBox* pSizeBox = nullptr;
842  SvxLanguageBox* pLangBox = nullptr;
843  sal_uInt16 nWhich = 0;
844  sal_uInt16 nSlot = 0;
845 
846  switch ( eLangGrp )
847  {
848  case Western :
849  pNameBox = m_xWestFontNameLB.get();
850  pStyleBox = m_xWestFontStyleLB.get();
851  pSizeBox = m_xWestFontSizeLB.get();
852  pLangBox = m_xWestFontLanguageLB.get();
853  nSlot = SID_ATTR_CHAR_FONT;
854  break;
855 
856  case Asian :
857  pNameBox = m_xEastFontNameLB.get();
858  pStyleBox = m_xEastFontStyleLB.get();
859  pSizeBox = m_xEastFontSizeLB.get();
860  pLangBox = m_xEastFontLanguageLB.get();
861  nSlot = SID_ATTR_CHAR_CJK_FONT;
862  break;
863 
864  case Ctl :
865  pNameBox = m_xCTLFontNameLB.get();
866  pStyleBox = m_xCTLFontStyleLB.get();
867  pSizeBox = m_xCTLFontSizeLB.get();
868  pLangBox = m_xCTLFontLanguageLB.get();
869  nSlot = SID_ATTR_CHAR_CTL_FONT;
870  break;
871  }
872 
873  nWhich = GetWhich( nSlot );
874  const SfxPoolItem* pItem = nullptr;
875  const SfxItemSet& rOldSet = GetItemSet();
876  const SfxPoolItem* pOld = nullptr;
877 
878  const SfxItemSet* pExampleSet = GetDialogExampleSet();
879 
880  bool bChanged = true;
881  const OUString& rFontName = pNameBox->get_active_text();
882  const FontList* pFontList = GetFontList();
883  OUString aStyleBoxText = pStyleBox->get_active_text();
884  int nEntryPos = pStyleBox->find_text(aStyleBoxText);
885  if (nEntryPos >= m_pImpl->m_nExtraEntryPos)
886  aStyleBoxText.clear();
887  FontMetric aInfo( pFontList->Get( rFontName, aStyleBoxText ) );
888  SvxFontItem aFontItem( aInfo.GetFamilyType(), aInfo.GetFamilyName(), aInfo.GetStyleName(),
889  aInfo.GetPitch(), aInfo.GetCharSet(), nWhich );
890  pOld = GetOldItem( rSet, nSlot );
891 
892  if ( pOld )
893  {
894  const SvxFontItem& rItem = *static_cast<const SvxFontItem*>(pOld);
895 
896  if ( rItem.GetFamilyName() == aFontItem.GetFamilyName() )
897  bChanged = false;
898  }
899 
900  if ( !bChanged )
901  bChanged = pNameBox->get_saved_value().isEmpty();
902 
903  if ( !bChanged && pExampleSet &&
904  pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
905  static_cast<const SvxFontItem*>(pItem)->GetFamilyName() != aFontItem.GetFamilyName() )
906  bChanged = true;
907 
908  if ( bChanged && !rFontName.isEmpty() )
909  {
910  rSet.Put( aFontItem );
911  bModified = true;
912  }
913  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
914  rSet.ClearItem( nWhich );
915 
916 
917  bChanged = true;
918  switch ( eLangGrp )
919  {
920  case Western : nSlot = SID_ATTR_CHAR_WEIGHT; break;
921  case Asian : nSlot = SID_ATTR_CHAR_CJK_WEIGHT; break;
922  case Ctl : nSlot = SID_ATTR_CHAR_CTL_WEIGHT; break;
923  }
924  nWhich = GetWhich( nSlot );
925  FontWeight eWeight = aInfo.GetWeight();
926  if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
927  eWeight = WEIGHT_NORMAL;
928  SvxWeightItem aWeightItem( eWeight, nWhich );
929  pOld = GetOldItem( rSet, nSlot );
930 
931  if ( pOld )
932  {
933  const SvxWeightItem& rItem = *static_cast<const SvxWeightItem*>(pOld);
934 
935  if ( rItem.GetValue() == aWeightItem.GetValue() )
936  bChanged = false;
937  }
938 
939  if ( !bChanged )
940  {
941  bChanged = pStyleBox->get_saved_value().isEmpty();
942 
943  if ( m_pImpl->m_bInSearchMode && bChanged &&
944  aInfo.GetWeight() == WEIGHT_NORMAL && aInfo.GetItalic() != ITALIC_NONE )
945  bChanged = false;
946  }
947 
948  if ( !bChanged && pExampleSet &&
949  pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
950  static_cast<const SvxWeightItem*>(pItem)->GetValue() != aWeightItem.GetValue() )
951  bChanged = true;
952 
953  if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
954  bChanged = ( nEntryPos == m_pImpl->m_nExtraEntryPos );
955 
956  OUString aText( pStyleBox->get_active_text() ); // Tristate, then text empty
957 
958  if ( bChanged && !aText.isEmpty() )
959  {
960  rSet.Put( aWeightItem );
961  bModified = true;
962  }
963  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
964  rSet.InvalidateItem(nWhich);
965 
966  bChanged = true;
967  switch ( eLangGrp )
968  {
969  case Western : nSlot = SID_ATTR_CHAR_POSTURE; break;
970  case Asian : nSlot = SID_ATTR_CHAR_CJK_POSTURE; break;
971  case Ctl : nSlot = SID_ATTR_CHAR_CTL_POSTURE; break;
972  }
973  nWhich = GetWhich( nSlot );
974  FontItalic eItalic = aInfo.GetItalic();
975  if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
976  eItalic = ITALIC_NONE;
977  SvxPostureItem aPostureItem( eItalic, nWhich );
978  pOld = GetOldItem( rSet, nSlot );
979 
980  if ( pOld )
981  {
982  const SvxPostureItem& rItem = *static_cast<const SvxPostureItem*>(pOld);
983 
984  if ( rItem.GetValue() == aPostureItem.GetValue() )
985  bChanged = false;
986  }
987 
988  if ( !bChanged )
989  {
990  bChanged = pStyleBox->get_saved_value().isEmpty();
991 
992  if ( m_pImpl->m_bInSearchMode && bChanged &&
993  aInfo.GetItalic() == ITALIC_NONE && aInfo.GetWeight() != WEIGHT_NORMAL )
994  bChanged = false;
995  }
996 
997  if ( !bChanged && pExampleSet &&
998  pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
999  static_cast<const SvxPostureItem*>(pItem)->GetValue() != aPostureItem.GetValue() )
1000  bChanged = true;
1001 
1002  if ( nEntryPos >= m_pImpl->m_nExtraEntryPos )
1003  bChanged = ( nEntryPos == ( m_pImpl->m_nExtraEntryPos + 1 ) );
1004 
1005  if ( bChanged && !aText.isEmpty() )
1006  {
1007  rSet.Put( aPostureItem );
1008  bModified = true;
1009  }
1010  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
1011  rSet.InvalidateItem(nWhich);
1012 
1013  // FontSize
1014  tools::Long nSize = pSizeBox->get_value();
1015 
1016  if ( pSizeBox->get_active_text().isEmpty() ) // GetValue() returns the min-value
1017  nSize = 0;
1018  tools::Long nSavedSize = pSizeBox->get_saved_value();
1019  const bool bRel = pSizeBox->IsRelative();
1020 
1021  switch ( eLangGrp )
1022  {
1023  case Western : nSlot = SID_ATTR_CHAR_FONTHEIGHT; break;
1024  case Asian : nSlot = SID_ATTR_CHAR_CJK_FONTHEIGHT; break;
1025  case Ctl : nSlot = SID_ATTR_CHAR_CTL_FONTHEIGHT; break;
1026  }
1027  nWhich = GetWhich( nSlot );
1028  const SvxFontHeightItem* pOldHeight = static_cast<const SvxFontHeightItem*>(GetOldItem( rSet, nSlot ));
1029  bChanged = ( nSize != nSavedSize );
1030 
1031  if ( !bChanged && pExampleSet &&
1032  pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET )
1033  {
1034  float fSize = static_cast<float>(nSize) / 10;
1035  tools::Long nVal = CalcToUnit( fSize, rSet.GetPool()->GetMetric( nWhich ) );
1036  if ( static_cast<const SvxFontHeightItem*>(pItem)->GetHeight() != static_cast<sal_uInt32>(nVal) )
1037  bChanged = true;
1038  }
1039 
1040  if ( bChanged || !pOldHeight ||
1041  bRel != ( MapUnit::MapRelative != pOldHeight->GetPropUnit() || 100 != pOldHeight->GetProp() ) )
1042  {
1043  MapUnit eUnit = rSet.GetPool()->GetMetric( nWhich );
1044  if ( pSizeBox->IsRelative() )
1045  {
1046  DBG_ASSERT( GetItemSet().GetParent(), "No parent set" );
1047  const SvxFontHeightItem& rOldItem =
1048  static_cast<const SvxFontHeightItem&>(GetItemSet().GetParent()->Get( nWhich ));
1049 
1050  SvxFontHeightItem aHeight( 240, 100, nWhich );
1051  if ( pSizeBox->IsPtRelative() )
1052  aHeight.SetHeight( rOldItem.GetHeight(), static_cast<sal_uInt16>( nSize / 10 ), MapUnit::MapPoint, eUnit );
1053  else
1054  aHeight.SetHeight( rOldItem.GetHeight(), static_cast<sal_uInt16>(nSize) );
1055  rSet.Put( aHeight );
1056  }
1057  else
1058  {
1059  float fSize = static_cast<float>(nSize) / 10;
1060  rSet.Put( SvxFontHeightItem( CalcToUnit( fSize, eUnit ), 100, nWhich ) );
1061  }
1062  bModified = true;
1063  }
1064  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
1065  rSet.InvalidateItem(nWhich);
1066 
1067  bChanged = true;
1068  switch ( eLangGrp )
1069  {
1070  case Western : nSlot = SID_ATTR_CHAR_LANGUAGE; break;
1071  case Asian : nSlot = SID_ATTR_CHAR_CJK_LANGUAGE; break;
1072  case Ctl : nSlot = SID_ATTR_CHAR_CTL_LANGUAGE; break;
1073  }
1074  nWhich = GetWhich( nSlot );
1075  pOld = GetOldItem( rSet, nSlot );
1076 
1077  // For language list boxes acting as ComboBox, check for, add and select an
1078  // edited entry.
1079  if (pLangBox == m_xWestFontLanguageLB.get())
1080  {
1081  switch (pLangBox->GetEditedAndValid())
1082  {
1084  ; // nothing to do
1085  break;
1087  {
1088  const int nPos = pLangBox->SaveEditedAsEntry();
1089  if (nPos != -1)
1090  pLangBox->set_active(nPos);
1091  }
1092  break;
1094  pLangBox->set_active_id(pLangBox->get_saved_active_id());
1095  break;
1096  }
1097  }
1098 
1099  int nLangPos = pLangBox->get_active();
1100  LanguageType eLangType = pLangBox->get_active_id();
1101 
1102  if (pOld)
1103  {
1104  const SvxLanguageItem& rItem = *static_cast<const SvxLanguageItem*>(pOld);
1105  if (nLangPos == -1 || eLangType == rItem.GetValue())
1106  bChanged = false;
1107  }
1108 
1109  if (!bChanged)
1110  bChanged = pLangBox->get_active_id_changed_from_saved();
1111 
1112  if (bChanged && nLangPos != -1)
1113  {
1114  rSet.Put(SvxLanguageItem(eLangType, nWhich));
1115  bModified = true;
1116  }
1117  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
1118  rSet.InvalidateItem(nWhich);
1119 
1120  return bModified;
1121 }
1122 
1123 IMPL_LINK_NOARG(SvxCharNamePage, UpdateHdl_Impl, Timer *, void)
1124 {
1125  UpdatePreview_Impl();
1126 }
1127 
1128 IMPL_LINK(SvxCharNamePage, FontModifyComboBoxHdl_Impl, weld::ComboBox&, rBox, void)
1129 {
1130  FontModifyHdl_Impl(rBox);
1131 }
1132 
1133 IMPL_LINK(SvxCharNamePage, FontFeatureButtonClicked, weld::Button&, rButton, void)
1134 {
1135  OUString sFontName;
1136  weld::ComboBox* pNameBox = nullptr;
1137 
1138  if (&rButton == m_xWestFontFeaturesButton.get())
1139  {
1140  pNameBox = m_xWestFontNameLB.get();
1141  sFontName = GetPreviewFont().GetFamilyName();
1142  }
1143  else if (&rButton == m_xEastFontFeaturesButton.get())
1144  {
1145  pNameBox = m_xEastFontNameLB.get();
1146  sFontName = GetPreviewCJKFont().GetFamilyName();
1147  }
1148  else if (&rButton == m_xCTLFontFeaturesButton.get())
1149  {
1150  pNameBox = m_xCTLFontNameLB.get();
1151  sFontName = GetPreviewCTLFont().GetFamilyName();
1152  }
1153 
1154  if (!sFontName.isEmpty() && pNameBox)
1155  {
1156  cui::FontFeaturesDialog aDialog(GetFrameWeld(), sFontName);
1157  if (aDialog.run() == RET_OK)
1158  {
1159  pNameBox->set_entry_text(aDialog.getResultFontName());
1160  UpdatePreview_Impl();
1161  }
1162  }
1163 }
1164 
1166 {
1167  m_pImpl->m_aUpdateIdle.Start();
1168 
1169  if (m_xWestFontNameLB.get() == &rNameBox || m_xEastFontNameLB.get() == &rNameBox || m_xCTLFontNameLB.get() == &rNameBox)
1170  {
1171  FillStyleBox_Impl(rNameBox);
1172  FillSizeBox_Impl(rNameBox);
1173  }
1174 }
1175 
1177 {
1179 
1180  UpdatePreview_Impl(); // instead of asynchronous calling in ctor
1181 }
1182 
1184 {
1185  if ( _pSet )
1186  FillItemSet( _pSet );
1187  return DeactivateRC::LeavePage;
1188 }
1189 
1190 std::unique_ptr<SfxTabPage> SvxCharNamePage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
1191 {
1192  return std::make_unique<SvxCharNamePage>(pPage, pController, *rSet );
1193 }
1194 
1196 {
1197  Reset_Impl( *rSet, Western );
1198  Reset_Impl( *rSet, Asian );
1199  Reset_Impl( *rSet, Ctl );
1200 
1201  SetPrevFontWidthScale( *rSet );
1203 }
1204 
1206 {
1207  m_xWestFontNameLB->save_value();
1208  m_xWestFontStyleLB->save_value();
1209  m_xWestFontSizeLB->save_value();
1210  m_xWestFontLanguageLB->save_active_id();
1211  m_xEastFontNameLB->save_value();
1212  m_xEastFontStyleLB->save_value();
1213  m_xEastFontSizeLB->save_value();
1214  m_xEastFontLanguageLB->save_active_id();
1215  m_xCTLFontNameLB->save_value();
1216  m_xCTLFontStyleLB->save_value();
1217  m_xCTLFontSizeLB->save_value();
1218  m_xCTLFontLanguageLB->save_active_id();
1219 }
1220 
1222 {
1223  bool bModified = FillItemSet_Impl( *rSet, Western );
1224  bModified |= FillItemSet_Impl( *rSet, Asian );
1225  bModified |= FillItemSet_Impl( *rSet, Ctl );
1226  return bModified;
1227 }
1228 
1230 {
1231  m_pImpl->m_pFontList = rItem.GetFontList()->Clone();
1232 }
1233 
1234 namespace
1235 {
1236  void enableRelativeMode( SvxCharNamePage const * _pPage, FontSizeBox* _pFontSizeLB, sal_uInt16 _nHeightWhich )
1237  {
1238  _pFontSizeLB->EnableRelativeMode( 5, 995 ); // min 5%, max 995%, step 5
1239 
1240  const SvxFontHeightItem& rHeightItem =
1241  static_cast<const SvxFontHeightItem&>(_pPage->GetItemSet().GetParent()->Get( _nHeightWhich ));
1242  MapUnit eUnit = _pPage->GetItemSet().GetPool()->GetMetric( _nHeightWhich );
1243  short nCurHeight =
1244  static_cast< short >( CalcToPoint( rHeightItem.GetHeight(), eUnit, 1 ) * 10 );
1245 
1246  // based on the current height:
1247  // - negative until minimum of 2 pt
1248  // - positive until maximum of 999 pt
1249  _pFontSizeLB->EnablePtRelativeMode( sal::static_int_cast< short >(-(nCurHeight - 20)), (9999 - nCurHeight) );
1250  }
1251 }
1252 
1254 {
1255  DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no ParentSet!" );
1256  enableRelativeMode(this,m_xWestFontSizeLB.get(),GetWhich( SID_ATTR_CHAR_FONTHEIGHT ));
1257  enableRelativeMode(this,m_xEastFontSizeLB.get(),GetWhich( SID_ATTR_CHAR_CJK_FONTHEIGHT ));
1258  enableRelativeMode(this,m_xCTLFontSizeLB.get(),GetWhich( SID_ATTR_CHAR_CTL_FONTHEIGHT ));
1259 }
1260 
1262 {
1263  m_pImpl->m_bInSearchMode = true;
1264 }
1265 
1266 void SvxCharNamePage::DisableControls( sal_uInt16 nDisable )
1267 {
1268  if ( DISABLE_HIDE_LANGUAGE & nDisable )
1269  {
1276  }
1277 }
1278 
1280 {
1281  const SvxFontListItem* pFontListItem = aSet.GetItem<SvxFontListItem>(SID_ATTR_CHAR_FONTLIST, false);
1282  const SfxUInt32Item* pFlagItem = aSet.GetItem<SfxUInt32Item>(SID_FLAG_TYPE, false);
1283  const SfxUInt16Item* pDisableItem = aSet.GetItem<SfxUInt16Item>(SID_DISABLE_CTL, false);
1284  if (pFontListItem)
1285  SetFontList(*pFontListItem);
1286 
1287  if (pFlagItem)
1288  {
1289  sal_uInt32 nFlags=pFlagItem->GetValue();
1290  if ( ( nFlags & SVX_RELATIVE_MODE ) == SVX_RELATIVE_MODE )
1292  if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER )
1293  // the writer uses SID_ATTR_BRUSH as font background
1295  }
1296  if (pDisableItem)
1297  DisableControls(pDisableItem->GetValue());
1298 }
1299 // class SvxCharEffectsPage ----------------------------------------------
1300 
1302  : SvxCharBasePage(pPage, pController, "cui/ui/effectspage.ui", "EffectsPage", rInSet)
1303  , m_bOrigFontColor(false)
1304  , m_bNewFontColor(false)
1305  , m_bEnableNoneFontColor(false)
1306  , m_xFontColorFT(m_xBuilder->weld_label("fontcolorft"))
1307  , m_xFontColorLB(new ColorListBox(m_xBuilder->weld_menu_button("fontcolorlb"), pController->getDialog()))
1308  , m_xFontTransparencyFT(m_xBuilder->weld_label("fonttransparencyft"))
1309  , m_xFontTransparencyMtr(
1310  m_xBuilder->weld_metric_spin_button("fonttransparencymtr", FieldUnit::PERCENT))
1311  , m_xEffectsFT(m_xBuilder->weld_label("effectsft"))
1312  , m_xEffectsLB(m_xBuilder->weld_combo_box("effectslb"))
1313  , m_xReliefFT(m_xBuilder->weld_label("reliefft"))
1314  , m_xReliefLB(m_xBuilder->weld_combo_box("relieflb"))
1315  , m_xOutlineBtn(m_xBuilder->weld_check_button("outlinecb"))
1316  , m_xShadowBtn(m_xBuilder->weld_check_button("shadowcb"))
1317  , m_xHiddenBtn(m_xBuilder->weld_check_button("hiddencb"))
1318  , m_xOverlineLB(m_xBuilder->weld_combo_box("overlinelb"))
1319  , m_xOverlineColorFT(m_xBuilder->weld_label("overlinecolorft"))
1320  , m_xOverlineColorLB(new ColorListBox(m_xBuilder->weld_menu_button("overlinecolorlb"), pController->getDialog()))
1321  , m_xStrikeoutLB(m_xBuilder->weld_combo_box("strikeoutlb"))
1322  , m_xUnderlineLB(m_xBuilder->weld_combo_box("underlinelb"))
1323  , m_xUnderlineColorFT(m_xBuilder->weld_label("underlinecolorft"))
1324  , m_xUnderlineColorLB(new ColorListBox(m_xBuilder->weld_menu_button("underlinecolorlb"), pController->getDialog()))
1325  , m_xIndividualWordsBtn(m_xBuilder->weld_check_button("individualwordscb"))
1326  , m_xEmphasisFT(m_xBuilder->weld_label("emphasisft"))
1327  , m_xEmphasisLB(m_xBuilder->weld_combo_box("emphasislb"))
1328  , m_xPositionFT(m_xBuilder->weld_label("positionft"))
1329  , m_xPositionLB(m_xBuilder->weld_combo_box("positionlb"))
1330  , m_xA11yWarningFT(m_xBuilder->weld_label("a11ywarning"))
1331 {
1332  m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin));
1333 #ifdef IOS
1334  m_xPreviewWin->hide();
1335 #endif
1336  m_xFontColorLB->SetSlotId(SID_ATTR_CHAR_COLOR);
1337  m_xOverlineColorLB->SetSlotId(SID_ATTR_CHAR_COLOR);
1338  m_xUnderlineColorLB->SetSlotId(SID_ATTR_CHAR_COLOR);
1339  Initialize();
1340 }
1341 
1343 {
1344  m_xFontColorLB->SetSlotId(SID_ATTR_CHAR_COLOR, true);
1345  m_bEnableNoneFontColor = true;
1346 }
1347 
1349 {
1350  m_xUnderlineColorLB.reset();
1351  m_xOverlineColorLB.reset();
1352  m_xFontTransparencyMtr.reset();
1353  m_xFontColorLB.reset();
1354 }
1355 
1357 {
1358  // to handle the changes of the other pages
1360 
1361  // HTML-Mode
1362  const SfxPoolItem* pItem;
1363  SfxObjectShell* pShell;
1364  if ( SfxItemState::SET == GetItemSet().GetItemState( SID_HTML_MODE, false, &pItem ) ||
1365  ( nullptr != ( pShell = SfxObjectShell::Current() ) &&
1366  nullptr != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) )
1367  {
1368  m_nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1369  if ( ( m_nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON )
1370  {
1372  }
1373  }
1374 
1375  m_xFontColorLB->SetSelectHdl(LINK(this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl));
1376  m_xFontTransparencyMtr->connect_value_changed(
1377  LINK(this, SvxCharEffectsPage, ModifyFontTransparencyHdl_Impl));
1378 
1379  // handler
1380  Link<weld::ComboBox&,void> aLink = LINK( this, SvxCharEffectsPage, SelectListBoxHdl_Impl );
1381  m_xUnderlineLB->connect_changed( aLink );
1382  m_xUnderlineColorLB->SetSelectHdl(LINK(this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl));
1383  m_xOverlineLB->connect_changed( aLink );
1384  m_xOverlineColorLB->SetSelectHdl(LINK(this, SvxCharEffectsPage, ColorBoxSelectHdl_Impl));
1385  m_xStrikeoutLB->connect_changed( aLink );
1386  m_xEmphasisLB->connect_changed( aLink );
1387  m_xPositionLB->connect_changed( aLink );
1388  m_xEffectsLB->connect_changed( aLink );
1389  m_xReliefLB->connect_changed( aLink );
1390 
1391  m_xUnderlineLB->set_active( 0 );
1392  m_xOverlineLB->set_active( 0 );
1393  m_xStrikeoutLB->set_active( 0 );
1394  m_xEmphasisLB->set_active( 0 );
1395  m_xPositionLB->set_active( 0 );
1396  SelectHdl_Impl(nullptr);
1398 
1399  m_xEffectsLB->set_active( 0 );
1400 
1401  m_xHiddenBtn->connect_toggled(LINK(this, SvxCharEffectsPage, HiddenBtnClickHdl));
1402  m_xIndividualWordsBtn->connect_toggled(LINK(this, SvxCharEffectsPage, CbClickHdl_Impl));
1403  m_xOutlineBtn->connect_toggled(LINK(this, SvxCharEffectsPage, OutlineBtnClickHdl));
1404  m_xShadowBtn->connect_toggled(LINK(this, SvxCharEffectsPage, ShadowBtnClickHdl));
1405 
1406  if ( !SvtLanguageOptions().IsAsianTypographyEnabled() )
1407  {
1408  m_xEmphasisFT->hide();
1409  m_xEmphasisLB->hide();
1410  m_xPositionFT->hide();
1411  m_xPositionLB->hide();
1412  }
1413 
1414  m_xA11yWarningFT->set_visible(officecfg::Office::Common::Accessibility::IsAutomaticFontColor::get());
1415 }
1416 
1418 {
1419  SvxFont& rFont = GetPreviewFont();
1420  SvxFont& rCJKFont = GetPreviewCJKFont();
1421  SvxFont& rCTLFont = GetPreviewCTLFont();
1422 
1423  const Color& rSelectedColor = m_xFontColorLB->GetSelectEntryColor();
1424  rFont.SetColor(rSelectedColor);
1425  rCJKFont.SetColor(rSelectedColor);
1426  rCTLFont.SetColor(rSelectedColor);
1427  m_aPreviewWin.AutoCorrectFontColor(); // handle color COL_AUTO
1428 
1429  FontLineStyle eUnderline = static_cast<FontLineStyle>(m_xUnderlineLB->get_active_id().toInt32());
1430  FontLineStyle eOverline = static_cast<FontLineStyle>(m_xOverlineLB->get_active_id().toInt32());
1431  FontStrikeout eStrikeout = static_cast<FontStrikeout>(m_xStrikeoutLB->get_active_id().toInt32());
1432  rFont.SetUnderline( eUnderline );
1433  rCJKFont.SetUnderline( eUnderline );
1434  rCTLFont.SetUnderline( eUnderline );
1435  m_aPreviewWin.SetTextLineColor( m_xUnderlineColorLB->GetSelectEntryColor() );
1436  rFont.SetOverline( eOverline );
1437  rCJKFont.SetOverline( eOverline );
1438  rCTLFont.SetOverline( eOverline );
1439  m_aPreviewWin.SetOverlineColor( m_xOverlineColorLB->GetSelectEntryColor() );
1440  rFont.SetStrikeout( eStrikeout );
1441  rCJKFont.SetStrikeout( eStrikeout );
1442  rCTLFont.SetStrikeout( eStrikeout );
1443 
1444  auto nEmphasis = m_xEmphasisLB->get_active();
1445  if (nEmphasis != -1)
1446  {
1447  bool bUnder = (CHRDLG_POSITION_UNDER == m_xPositionLB->get_active_id().toInt32());
1448  FontEmphasisMark eMark = static_cast<FontEmphasisMark>(nEmphasis);
1449  eMark |= bUnder ? FontEmphasisMark::PosBelow : FontEmphasisMark::PosAbove;
1450  rFont.SetEmphasisMark( eMark );
1451  rCJKFont.SetEmphasisMark( eMark );
1452  rCTLFont.SetEmphasisMark( eMark );
1453  }
1454 
1455  auto nRelief = m_xReliefLB->get_active();
1456  if (nRelief != -1)
1457  {
1458  rFont.SetRelief( static_cast<FontRelief>(nRelief) );
1459  rCJKFont.SetRelief( static_cast<FontRelief>(nRelief) );
1460  rCTLFont.SetRelief( static_cast<FontRelief>(nRelief) );
1461  }
1462 
1463  rFont.SetOutline( StateToAttr( m_xOutlineBtn->get_state() ) );
1464  rCJKFont.SetOutline( rFont.IsOutline() );
1465  rCTLFont.SetOutline( rFont.IsOutline() );
1466 
1467  rFont.SetShadow( StateToAttr( m_xShadowBtn->get_state() ) );
1468  rCJKFont.SetShadow( rFont.IsShadow() );
1469  rCTLFont.SetShadow( rFont.IsShadow() );
1470 
1471  auto nCapsPos = m_xEffectsLB->get_active();
1472  if (nCapsPos != -1)
1473  {
1474  SvxCaseMap eCaps = static_cast<SvxCaseMap>(nCapsPos);
1475  rFont.SetCaseMap( eCaps );
1476  rCJKFont.SetCaseMap( eCaps );
1477  // #i78474# small caps do not exist in CTL fonts
1478  rCTLFont.SetCaseMap( eCaps == SvxCaseMap::SmallCaps ? SvxCaseMap::NotMapped : eCaps );
1479  }
1480 
1481  bool bWordLine = StateToAttr( m_xIndividualWordsBtn->get_state() );
1482  rFont.SetWordLineMode( bWordLine );
1483  rCJKFont.SetWordLineMode( bWordLine );
1484  rCTLFont.SetWordLineMode( bWordLine );
1485 
1486  m_aPreviewWin.Invalidate();
1487 }
1488 
1490 {
1491  if ( SvxCaseMap::End > eCaseMap )
1492  m_xEffectsLB->set_active(
1493  sal::static_int_cast< sal_Int32 >( eCaseMap ) );
1494  else
1495  {
1496  // not mapped
1497  m_xEffectsLB->set_active(-1);
1498  }
1499 
1501 }
1502 
1504 {
1505  sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
1506  SfxItemState eState = rSet.GetItemState( nWhich );
1507 
1508  m_bOrigFontColor = false;
1509  switch ( eState )
1510  {
1511  case SfxItemState::UNKNOWN:
1512  m_xFontColorFT->hide();
1513  m_xFontColorLB->hide();
1514  break;
1515 
1516  case SfxItemState::DISABLED:
1517  case SfxItemState::READONLY:
1518  m_xFontColorFT->set_sensitive(false);
1519  m_xFontColorLB->set_sensitive(false);
1520  break;
1521 
1522  case SfxItemState::DONTCARE:
1523  //Related: tdf#106080 if there is no font color, then allow "none"
1524  //as a color so the listbox can display that state.
1526  m_xFontColorLB->SetNoSelection();
1527  break;
1528 
1529  case SfxItemState::DEFAULT:
1530  case SfxItemState::SET:
1531  {
1532  SvxFont& rFont = GetPreviewFont();
1533  SvxFont& rCJKFont = GetPreviewCJKFont();
1534  SvxFont& rCTLFont = GetPreviewCTLFont();
1535 
1536  const SvxColorItem& rItem = static_cast<const SvxColorItem&>(rSet.Get( nWhich ));
1537  Color aColor = rItem.GetValue();
1538  rFont.SetColor(aColor);
1539  rCJKFont.SetColor(aColor);
1540  rCTLFont.SetColor(aColor);
1541  m_aPreviewWin.AutoCorrectFontColor(); // handle color COL_AUTO
1542 
1543  m_aPreviewWin.Invalidate();
1544 
1545  Color aRGBColor = aColor;
1546  if (aRGBColor.GetTransparency() && aColor != COL_AUTO)
1547  {
1548  aRGBColor.SetTransparency(0);
1549  }
1550  m_xFontColorLB->SelectEntry(aRGBColor);
1551 
1552  if (m_xFontTransparencyMtr->get_visible() && aColor != COL_AUTO)
1553  {
1554  double fTransparency = aColor.GetTransparency() * 100.0 / 255;
1555  m_xFontTransparencyMtr->set_value(basegfx::fround(fTransparency),
1556  FieldUnit::PERCENT);
1557  }
1558 
1559  m_aOrigFontColor = aColor;
1560  m_bOrigFontColor = true;
1561  break;
1562  }
1563  }
1564  m_bNewFontColor = false;
1565 }
1566 
1568 {
1569  sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
1570  const SfxItemSet& rOldSet = GetItemSet();
1571 
1572  Color aSelectedColor;
1573  bool bChanged = m_bNewFontColor;
1574 
1575  if (bChanged)
1576  {
1577  aSelectedColor = m_xFontColorLB->GetSelectEntryColor();
1578 
1579  if (m_xFontTransparencyMtr->get_value_changed_from_saved())
1580  {
1581  double fTransparency
1582  = m_xFontTransparencyMtr->get_value(FieldUnit::PERCENT) * 255.0 / 100;
1583  aSelectedColor.SetTransparency(static_cast<sal_uInt8>(basegfx::fround(fTransparency)));
1584  }
1585 
1586  if (m_bOrigFontColor)
1587  bChanged = aSelectedColor != m_aOrigFontColor;
1588  if (m_bEnableNoneFontColor && bChanged && aSelectedColor == COL_NONE_COLOR)
1589  bChanged = false;
1590  }
1591 
1592  if (bChanged)
1593  rSet.Put( SvxColorItem( aSelectedColor, nWhich ) );
1594  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
1595  rSet.InvalidateItem(nWhich);
1596 
1597  return bChanged;
1598 }
1599 
1600 IMPL_LINK( SvxCharEffectsPage, SelectListBoxHdl_Impl, weld::ComboBox&, rBox, void )
1601 {
1602  SelectHdl_Impl(&rBox);
1603 }
1604 
1606 {
1607  if (m_xEmphasisLB.get() == pBox)
1608  {
1609  auto nEPos = m_xEmphasisLB->get_active();
1610  bool bEnable = nEPos > 0;
1611  m_xPositionFT->set_sensitive( bEnable );
1612  m_xPositionLB->set_sensitive( bEnable );
1613  }
1614  else if (m_xReliefLB.get() == pBox)
1615  {
1616  bool bEnable = ( pBox->get_active() == 0 );
1617  m_xOutlineBtn->set_sensitive( bEnable );
1618  m_xShadowBtn->set_sensitive( bEnable );
1619  }
1620  else if (m_xPositionLB.get() != pBox)
1621  {
1622  auto nUPos = m_xUnderlineLB->get_active();
1623  bool bUEnable = nUPos > 0;
1624  m_xUnderlineColorFT->set_sensitive(bUEnable);
1625  m_xUnderlineColorLB->set_sensitive(bUEnable);
1626 
1627  auto nOPos = m_xOverlineLB->get_active();
1628  bool bOEnable = nOPos > 0;
1629  m_xOverlineColorFT->set_sensitive(bOEnable);
1630  m_xOverlineColorLB->set_sensitive(bOEnable);
1631 
1632  auto nSPos = m_xStrikeoutLB->get_active();
1633  m_xIndividualWordsBtn->set_sensitive( bUEnable || bOEnable || nSPos > 0);
1634  }
1636 }
1637 
1638 IMPL_LINK(SvxCharEffectsPage, CbClickHdl_Impl, weld::ToggleButton&, rToggle, void)
1639 {
1640  m_aIndividualWordsState.ButtonToggled(rToggle);
1641  UpdatePreview_Impl();
1642  UpdatePreview_Impl();
1643 }
1644 
1645 IMPL_LINK(SvxCharEffectsPage, ColorBoxSelectHdl_Impl, ColorListBox&, rBox, void)
1646 {
1647  if (m_xFontColorLB.get() == &rBox)
1648  m_bNewFontColor = true;
1649  UpdatePreview_Impl();
1650 }
1651 
1652 IMPL_LINK_NOARG(SvxCharEffectsPage, ModifyFontTransparencyHdl_Impl, weld::MetricSpinButton&, void)
1653 {
1654  m_bNewFontColor = true;
1655 }
1656 
1658 {
1659  if ( _pSet )
1660  FillItemSet( _pSet );
1661  return DeactivateRC::LeavePage;
1662 }
1663 
1664 std::unique_ptr<SfxTabPage> SvxCharEffectsPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet )
1665 {
1666  return std::make_unique<SvxCharEffectsPage>( pPage, pController, *rSet );
1667 }
1668 
1670 {
1671  SvxFont& rFont = GetPreviewFont();
1672  SvxFont& rCJKFont = GetPreviewCJKFont();
1673  SvxFont& rCTLFont = GetPreviewCTLFont();
1674 
1675  bool bEnable = false;
1676 
1677  // Underline
1678  sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE );
1679  rFont.SetUnderline( LINESTYLE_NONE );
1680  rCJKFont.SetUnderline( LINESTYLE_NONE );
1681  rCTLFont.SetUnderline( LINESTYLE_NONE );
1682 
1683  m_xUnderlineLB->set_active( 0 );
1684  SfxItemState eState = rSet->GetItemState( nWhich );
1685 
1686  if ( eState >= SfxItemState::DONTCARE )
1687  {
1688  if ( eState == SfxItemState::DONTCARE )
1689  m_xUnderlineLB->set_active(-1);
1690  else
1691  {
1692  const SvxUnderlineItem& rItem = static_cast<const SvxUnderlineItem&>(rSet->Get( nWhich ));
1693  FontLineStyle eUnderline = rItem.GetValue();
1694  rFont.SetUnderline( eUnderline );
1695  rCJKFont.SetUnderline( eUnderline );
1696  rCTLFont.SetUnderline( eUnderline );
1697 
1698  if ( eUnderline != LINESTYLE_NONE )
1699  {
1700  auto nPos = m_xUnderlineLB->find_id(OUString::number(eUnderline));
1701  if (nPos != -1)
1702  {
1703  m_xUnderlineLB->set_active(nPos);
1704  bEnable = true;
1705  }
1706  Color aColor = rItem.GetColor();
1707  m_xUnderlineColorLB->SelectEntry(aColor);
1708  }
1709  else
1710  {
1711  m_xUnderlineColorLB->SelectEntry(COL_AUTO);
1712  m_xUnderlineColorLB->set_sensitive(false);
1713  }
1714  }
1715  }
1716 
1717  // Overline
1718  nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE );
1719  rFont.SetOverline( LINESTYLE_NONE );
1720  rCJKFont.SetOverline( LINESTYLE_NONE );
1721  rCTLFont.SetOverline( LINESTYLE_NONE );
1722 
1723  m_xOverlineLB->set_active( 0 );
1724  eState = rSet->GetItemState( nWhich );
1725 
1726  if ( eState >= SfxItemState::DONTCARE )
1727  {
1728  if ( eState == SfxItemState::DONTCARE )
1729  m_xOverlineLB->set_active(-1);
1730  else
1731  {
1732  const SvxOverlineItem& rItem = static_cast<const SvxOverlineItem&>(rSet->Get( nWhich ));
1733  FontLineStyle eOverline = rItem.GetValue();
1734  rFont.SetOverline( eOverline );
1735  rCJKFont.SetOverline( eOverline );
1736  rCTLFont.SetOverline( eOverline );
1737 
1738  if ( eOverline != LINESTYLE_NONE )
1739  {
1740  auto nPos = m_xOverlineLB->find_id(OUString::number(eOverline));
1741  if (nPos != -1)
1742  {
1743  m_xOverlineLB->set_active(nPos);
1744  bEnable = true;
1745  }
1746  Color aColor = rItem.GetColor();
1747  m_xOverlineColorLB->SelectEntry(aColor);
1748  }
1749  else
1750  {
1751  m_xOverlineColorLB->SelectEntry(COL_AUTO);
1752  m_xOverlineColorLB->set_sensitive(false);
1753  }
1754  }
1755  }
1756 
1757  // Strikeout
1758  nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT );
1759  rFont.SetStrikeout( STRIKEOUT_NONE );
1760  rCJKFont.SetStrikeout( STRIKEOUT_NONE );
1761  rCTLFont.SetStrikeout( STRIKEOUT_NONE );
1762 
1763  m_xStrikeoutLB->set_active( 0 );
1764  eState = rSet->GetItemState( nWhich );
1765 
1766  if ( eState >= SfxItemState::DONTCARE )
1767  {
1768  if ( eState == SfxItemState::DONTCARE )
1769  m_xStrikeoutLB->set_active(-1);
1770  else
1771  {
1772  const SvxCrossedOutItem& rItem = static_cast<const SvxCrossedOutItem&>(rSet->Get( nWhich ));
1773  FontStrikeout eStrikeout = rItem.GetValue();
1774  rFont.SetStrikeout( eStrikeout );
1775  rCJKFont.SetStrikeout( eStrikeout );
1776  rCTLFont.SetStrikeout( eStrikeout );
1777 
1778  if ( eStrikeout != STRIKEOUT_NONE )
1779  {
1780  auto nPos = m_xStrikeoutLB->find_id(OUString::number(eStrikeout));
1781  if (nPos != -1)
1782  {
1783  m_xStrikeoutLB->set_active(nPos);
1784  bEnable = true;
1785  }
1786  }
1787  }
1788  }
1789 
1790  // WordLineMode
1791  nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE );
1792  eState = rSet->GetItemState( nWhich );
1793 
1794  switch ( eState )
1795  {
1796  case SfxItemState::UNKNOWN:
1798  m_xIndividualWordsBtn->hide();
1799  break;
1800 
1801  case SfxItemState::DISABLED:
1802  case SfxItemState::READONLY:
1804  m_xIndividualWordsBtn->set_sensitive(false);
1805  break;
1806 
1807  case SfxItemState::DONTCARE:
1809  m_xIndividualWordsBtn->set_state( TRISTATE_INDET );
1810  break;
1811 
1812  case SfxItemState::DEFAULT:
1813  case SfxItemState::SET:
1814  {
1815  const SvxWordLineModeItem& rItem = static_cast<const SvxWordLineModeItem&>(rSet->Get( nWhich ));
1816  rFont.SetWordLineMode( rItem.GetValue() );
1817  rCJKFont.SetWordLineMode( rItem.GetValue() );
1818  rCTLFont.SetWordLineMode( rItem.GetValue() );
1819 
1821  m_xIndividualWordsBtn->set_active(rItem.GetValue());
1822  m_xIndividualWordsBtn->set_sensitive(bEnable);
1823  break;
1824  }
1825  }
1826 
1827  // Emphasis
1828  nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK );
1829  eState = rSet->GetItemState( nWhich );
1830 
1831  if ( eState >= SfxItemState::DEFAULT )
1832  {
1833  const SvxEmphasisMarkItem& rItem = static_cast<const SvxEmphasisMarkItem&>(rSet->Get( nWhich ));
1834  FontEmphasisMark eMark = rItem.GetEmphasisMark();
1835  rFont.SetEmphasisMark( eMark );
1836  rCJKFont.SetEmphasisMark( eMark );
1837  rCTLFont.SetEmphasisMark( eMark );
1838 
1839  m_xEmphasisLB->set_active( static_cast<sal_Int32>(FontEmphasisMark( eMark & FontEmphasisMark::Style )) );
1840  eMark &= ~FontEmphasisMark::Style;
1841  int nEntryData = ( eMark == FontEmphasisMark::PosAbove )
1843  : ( eMark == FontEmphasisMark::PosBelow ) ? CHRDLG_POSITION_UNDER : 0;
1844 
1845  auto nPos = m_xPositionLB->find_id(OUString::number(nEntryData));
1846  if (nPos != -1)
1847  m_xPositionLB->set_active(nPos);
1848  }
1849  else if ( eState == SfxItemState::DONTCARE )
1850  m_xEmphasisLB->set_active(-1);
1851  else if ( eState == SfxItemState::UNKNOWN )
1852  {
1853  m_xEmphasisFT->hide();
1854  m_xEmphasisLB->hide();
1855  }
1856  else // SfxItemState::DISABLED or SfxItemState::READONLY
1857  {
1858  m_xEmphasisFT->set_sensitive(false);
1859  m_xEmphasisLB->set_sensitive(false);
1860  }
1861 
1862  // the select handler for the underline/overline/strikeout list boxes
1864 
1865  // the select handler for the emphasis listbox
1867 
1868  // Effects
1869  SvxCaseMap eCaseMap = SvxCaseMap::End;
1870  nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP );
1871  eState = rSet->GetItemState( nWhich );
1872  switch ( eState )
1873  {
1874  case SfxItemState::UNKNOWN:
1875  m_xEffectsFT->hide();
1876  m_xEffectsLB->hide();
1877  break;
1878 
1879  case SfxItemState::DISABLED:
1880  case SfxItemState::READONLY:
1881  m_xEffectsFT->set_sensitive(false);
1882  m_xEffectsLB->set_sensitive(false);
1883  break;
1884 
1885  case SfxItemState::DONTCARE:
1886  m_xEffectsLB->set_active(-1);
1887  break;
1888 
1889  case SfxItemState::DEFAULT:
1890  case SfxItemState::SET:
1891  {
1892  const SvxCaseMapItem& rItem = static_cast<const SvxCaseMapItem&>(rSet->Get( nWhich ));
1893  eCaseMap = rItem.GetValue();
1894  break;
1895  }
1896  }
1897  SetCaseMap_Impl( eCaseMap );
1898 
1899  //Relief
1900  nWhich = GetWhich(SID_ATTR_CHAR_RELIEF);
1901  eState = rSet->GetItemState( nWhich );
1902  switch ( eState )
1903  {
1904  case SfxItemState::UNKNOWN:
1905  m_xReliefFT->hide();
1906  m_xReliefLB->hide();
1907  break;
1908 
1909  case SfxItemState::DISABLED:
1910  case SfxItemState::READONLY:
1911  m_xReliefFT->set_sensitive(false);
1912  m_xReliefLB->set_sensitive(false);
1913  break;
1914 
1915  case SfxItemState::DONTCARE:
1916  m_xReliefLB->set_active(-1);
1917  break;
1918 
1919  case SfxItemState::DEFAULT:
1920  case SfxItemState::SET:
1921  {
1922  const SvxCharReliefItem& rItem = static_cast<const SvxCharReliefItem&>(rSet->Get( nWhich ));
1923  m_xReliefLB->set_active(static_cast<sal_Int32>(rItem.GetValue()));
1924  SelectHdl_Impl(m_xReliefLB.get());
1925  break;
1926  }
1927  }
1928 
1929  // Outline
1930  nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR );
1931  eState = rSet->GetItemState( nWhich );
1932  switch ( eState )
1933  {
1934  case SfxItemState::UNKNOWN:
1936  m_xOutlineBtn->hide();
1937  break;
1938 
1939  case SfxItemState::DISABLED:
1940  case SfxItemState::READONLY:
1942  m_xOutlineBtn->set_sensitive(false);
1943  break;
1944 
1945  case SfxItemState::DONTCARE:
1947  m_xOutlineBtn->set_state(TRISTATE_INDET);
1948  break;
1949 
1950  case SfxItemState::DEFAULT:
1951  case SfxItemState::SET:
1952  {
1953  const SvxContourItem& rItem = static_cast<const SvxContourItem&>(rSet->Get( nWhich ));
1955  m_xOutlineBtn->set_state(static_cast<TriState>(rItem.GetValue()));
1956  break;
1957  }
1958  }
1959 
1960  // Shadow
1961  nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED );
1962  eState = rSet->GetItemState( nWhich );
1963 
1964  switch ( eState )
1965  {
1966  case SfxItemState::UNKNOWN:
1968  m_xShadowBtn->hide();
1969  break;
1970 
1971  case SfxItemState::DISABLED:
1972  case SfxItemState::READONLY:
1974  m_xShadowBtn->set_sensitive(false);
1975  break;
1976 
1977  case SfxItemState::DONTCARE:
1979  m_xShadowBtn->set_state( TRISTATE_INDET );
1980  break;
1981 
1982  case SfxItemState::DEFAULT:
1983  case SfxItemState::SET:
1984  {
1985  const SvxShadowedItem& rItem = static_cast<const SvxShadowedItem&>(rSet->Get( nWhich ));
1987  m_xShadowBtn->set_state( static_cast<TriState>(rItem.GetValue()) );
1988  break;
1989  }
1990  }
1991 
1992  // Hidden
1993  nWhich = GetWhich( SID_ATTR_CHAR_HIDDEN );
1994  eState = rSet->GetItemState( nWhich );
1995 
1996  switch ( eState )
1997  {
1998  case SfxItemState::UNKNOWN:
2000  m_xHiddenBtn->hide();
2001  break;
2002 
2003  case SfxItemState::DISABLED:
2004  case SfxItemState::READONLY:
2006  m_xHiddenBtn->set_sensitive(false);
2007  break;
2008 
2009  case SfxItemState::DONTCARE:
2011  m_xHiddenBtn->set_state(TRISTATE_INDET);
2012  break;
2013 
2014  case SfxItemState::DEFAULT:
2015  case SfxItemState::SET:
2016  {
2017  const SvxCharHiddenItem& rItem = static_cast<const SvxCharHiddenItem&>(rSet->Get( nWhich ));
2019  m_xHiddenBtn->set_state(static_cast<TriState>(rItem.GetValue()));
2020  break;
2021  }
2022  }
2023 
2024  SetPrevFontWidthScale( *rSet );
2025  ResetColor_Impl( *rSet );
2026 
2027  // preview update
2028  m_aPreviewWin.Invalidate();
2029 
2030  // save this settings
2031  ChangesApplied();
2032 }
2033 
2034 IMPL_LINK(SvxCharEffectsPage, HiddenBtnClickHdl, weld::ToggleButton&, rToggle, void)
2035 {
2036  m_aHiddenState.ButtonToggled(rToggle);
2037 }
2038 
2039 IMPL_LINK(SvxCharEffectsPage, OutlineBtnClickHdl, weld::ToggleButton&, rToggle, void)
2040 {
2041  m_aOutlineState.ButtonToggled(rToggle);
2042  UpdatePreview_Impl();
2043 }
2044 
2045 IMPL_LINK(SvxCharEffectsPage, ShadowBtnClickHdl, weld::ToggleButton&, rToggle, void)
2046 {
2047  m_aShadowState.ButtonToggled(rToggle);
2048  UpdatePreview_Impl();
2049 }
2050 
2052 {
2053  m_xUnderlineLB->save_value();
2054  m_xOverlineLB->save_value();
2055  m_xStrikeoutLB->save_value();
2056  m_xIndividualWordsBtn->save_state();
2057  m_xEmphasisLB->save_value();
2058  m_xPositionLB->save_value();
2059  m_xEffectsLB->save_value();
2060  m_xReliefLB->save_value();
2061  m_xOutlineBtn->save_state();
2062  m_xShadowBtn->save_state();
2063  m_xHiddenBtn->save_state();
2064  m_xFontTransparencyMtr->save_value();
2065 }
2066 
2068 {
2069  const SfxPoolItem* pOld = nullptr;
2070  const SfxItemSet& rOldSet = GetItemSet();
2071  bool bModified = false;
2072  bool bChanged = true;
2073 
2074  // Underline
2075  sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_UNDERLINE );
2076  pOld = GetOldItem( *rSet, SID_ATTR_CHAR_UNDERLINE );
2077  auto nPos = m_xUnderlineLB->get_active();
2078  FontLineStyle eUnder = static_cast<FontLineStyle>(m_xUnderlineLB->get_active_id().toInt32());
2079 
2080  if ( pOld )
2081  {
2086  bool bAllowChg = nPos != -1 &&
2087  SfxItemState::DEFAULT > rOldSet.GetItemState( nWhich );
2088 
2089  const SvxUnderlineItem& rItem = *static_cast<const SvxUnderlineItem*>(pOld);
2090  if ( rItem.GetValue() == eUnder &&
2091  ( LINESTYLE_NONE == eUnder || rItem.GetColor() == m_xUnderlineColorLB->GetSelectEntryColor() ) &&
2092  ! bAllowChg )
2093  bChanged = false;
2094  }
2095 
2096  if ( bChanged )
2097  {
2098  SvxUnderlineItem aNewItem( eUnder, nWhich );
2099  aNewItem.SetColor( m_xUnderlineColorLB->GetSelectEntryColor() );
2100  rSet->Put( aNewItem );
2101  bModified = true;
2102  }
2103  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2104  rSet->InvalidateItem(nWhich);
2105 
2106  bChanged = true;
2107 
2108  // Overline
2109  nWhich = GetWhich( SID_ATTR_CHAR_OVERLINE );
2110  pOld = GetOldItem( *rSet, SID_ATTR_CHAR_OVERLINE );
2111  nPos = m_xOverlineLB->get_active();
2112  FontLineStyle eOver = static_cast<FontLineStyle>(m_xOverlineLB->get_active_id().toInt32());
2113 
2114  if ( pOld )
2115  {
2120  bool bAllowChg = nPos != -1 &&
2121  SfxItemState::DEFAULT > rOldSet.GetItemState( nWhich );
2122 
2123  const SvxOverlineItem& rItem = *static_cast<const SvxOverlineItem*>(pOld);
2124  if ( rItem.GetValue() == eOver &&
2125  ( LINESTYLE_NONE == eOver || rItem.GetColor() == m_xOverlineColorLB->GetSelectEntryColor() ) &&
2126  ! bAllowChg )
2127  bChanged = false;
2128  }
2129 
2130  if ( bChanged )
2131  {
2132  SvxOverlineItem aNewItem( eOver, nWhich );
2133  aNewItem.SetColor( m_xOverlineColorLB->GetSelectEntryColor() );
2134  rSet->Put( aNewItem );
2135  bModified = true;
2136  }
2137  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2138  rSet->InvalidateItem(nWhich);
2139 
2140  bChanged = true;
2141 
2142  // Strikeout
2143  nWhich = GetWhich( SID_ATTR_CHAR_STRIKEOUT );
2144  pOld = GetOldItem( *rSet, SID_ATTR_CHAR_STRIKEOUT );
2145  nPos = m_xStrikeoutLB->get_active();
2146  FontStrikeout eStrike = static_cast<FontStrikeout>(m_xStrikeoutLB->get_active_id().toInt32());
2147 
2148  if ( pOld )
2149  {
2154  bool bAllowChg = nPos != -1 &&
2155  SfxItemState::DEFAULT > rOldSet.GetItemState( nWhich );
2156 
2157  const SvxCrossedOutItem& rItem = *static_cast<const SvxCrossedOutItem*>(pOld);
2158  if ( !m_xStrikeoutLB->get_sensitive()
2159  || (rItem.GetValue() == eStrike && !bAllowChg) )
2160  bChanged = false;
2161  }
2162 
2163  if ( bChanged )
2164  {
2165  rSet->Put( SvxCrossedOutItem( eStrike, nWhich ) );
2166  bModified = true;
2167  }
2168  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2169  rSet->InvalidateItem(nWhich);
2170 
2171  bChanged = true;
2172 
2173  // Individual words
2174  const SfxItemSet* pExampleSet = GetDialogExampleSet();
2175  nWhich = GetWhich( SID_ATTR_CHAR_WORDLINEMODE );
2176  pOld = GetOldItem( *rSet, SID_ATTR_CHAR_WORDLINEMODE );
2177  TriState eState = m_xIndividualWordsBtn->get_state();
2178  const SfxPoolItem* pItem;
2179 
2180  if ( pOld )
2181  {
2182  const SvxWordLineModeItem& rItem = *static_cast<const SvxWordLineModeItem*>(pOld);
2183  if ( rItem.GetValue() == StateToAttr( eState ) && m_xIndividualWordsBtn->get_saved_state() == eState )
2184  bChanged = false;
2185  }
2186 
2187  if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
2188  !StateToAttr( eState ) && static_cast<const SvxWordLineModeItem*>(pItem)->GetValue() )
2189  bChanged = true;
2190 
2191  if ( bChanged && eState != TRISTATE_INDET )
2192  {
2193  rSet->Put( SvxWordLineModeItem( StateToAttr( eState ), nWhich ) );
2194  bModified = true;
2195  }
2196  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2197  rSet->InvalidateItem(nWhich);
2198 
2199  bChanged = true;
2200 
2201  // Emphasis
2202  nWhich = GetWhich( SID_ATTR_CHAR_EMPHASISMARK );
2203  pOld = GetOldItem( *rSet, SID_ATTR_CHAR_EMPHASISMARK );
2204  int nMarkPos = m_xEmphasisLB->get_active();
2205  OUString sMarkPos = m_xEmphasisLB->get_active_text();
2206  OUString sPosPos = m_xPositionLB->get_active_text();
2207  FontEmphasisMark eMark = static_cast<FontEmphasisMark>(nMarkPos);
2208  if (m_xPositionLB->get_sensitive())
2209  {
2210  eMark |= (CHRDLG_POSITION_UNDER == m_xPositionLB->get_active_id().toInt32())
2211  ? FontEmphasisMark::PosBelow : FontEmphasisMark::PosAbove;
2212  }
2213 
2214  if ( pOld )
2215  {
2216  if( rOldSet.GetItemState( nWhich ) != SfxItemState::DONTCARE )
2217  {
2218  const SvxEmphasisMarkItem& rItem = *static_cast<const SvxEmphasisMarkItem*>(pOld);
2219  if ( rItem.GetEmphasisMark() == eMark )
2220  bChanged = false;
2221  }
2222  }
2223 
2224  if (rOldSet.GetItemState( nWhich ) == SfxItemState::DONTCARE &&
2225  m_xEmphasisLB->get_saved_value() == sMarkPos && m_xPositionLB->get_saved_value() == sPosPos)
2226  {
2227  bChanged = false;
2228  }
2229 
2230  if (bChanged)
2231  {
2232  rSet->Put( SvxEmphasisMarkItem( eMark, nWhich ) );
2233  bModified = true;
2234  }
2235  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2236  rSet->InvalidateItem(nWhich);
2237 
2238  bChanged = true;
2239 
2240  // Effects
2241  nWhich = GetWhich( SID_ATTR_CHAR_CASEMAP );
2242  pOld = GetOldItem( *rSet, SID_ATTR_CHAR_CASEMAP );
2243  SvxCaseMap eCaseMap = SvxCaseMap::NotMapped;
2244  bool bChecked = false;
2245  auto nCapsPos = m_xEffectsLB->get_active();
2246  if (nCapsPos != -1)
2247  {
2248  eCaseMap = static_cast<SvxCaseMap>(nCapsPos);
2249  bChecked = true;
2250  }
2251 
2252  if ( pOld )
2253  {
2258  bool bAllowChg = nPos != -1 &&
2259  SfxItemState::DEFAULT > rOldSet.GetItemState( nWhich );
2260 
2261  const SvxCaseMapItem& rItem = *static_cast<const SvxCaseMapItem*>(pOld);
2262  if ( rItem.GetValue() == eCaseMap && !bAllowChg )
2263  bChanged = false;
2264  }
2265 
2266  if ( bChanged && bChecked )
2267  {
2268  rSet->Put( SvxCaseMapItem( eCaseMap, nWhich ) );
2269  bModified = true;
2270  }
2271  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2272  rSet->InvalidateItem(nWhich);
2273 
2274  bChanged = true;
2275 
2276  //Relief
2277  nWhich = GetWhich(SID_ATTR_CHAR_RELIEF);
2278  if (m_xReliefLB->get_value_changed_from_saved())
2279  {
2280  m_xReliefLB->save_value();
2281  SvxCharReliefItem aRelief(static_cast<FontRelief>(m_xReliefLB->get_active()), nWhich);
2282  rSet->Put(aRelief);
2283  }
2284 
2285  // Outline
2286  nWhich = GetWhich( SID_ATTR_CHAR_CONTOUR );
2287  pOld = GetOldItem( *rSet, SID_ATTR_CHAR_CONTOUR );
2288  eState = m_xOutlineBtn->get_state();
2289 
2290  if ( pOld )
2291  {
2292  const SvxContourItem& rItem = *static_cast<const SvxContourItem*>(pOld);
2293  if ( rItem.GetValue() == StateToAttr( eState ) && m_xOutlineBtn->get_saved_state() == eState )
2294  bChanged = false;
2295  }
2296 
2297  if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
2298  !StateToAttr( eState ) && static_cast<const SvxContourItem*>(pItem)->GetValue() )
2299  bChanged = true;
2300 
2301  if ( bChanged && eState != TRISTATE_INDET )
2302  {
2303  rSet->Put( SvxContourItem( StateToAttr( eState ), nWhich ) );
2304  bModified = true;
2305  }
2306  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2307  rSet->InvalidateItem(nWhich);
2308 
2309  bChanged = true;
2310 
2311  // Shadow
2312  nWhich = GetWhich( SID_ATTR_CHAR_SHADOWED );
2313  pOld = GetOldItem( *rSet, SID_ATTR_CHAR_SHADOWED );
2314  eState = m_xShadowBtn->get_state();
2315 
2316  if ( pOld )
2317  {
2318  const SvxShadowedItem& rItem = *static_cast<const SvxShadowedItem*>(pOld);
2319  if ( rItem.GetValue() == StateToAttr( eState ) && m_xShadowBtn->get_saved_state() == eState )
2320  bChanged = false;
2321  }
2322 
2323  if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
2324  !StateToAttr( eState ) && static_cast<const SvxShadowedItem*>(pItem)->GetValue() )
2325  bChanged = true;
2326 
2327  if ( bChanged && eState != TRISTATE_INDET )
2328  {
2329  rSet->Put( SvxShadowedItem( StateToAttr( eState ), nWhich ) );
2330  bModified = true;
2331  }
2332  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2333  rSet->InvalidateItem(nWhich);
2334 
2335  bChanged = true;
2336 
2337  // Hidden
2338  nWhich = GetWhich( SID_ATTR_CHAR_HIDDEN );
2339  pOld = GetOldItem( *rSet, SID_ATTR_CHAR_HIDDEN );
2340  eState = m_xHiddenBtn->get_state();
2341  bChanged = true;
2342 
2343  if ( pOld )
2344  {
2345  const SvxCharHiddenItem& rItem = *static_cast<const SvxCharHiddenItem*>(pOld);
2346  if ( rItem.GetValue() == StateToAttr( eState ) && m_xHiddenBtn->get_saved_state() == eState )
2347  bChanged = false;
2348  }
2349 
2350  if ( !bChanged && pExampleSet && pExampleSet->GetItemState( nWhich, false, &pItem ) == SfxItemState::SET &&
2351  !StateToAttr( eState ) && static_cast<const SvxCharHiddenItem*>(pItem)->GetValue() )
2352  bChanged = true;
2353 
2354  if ( bChanged && eState != TRISTATE_INDET )
2355  {
2356  rSet->Put( SvxCharHiddenItem( StateToAttr( eState ), nWhich ) );
2357  bModified = true;
2358  }
2359  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2360  rSet->InvalidateItem(nWhich);
2361 
2362  bModified |= FillItemSetColor_Impl( *rSet );
2363 
2364  return bModified;
2365 }
2366 
2367 void SvxCharEffectsPage::DisableControls( sal_uInt16 nDisable )
2368 {
2369  if ( ( DISABLE_CASEMAP & nDisable ) == DISABLE_CASEMAP )
2370  {
2371  m_xEffectsFT->set_sensitive(false);
2372  m_xEffectsLB->set_sensitive(false);
2373  }
2374 }
2375 
2377 {
2378  const SfxUInt16Item* pDisableCtlItem = aSet.GetItem<SfxUInt16Item>(SID_DISABLE_CTL, false);
2379  const SfxUInt32Item* pFlagItem = aSet.GetItem<SfxUInt32Item>(SID_FLAG_TYPE, false);
2380  if (pDisableCtlItem)
2381  DisableControls(pDisableCtlItem->GetValue());
2382 
2383  if (!pFlagItem)
2384  return;
2385 
2386  sal_uInt32 nFlags=pFlagItem->GetValue();
2387  if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER )
2388  // the writer uses SID_ATTR_BRUSH as font background
2390  if ((nFlags & SVX_ENABLE_CHAR_TRANSPARENCY) != SVX_ENABLE_CHAR_TRANSPARENCY)
2391  {
2392  // Only show these in case client code explicitly wants this.
2393  m_xFontTransparencyFT->hide();
2394  m_xFontTransparencyMtr->hide();
2395  }
2396 }
2397 
2398 // class SvxCharPositionPage ---------------------------------------------
2399 
2401  : SvxCharBasePage(pPage, pController, "cui/ui/positionpage.ui", "PositionPage", rInSet)
2402  , m_nSuperEsc(short(DFLT_ESC_SUPER))
2403  , m_nSubEsc(short(DFLT_ESC_SUB))
2404  , m_nScaleWidthItemSetVal(100)
2405  , m_nScaleWidthInitialVal(100)
2406  , m_nSuperProp(sal_uInt8(DFLT_ESC_PROP))
2407  , m_nSubProp(sal_uInt8(DFLT_ESC_PROP))
2408  , m_xHighPosBtn(m_xBuilder->weld_radio_button("superscript"))
2409  , m_xNormalPosBtn(m_xBuilder->weld_radio_button("normal"))
2410  , m_xLowPosBtn(m_xBuilder->weld_radio_button("subscript"))
2411  , m_xHighLowFT(m_xBuilder->weld_label("raiselower"))
2412  , m_xHighLowMF(m_xBuilder->weld_metric_spin_button("raiselowersb", FieldUnit::PERCENT))
2413  , m_xHighLowRB(m_xBuilder->weld_check_button("automatic"))
2414  , m_xFontSizeFT(m_xBuilder->weld_label("relativefontsize"))
2415  , m_xFontSizeMF(m_xBuilder->weld_metric_spin_button("fontsizesb", FieldUnit::PERCENT))
2416  , m_xRotationContainer(m_xBuilder->weld_widget("rotationcontainer"))
2417  , m_xScalingFT(m_xBuilder->weld_label("scale"))
2418  , m_xScalingAndRotationFT(m_xBuilder->weld_label("rotateandscale"))
2419  , m_x0degRB(m_xBuilder->weld_radio_button("0deg"))
2420  , m_x90degRB(m_xBuilder->weld_radio_button("90deg"))
2421  , m_x270degRB(m_xBuilder->weld_radio_button("270deg"))
2422  , m_xFitToLineCB(m_xBuilder->weld_check_button("fittoline"))
2423  , m_xScaleWidthMF(m_xBuilder->weld_metric_spin_button("scalewidthsb", FieldUnit::PERCENT))
2424  , m_xKerningMF(m_xBuilder->weld_metric_spin_button("kerningsb", FieldUnit::POINT))
2425  , m_xPairKerningBtn(m_xBuilder->weld_check_button("pairkerning"))
2426 {
2427  m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin));
2428 #ifdef IOS
2429  m_xPreviewWin->hide();
2430 #endif
2431  Initialize();
2432 }
2433 
2435 {
2436 }
2437 
2438 
2440 {
2441  // to handle the changes of the other pages
2443 
2444  GetPreviewFont().SetFontSize( Size( 0, 240 ) );
2445  GetPreviewCJKFont().SetFontSize( Size( 0, 240 ) );
2446  GetPreviewCTLFont().SetFontSize( Size( 0, 240 ) );
2447 
2448  m_xNormalPosBtn->set_active(true);
2449  PositionHdl_Impl(*m_xNormalPosBtn);
2450 
2451  Link<weld::ToggleButton&,void> aLink2 = LINK(this, SvxCharPositionPage, PositionHdl_Impl);
2452  m_xHighPosBtn->connect_toggled(aLink2);
2453  m_xNormalPosBtn->connect_toggled(aLink2);
2454  m_xLowPosBtn->connect_toggled(aLink2);
2455 
2456  aLink2 = LINK( this, SvxCharPositionPage, RotationHdl_Impl );
2457  m_x0degRB->connect_toggled(aLink2);
2458  m_x90degRB->connect_toggled(aLink2);
2459  m_x270degRB->connect_toggled(aLink2);
2460 
2461  Link<weld::MetricSpinButton&,void> aLink3 = LINK(this, SvxCharPositionPage, ValueChangedHdl_Impl);
2462  m_xHighLowMF->connect_value_changed(aLink3);
2463  m_xFontSizeMF->connect_value_changed(aLink3);
2464 
2465  m_xHighLowRB->connect_toggled(LINK(this, SvxCharPositionPage, AutoPositionHdl_Impl));
2466  m_xFitToLineCB->connect_toggled(LINK(this, SvxCharPositionPage, FitToLineHdl_Impl));
2467  m_xKerningMF->connect_value_changed(LINK(this, SvxCharPositionPage, KerningModifyHdl_Impl));
2468  m_xScaleWidthMF->connect_value_changed(LINK(this, SvxCharPositionPage, ScaleWidthModifyHdl_Impl));
2469 }
2470 
2472 {
2473  SetPrevFontEscapement( nProp, nEscProp, nEsc );
2474 }
2475 
2476 
2478 {
2479  SvxEscapementItem aEscItm( nEsc, SID_ATTR_CHAR_ESCAPEMENT );
2480 
2481  if ( SvxEscapement::Superscript == nEsc )
2482  {
2483  aEscItm.GetEsc() = m_nSuperEsc;
2484  aEscItm.GetProportionalHeight() = m_nSuperProp;
2485  }
2486  else if ( SvxEscapement::Subscript == nEsc )
2487  {
2488  aEscItm.GetEsc() = m_nSubEsc;
2489  aEscItm.GetProportionalHeight() = m_nSubProp;
2490  }
2491 
2492  short nFac = aEscItm.GetEsc() < 0 ? -1 : 1;
2493 
2494  m_xHighLowMF->set_value(aEscItm.GetEsc() * nFac, FieldUnit::PERCENT);
2495  m_xFontSizeMF->set_value(aEscItm.GetProportionalHeight(), FieldUnit::PERCENT);
2496 
2497  if ( SvxEscapement::Off == nEsc )
2498  {
2499  m_xHighLowFT->set_sensitive(false);
2500  m_xHighLowMF->set_sensitive(false);
2501  m_xFontSizeFT->set_sensitive(false);
2502  m_xFontSizeMF->set_sensitive(false);
2503  m_xHighLowRB->set_sensitive(false);
2504  }
2505  else
2506  {
2507  m_xFontSizeFT->set_sensitive(true);
2508  m_xFontSizeMF->set_sensitive(true);
2509  m_xHighLowRB->set_sensitive(true);
2510 
2511  if (!m_xHighLowRB->get_active())
2512  {
2513  m_xHighLowFT->set_sensitive(true);
2514  m_xHighLowMF->set_sensitive(true);
2515  }
2516  else
2517  AutoPositionHdl_Impl(*m_xHighLowRB);
2518  }
2519 
2520  UpdatePreview_Impl( 100, aEscItm.GetProportionalHeight(), aEscItm.GetEsc() );
2521 }
2522 
2523 
2525 {
2526  SvxEscapement nEsc = SvxEscapement::Off; // also when pBtn == NULL
2527 
2528  if (m_xHighPosBtn->get_active())
2529  nEsc = SvxEscapement::Superscript;
2530  else if (m_xLowPosBtn->get_active())
2531  nEsc = SvxEscapement::Subscript;
2532 
2533  SetEscapement_Impl( nEsc );
2534 }
2535 
2537 {
2538  bool bEnable = false;
2539  if (m_x90degRB->get_active() || m_x270degRB->get_active())
2540  bEnable = true;
2541  else
2542  OSL_ENSURE(m_x0degRB->get_active(), "unexpected button");
2543  m_xFitToLineCB->set_sensitive(bEnable);
2544 }
2545 
2547 {
2548  sal_uInt8 nEscProp = static_cast<sal_uInt8>(m_xFontSizeMF->get_value(FieldUnit::PERCENT));
2549  short nEsc = static_cast<short>(m_xHighLowMF->get_value(FieldUnit::PERCENT));
2550  nEsc *= m_xLowPosBtn->get_active() ? -1 : 1;
2551  UpdatePreview_Impl( 100, nEscProp, nEsc );
2552 }
2553 
2554 IMPL_LINK(SvxCharPositionPage, AutoPositionHdl_Impl, weld::ToggleButton&, rBox, void)
2555 {
2556  if (rBox.get_active())
2557  {
2558  m_xHighLowFT->set_sensitive(false);
2559  m_xHighLowMF->set_sensitive(false);
2560  }
2561  else
2562  PositionHdl_Impl(m_xHighPosBtn->get_active() ? *m_xHighPosBtn
2563  : m_xLowPosBtn->get_active() ? *m_xLowPosBtn
2564  : *m_xNormalPosBtn);
2565 }
2566 
2568 {
2569  sal_uInt16 nVal = m_nScaleWidthInitialVal;
2570  if (m_xFitToLineCB->get_active())
2571  nVal = m_nScaleWidthItemSetVal;
2572  m_xScaleWidthMF->set_value(nVal, FieldUnit::PERCENT);
2573  m_aPreviewWin.SetFontWidthScale( nVal );
2574 }
2575 
2577 {
2578  tools::Long nVal = static_cast<tools::Long>(m_xKerningMF->get_value(FieldUnit::POINT));
2579  nVal = OutputDevice::LogicToLogic( nVal, MapUnit::MapPoint, MapUnit::MapTwip );
2580  tools::Long nKern = static_cast<short>(m_xKerningMF->denormalize(nVal));
2581 
2582  SvxFont& rFont = GetPreviewFont();
2583  SvxFont& rCJKFont = GetPreviewCJKFont();
2584  SvxFont& rCTLFont = GetPreviewCTLFont();
2585 
2586  rFont.SetFixKerning( static_cast<short>(nKern) );
2587  rCJKFont.SetFixKerning( static_cast<short>(nKern) );
2588  rCTLFont.SetFixKerning( static_cast<short>(nKern) );
2589  m_aPreviewWin.Invalidate();
2590 }
2591 
2592 IMPL_LINK(SvxCharPositionPage, ValueChangedHdl_Impl, weld::MetricSpinButton&, rField, void)
2593 {
2594  bool bHigh = m_xHighPosBtn->get_active();
2595  bool bLow = m_xLowPosBtn->get_active();
2596  DBG_ASSERT( bHigh || bLow, "normal position is not valid" );
2597 
2598  if (m_xHighLowMF.get() == &rField)
2599  {
2600  if ( bLow )
2601  m_nSubEsc = static_cast<short>(m_xHighLowMF->get_value(FieldUnit::PERCENT)) * -1;
2602  else
2603  m_nSuperEsc = static_cast<short>(m_xHighLowMF->get_value(FieldUnit::PERCENT));
2604  }
2605  else if (m_xFontSizeMF.get() == &rField)
2606  {
2607  if ( bLow )
2608  m_nSubProp = static_cast<sal_uInt8>(m_xFontSizeMF->get_value(FieldUnit::PERCENT));
2609  else
2610  m_nSuperProp = static_cast<sal_uInt8>(m_xFontSizeMF->get_value(FieldUnit::PERCENT));
2611  }
2612 
2613  FontModifyHdl_Impl();
2614 }
2615 
2617 {
2618  m_aPreviewWin.SetFontWidthScale(sal_uInt16(m_xScaleWidthMF->get_value(FieldUnit::PERCENT)));
2619 }
2620 
2622 {
2623  if ( _pSet )
2624  FillItemSet( _pSet );
2625  return DeactivateRC::LeavePage;
2626 }
2627 
2628 std::unique_ptr<SfxTabPage> SvxCharPositionPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
2629 {
2630  return std::make_unique<SvxCharPositionPage>(pPage, pController, *rSet);
2631 }
2632 
2634 {
2635  OUString sUser = GetUserData();
2636 
2637  if ( !sUser.isEmpty() )
2638  {
2639  sal_Int32 nIdx {0};
2640  m_nSuperEsc = static_cast<short>(sUser.getToken( 0, ';', nIdx ).toInt32());
2641  m_nSubEsc = static_cast<short>(sUser.getToken( 0, ';', nIdx ).toInt32());
2642  m_nSuperProp = static_cast<sal_uInt8>(sUser.getToken( 0, ';', nIdx ).toInt32());
2643  m_nSubProp = static_cast<sal_uInt8>(sUser.getToken( 0, ';', nIdx ).toInt32());
2644 
2645  m_xHighLowMF->set_max(MAX_ESC_POS, FieldUnit::PERCENT);
2646 
2647  //fdo#75307 validate all the entries and discard all of them if any are
2648  //out of range
2649  bool bValid = true;
2650  if (m_nSuperEsc < m_xHighLowMF->get_min(FieldUnit::PERCENT) || m_nSuperEsc > m_xHighLowMF->get_max(FieldUnit::PERCENT))
2651  bValid = false;
2652  if (m_nSubEsc*-1 < m_xHighLowMF->get_min(FieldUnit::PERCENT) || m_nSubEsc*-1 > m_xHighLowMF->get_max(FieldUnit::PERCENT))
2653  bValid = false;
2654  if (m_nSuperProp < m_xFontSizeMF->get_min(FieldUnit::PERCENT) || m_nSuperProp > m_xFontSizeMF->get_max(FieldUnit::PERCENT))
2655  bValid = false;
2656  if (m_nSubProp < m_xFontSizeMF->get_min(FieldUnit::PERCENT) || m_nSubProp > m_xFontSizeMF->get_max(FieldUnit::PERCENT))
2657  bValid = false;
2658 
2659  if (!bValid)
2660  {
2665  }
2666  }
2667 
2668  short nEsc = 0;
2669  sal_uInt8 nEscProp = 100;
2670 
2671  m_xHighLowFT->set_sensitive(false);
2672  m_xHighLowMF->set_sensitive(false);
2673  m_xFontSizeFT->set_sensitive(false);
2674  m_xFontSizeMF->set_sensitive(false);
2675 
2676  SvxFont& rFont = GetPreviewFont();
2677  SvxFont& rCJKFont = GetPreviewCJKFont();
2678  SvxFont& rCTLFont = GetPreviewCTLFont();
2679  sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT );
2680 
2681  if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
2682  {
2683  const SvxEscapementItem& rItem = static_cast<const SvxEscapementItem&>(rSet->Get( nWhich ));
2684  nEsc = rItem.GetEsc();
2685  nEscProp = rItem.GetProportionalHeight();
2686 
2687  if ( nEsc != 0 )
2688  {
2689  m_xHighLowFT->set_sensitive(true);
2690  m_xHighLowMF->set_sensitive(true);
2691  m_xFontSizeFT->set_sensitive(true);
2692  m_xFontSizeMF->set_sensitive(true);
2693 
2694  short nFac;
2695  bool bAutomatic(false);
2696 
2697  if ( nEsc > 0 )
2698  {
2699  nFac = 1;
2700  m_xHighPosBtn->set_active(true);
2701  if ( nEsc == DFLT_ESC_AUTO_SUPER )
2702  {
2703  nEsc = DFLT_ESC_SUPER;
2704  bAutomatic = true;
2705  }
2706  }
2707  else
2708  {
2709  nFac = -1;
2710  m_xLowPosBtn->set_active(true);
2711  if ( nEsc == DFLT_ESC_AUTO_SUB )
2712  {
2713  nEsc = DFLT_ESC_SUB;
2714  bAutomatic = true;
2715  }
2716  }
2717  if (!m_xHighLowRB->get_sensitive())
2718  {
2719  m_xHighLowRB->set_sensitive(true);
2720  }
2721  m_xHighLowRB->set_active(bAutomatic);
2722 
2723  if (m_xHighLowRB->get_active())
2724  {
2725  m_xHighLowFT->set_sensitive(false);
2726  m_xHighLowMF->set_sensitive(false);
2727  }
2728  m_xHighLowMF->set_value(m_xHighLowMF->normalize(nFac * nEsc), FieldUnit::PERCENT);
2729  }
2730  else
2731  {
2732  m_xNormalPosBtn->set_active(true);
2733  m_xHighLowRB->set_active(true);
2734  PositionHdl_Impl(*m_xNormalPosBtn);
2735  }
2736  //the height has to be set after the handler is called to keep the value also if the escapement is zero
2737  m_xFontSizeMF->set_value(m_xFontSizeMF->normalize(nEscProp), FieldUnit::PERCENT);
2738  }
2739  else
2740  {
2741  m_xHighPosBtn->set_active(false);
2742  m_xNormalPosBtn->set_active(false);
2743  m_xLowPosBtn->set_active(false);
2744  }
2745 
2746  // set BspFont
2747  SetPrevFontEscapement( 100, nEscProp, nEsc );
2748 
2749  // Kerning
2750  nWhich = GetWhich( SID_ATTR_CHAR_KERNING );
2751 
2752  if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
2753  {
2754  const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>(rSet->Get( nWhich ));
2755  MapUnit eUnit = rSet->GetPool()->GetMetric( nWhich );
2756  tools::Long nBig = static_cast<tools::Long>(m_xKerningMF->normalize( static_cast<tools::Long>(rItem.GetValue()) ));
2757  tools::Long nKerning = OutputDevice::LogicToLogic(nBig, eUnit, MapUnit::MapPoint);
2758 
2759  // set Kerning at the Font, convert into Twips before
2760  tools::Long nKern = OutputDevice::LogicToLogic(rItem.GetValue(), eUnit, MapUnit::MapTwip);
2761  rFont.SetFixKerning( static_cast<short>(nKern) );
2762  rCJKFont.SetFixKerning( static_cast<short>(nKern) );
2763  rCTLFont.SetFixKerning( static_cast<short>(nKern) );
2764 
2765  //the attribute value must be displayed also if it's above the maximum allowed value
2766  tools::Long nVal = static_cast<tools::Long>(m_xKerningMF->get_max(FieldUnit::POINT));
2767  if(nVal < nKerning)
2768  m_xKerningMF->set_max(nKerning, FieldUnit::POINT);
2769  m_xKerningMF->set_value(nKerning, FieldUnit::POINT);
2770  }
2771  else
2772  m_xKerningMF->set_text(OUString());
2773 
2774  // Pair kerning
2775  nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN );
2776 
2777  if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
2778  {
2779  const SvxAutoKernItem& rItem = static_cast<const SvxAutoKernItem&>(rSet->Get( nWhich ));
2780  m_xPairKerningBtn->set_active(rItem.GetValue());
2781  }
2782  else
2783  m_xPairKerningBtn->set_active(false);
2784 
2785  // Scale Width
2786  nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
2787  if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
2788  {
2789  const SvxCharScaleWidthItem& rItem = static_cast<const SvxCharScaleWidthItem&>( rSet->Get( nWhich ) );
2790  m_nScaleWidthInitialVal = rItem.GetValue();
2791  m_xScaleWidthMF->set_value(m_nScaleWidthInitialVal, FieldUnit::PERCENT);
2792  }
2793  else
2794  m_xScaleWidthMF->set_value(100, FieldUnit::PERCENT);
2795 
2796  nWhich = GetWhich( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE );
2797  if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT )
2798  m_nScaleWidthItemSetVal = static_cast<const SfxUInt16Item&>( rSet->Get( nWhich )).GetValue();
2799 
2800  // Rotation
2801  nWhich = GetWhich( SID_ATTR_CHAR_ROTATED );
2802  SfxItemState eState = rSet->GetItemState( nWhich );
2803  if( SfxItemState::UNKNOWN == eState )
2804  {
2805  m_xRotationContainer->hide();
2806  m_xScalingAndRotationFT->hide();
2807  m_xScalingFT->show();
2808  }
2809  else
2810  {
2811  m_xRotationContainer->show();
2812  m_xScalingAndRotationFT->show();
2813  m_xScalingFT->hide();
2814 
2815  if( eState >= SfxItemState::DEFAULT )
2816  {
2817  const SvxCharRotateItem& rItem =
2818  static_cast<const SvxCharRotateItem&>( rSet->Get( nWhich ));
2819  if (rItem.IsBottomToTop())
2820  m_x90degRB->set_active(true);
2821  else if (rItem.IsTopToBottom())
2822  m_x270degRB->set_active(true);
2823  else
2824  {
2825  DBG_ASSERT( Degree10(0) == rItem.GetValue(), "incorrect value" );
2826  m_x0degRB->set_active(true);
2827  }
2828  m_xFitToLineCB->set_active(rItem.IsFitToLine());
2829  }
2830  else
2831  {
2832  if( eState == SfxItemState::DONTCARE )
2833  {
2834  m_x0degRB->set_active(false);
2835  m_x90degRB->set_active(false);
2836  m_x270degRB->set_active(false);
2837  }
2838  else
2839  m_x0degRB->set_active(true);
2840 
2841  m_xFitToLineCB->set_active(false);
2842  }
2843  m_xFitToLineCB->set_sensitive(!m_x0degRB->get_active());
2844 
2845  // is this value set?
2846  if( SfxItemState::UNKNOWN == rSet->GetItemState( GetWhich(
2847  SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ) ))
2848  m_xFitToLineCB->hide();
2849  }
2850  ChangesApplied();
2851 }
2852 
2854 {
2855  m_xHighPosBtn->save_state();
2856  m_xNormalPosBtn->save_state();
2857  m_xLowPosBtn->save_state();
2858  m_xHighLowRB->save_state();
2859  m_x0degRB->save_state();
2860  m_x90degRB->save_state();
2861  m_x270degRB->save_state();
2862  m_xFitToLineCB->save_state();
2863  m_xScaleWidthMF->save_value();
2864  m_xKerningMF->save_value();
2865  m_xPairKerningBtn->save_state();
2866 }
2867 
2869 {
2870  // Position (high, normal or low)
2871  const SfxItemSet& rOldSet = GetItemSet();
2872  bool bModified = false, bChanged = true;
2873  sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_ESCAPEMENT );
2874  const SfxPoolItem* pOld = GetOldItem( *rSet, SID_ATTR_CHAR_ESCAPEMENT );
2875  const bool bHigh = m_xHighPosBtn->get_active();
2876  short nEsc;
2877  sal_uInt8 nEscProp;
2878 
2879  if (bHigh || m_xLowPosBtn->get_active())
2880  {
2881  if (m_xHighLowRB->get_active())
2882  nEsc = bHigh ? DFLT_ESC_AUTO_SUPER : DFLT_ESC_AUTO_SUB;
2883  else
2884  {
2885  nEsc = static_cast<short>(m_xHighLowMF->denormalize(m_xHighLowMF->get_value(FieldUnit::PERCENT)));
2886  nEsc *= (bHigh ? 1 : -1);
2887  }
2888  nEscProp = static_cast<sal_uInt8>(m_xFontSizeMF->denormalize(m_xFontSizeMF->get_value(FieldUnit::PERCENT)));
2889  }
2890  else
2891  {
2892  nEsc = 0;
2893  nEscProp = 100;
2894  }
2895 
2896  if ( pOld )
2897  {
2898  const SvxEscapementItem& rItem = *static_cast<const SvxEscapementItem*>(pOld);
2899  if (rItem.GetEsc() == nEsc && rItem.GetProportionalHeight() == nEscProp)
2900  bChanged = false;
2901  }
2902 
2903  if ( !bChanged && !m_xHighPosBtn->get_saved_state() &&
2904  !m_xNormalPosBtn->get_saved_state() && !m_xLowPosBtn->get_saved_state() )
2905  bChanged = true;
2906 
2907  if ( bChanged &&
2908  ( m_xHighPosBtn->get_active() || m_xNormalPosBtn->get_active() || m_xLowPosBtn->get_active() ) )
2909  {
2910  rSet->Put( SvxEscapementItem( nEsc, nEscProp, nWhich ) );
2911  bModified = true;
2912  }
2913  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2914  rSet->InvalidateItem(nWhich);
2915 
2916  bChanged = true;
2917 
2918  // Kerning
2919  nWhich = GetWhich( SID_ATTR_CHAR_KERNING );
2920  pOld = GetOldItem( *rSet, SID_ATTR_CHAR_KERNING );
2921  short nKerning = 0;
2922  MapUnit eUnit = rSet->GetPool()->GetMetric( nWhich );
2923 
2924  tools::Long nTmp = static_cast<tools::Long>(m_xKerningMF->get_value(FieldUnit::POINT));
2925  tools::Long nVal = OutputDevice::LogicToLogic(nTmp, MapUnit::MapPoint, eUnit);
2926  nKerning = static_cast<short>(m_xKerningMF->denormalize( nVal ));
2927 
2928  SfxItemState eOldKernState = rOldSet.GetItemState( nWhich, false );
2929  if ( pOld )
2930  {
2931  const SvxKerningItem& rItem = *static_cast<const SvxKerningItem*>(pOld);
2932  if ( (eOldKernState >= SfxItemState::DEFAULT || m_xKerningMF->get_text().isEmpty()) && rItem.GetValue() == nKerning )
2933  bChanged = false;
2934  }
2935 
2936  if ( bChanged )
2937  {
2938  rSet->Put( SvxKerningItem( nKerning, nWhich ) );
2939  bModified = true;
2940  }
2941  else if ( SfxItemState::DEFAULT == eOldKernState )
2942  rSet->InvalidateItem(nWhich);
2943 
2944  // Pair-Kerning
2945  nWhich = GetWhich( SID_ATTR_CHAR_AUTOKERN );
2946 
2947  if (m_xPairKerningBtn->get_state_changed_from_saved())
2948  {
2949  rSet->Put( SvxAutoKernItem( m_xPairKerningBtn->get_active(), nWhich ) );
2950  bModified = true;
2951  }
2952  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2953  rSet->InvalidateItem(nWhich);
2954 
2955  // Scale Width
2956  nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH );
2957  if (m_xScaleWidthMF->get_value_changed_from_saved())
2958  {
2959  rSet->Put(SvxCharScaleWidthItem(static_cast<sal_uInt16>(m_xScaleWidthMF->get_value(FieldUnit::PERCENT)), nWhich));
2960  bModified = true;
2961  }
2962  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2963  rSet->InvalidateItem(nWhich);
2964 
2965  // Rotation
2966  nWhich = GetWhich( SID_ATTR_CHAR_ROTATED );
2967  if ( m_x0degRB->get_state_changed_from_saved() ||
2968  m_x90degRB->get_state_changed_from_saved() ||
2969  m_x270degRB->get_state_changed_from_saved() ||
2970  m_xFitToLineCB->get_state_changed_from_saved() )
2971  {
2972  SvxCharRotateItem aItem( Degree10(0), m_xFitToLineCB->get_active(), nWhich );
2973  if (m_x90degRB->get_active())
2974  aItem.SetBottomToTop();
2975  else if (m_x270degRB->get_active())
2976  aItem.SetTopToBottom();
2977  rSet->Put( aItem );
2978  bModified = true;
2979  }
2980  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
2981  rSet->InvalidateItem(nWhich);
2982 
2983  return bModified;
2984 }
2985 
2986 
2988 {
2989  const OUString cTok( ";" );
2990 
2991  OUString sUser = OUString::number( m_nSuperEsc ) + cTok +
2992  OUString::number( m_nSubEsc ) + cTok +
2993  OUString::number( m_nSuperProp ) + cTok +
2994  OUString::number( m_nSubProp );
2995  SetUserData( sUser );
2996 }
2997 
2998 
3000 {
3001  const SfxUInt32Item* pFlagItem = aSet.GetItem<SfxUInt32Item>(SID_FLAG_TYPE, false);
3002  if (pFlagItem)
3003  {
3004  sal_uInt32 nFlags=pFlagItem->GetValue();
3005  if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER )
3006  // the writer uses SID_ATTR_BRUSH as font background
3008  }
3009 }
3010 // class SvxCharTwoLinesPage ------------------------------------------------
3011 
3013  : SvxCharBasePage(pPage, pController, "cui/ui/twolinespage.ui", "TwoLinesPage", rInSet)
3014  , m_nStartBracketPosition( 0 )
3015  , m_nEndBracketPosition( 0 )
3016  , m_xTwoLinesBtn(m_xBuilder->weld_check_button("twolines"))
3017  , m_xEnclosingFrame(m_xBuilder->weld_widget("enclosing"))
3018  , m_xStartBracketLB(m_xBuilder->weld_tree_view("startbracket"))
3019  , m_xEndBracketLB(m_xBuilder->weld_tree_view("endbracket"))
3020 {
3021  for (size_t i = 0; i < SAL_N_ELEMENTS(TWOLINE_OPEN); ++i)
3022  m_xStartBracketLB->append(OUString::number(TWOLINE_OPEN[i].second), CuiResId(TWOLINE_OPEN[i].first));
3023  for (size_t i = 0; i < SAL_N_ELEMENTS(TWOLINE_CLOSE); ++i)
3024  m_xEndBracketLB->append(OUString::number(TWOLINE_CLOSE[i].second), CuiResId(TWOLINE_CLOSE[i].first));
3025 
3026  m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin));
3027 #ifdef IOS
3028  m_xPreviewWin->hide();
3029 #endif
3030  Initialize();
3031 }
3032 
3034 {
3035 }
3036 
3038 {
3039  m_xTwoLinesBtn->set_active(false);
3040  TwoLinesHdl_Impl(*m_xTwoLinesBtn);
3041 
3042  m_xTwoLinesBtn->connect_toggled(LINK(this, SvxCharTwoLinesPage, TwoLinesHdl_Impl));
3043 
3044  Link<weld::TreeView&,void> aLink = LINK(this, SvxCharTwoLinesPage, CharacterMapHdl_Impl);
3045  m_xStartBracketLB->connect_changed(aLink);
3046  m_xEndBracketLB->connect_changed(aLink);
3047 
3048  SvxFont& rFont = GetPreviewFont();
3049  SvxFont& rCJKFont = GetPreviewCJKFont();
3050  SvxFont& rCTLFont = GetPreviewCTLFont();
3051  rFont.SetFontSize( Size( 0, 220 ) );
3052  rCJKFont.SetFontSize( Size( 0, 220 ) );
3053  rCTLFont.SetFontSize( Size( 0, 220 ) );
3054 }
3055 
3057 {
3058  bool bStart = pBox == m_xStartBracketLB.get();
3059  SvxCharacterMap aDlg(GetFrameWeld(), nullptr, nullptr);
3060  aDlg.DisableFontSelection();
3061 
3062  if (aDlg.run() == RET_OK)
3063  {
3064  sal_Unicode cChar = static_cast<sal_Unicode>(aDlg.GetChar());
3065  SetBracket( cChar, bStart );
3066  }
3067  else
3068  {
3070  }
3071 }
3072 
3073 
3074 void SvxCharTwoLinesPage::SetBracket( sal_Unicode cBracket, bool bStart )
3075 {
3076  int nEntryPos = 0;
3077  weld::TreeView* pBox = bStart ? m_xStartBracketLB.get() : m_xEndBracketLB.get();
3078  if (cBracket == 0)
3079  pBox->select(0);
3080  else
3081  {
3082  bool bFound = false;
3083  for (int i = 1; i < pBox->n_children(); ++i)
3084  {
3085  if (pBox->get_id(i).toInt32() != CHRDLG_ENCLOSE_SPECIAL_CHAR)
3086  {
3087  const sal_Unicode cChar = pBox->get_text(i)[0];
3088  if (cChar == cBracket)
3089  {
3090  pBox->select(i);
3091  nEntryPos = i;
3092  bFound = true;
3093  break;
3094  }
3095  }
3096  }
3097 
3098  if (!bFound)
3099  {
3100  pBox->append_text(OUString(cBracket));
3101  nEntryPos = pBox->n_children() - 1;
3102  pBox->select(nEntryPos);
3103  }
3104  }
3105  if (bStart)
3106  m_nStartBracketPosition = nEntryPos;
3107  else
3108  m_nEndBracketPosition = nEntryPos;
3109 }
3110 
3112 {
3113  bool bChecked = m_xTwoLinesBtn->get_active();
3114  m_xEnclosingFrame->set_sensitive(bChecked);
3115  UpdatePreview_Impl();
3116 }
3117 
3118 IMPL_LINK(SvxCharTwoLinesPage, CharacterMapHdl_Impl, weld::TreeView&, rBox, void)
3119 {
3120  int nPos = rBox.get_selected_index();
3121  if (rBox.get_id(nPos).toInt32() == CHRDLG_ENCLOSE_SPECIAL_CHAR)
3122  SelectCharacter( &rBox );
3123  else
3124  {
3125  bool bStart = &rBox == m_xStartBracketLB.get();
3126  if (bStart)
3127  m_nStartBracketPosition = nPos;
3128  else
3129  m_nEndBracketPosition = nPos;
3130  }
3131  UpdatePreview_Impl();
3132 }
3133 
3135 {
3137 }
3138 
3140 {
3141  if ( _pSet )
3142  FillItemSet( _pSet );
3143  return DeactivateRC::LeavePage;
3144 }
3145 
3146 std::unique_ptr<SfxTabPage> SvxCharTwoLinesPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
3147 {
3148  return std::make_unique<SvxCharTwoLinesPage>(pPage, pController, *rSet);
3149 }
3150 
3152 {
3153  m_xTwoLinesBtn->set_active(false);
3154  sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES );
3155  SfxItemState eState = rSet->GetItemState( nWhich );
3156 
3157  if ( eState >= SfxItemState::DONTCARE )
3158  {
3159  const SvxTwoLinesItem& rItem = static_cast<const SvxTwoLinesItem&>(rSet->Get( nWhich ));
3160  m_xTwoLinesBtn->set_active(rItem.GetValue());
3161 
3162  if ( rItem.GetValue() )
3163  {
3164  SetBracket( rItem.GetStartBracket(), true );
3165  SetBracket( rItem.GetEndBracket(), false );
3166  }
3167  }
3168  TwoLinesHdl_Impl(*m_xTwoLinesBtn);
3169 
3170  SetPrevFontWidthScale( *rSet );
3171 }
3172 
3174 {
3175  const SfxItemSet& rOldSet = GetItemSet();
3176  bool bModified = false, bChanged = true;
3177  sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES );
3178  const SfxPoolItem* pOld = GetOldItem( *rSet, SID_ATTR_CHAR_TWO_LINES );
3179  bool bOn = m_xTwoLinesBtn->get_active();
3180  sal_Unicode cStart = ( bOn && m_xStartBracketLB->get_selected_index() > 0 )
3181  ? m_xStartBracketLB->get_selected_text()[0] : 0;
3182  sal_Unicode cEnd = ( bOn && m_xEndBracketLB->get_selected_index() > 0 )
3183  ? m_xEndBracketLB->get_selected_text()[0] : 0;
3184 
3185  if ( pOld )
3186  {
3187  const SvxTwoLinesItem& rItem = *static_cast<const SvxTwoLinesItem*>(pOld);
3188  if ( rItem.GetValue() == bOn &&
3189  ( !bOn || ( rItem.GetStartBracket() == cStart && rItem.GetEndBracket() == cEnd ) ) )
3190  bChanged = false;
3191  }
3192 
3193  if ( bChanged )
3194  {
3195  rSet->Put( SvxTwoLinesItem( bOn, cStart, cEnd, nWhich ) );
3196  bModified = true;
3197  }
3198  else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
3199  rSet->InvalidateItem(nWhich);
3200 
3201  return bModified;
3202 }
3203 
3205 {
3206  sal_Unicode cStart = m_xStartBracketLB->get_selected_index() > 0
3207  ? m_xStartBracketLB->get_selected_text()[0] : 0;
3208  sal_Unicode cEnd = m_xEndBracketLB->get_selected_index() > 0
3209  ? m_xEndBracketLB->get_selected_text()[0] : 0;
3210  m_aPreviewWin.SetBrackets(cStart, cEnd);
3211  m_aPreviewWin.SetTwoLines(m_xTwoLinesBtn->get_active());
3212  m_aPreviewWin.Invalidate();
3213 }
3214 
3216 {
3217  const SfxUInt32Item* pFlagItem = aSet.GetItem<SfxUInt32Item>(SID_FLAG_TYPE, false);
3218  if (pFlagItem)
3219  {
3220  sal_uInt32 nFlags=pFlagItem->GetValue();
3221  if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER )
3222  // the writer uses SID_ATTR_BRUSH as font background
3224  }
3225 }
3226 
3227 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetFamily(FontFamily)
sal_uInt16 m_nScaleWidthInitialVal
Definition: chardlg.hxx:243
tools::Long PointToTwips(tools::Long nIn)
virtual ~SvxCharEffectsPage() override
Definition: chardlg.cxx:1348
std::unique_ptr< weld::CheckButton > m_xFitToLineCB
Definition: chardlg.hxx:264
std::unique_ptr< weld::Label > m_xWestFontLanguageFT
Definition: chardlg.hxx:75
std::unique_ptr< FontSizeBox > m_xEastFontSizeLB
Definition: chardlg.hxx:86
std::unique_ptr< FontStyleBox > m_xCTLFontStyleLB
Definition: chardlg.hxx:96
bool IsRelativeMode() const
void SetPropr(const sal_uInt8 nNewPropr)
std::unique_ptr< weld::RadioButton > m_xHighPosBtn
Definition: chardlg.hxx:248
std::unique_ptr< SvxCharNamePage_Impl > m_pImpl
Definition: chardlg.hxx:66
FieldUnit
void SetBracket(sal_Unicode cBracket, bool bStart)
Definition: chardlg.cxx:3074
std::unique_ptr< weld::RadioButton > m_xNormalPosBtn
Definition: chardlg.hxx:249
SvxFont & GetCTLFont()
sal_Int32 nIndex
std::unique_ptr< weld::ComboBox > m_xStrikeoutLB
Definition: chardlg.hxx:188
OUString m_aNoStyleText
Definition: chardlg.cxx:198
void SetFontSize(const Size &)
OUString const & get_saved_value() const
const OUString & GetFamilyName() const
std::unique_ptr< weld::CheckButton > m_xHiddenBtn
Definition: chardlg.hxx:184
IMPL_LINK_NOARG(SvxCharNamePage, UpdateHdl_Impl, Timer *, void)
Definition: chardlg.cxx:1123
void SetTransparency(sal_uInt8 nTransparency)
void SetUserData(const OUString &rString)
void FillSizeBox_Impl(const weld::Widget &rBox)
Definition: chardlg.cxx:552
int get_value() const
void setWidth(tools::Long nWidth)
bool GetValue() const
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: chardlg.cxx:1183
std::unique_ptr< weld::Button > m_xWestFontFeaturesButton
Definition: chardlg.hxx:78
virtual void FillUserData() override
Definition: chardlg.cxx:2987
std::unique_ptr< weld::ComboBox > m_xWestFontNameLB
Definition: chardlg.hxx:70
sal_Unicode GetStartBracket() const
std::string GetValue
const OUString & GetStyleName() const
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: chardlg.cxx:1657
std::unique_ptr< weld::MetricSpinButton > m_xFontSizeMF
Definition: chardlg.hxx:255
SvxCaseMap
virtual short run() override
OUString const & getResultFontName() const
LanguageType get_active_id() const
bool FillItemSetColor_Impl(SfxItemSet &rSet)
Definition: chardlg.cxx:1567
virtual void hide()=0
void SetColor(const Color &rCol)
SvxCharPositionPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: chardlg.cxx:2400
void set_active_text(const OUString &rText)
const FontList * GetFontList() const
Definition: chardlg.cxx:376
#define DISABLE_HIDE_LANGUAGE
bool IsRelative() const
sal_uInt8 GetTransparency() const
long Long
bool get_value_changed_from_saved() const
std::unique_ptr< weld::Label > m_xWestFontStyleFT
Definition: chardlg.hxx:71
sal_uInt8 & GetProportionalHeight()
SvxFont & GetPreviewFont()
Definition: chardlg.cxx:144
FontEmphasisMark
std::unique_ptr< weld::Widget > m_xRotationContainer
Definition: chardlg.hxx:257
SvxFontPrevWindow m_aPreviewWin
Definition: chardlg.hxx:37
SvxFont & GetCJKFont()
std::unique_ptr< weld::Label > m_xEmphasisFT
Definition: chardlg.hxx:193
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
void set_value(int nValue)
constexpr OUStringLiteral PERCENT(u"Percent")
Language for asian text.
Definition: chardlg.hxx:118
virtual void Reset(const SfxItemSet *rSet) override
Definition: chardlg.cxx:3151
std::unique_ptr< weld::Label > m_xFontColorFT
Definition: chardlg.hxx:174
std::unique_ptr< weld::ComboBox > m_xEffectsLB
Definition: chardlg.hxx:179
std::unique_ptr< weld::Label > m_xCTLFontStyleFT
Definition: chardlg.hxx:95
std::unique_ptr< weld::Label > m_xEastFontNameFT
Definition: chardlg.hxx:81
sal_uInt16 m_nHtmlMode
Definition: chardlg.hxx:167
#define max(a, b)
void SetPtRelative(bool bPtRel)
sal_uInt16 GetValue() const
virtual int find_text(const OUString &rStr) const =0
void SetHeight(sal_uInt32 nNewHeight, const sal_uInt16 nNewProp=100, MapUnit eUnit=MapUnit::MapRelative)
virtual void ChangesApplied() override
Definition: chardlg.cxx:1205
void InvalidateItem(sal_uInt16 nWhich)
tools::Long ItemToControl(tools::Long nIn, MapUnit eItem, FieldUnit eCtrl)
std::unique_ptr< weld::Label > m_xWestFontNameFT
Definition: chardlg.hxx:69
void save_value()
std::unique_ptr< weld::Label > m_xWestFontSizeFT
Definition: chardlg.hxx:73
Language for western text.
Definition: chardlg.hxx:114
bool IsBottomToTop() const
std::unique_ptr< weld::ComboBox > m_xReliefLB
Definition: chardlg.hxx:181
EditedAndValid GetEditedAndValid() const
void SetCharSet(rtl_TextEncoding)
static SfxObjectShell * Current()
#define DFLT_ESC_AUTO_SUB
virtual void Reset(const SfxItemSet *rSet) override
Definition: chardlg.cxx:1195
virtual int get_active() const =0
void Initialize()
Definition: chardlg.cxx:348
void set_sensitive(bool bSensitive)
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: chardlg.cxx:169
FontPitch GetPitch() const
TRISTATE_TRUE
#define DISABLE_CASEMAP
void SetCaseMap_Impl(SvxCaseMap eCaseMap)
Definition: chardlg.cxx:1489
OUString get_active_text() const
virtual void ChangesApplied() override
Definition: chardlg.cxx:2853
bool m_bPreviewBackgroundToCharacter
Definition: chardlg.hxx:40
weld::TriStateEnabled m_aShadowState
Definition: chardlg.hxx:170
bool IsAvailable(const OUString &rName) const
std::unique_ptr< weld::CheckButton > m_xShadowBtn
Definition: chardlg.hxx:183
std::unique_ptr< weld::Label > m_xCTLFontTypeFT
Definition: chardlg.hxx:101
void FontModifyHdl_Impl(const weld::Widget &)
Definition: chardlg.cxx:1165
FontFamily GetFamily() const
FontFamily GetFamilyType()
void FillStyleBox_Impl(const weld::Widget &rBox)
Definition: chardlg.cxx:506
std::unique_ptr< FontStyleBox > m_xEastFontStyleLB
Definition: chardlg.hxx:84
bool IsCJKFontEnabled() const
void SelectHdl_Impl(const weld::ComboBox *)
Definition: chardlg.cxx:1605
static OutputDevice * GetDefaultDevice()
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
std::unique_ptr< weld::CheckButton > m_xIndividualWordsBtn
Definition: chardlg.hxx:192
SvxFont & GetPreviewCTLFont()
Definition: chardlg.cxx:154
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
#define CHRDLG_POSITION_UNDER
Definition: chardlg.h:24
sal_uInt16 sal_Unicode
FontItalic GetItalic()
virtual ~SvxCharPositionPage() override
Definition: chardlg.cxx:2434
const Color & GetColor() const
std::unique_ptr< weld::CheckButton > m_xOutlineBtn
Definition: chardlg.hxx:182
Degree10 GetValue() const
std::unique_ptr< weld::Label > m_xOverlineColorFT
Definition: chardlg.hxx:186
sal_Unicode GetEndBracket() const
void append_text(const OUString &rStr)
std::unique_ptr< weld::RadioButton > m_x0degRB
Definition: chardlg.hxx:261
LINESTYLE_NONE
std::unique_ptr< SvxLanguageBox > m_xEastFontLanguageLB
Definition: chardlg.hxx:88
void SetTextLineColor(const Color &rColor)
rtl_TextEncoding GetCharSet() const
std::unique_ptr< SvxLanguageBox > m_xWestFontLanguageLB
Definition: chardlg.hxx:76
void SetExchangeSupport()
void SetFixKerning(const short nNewKern)
std::unique_ptr< weld::ComboBox > m_xPositionLB
Definition: chardlg.hxx:196
std::unique_ptr< weld::Label > m_xWestFontTypeFT
Definition: chardlg.hxx:77
virtual int n_children() const =0
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: chardlg.cxx:3215
const OUString & GetBoldStr() const
virtual ~SvxCharNamePage() override
Definition: chardlg.cxx:333
Color m_aOrigFontColor
Definition: chardlg.hxx:166
#define SVX_PREVIEW_CHARACTER
FontMetric Get(const OUString &rName, const OUString &rStyleName) const
const OUString & GetUserData() const
virtual OUString get_id(int pos) const =0
void SetRelative(bool bRelative)
#define DFLT_ESC_AUTO_SUPER
FontEmphasisMark GetEmphasisMark() const
IMPL_LINK(SvxCharNamePage, FontModifyComboBoxHdl_Impl, weld::ComboBox &, rBox, void)
Definition: chardlg.cxx:1128
std::unique_ptr< weld::CheckButton > m_xHighLowRB
Definition: chardlg.hxx:253
bool get_active_id_changed_from_saved() const
bool FillItemSet_Impl(SfxItemSet &rSet, LanguageGroup eLangGrp)
Definition: chardlg.cxx:835
std::unique_ptr< weld::Label > m_xEastFontLanguageFT
Definition: chardlg.hxx:87
void save_value()
void SetEscapement_Impl(SvxEscapement nEsc)
Definition: chardlg.cxx:2477
SvxFont & GetFont()
#define DFLT_ESC_PROP
sal_uInt8 m_nSuperProp
Definition: chardlg.hxx:245
void DisableControls(sal_uInt16 nDisable)
Definition: chardlg.cxx:1266
const OUString & GetStyleName(FontWeight eWeight, FontItalic eItalic) const
std::unique_ptr< weld::CustomWeld > m_xPreviewWin
Definition: chardlg.hxx:38
TRISTATE_INDET
B2IRange fround(const B2DRange &rRange)
virtual ~SvxCharBasePage() override
Definition: chardlg.cxx:165
sal_uInt16 GetProp() const
void FontModifyHdl_Impl()
Definition: chardlg.cxx:2546
std::unique_ptr< weld::CheckButton > m_xTwoLinesBtn
Definition: chardlg.hxx:310
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: chardlg.cxx:2067
void SetPitch(FontPitch ePitch)
SvxFont & GetPreviewCJKFont()
Definition: chardlg.cxx:149
const OUString & GetStyleName() const
LanguageType get_saved_active_id() const
const SfxItemSet & GetItemSet() const
#define SAL_N_ELEMENTS(arr)
virtual void Reset(const SfxItemSet *rSet) override
Definition: chardlg.cxx:1669
void save_active_id()
std::unique_ptr< weld::Label > m_xHighLowFT
Definition: chardlg.hxx:251
const FontMetric & GetFontName(size_t nFont) const
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: chardlg.cxx:1190
std::unique_ptr< weld::Label > m_xUnderlineColorFT
Definition: chardlg.hxx:190
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
weld::TriStateEnabled m_aIndividualWordsState
Definition: chardlg.hxx:172
std::unique_ptr< weld::Label > m_xCTLFontLanguageFT
Definition: chardlg.hxx:99
void set_active_text(const OUString &rStr)
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
int get_count() const
const SfxItemSet * GetParent() const
#define COL_NONE_COLOR
void SetFamilyName(const OUString &rFamilyName)
std::unique_ptr< weld::Label > m_xEastFontStyleFT
Definition: chardlg.hxx:83
FontPitch GetPitch()
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
void EnableSearchMode()
Definition: chardlg.cxx:1261
int i
std::unique_ptr< weld::Label > m_xEffectsFT
Definition: chardlg.hxx:178
std::unique_ptr< FontStyleBox > m_xWestFontStyleLB
Definition: chardlg.hxx:72
#define LANGUAGE_SYSTEM
void set_sensitive(bool bSensitive)
static const sal_uInt16 pEffectsRanges[]
Definition: chardlg.hxx:162
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: chardlg.cxx:3134
virtual void insert_vector(const std::vector< weld::ComboBoxEntry > &rItems, bool bKeepExisting)=0
sal_uInt16 m_nEndBracketPosition
Definition: chardlg.hxx:308
HTMLMODE_ON
SvxCharTwoLinesPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: chardlg.cxx:3012
void SetPrevFontEscapement(sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc)
Definition: chardlg.cxx:184
std::unique_ptr< weld::CheckButton > m_xPairKerningBtn
Definition: chardlg.hxx:269
WEIGHT_NORMAL
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: chardlg.cxx:1221
std::unique_ptr< SvxLanguageBox > m_xCTLFontLanguageLB
Definition: chardlg.hxx:100
sal_uInt16 m_nStartBracketPosition
Definition: chardlg.hxx:307
std::unique_ptr< weld::Label > m_xEastFontSizeFT
Definition: chardlg.hxx:85
std::unique_ptr< ColorListBox > m_xFontColorLB
Definition: chardlg.hxx:175
static const sal_uInt16 pNameRanges[]
Definition: chardlg.hxx:64
#define LANGUAGE_DONTKNOW
const Size & GetFontSize() const
std::unique_ptr< weld::Widget > m_xEastFrame
Definition: chardlg.hxx:80
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: chardlg.cxx:2376
tools::Long CalcToUnit(float nIn, MapUnit eUnit)
virtual OUString get_text(int row, int col=-1) const =0
void EnableNoneFontColor()
Definition: chardlg.cxx:1342
virtual void set_active(int pos)=0
SvxCharBasePage(weld::Container *pPage, weld::DialogController *pController, const OUString &rUIXMLDescription, const OString &rID, const SfxItemSet &rAttrSet)
Definition: chardlg.cxx:159
ITALIC_NONE
void set_active_id(const LanguageType eLangType)
std::unique_ptr< weld::ComboBox > m_xEastFontNameLB
Definition: chardlg.hxx:82
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: chardlg.cxx:1176
SfxItemPool * GetPool() const
const SfxItemSet * GetDialogExampleSet() const
std::unique_ptr< weld::ComboBox > m_xUnderlineLB
Definition: chardlg.hxx:189
virtual void Reset(const SfxItemSet *rSet) override
Definition: chardlg.cxx:2633
OUString CuiResId(const char *pKey)
Definition: cuiresmgr.cxx:23
void SetTwoLines(bool bSet)
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: chardlg.cxx:2999
bool IsFitToLine() const
void set_active_or_entry_text(const OUString &rText)
void EnableRelativeMode()
Definition: chardlg.cxx:1253
virtual short run() override
Definition: cuicharmap.cxx:183
static const sal_uInt16 pPositionRanges[]
Definition: chardlg.hxx:236
int get_active() const
size_t GetFontNameCount() const
std::unique_ptr< weld::Widget > m_xWestFrame
Definition: chardlg.hxx:68
sal_uInt8 m_nSubProp
Definition: chardlg.hxx:246
std::unique_ptr< weld::RadioButton > m_x90degRB
Definition: chardlg.hxx:262
std::unique_ptr< weld::Label > m_xReliefFT
Definition: chardlg.hxx:180
void ResetColor_Impl(const SfxItemSet &rSet)
Definition: chardlg.cxx:1503
const OUString & GetFamilyName() const
bool m_bEnableNoneFontColor
Definition: chardlg.hxx:165
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void SetCaseMap(const SvxCaseMap eNew)
void set_active(int nPos)
virtual void select(int pos)=0
FontWeight
std::unique_ptr< weld::Label > m_xEastFontTypeFT
Definition: chardlg.hxx:89
weld::Window * GetFrameWeld() const
void SetStyleName(const OUString &rStyleName)
sal_Int32 SaveEditedAsEntry()
static bool StateToAttr(TriState aState)
Definition: chardlg.cxx:129
sal_uInt32 GetHeight() const
void SetBrackets(sal_Unicode cStart, sal_Unicode cEnd)
SfxItemState
void EnableRelativeMode(sal_uInt16 nMin, sal_uInt16 nMax, sal_uInt16 nStep=5)
std::unique_ptr< FontSizeBox > m_xWestFontSizeLB
Definition: chardlg.hxx:74
#define DFLT_ESC_SUB
std::unique_ptr< weld::Widget > m_xCTLFrame
Definition: chardlg.hxx:92
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void ChangesApplied() override
Definition: chardlg.cxx:2051
std::unique_ptr< weld::RadioButton > m_x270degRB
Definition: chardlg.hxx:263
void set_sensitive(bool bSensitive)
FontWeight GetWeight()
unsigned char sal_uInt8
void UpdatePreview_Impl(sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc)
Definition: chardlg.cxx:2471
std::unique_ptr< weld::TreeView > m_xEndBracketLB
Definition: chardlg.hxx:313
void SetPrevFontWidthScale(const SfxItemSet &rSet)
Definition: chardlg.cxx:174
void UpdatePreview_Impl()
Definition: chardlg.cxx:474
tools::Long CalcToPoint(tools::Long nIn, MapUnit eUnit, sal_uInt16 nFactor)
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: chardlg.cxx:3139
const OUString & GetItalicStr() const
std::unique_ptr< weld::MetricSpinButton > m_xHighLowMF
Definition: chardlg.hxx:252
RET_OK
bool IsCTLFontEnabled() const
virtual ~SvxCharTwoLinesPage() override
Definition: chardlg.cxx:3033
bool IsTopToBottom() const
#define DFLT_ESC_SUPER
int find_text(const OUString &rStr) const
void Fill(const OUString &rName, const FontList *pList)
void DisableControls(sal_uInt16 nDisable)
Definition: chardlg.cxx:2367
void DisableFontSelection()
Definition: cuicharmap.cxx:216
int get_saved_value() const
void UpdatePreview_Impl()
Definition: chardlg.cxx:3204
Language for ctl text.
Definition: chardlg.hxx:122
virtual OUString get_id(int pos) const =0
std::unique_ptr< weld::Label > m_xCTLFontNameFT
Definition: chardlg.hxx:93
std::unique_ptr< weld::MetricSpinButton > m_xKerningMF
Definition: chardlg.hxx:268
#define CHRDLG_POSITION_OVER
Definition: chardlg.h:23
weld::TriStateEnabled m_aOutlineState
Definition: chardlg.hxx:169
std::unique_ptr< weld::Label > m_xCTLFontSizeFT
Definition: chardlg.hxx:97
DeactivateRC
void setHeight(tools::Long nHeight)
void SelectCharacter(weld::TreeView *pBox)
Definition: chardlg.cxx:3056
void SetProprRel(const sal_uInt8 nNewPropr)
SvxEscapement
sal_uInt32 GetValue() const
void SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBackgroundToCharacter)
std::unique_ptr< weld::TreeView > m_xStartBracketLB
Definition: chardlg.hxx:312
void Reset_Impl(const SfxItemSet &rSet, LanguageGroup eLangGrp)
Definition: chardlg.cxx:606
sal_UCS4 GetChar() const
Definition: cuicharmap.cxx:210
MapUnit
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: chardlg.cxx:2868
#define SAL_WARN(area, stream)
void AutoCorrectFontColor()
std::unique_ptr< FontSizeBox > m_xCTLFontSizeLB
Definition: chardlg.hxx:98
The main purpose of this dialog is to enable the use of characters that are not easily accessible fro...
Definition: cuicharmap.hxx:72
std::unique_ptr< weld::Button > m_xEastFontFeaturesButton
Definition: chardlg.hxx:90
std::unique_ptr< ColorListBox > m_xUnderlineColorLB
Definition: chardlg.hxx:191
void SetPriority(TaskPriority ePriority)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: chardlg.cxx:1664
void SetFontList(const SvxFontListItem &rItem)
Definition: chardlg.cxx:1229
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: chardlg.cxx:2621
#define MAX_ESC_POS
std::unique_ptr< FontList > m_pFontList
Definition: chardlg.cxx:199
const FontList * GetFontList() const
STRIKEOUT_NONE
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
TriState
FontLineStyle
sal_uInt16 m_nScaleWidthItemSetVal
Definition: chardlg.hxx:242
OUString GetFontMapText(const FontMetric &rFontMetric) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
static const sal_uInt16 pTwoLinesRanges[]
Definition: chardlg.hxx:306
std::unique_ptr< weld::MetricSpinButton > m_xFontTransparencyMtr
Definition: chardlg.hxx:177
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: chardlg.cxx:3173
#define SVX_ENABLE_CHAR_TRANSPARENCY
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: chardlg.cxx:2628
bool IsPtRelative() const
void Fill(const FontMetric *pFontMetric, const FontList *pList)
std::unique_ptr< weld::Label > m_xScalingFT
Definition: chardlg.hxx:259
void SetEscapement(const short nNewEsc)
std::unique_ptr< weld::ComboBox > m_xOverlineLB
Definition: chardlg.hxx:185
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
std::unique_ptr< weld::Label > m_xScalingAndRotationFT
Definition: chardlg.hxx:260
OUString const & get_saved_value() const
std::unique_ptr< weld::MetricSpinButton > m_xScaleWidthMF
Definition: chardlg.hxx:266
std::unique_ptr< weld::Label > m_xFontSizeFT
Definition: chardlg.hxx:254
virtual void set_entry_text(const OUString &rStr)=0
std::unique_ptr< weld::RadioButton > m_xLowPosBtn
Definition: chardlg.hxx:250
#define SVX_RELATIVE_MODE
std::unique_ptr< ColorListBox > m_xOverlineColorLB
Definition: chardlg.hxx:187
FontStrikeout
OUString get_active_text() const
MapUnit GetPropUnit() const
std::unique_ptr< weld::Button > m_xCTLFontFeaturesButton
Definition: chardlg.hxx:102
std::unique_ptr< weld::ComboBox > m_xEmphasisLB
Definition: chardlg.hxx:194
SvxCharEffectsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: chardlg.cxx:1301
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: chardlg.cxx:1279
std::unique_ptr< FontList > Clone() const
void SetFontWidthScale(sal_uInt16 nScaleInPercent)
weld::TriStateEnabled m_aHiddenState
Definition: chardlg.hxx:171
std::unique_ptr< weld::Label > m_xA11yWarningFT
Definition: chardlg.hxx:197
rtl_TextEncoding GetCharSet() const
void EnablePtRelativeMode(short nMin, short nMax, short nStep=10)
const Color & GetValue() const
sal_uInt16 nPos
virtual void set_sensitive(bool sensitive)=0
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
void append_text(const OUString &rStr)
const char first[]
FontItalic
virtual OUString get_active_text() const =0
std::unique_ptr< weld::Label > m_xFontTransparencyFT
Definition: chardlg.hxx:176
void UpdatePreview_Impl()
Definition: chardlg.cxx:1417
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: chardlg.cxx:3146
void SetOverlineColor(const Color &rColor)
std::unique_ptr< weld::Label > m_xPositionFT
Definition: chardlg.hxx:195
std::unique_ptr< weld::ComboBox > m_xCTLFontNameLB
Definition: chardlg.hxx:94
SvxCharNamePage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: chardlg.cxx:214