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