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