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