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