LibreOffice Module cui (master) 1
optgdlg.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 <config_features.h>
21#include <svl/numformat.hxx>
22#include <svl/zforlist.hxx>
23#include <svl/currencytable.hxx>
24#include <svtools/langhelp.hxx>
25#include <unotools/lingucfg.hxx>
26#if defined(_WIN32)
27#include <unotools/resmgr.hxx>
28#endif
29#include <sfx2/bindings.hxx>
30#include <sfx2/viewfrm.hxx>
35#include <svl/cjkoptions.hxx>
36#include <svl/ctloptions.hxx>
37#include <svtools/miscopt.hxx>
39#include <sfx2/objsh.hxx>
42#include <svtools/langtab.hxx>
43#include <editeng/unolingu.hxx>
44#include <editeng/langitem.hxx>
46#include <comphelper/string.hxx>
47#include <rtl/ustrbuf.hxx>
48#include <editeng/editids.hrc>
49#include <svx/svxids.hrc>
50#include <svl/intitem.hxx>
53#include <sal/log.hxx>
54#include <officecfg/Office/Common.hxx>
55#include <officecfg/Setup.hxx>
58#if HAVE_FEATURE_BREAKPAD
60#endif
61
62#include <com/sun/star/configuration/theDefaultProvider.hpp>
63#include <com/sun/star/container/XNameAccess.hpp>
64#include <com/sun/star/container/XNameReplace.hpp>
65#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
66#include <com/sun/star/beans/NamedValue.hpp>
67#include <com/sun/star/beans/PropertyAttribute.hpp>
68#include <com/sun/star/beans/XPropertySet.hpp>
69#include <com/sun/star/util/XChangesBatch.hpp>
70#include <com/sun/star/uno/Any.hxx>
71#include <com/sun/star/container/XContentEnumerationAccess.hpp>
72#include <com/sun/star/container/XSet.hpp>
73#include <com/sun/star/i18n/ScriptType.hpp>
74#include <com/sun/star/office/Quickstart.hpp>
75#include <com/sun/star/linguistic2/XLinguProperties.hpp>
77
78#include <vcl/vclenum.hxx>
79#include <vcl/svapp.hxx>
80#include <vcl/settings.hxx>
81#include <vcl/window.hxx>
82#include <vcl/IconThemeInfo.hxx>
84#include "optgdlg.hxx"
85#include <svtools/apearcfg.hxx>
88#include <svtools/imgdef.hxx>
89
90#if defined(_WIN32)
92#endif
93using namespace ::com::sun::star::uno;
94using namespace ::com::sun::star::lang;
95using namespace ::com::sun::star::beans;
96using namespace ::com::sun::star::container;
97using namespace ::com::sun::star::util;
98using namespace ::utl;
99
100// class OfaMiscTabPage --------------------------------------------------
101
103{
104 if ( pSet_ )
105 FillItemSet( pSet_ );
106 return DeactivateRC::LeavePage;
107}
108
109namespace
110{
111OUString impl_SystemFileOpenServiceName()
112{
113 #if defined(_WIN32)
114 return "com.sun.star.ui.dialogs.SystemFilePicker";
115 #elif defined MACOSX
116 return "com.sun.star.ui.dialogs.AquaFilePicker";
117 #else
118 return OUString();
119 #endif
120}
121
122bool lcl_HasSystemFilePicker()
123{
125 return true;
126
127 // Otherwise fall-back on querying services
128 bool bRet = false;
130
131 Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY );
132 Reference< XSet > xSet( xFactory, UNO_QUERY );
133
134 if ( ! xEnumAccess.is() || ! xSet.is() )
135 return bRet;
136
137 try
138 {
139 OUString aFileService = impl_SystemFileOpenServiceName();
140 Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService );
141 if ( xEnum.is() && xEnum->hasMoreElements() )
142 bRet = true;
143 }
144 catch (const IllegalArgumentException&)
145 {
146 }
147 catch (const ElementExistException&)
148 {
149 }
150 return bRet;
151}
152}
153
155 : SfxTabPage(pPage, pController, "cui/ui/optgeneralpage.ui", "OptGeneralPage", &rSet)
156 , m_xExtHelpCB(m_xBuilder->weld_check_button("exthelp"))
157 , m_xPopUpNoHelpCB(m_xBuilder->weld_check_button("popupnohelp"))
158 , m_xShowTipOfTheDay(m_xBuilder->weld_check_button("cbShowTipOfTheDay"))
159 , m_xFileDlgFrame(m_xBuilder->weld_widget("filedlgframe"))
160 , m_xFileDlgROImage(m_xBuilder->weld_widget("lockimage"))
161 , m_xFileDlgCB(m_xBuilder->weld_check_button("filedlg"))
162 , m_xPrintDlgCB(m_xBuilder->weld_check_button("printdlg"))
163 , m_xDocStatusCB(m_xBuilder->weld_check_button("docstatus"))
164 , m_xYearFrame(m_xBuilder->weld_widget("yearframe"))
165 , m_xYearValueField(m_xBuilder->weld_spin_button("year"))
166 , m_xToYearFT(m_xBuilder->weld_label("toyear"))
167 , m_xCrashReport(m_xBuilder->weld_check_button("crashreport"))
168 , m_xQuickStarterFrame(m_xBuilder->weld_widget("quickstarter"))
169 , m_xHelpImproveLabel(m_xBuilder->weld_label("label7")) //"Help Improve"
170#if defined(UNX)
171 , m_xQuickLaunchCB(m_xBuilder->weld_check_button("systray"))
172#else
173 , m_xQuickLaunchCB(m_xBuilder->weld_check_button("quicklaunch"))
174#endif
175#if defined(_WIN32)
176 , m_xFileAssocFrame(m_xBuilder->weld_widget("fileassoc"))
177 , m_xFileAssocBtn(m_xBuilder->weld_button("assocfiles"))
178 , m_xPerformFileExtCheck(m_xBuilder->weld_check_button("cbPerformFileExtCheck"))
179#endif
180{
181 if (!lcl_HasSystemFilePicker())
182 m_xFileDlgFrame->hide();
183 else if (officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly())
184 {
185 m_xFileDlgROImage->show();
186 m_xFileDlgCB->set_sensitive(false);
187 }
188
189 m_xQuickLaunchCB->show();
190
191 //Only available in Win or if building the gtk systray
192#if !defined(_WIN32)
193 m_xQuickStarterFrame->hide();
194 //Hide frame label in case of no content
195 m_xHelpImproveLabel->hide();
196#endif
197
198#if defined(_WIN32)
199 m_xFileAssocFrame->show();
200 m_xFileAssocBtn->connect_clicked(LINK(this, OfaMiscTabPage, FileAssocClick));
201#endif
202
203 m_aStrDateInfo = m_xToYearFT->get_label();
204 m_xYearValueField->connect_value_changed( LINK( this, OfaMiscTabPage, TwoFigureHdl ) );
205
207}
208
210{
211}
212
213std::unique_ptr<SfxTabPage> OfaMiscTabPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet )
214{
215 return std::make_unique<OfaMiscTabPage>( pPage, pController, *rAttrSet );
216}
217
219{
220 bool bModified = false;
221 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
222
223 if ( m_xPopUpNoHelpCB->get_state_changed_from_saved() )
224 officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::set(m_xPopUpNoHelpCB->get_active(), batch);
225
226 if ( m_xExtHelpCB->get_state_changed_from_saved() )
227 officecfg::Office::Common::Help::ExtendedTip::set(m_xExtHelpCB->get_active(), batch);
228
229 if ( m_xShowTipOfTheDay->get_state_changed_from_saved() )
230 {
231 officecfg::Office::Common::Misc::ShowTipOfTheDay::set(m_xShowTipOfTheDay->get_active(), batch);
232 bModified = true;
233 }
234
235 if ( m_xFileDlgCB->get_state_changed_from_saved() )
236 {
237 officecfg::Office::Common::Misc::UseSystemFileDialog::set( !m_xFileDlgCB->get_active(), batch );
238 bModified = true;
239 }
240
241 if (m_xDocStatusCB->get_state_changed_from_saved())
242 {
243 officecfg::Office::Common::Print::PrintingModifiesDocument::set(m_xDocStatusCB->get_active(), batch);
244 bModified = true;
245 }
246
247 const SfxUInt16Item* pUInt16Item = GetOldItem( *rSet, SID_ATTR_YEAR2000 );
248 sal_uInt16 nNum = static_cast<sal_uInt16>(m_xYearValueField->get_text().toInt32());
249 if ( pUInt16Item && pUInt16Item->GetValue() != nNum )
250 {
251 bModified = true;
252 rSet->Put( SfxUInt16Item( SID_ATTR_YEAR2000, nNum ) );
253 }
254
255#if HAVE_FEATURE_BREAKPAD
256 if (m_xCrashReport->get_state_changed_from_saved())
257 {
258 officecfg::Office::Common::Misc::CrashReport::set(m_xCrashReport->get_active(), batch);
259 bModified = true;
260 }
261#endif
262
263#if defined(_WIN32)
264 if (m_xPerformFileExtCheck->get_state_changed_from_saved())
265 {
266 officecfg::Office::Common::Misc::PerformFileExtCheck::set(
267 m_xPerformFileExtCheck->get_active(), batch);
268 bModified = true;
269 }
270#endif
271
272 batch->commit();
273
274 if( m_xQuickLaunchCB->get_state_changed_from_saved())
275 {
276 rSet->Put(SfxBoolItem(SID_ATTR_QUICKLAUNCHER, m_xQuickLaunchCB->get_active()));
277 bModified = true;
278 }
279
280 return bModified;
281}
282
284{
285 m_xExtHelpCB->set_active( officecfg::Office::Common::Help::Tip::get() &&
286 officecfg::Office::Common::Help::ExtendedTip::get() );
287 m_xExtHelpCB->save_state();
288 m_xPopUpNoHelpCB->set_active( officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::get() );
289 m_xPopUpNoHelpCB->save_state();
290 m_xShowTipOfTheDay->set_active( officecfg::Office::Common::Misc::ShowTipOfTheDay::get() );
291 m_xShowTipOfTheDay->save_state();
292 m_xFileDlgCB->set_active( !officecfg::Office::Common::Misc::UseSystemFileDialog::get() );
293 m_xFileDlgCB->save_state();
294
295 m_xDocStatusCB->set_active(officecfg::Office::Common::Print::PrintingModifiesDocument::get());
296 m_xDocStatusCB->save_state();
297
298 if ( const SfxUInt16Item* pYearItem = rSet->GetItemIfSet( SID_ATTR_YEAR2000, false ) )
299 {
300 m_xYearValueField->set_value( pYearItem->GetValue() );
301 TwoFigureHdl(*m_xYearValueField);
302 }
303 else
304 m_xYearFrame->set_sensitive(false);
305
306#if HAVE_FEATURE_BREAKPAD
307 m_xCrashReport->set_active(officecfg::Office::Common::Misc::CrashReport::get() && CrashReporter::IsDumpEnable());
308 m_xCrashReport->set_sensitive(!officecfg::Office::Common::Misc::CrashReport::isReadOnly() && CrashReporter::IsDumpEnable());
309 m_xCrashReport->save_state();
310#else
311 m_xCrashReport->hide();
312#endif
313
314 const SfxPoolItem* pItem = nullptr;
315 SfxItemState eState = rSet->GetItemState( SID_ATTR_QUICKLAUNCHER, false, &pItem );
316 if ( SfxItemState::SET == eState )
317 m_xQuickLaunchCB->set_active( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
318 else if ( SfxItemState::DISABLED == eState )
319 {
320 // quickstart not installed
321 m_xQuickStarterFrame->hide();
322 }
323
324 m_xQuickLaunchCB->save_state();
325
326#if defined(_WIN32)
327 m_xPerformFileExtCheck->set_active(
328 officecfg::Office::Common::Misc::PerformFileExtCheck::get());
329 m_xPerformFileExtCheck->save_state();
330 m_xPerformFileExtCheck->set_sensitive(!officecfg::Office::Common::Misc::PerformFileExtCheck::isReadOnly());
331#endif
332}
333
335{
336 OUString aOutput( m_aStrDateInfo );
337 OUString aStr( m_xYearValueField->get_text() );
338 sal_Int32 nNum = aStr.toInt32();
339 if ( aStr.getLength() != 4 || nNum < m_xYearValueField->get_min() || nNum > m_xYearValueField->get_max() )
340 aOutput += "????";
341 else
342 {
343 nNum += 99;
344 aOutput += OUString::number( nNum );
345 }
346 m_xToYearFT->set_label( aOutput );
347}
348
349#if defined(_WIN32)
351{
353}
354#endif
355
357{
358public:
360
363 bool IsHardwareAccelerationRO() const;
364 void EnabledHardwareAcceleration( bool _bEnabled ) const;
365
366private:
367 typedef std::vector< std::pair<OUString,Sequence<OUString> > > ServiceVector;
368
369 Reference<XNameAccess> mxForceFlagNameAccess;
371 mutable bool mbHWAccelAvailable;
372 mutable bool mbHWAccelChecked;
373};
374
376 mbHWAccelAvailable(false),
377 mbHWAccelChecked(false)
378{
379 try
380 {
381 Reference<XMultiServiceFactory> xConfigProvider(
382 css::configuration::theDefaultProvider::get(
384
385 Sequence<Any> aArgs1(comphelper::InitAnyPropertySequence(
386 {
387 {"nodepath", Any(OUString("/org.openoffice.Office.Canvas"))}
388 }));
390 xConfigProvider->createInstanceWithArguments(
391 "com.sun.star.configuration.ConfigurationUpdateAccess",
392 aArgs1 ),
393 UNO_QUERY_THROW );
394
395 Sequence<Any> aArgs2(comphelper::InitAnyPropertySequence(
396 {
397 {"nodepath", Any(OUString("/org.openoffice.Office.Canvas/CanvasServiceList"))}
398 }));
399 Reference<XNameAccess> xNameAccess(
400 xConfigProvider->createInstanceWithArguments(
401 "com.sun.star.configuration.ConfigurationAccess",
402 aArgs2 ), UNO_QUERY_THROW );
403 Reference<XHierarchicalNameAccess> xHierarchicalNameAccess(
404 xNameAccess, UNO_QUERY_THROW);
405
406 Sequence<OUString> serviceNames = xNameAccess->getElementNames();
407 const OUString* pCurr = serviceNames.getConstArray();
408 const OUString* const pEnd = pCurr + serviceNames.getLength();
409 while( pCurr != pEnd )
410 {
411 Reference<XNameAccess> xEntryNameAccess(
412 xHierarchicalNameAccess->getByHierarchicalName(*pCurr),
413 UNO_QUERY );
414
415 if( xEntryNameAccess.is() )
416 {
417 Sequence<OUString> preferredImplementations;
418 if( xEntryNameAccess->getByName("PreferredImplementations") >>= preferredImplementations )
419 maAvailableImplementations.emplace_back(*pCurr,preferredImplementations );
420 }
421
422 ++pCurr;
423 }
424 }
425 catch (const Exception&)
426 {
427 }
428}
429
431{
432 if( !mbHWAccelChecked )
433 {
434 mbHWAccelChecked = true;
435
437
438 // check whether any of the service lists has an
439 // implementation that presents the "HardwareAcceleration" property
440 for (auto const& availableImpl : maAvailableImplementations)
441 {
442 const OUString* pCurrImpl = availableImpl.second.getConstArray();
443 const OUString* const pEndImpl = pCurrImpl + availableImpl.second.getLength();
444
445 while( pCurrImpl != pEndImpl )
446 {
447 try
448 {
449 Reference<XPropertySet> xPropSet( xFactory->createInstance(
450 pCurrImpl->trim() ),
451 UNO_QUERY_THROW );
452 bool bHasAccel(false);
453 if( xPropSet->getPropertyValue("HardwareAcceleration") >>= bHasAccel )
454 if( bHasAccel )
455 {
456 mbHWAccelAvailable = true;
457 return mbHWAccelAvailable;
458 }
459 }
460 catch (const Exception&)
461 {
462 }
463
464 ++pCurrImpl;
465 }
466 }
467 }
468
469 return mbHWAccelAvailable;
470}
471
473{
474 bool bForceLastEntry(false);
475 if( !mxForceFlagNameAccess.is() )
476 return true;
477
478 if( !(mxForceFlagNameAccess->getByName("ForceSafeServiceImpl") >>= bForceLastEntry) )
479 return true;
480
481 return !bForceLastEntry;
482}
483
485{
487 if (!xSet.is())
488 return true;
489
490 Reference< XPropertySetInfo > xInfo = xSet->getPropertySetInfo();
491 Property aProp = xInfo->getPropertyByName("ForceSafeServiceImpl");
492 return ((aProp.Attributes & css::beans::PropertyAttribute::READONLY ) == css::beans::PropertyAttribute::READONLY);
493}
494
496{
497 Reference< XNameReplace > xNameReplace(
498 mxForceFlagNameAccess, UNO_QUERY );
499
500 if( !xNameReplace.is() )
501 return;
502
503 xNameReplace->replaceByName( "ForceSafeServiceImpl", Any(!_bEnabled) );
504
505 Reference< XChangesBatch > xChangesBatch(
506 mxForceFlagNameAccess, UNO_QUERY );
507
508 if( !xChangesBatch.is() )
509 return;
510
511 xChangesBatch->commitChanges();
512}
513
514// class OfaViewTabPage --------------------------------------------------
515
516static bool DisplayNameCompareLessThan(const vcl::IconThemeInfo& rInfo1, const vcl::IconThemeInfo& rInfo2)
517{
518 return rInfo1.GetDisplayName().compareTo(rInfo2.GetDisplayName()) < 0;
519}
520
522 : SfxTabPage(pPage, pController, "cui/ui/optviewpage.ui", "OptViewPage", &rSet)
523 , nSizeLB_InitialSelection(0)
524 , nSidebarSizeLB_InitialSelection(0)
525 , nNotebookbarSizeLB_InitialSelection(0)
526 , nStyleLB_InitialSelection(0)
527 , pAppearanceCfg(new SvtTabAppearanceCfg)
528 , pCanvasSettings(new CanvasSettings)
529 , m_xIconSizeLB(m_xBuilder->weld_combo_box("iconsize"))
530 , m_xSidebarIconSizeLB(m_xBuilder->weld_combo_box("sidebariconsize"))
531 , m_xNotebookbarIconSizeLB(m_xBuilder->weld_combo_box("notebookbariconsize"))
532 , m_xIconStyleLB(m_xBuilder->weld_combo_box("iconstyle"))
533 , m_xFontAntiAliasing(m_xBuilder->weld_check_button("aafont"))
534 , m_xAAPointLimitLabel(m_xBuilder->weld_label("aafrom"))
535 , m_xAAPointLimit(m_xBuilder->weld_metric_spin_button("aanf", FieldUnit::PIXEL))
536 , m_xMenuIconBox(m_xBuilder->weld_widget("menuiconsbox"))
537 , m_xMenuIconsLB(m_xBuilder->weld_combo_box("menuicons"))
538 , m_xContextMenuShortcutsLB(m_xBuilder->weld_combo_box("contextmenushortcuts"))
539 , m_xFontShowCB(m_xBuilder->weld_check_button("showfontpreview"))
540 , m_xUseHardwareAccell(m_xBuilder->weld_check_button("useaccel"))
541 , m_xUseAntiAliase(m_xBuilder->weld_check_button("useaa"))
542 , m_xUseSkia(m_xBuilder->weld_check_button("useskia"))
543 , m_xForceSkiaRaster(m_xBuilder->weld_check_button("forceskiaraster"))
544 , m_xSkiaStatusEnabled(m_xBuilder->weld_label("skiaenabled"))
545 , m_xSkiaStatusDisabled(m_xBuilder->weld_label("skiadisabled"))
546 , m_xMousePosLB(m_xBuilder->weld_combo_box("mousepos"))
547 , m_xMouseMiddleLB(m_xBuilder->weld_combo_box("mousemiddle"))
548 , m_xMoreIcons(m_xBuilder->weld_button("btnMoreIcons"))
549 , m_xRunGPTests(m_xBuilder->weld_button("btn_rungptest"))
550{
551 if (Application::GetToolkitName().startsWith("gtk"))
552 m_xMenuIconBox->hide();
553
554 m_xFontAntiAliasing->connect_toggled( LINK( this, OfaViewTabPage, OnAntialiasingToggled ) );
555
556 m_xUseSkia->connect_toggled(LINK(this, OfaViewTabPage, OnUseSkiaToggled));
557
558 // Set known icon themes
559 OUString sAutoStr( m_xIconStyleLB->get_text( 0 ) );
560 m_xIconStyleLB->clear();
564
565 // Start with the automatically chosen icon theme
566 OUString autoThemeId = aStyleSettings.GetAutomaticallyChosenIconTheme();
568
569 OUString entryForAuto = sAutoStr + " (" +
570 autoIconTheme.GetDisplayName() +
571 ")";
572 m_xIconStyleLB->append("auto", entryForAuto); // index 0 means choose style automatically
573
574 // separate auto and other icon themes
575 m_xIconStyleLB->append_separator("");
576
577 for (auto const& installIconTheme : mInstalledIconThemes)
578 m_xIconStyleLB->append(installIconTheme.GetThemeId(), installIconTheme.GetDisplayName());
579
580 m_xIconStyleLB->set_active(0);
581
582 m_xMoreIcons->set_from_icon_name("cmd/sc_additionsdialog.png");
583 m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
584 m_xRunGPTests->connect_clicked( LINK( this, OfaViewTabPage, OnRunGPTestClick));
585}
586
588{
589}
590
592{
593 GraphicsTestsDialog m_xGraphicsTestDialog(m_xContainer.get());
594 m_xGraphicsTestDialog.run();
595}
596
598{
599 css::uno::Sequence<css::beans::PropertyValue> aArgs{ comphelper::makePropertyValue(
600 "AdditionsTag", OUString("Icons")) };
601 comphelper::dispatchCommand(".uno:AdditionsDialog", aArgs);
602}
603
604IMPL_LINK_NOARG( OfaViewTabPage, OnAntialiasingToggled, weld::Toggleable&, void )
605{
606 bool bAAEnabled = m_xFontAntiAliasing->get_active();
607
608 m_xAAPointLimitLabel->set_sensitive(bAAEnabled);
609 m_xAAPointLimit->set_sensitive(bAAEnabled);
610}
611
613{
614 UpdateSkiaStatus();
615}
616
618{
619 m_xUseSkia->hide();
620 m_xForceSkiaRaster->hide();
621 m_xSkiaStatusEnabled->hide();
622 m_xSkiaStatusDisabled->hide();
623}
624
626{
627#if HAVE_FEATURE_SKIA
628 bool skiaHidden = true;
629
630 // For now Skia is used mainly on Windows, enable the controls there.
631 if (Application::GetToolkitName() == "win")
632 skiaHidden = false;
633 // It can also be used on Linux, but only with the rarely used 'gen' backend.
634 if (Application::GetToolkitName() == "x11")
635 skiaHidden = false;
636 // OSX backend has Skia support too.
637 if (Application::GetToolkitName() == "osx")
638 skiaHidden = false;
639
640 if (skiaHidden)
641 {
643 return;
644 }
645
646 // Easier than a custom translation string.
647 bool bEnabled = SkiaHelper::isVCLSkiaEnabled();
648 m_xSkiaStatusEnabled->set_visible(bEnabled);
649 m_xSkiaStatusDisabled->set_visible(!bEnabled);
650
651 // FIXME: should really add code to show a 'lock' icon here.
652 m_xUseSkia->set_sensitive(!officecfg::Office::Common::VCL::UseSkia::isReadOnly());
653 m_xForceSkiaRaster->set_sensitive(m_xUseSkia->get_active() && !officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
654
655 // Technically the 'use hardware acceleration' option could be used to mean !forceSkiaRaster, but the implementation
656 // of the option is so tied to the implementation of the canvas module that it's simpler to ignore it.
658#else
660#endif
661}
662
663std::unique_ptr<SfxTabPage> OfaViewTabPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet )
664{
665 return std::make_unique<OfaViewTabPage>(pPage, pController, *rAttrSet);
666}
667
669{
670 bool bModified = false;
671 bool bMenuOptModified = false;
672 bool bRepaintWindows(false);
673 std::shared_ptr<comphelper::ConfigurationChanges> xChanges(comphelper::ConfigurationChanges::create());
674
675 SvtMiscOptions aMiscOptions;
676 const sal_Int32 nSizeLB_NewSelection = m_xIconSizeLB->get_active();
677 if( nSizeLB_InitialSelection != nSizeLB_NewSelection )
678 {
679 // from now on it's modified, even if via auto setting the same size was set as now selected in the LB
680 sal_Int16 eSet = SFX_SYMBOLS_SIZE_AUTO;
681 switch( nSizeLB_NewSelection )
682 {
683 case 0: eSet = SFX_SYMBOLS_SIZE_AUTO; break;
684 case 1: eSet = SFX_SYMBOLS_SIZE_SMALL; break;
685 case 2: eSet = SFX_SYMBOLS_SIZE_LARGE; break;
686 case 3: eSet = SFX_SYMBOLS_SIZE_32; break;
687 default:
688 OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_xIconSizeLB should not be possible!" );
689 }
690 aMiscOptions.SetSymbolsSize( eSet );
691 }
692
693 const sal_Int32 nSidebarSizeLB_NewSelection = m_xSidebarIconSizeLB->get_active();
694 if( nSidebarSizeLB_InitialSelection != nSidebarSizeLB_NewSelection )
695 {
696 // from now on it's modified, even if via auto setting the same size was set as now selected in the LB
697 ToolBoxButtonSize eSet = ToolBoxButtonSize::DontCare;
698 switch( nSidebarSizeLB_NewSelection )
699 {
700 case 0: eSet = ToolBoxButtonSize::DontCare; break;
701 case 1: eSet = ToolBoxButtonSize::Small; break;
702 case 2: eSet = ToolBoxButtonSize::Large; break;
703 default:
704 OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_xSidebarIconSizeLB should not be possible!" );
705 }
706 officecfg::Office::Common::Misc::SidebarIconSize::set(static_cast<sal_Int16>(eSet), xChanges);
707 }
708
709 const sal_Int32 nNotebookbarSizeLB_NewSelection = m_xNotebookbarIconSizeLB->get_active();
710 if( nNotebookbarSizeLB_InitialSelection != nNotebookbarSizeLB_NewSelection )
711 {
712 // from now on it's modified, even if via auto setting the same size was set as now selected in the LB
713 ToolBoxButtonSize eSet = ToolBoxButtonSize::DontCare;
714 switch( nNotebookbarSizeLB_NewSelection )
715 {
716 case 0: eSet = ToolBoxButtonSize::DontCare; break;
717 case 1: eSet = ToolBoxButtonSize::Small; break;
718 case 2: eSet = ToolBoxButtonSize::Large; break;
719 default:
720 OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_xNotebookbarIconSizeLB should not be possible!" );
721 }
722 officecfg::Office::Common::Misc::NotebookbarIconSize::set(static_cast<sal_Int16>(eSet), xChanges);
723 }
724
725 const sal_Int32 nStyleLB_NewSelection = m_xIconStyleLB->get_active();
726 if( nStyleLB_InitialSelection != nStyleLB_NewSelection )
727 {
728 aMiscOptions.SetIconTheme(m_xIconStyleLB->get_active_id());
729 nStyleLB_InitialSelection = nStyleLB_NewSelection;
730 }
731
732 bool bAppearanceChanged = false;
733
734 // Mouse Snap Mode
735 SnapType eOldSnap = pAppearanceCfg->GetSnapMode();
736 SnapType eNewSnap = static_cast<SnapType>(m_xMousePosLB->get_active());
737 if(eNewSnap > SnapType::NONE)
738 eNewSnap = SnapType::NONE;
739
740 if ( eNewSnap != eOldSnap )
741 {
742 pAppearanceCfg->SetSnapMode(eNewSnap );
743 bAppearanceChanged = true;
744 }
745
746 // Middle Mouse Button
747 MouseMiddleButtonAction eOldMiddleMouse = pAppearanceCfg->GetMiddleMouseButton();
748 short eNewMiddleMouse = m_xMouseMiddleLB->get_active();
749 if(eNewMiddleMouse > 2)
750 eNewMiddleMouse = 2;
751
752 if ( eNewMiddleMouse != static_cast<short>(eOldMiddleMouse) )
753 {
754 pAppearanceCfg->SetMiddleMouseButton( static_cast<MouseMiddleButtonAction>(eNewMiddleMouse) );
755 bAppearanceChanged = true;
756 }
757
758 if (m_xFontAntiAliasing->get_state_changed_from_saved())
759 {
760 pAppearanceCfg->SetFontAntiAliasing(m_xFontAntiAliasing->get_active());
761 bAppearanceChanged = true;
762 }
763
764 if (m_xAAPointLimit->get_value_changed_from_saved())
765 {
766 pAppearanceCfg->SetFontAntialiasingMinPixelHeight(m_xAAPointLimit->get_value(FieldUnit::PIXEL));
767 bAppearanceChanged = true;
768 }
769
770 if (m_xFontShowCB->get_state_changed_from_saved())
771 {
772 officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::set(m_xFontShowCB->get_active(), xChanges);
773 bModified = true;
774 }
775
776 if (m_xMenuIconsLB->get_value_changed_from_saved())
777 {
778 officecfg::Office::Common::View::Menu::IsSystemIconsInMenus::set(m_xMenuIconsLB->get_active() == 0, xChanges);
779 officecfg::Office::Common::View::Menu::ShowIconsInMenues::set(m_xMenuIconsLB->get_active() == 2, xChanges);
780 bModified = true;
781 bMenuOptModified = true;
782 bAppearanceChanged = true;
783 }
784
785 if (m_xContextMenuShortcutsLB->get_value_changed_from_saved())
786 {
787 officecfg::Office::Common::View::Menu::ShortcutsInContextMenus::set(
788 m_xContextMenuShortcutsLB->get_active() == 0 ?
790 static_cast<TriState>(m_xContextMenuShortcutsLB->get_active() - 1),
791 xChanges);
792 bModified = true;
793 bMenuOptModified = true;
794 bAppearanceChanged = true;
795 }
796
797 // #i95644# if disabled, do not use value, see in ::Reset()
798 if (m_xUseHardwareAccell->get_sensitive())
799 {
800 if(m_xUseHardwareAccell->get_state_changed_from_saved())
801 {
802 pCanvasSettings->EnabledHardwareAcceleration(m_xUseHardwareAccell->get_active());
803 bModified = true;
804 }
805 }
806
807 // #i95644# if disabled, do not use value, see in ::Reset()
808 if (m_xUseAntiAliase->get_sensitive())
809 {
811 {
812 SvtOptionsDrawinglayer::SetAntiAliasing(m_xUseAntiAliase->get_active(), /*bTemporary*/false);
813 bModified = true;
814 bRepaintWindows = true;
815 }
816 }
817
818 if (m_xUseSkia->get_state_changed_from_saved() ||
819 m_xForceSkiaRaster->get_state_changed_from_saved())
820 {
821 officecfg::Office::Common::VCL::UseSkia::set(m_xUseSkia->get_active(), xChanges);
822 officecfg::Office::Common::VCL::ForceSkiaRaster::set(m_xForceSkiaRaster->get_active(), xChanges);
823 bModified = true;
824 }
825
826 xChanges->commit();
827
828 if( bMenuOptModified )
829 {
830 // Set changed settings to the application instance
831 AllSettings aAllSettings = Application::GetSettings();
832 StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
833 aAllSettings.SetStyleSettings(aStyleSettings);
834 Application::MergeSystemSettings( aAllSettings );
835 Application::SetSettings(aAllSettings);
836 }
837
838 if ( bAppearanceChanged )
839 {
840 pAppearanceCfg->Commit();
841 pAppearanceCfg->SetApplicationDefaults ( GetpApp() );
842 }
843
844 if(bRepaintWindows)
845 {
847
848 while(pAppWindow)
849 {
850 pAppWindow->Invalidate();
851 pAppWindow = Application::GetNextTopLevelWindow(pAppWindow);
852 }
853 }
854
855 if (m_xUseSkia->get_state_changed_from_saved() ||
856 m_xForceSkiaRaster->get_state_changed_from_saved())
857 {
858 SolarMutexGuard aGuard;
862 GetDialogController()->response(RET_OK);
863 }
864
865 return bModified;
866}
867
869{
870 SvtMiscOptions aMiscOptions;
871
872 if (aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO)
873 {
875
876 if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
878 else if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_32)
880 }
882 m_xIconSizeLB->save_value();
883
884 ToolBoxButtonSize eSidebarIconSize = static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::SidebarIconSize::get());
885 if( eSidebarIconSize == ToolBoxButtonSize::DontCare )
886 ; // do nothing
887 else if( eSidebarIconSize == ToolBoxButtonSize::Small )
889 else if( eSidebarIconSize == ToolBoxButtonSize::Large )
892 m_xSidebarIconSizeLB->save_value();
893 ToolBoxButtonSize eNotebookbarIconSize = static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::NotebookbarIconSize::get());
894 if( eNotebookbarIconSize == ToolBoxButtonSize::DontCare )
895 ; // do nothing
896 else if( eNotebookbarIconSize == ToolBoxButtonSize::Small )
898 else if( eNotebookbarIconSize == ToolBoxButtonSize::Large )
901 m_xNotebookbarIconSizeLB->save_value();
902
903 if (aMiscOptions.IconThemeWasSetAutomatically()) {
905 }
906 else {
907 const OUString& selected = aMiscOptions.GetIconTheme();
908 const vcl::IconThemeInfo& selectedInfo =
910 nStyleLB_InitialSelection = m_xIconStyleLB->find_text(selectedInfo.GetDisplayName());
911 }
912
914 m_xIconStyleLB->save_value();
915
916 // Mouse Snap
917 m_xMousePosLB->set_active(static_cast<sal_Int32>(pAppearanceCfg->GetSnapMode()));
918 m_xMousePosLB->save_value();
919
920 // Mouse Snap
921 m_xMouseMiddleLB->set_active(static_cast<short>(pAppearanceCfg->GetMiddleMouseButton()));
922 m_xMouseMiddleLB->save_value();
923
924 m_xFontAntiAliasing->set_active( pAppearanceCfg->IsFontAntiAliasing() );
925 m_xAAPointLimit->set_value(pAppearanceCfg->GetFontAntialiasingMinPixelHeight(), FieldUnit::PIXEL);
926
927 // WorkingSet
928 m_xFontShowCB->set_active(officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::get());
929 bool bSystemMenuIcons = officecfg::Office::Common::View::Menu::IsSystemIconsInMenus::get();
930 bool bMenuIcons = officecfg::Office::Common::View::Menu::ShowIconsInMenues::get();
931 m_xMenuIconsLB->set_active(bSystemMenuIcons ? 0 : (bMenuIcons ? 2 : 1));
932 m_xMenuIconsLB->save_value();
933
934 TriState eContextMenuShortcuts = static_cast<TriState>(officecfg::Office::Common::View::Menu::ShortcutsInContextMenus::get());
935 bool bContextMenuShortcutsNonDefault = eContextMenuShortcuts == TRISTATE_FALSE || eContextMenuShortcuts == TRISTATE_TRUE;
936 m_xContextMenuShortcutsLB->set_active(bContextMenuShortcutsNonDefault ? eContextMenuShortcuts + 1 : 0);
937 m_xContextMenuShortcutsLB->save_value();
938
940 m_xUseHardwareAccell->save_state();
941
942 { // #i95644# AntiAliasing
944 {
946 }
947 else
948 {
949 m_xUseAntiAliase->set_active(false);
950 m_xUseAntiAliase->set_sensitive(false);
951 }
952
953 m_xUseAntiAliase->save_state();
954 }
955
956 m_xUseSkia->set_active(officecfg::Office::Common::VCL::UseSkia::get());
957 m_xForceSkiaRaster->set_active(officecfg::Office::Common::VCL::ForceSkiaRaster::get());
958 m_xUseSkia->save_state();
959 m_xForceSkiaRaster->save_state();
960
961 m_xFontAntiAliasing->save_state();
962 m_xAAPointLimit->save_value();
963 m_xFontShowCB->save_state();
964
965 OnAntialiasingToggled(*m_xFontAntiAliasing);
967}
968
970{
971 // #i95644# HW accel (unified to disable mechanism)
972 if(pCanvasSettings->IsHardwareAccelerationAvailable())
973 {
974 m_xUseHardwareAccell->set_active(pCanvasSettings->IsHardwareAccelerationEnabled());
975 m_xUseHardwareAccell->set_sensitive(!pCanvasSettings->IsHardwareAccelerationRO());
976 }
977 else
978 {
979 m_xUseHardwareAccell->set_active(false);
980 m_xUseHardwareAccell->set_sensitive(false);
981 }
982#if HAVE_FEATURE_SKIA
983 m_xUseHardwareAccell->set_sensitive(!m_xUseSkia->get_active());
984#endif
985}
986
988{
992};
993
994static bool bLanguageCurrentDoc_Impl = false;
995
996// some things we'll need...
997constexpr OUStringLiteral sAccessSrvc = u"com.sun.star.configuration.ConfigurationAccess";
998constexpr OUStringLiteral sAccessUpdSrvc = u"com.sun.star.configuration.ConfigurationUpdateAccess";
999constexpr OUStringLiteral sInstalledLocalesPath = u"org.openoffice.Setup/Office/InstalledLocales";
1000constexpr OUStringLiteral sUserLocalePath = u"org.openoffice.Office.Linguistic/General";
1001constexpr OUStringLiteral sUserLocaleKey = u"UILocale";
1003
1004static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocaleWrapper )
1005{
1006 Sequence< OUString > aDateAcceptancePatterns = rLocaleWrapper.getDateAcceptancePatterns();
1007 sal_Int32 nPatterns = aDateAcceptancePatterns.getLength();
1008 OUStringBuffer aBuf( nPatterns * 6 ); // 6 := length of Y-M-D;
1009 SAL_WARN_IF( !nPatterns, "cui.options", "No date acceptance pattern");
1010 if (nPatterns)
1011 {
1012 const OUString* pPatterns = aDateAcceptancePatterns.getConstArray();
1013 aBuf.append( pPatterns[0]);
1014 for (sal_Int32 i=1; i < nPatterns; ++i)
1015 aBuf.append(';').append( pPatterns[i]);
1016 }
1017 return aBuf.makeStringAndClear();
1018}
1019
1020namespace
1021{
1022 //what ui language will be selected by default if the user override of General::UILocale is unset ?
1023 LanguageTag GetInstalledLocaleForSystemUILanguage()
1024 {
1025 css::uno::Sequence<OUString> inst(officecfg::Setup::Office::InstalledLocales::get()->getElementNames());
1027 }
1028}
1029
1031 : SfxTabPage(pPage, pController, "cui/ui/optlanguagespage.ui", "OptLanguagesPage", &rSet)
1032 , pLangConfig(new LanguageConfig_Impl)
1033 , m_bDatePatternsValid(false)
1034 , m_xUserInterfaceLB(m_xBuilder->weld_combo_box("userinterface"))
1035 , m_xLocaleSettingFT(m_xBuilder->weld_label("localesettingFT"))
1036 , m_xLocaleSettingLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("localesetting")))
1037 , m_xDecimalSeparatorCB(m_xBuilder->weld_check_button("decimalseparator"))
1038 , m_xCurrencyFT(m_xBuilder->weld_label("defaultcurrency"))
1039 , m_xCurrencyLB(m_xBuilder->weld_combo_box("currencylb"))
1040 , m_xDatePatternsFT(m_xBuilder->weld_label("dataaccpatterns"))
1041 , m_xDatePatternsED(m_xBuilder->weld_entry("datepatterns"))
1042 , m_xWesternLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("westernlanguage")))
1043 , m_xWesternLanguageFT(m_xBuilder->weld_label("western"))
1044 , m_xAsianLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("asianlanguage")))
1045 , m_xComplexLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("complexlanguage")))
1046 , m_xCurrentDocCB(m_xBuilder->weld_check_button("currentdoc"))
1047 , m_xAsianSupportCB(m_xBuilder->weld_check_button("asiansupport"))
1048 , m_xCTLSupportCB(m_xBuilder->weld_check_button("ctlsupport"))
1049 , m_xIgnoreLanguageChangeCB(m_xBuilder->weld_check_button("ignorelanguagechange"))
1050{
1051 // tdf#125483 save original default label
1053
1054 // initialize user interface language selection
1056
1057 OUString aUILang = m_sSystemDefaultString +
1058 " - " +
1059 SvtLanguageTable::GetLanguageString(GetInstalledLocaleForSystemUILanguage().getLanguageType());
1060
1061 m_xUserInterfaceLB->append("0", aUILang);
1062 m_xUserInterfaceLB->append_separator("");
1063 try
1064 {
1065 Reference< XMultiServiceFactory > theConfigProvider(
1066 css::configuration::theDefaultProvider::get(
1068 // find out which locales are currently installed and add them to the listbox
1069 Sequence< Any > theArgs{ Any(NamedValue("nodepath", Any(OUString(sInstalledLocalesPath)))) };
1070 Reference< XNameAccess > theNameAccess(
1071 theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs ), UNO_QUERY_THROW );
1072 seqInstalledLanguages = theNameAccess->getElementNames();
1074 std::vector< std::pair<sal_Int32, OUString> > aUILanguages;
1075 for (sal_Int32 i=0; i<seqInstalledLanguages.getLength(); i++)
1076 {
1078 if (aLang != LANGUAGE_DONTKNOW)
1079 {
1080 OUString aLangStr( SvtLanguageTable::GetLanguageString( aLang ) );
1081 aUILanguages.emplace_back(i+1, aLangStr);
1082 }
1083 }
1084
1085 std::sort(aUILanguages.begin(), aUILanguages.end(), [](const auto& l1, const auto& l2) {
1086 static const auto aSorter = comphelper::string::NaturalStringSorter(
1087 comphelper::getProcessComponentContext(),
1088 Application::GetSettings().GetLanguageTag().getLocale());
1089 return aSorter.compare(l1.second, l2.second) < 0;
1090 });
1091
1092 // tdf#114694: append the sorted list after the default entry and separator.
1093 for (const auto & [ nGroupID, sGroupName ] : aUILanguages)
1094 {
1095 m_xUserInterfaceLB->append(OUString::number(nGroupID), sGroupName);
1096 }
1097
1098 m_xUserInterfaceLB->set_active(0);
1099
1100 // find out whether the user has a specific locale specified
1101 Sequence< Any > theArgs2{ Any(NamedValue("nodepath", Any(OUString(sUserLocalePath)))) };
1102 theNameAccess.set(
1103 theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs2 ), UNO_QUERY_THROW );
1104 if (theNameAccess->hasByName(sUserLocaleKey))
1105 theNameAccess->getByName(sUserLocaleKey) >>= m_sUserLocaleValue;
1106 // select the user specified locale in the listbox
1107 if (!m_sUserLocaleValue.isEmpty())
1108 {
1109 for (sal_Int32 i = 0, nEntryCount = m_xUserInterfaceLB->get_count(); i < nEntryCount; ++i)
1110 {
1111 sal_Int32 d = m_xUserInterfaceLB->get_id(i).toInt32();
1112 if ( d > 0 && seqInstalledLanguages.getLength() > d-1 && seqInstalledLanguages[d-1] == m_sUserLocaleValue)
1113 m_xUserInterfaceLB->set_active(i);
1114 }
1115 }
1116
1117 }
1118 catch (const Exception &)
1119 {
1120 // we'll just leave the box in its default setting and won't
1121 // even give it event handler...
1122 TOOLS_WARN_EXCEPTION("cui.options", "ignoring" );
1123 }
1124
1125 m_xWesternLanguageLB->SetLanguageList(
1126 SvxLanguageListFlags::WESTERN | SvxLanguageListFlags::ONLY_KNOWN, true, false, true, true,
1127 LANGUAGE_SYSTEM, css::i18n::ScriptType::LATIN);
1128
1129 m_xAsianLanguageLB->SetLanguageList(
1130 SvxLanguageListFlags::CJK | SvxLanguageListFlags::ONLY_KNOWN, true, false, true, true,
1131 LANGUAGE_SYSTEM, css::i18n::ScriptType::ASIAN);
1132
1133 m_xComplexLanguageLB->SetLanguageList(
1134 SvxLanguageListFlags::CTL | SvxLanguageListFlags::ONLY_KNOWN, true, false, true, true,
1135 LANGUAGE_SYSTEM, css::i18n::ScriptType::COMPLEX);
1136
1137 m_xLocaleSettingLB->SetLanguageList(
1138 SvxLanguageListFlags::ALL | SvxLanguageListFlags::ONLY_KNOWN, false, false, false, true,
1139 LANGUAGE_USER_SYSTEM_CONFIG, css::i18n::ScriptType::WEAK);
1140
1142 const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry( LANGUAGE_SYSTEM );
1143 // insert SYSTEM entry
1144 OUString aDefaultCurr = m_sSystemDefaultString + " - " + rCurr.GetBankSymbol();
1145 m_xCurrencyLB->append("default", aDefaultCurr);
1146 m_xCurrencyLB->append_separator("");
1147
1148 assert(m_xCurrencyLB->find_id("default") != -1);
1149 // all currencies
1150 OUString aTwoSpace( " " );
1151 sal_uInt16 nCurrCount = rCurrTab.size();
1152 std::vector< const NfCurrencyEntry* > aCurrencies;
1153 // first entry is SYSTEM, skip it
1154 for ( sal_uInt16 j=1; j < nCurrCount; ++j )
1155 {
1156 aCurrencies.push_back(&rCurrTab[j]);
1157 }
1158 std::sort(aCurrencies.begin(), aCurrencies.end(),
1159 [](const NfCurrencyEntry* c1, const NfCurrencyEntry* c2) {
1160 return c1->GetBankSymbol().compareTo(c2->GetBankSymbol()) < 0;
1161 });
1162
1163 for (auto &v : aCurrencies)
1164 {
1165 OUString aStr_ = v->GetBankSymbol() +
1166 aTwoSpace +
1167 v->GetSymbol();
1168 aStr_ = ApplyLreOrRleEmbedding( aStr_ ) +
1169 aTwoSpace +
1171 m_xCurrencyLB->append(weld::toId(v), aStr_);
1172 }
1173
1174 m_xCurrencyLB->set_active(0);
1175
1176 m_xLocaleSettingLB->connect_changed( LINK( this, OfaLanguagesTabPage, LocaleSettingHdl ) );
1177 m_xDatePatternsED->connect_changed( LINK( this, OfaLanguagesTabPage, DatePatternsHdl ) );
1178
1179 Link<weld::Toggleable&,void> aLink( LINK( this, OfaLanguagesTabPage, SupportHdl ) );
1180 m_xAsianSupportCB->connect_toggled( aLink );
1181 m_xCTLSupportCB->connect_toggled( aLink );
1182
1184 m_xAsianSupportCB->set_active(m_bOldAsian);
1185 m_xAsianSupportCB->save_state();
1187 m_xAsianSupportCB->set_sensitive(!bReadonly);
1188 SupportHdl(*m_xAsianSupportCB);
1189
1190 m_bOldCtl = pLangConfig->aCTLLanguageOptions.IsCTLFontEnabled();
1191 m_xCTLSupportCB->set_active(m_bOldCtl);
1192 m_xCTLSupportCB->save_state();
1193 bReadonly = pLangConfig->aCTLLanguageOptions.IsReadOnly(SvtCTLOptions::E_CTLFONT);
1194 m_xCTLSupportCB->set_sensitive(!bReadonly);
1195 SupportHdl(*m_xCTLSupportCB);
1196
1197 m_xIgnoreLanguageChangeCB->set_active( pLangConfig->aSysLocaleOptions.IsIgnoreLanguageChange() );
1198}
1199
1201{
1202}
1203
1204std::unique_ptr<SfxTabPage> OfaLanguagesTabPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet )
1205{
1206 return std::make_unique<OfaLanguagesTabPage>(pPage, pController, *rAttrSet);
1207}
1208
1209static void lcl_Update(std::unique_ptr<SfxVoidItem> pInvalidItems[], std::unique_ptr<SfxBoolItem> pBoolItems[], sal_uInt16 nCount)
1210{
1211 SfxViewFrame* pCurrentFrm = SfxViewFrame::Current();
1213 while(pViewFrm)
1214 {
1215 SfxBindings& rBind = pViewFrm->GetBindings();
1216 for(sal_uInt16 i = 0; i < nCount; i++)
1217 {
1218 if(pCurrentFrm == pViewFrm)
1219 rBind.InvalidateAll(false);
1220 rBind.SetState( *pInvalidItems[i] );
1221 rBind.SetState( *pBoolItems[i] );
1222 }
1223 pViewFrm = SfxViewFrame::GetNext(*pViewFrm);
1224 }
1225}
1226
1228{
1229 // lock configuration broadcasters so that we can coordinate the notifications
1230 pLangConfig->aSysLocaleOptions.BlockBroadcasts( true );
1231 pLangConfig->aCTLLanguageOptions.BlockBroadcasts( true );
1232 pLangConfig->aLinguConfig.BlockBroadcasts( true );
1233
1234 /*
1235 * Sequence checking only matters when CTL support is enabled.
1236 *
1237 * So we only need to check for sequence checking if
1238 * a) previously it was unchecked and is now checked or
1239 * b) it was already checked but the CTL language has changed
1240 */
1241 if (
1242 m_xCTLSupportCB->get_active() &&
1243 (m_xCTLSupportCB->get_saved_state() != TRISTATE_TRUE ||
1244 m_xComplexLanguageLB->get_active_id_changed_from_saved())
1245 )
1246 {
1247 //sequence checking has to be switched on depending on the selected CTL language
1248 LanguageType eCTLLang = m_xComplexLanguageLB->get_active_id();
1249 bool bOn = MsLangId::needsSequenceChecking( eCTLLang);
1250 pLangConfig->aCTLLanguageOptions.SetCTLSequenceCheckingRestricted(bOn);
1251 pLangConfig->aCTLLanguageOptions.SetCTLSequenceChecking(bOn);
1252 pLangConfig->aCTLLanguageOptions.SetCTLSequenceCheckingTypeAndReplace(bOn);
1253 }
1254 try
1255 {
1256 // handle settings for UI Language
1257 // a change of setting needs to bring up a warning message
1258 OUString aLangString;
1259 sal_Int32 d = m_xUserInterfaceLB->get_active_id().toInt32();
1260 if( d > 0 && seqInstalledLanguages.getLength() > d-1)
1261 aLangString = seqInstalledLanguages[d-1];
1262
1263 /*
1264 if( m_xUserInterfaceLB->GetSelectedEntryPos() > 0)
1265 aLangString = ConvertLanguageToIsoString(m_xUserInterfaceLB->get_active_id());
1266 */
1267 Reference< XMultiServiceFactory > theConfigProvider(
1268 css::configuration::theDefaultProvider::get(
1270 Sequence< Any > theArgs{ Any(NamedValue("nodepath", Any(OUString(sUserLocalePath)))) };
1272 theConfigProvider->createInstanceWithArguments(sAccessUpdSrvc, theArgs ), UNO_QUERY_THROW );
1273 if ( m_sUserLocaleValue != aLangString)
1274 {
1275 // OSL_FAIL("UserInterface language was changed, restart.");
1276 // write new value
1277 xProp->setPropertyValue(sUserLocaleKey, Any(aLangString));
1278 Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges();
1279 // display info
1280 SolarMutexGuard aGuard;
1284 GetDialogController()->response(RET_OK);
1285
1286 // tell quickstarter to stop being a veto listener
1287
1288 Reference< XComponentContext > xContext(
1290 css::office::Quickstart::createAndSetVeto(xContext, false, false, false/*DisableVeto*/);
1291 }
1292 }
1293 catch (const Exception&)
1294 {
1295 // we'll just leave the box in its default setting and won't
1296 // even give it event handler...
1297 TOOLS_WARN_EXCEPTION("cui.options", "ignoring");
1298 }
1299
1300 LanguageTag aLanguageTag( pLangConfig->aSysLocaleOptions.GetLanguageTag());
1301 LanguageType eOldLocale = (aLanguageTag.isSystemLocale() ? LANGUAGE_SYSTEM :
1302 aLanguageTag.makeFallback().getLanguageType());
1303 LanguageType eNewLocale = m_xLocaleSettingLB->get_active_id();
1304
1305 // If the "Default ..." entry was selected that means SYSTEM, the actual
1306 // eNewLocale value is temporary for the dialog only, do not resolve to
1307 // what system currently is.
1308 if (eNewLocale == LANGUAGE_USER_SYSTEM_CONFIG)
1309 eNewLocale = LANGUAGE_SYSTEM;
1310
1311 if ( eOldLocale != eNewLocale )
1312 {
1313 // an empty string denotes SYSTEM locale
1314 OUString sNewLang;
1315 if ( eNewLocale != LANGUAGE_SYSTEM )
1316 sNewLang = LanguageTag::convertToBcp47( eNewLocale);
1317
1318 // locale nowadays get to AppSettings via notification
1319 // this will happen after releasing the lock on the ConfigurationBroadcaster at
1320 // the end of this method
1321 pLangConfig->aSysLocaleOptions.SetLocaleConfigString( sNewLang );
1322 rSet->Put( SfxBoolItem( SID_OPT_LOCALE_CHANGED, true ) );
1323
1325 bool bNewCJK = bool( nNewType & SvtScriptType::ASIAN );
1326 SvtCompatibilityOptions aCompatOpts;
1328 }
1329
1330 if(m_xDecimalSeparatorCB->get_state_changed_from_saved())
1331 pLangConfig->aSysLocaleOptions.SetDecimalSeparatorAsLocale(m_xDecimalSeparatorCB->get_active());
1332
1333 if(m_xIgnoreLanguageChangeCB->get_state_changed_from_saved())
1334 pLangConfig->aSysLocaleOptions.SetIgnoreLanguageChange(m_xIgnoreLanguageChangeCB->get_active());
1335
1336 // Configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default.
1337 OUString sOldCurr = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
1338 OUString sId = m_xCurrencyLB->get_active_id();
1339 const NfCurrencyEntry* pCurr = sId == "default" ? nullptr : weld::fromId<const NfCurrencyEntry*>(sId);
1340 OUString sNewCurr;
1341 if ( pCurr )
1343 pCurr->GetBankSymbol(), pCurr->GetLanguage() );
1344 if ( sOldCurr != sNewCurr )
1345 pLangConfig->aSysLocaleOptions.SetCurrencyConfigString( sNewCurr );
1346
1347 // Configured date acceptance patterns, for example Y-M-D;M-D or empty for
1348 // locale default.
1349 if (m_bDatePatternsValid && m_xDatePatternsED->get_value_changed_from_saved())
1350 pLangConfig->aSysLocaleOptions.SetDatePatternsConfigString( m_xDatePatternsED->get_text());
1351
1352 SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current();
1353 Reference< css::linguistic2::XLinguProperties > xLinguProp = LinguMgr::GetLinguPropertySet();
1354 bool bCurrentDocCBChecked = m_xCurrentDocCB->get_active();
1355 if (m_xCurrentDocCB->get_sensitive())
1356 bLanguageCurrentDoc_Impl = bCurrentDocCBChecked;
1357 bool bCurrentDocCBChanged = m_xCurrentDocCB->get_state_changed_from_saved();
1358
1359 bool bValChanged = m_xWesternLanguageLB->get_active_id_changed_from_saved();
1360 if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
1361 {
1362 LanguageType eSelectLang = m_xWesternLanguageLB->get_active_id();
1363 if(!bCurrentDocCBChecked)
1364 {
1365 Any aValue;
1366 Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
1367 aValue <<= aLocale;
1368 pLangConfig->aLinguConfig.SetProperty( u"DefaultLocale", aValue );
1369 if (xLinguProp.is())
1370 xLinguProp->setDefaultLocale( aLocale );
1371 }
1372 if(pCurrentDocShell)
1373 {
1374 rSet->Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, css::i18n::ScriptType::LATIN),
1375 SID_ATTR_LANGUAGE));
1376 }
1377 }
1378 bValChanged = m_xAsianLanguageLB->get_active_id_changed_from_saved();
1379 if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
1380 {
1381 LanguageType eSelectLang = m_xAsianLanguageLB->get_active_id();
1382 if(!bCurrentDocCBChecked)
1383 {
1384 Any aValue;
1385 Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
1386 aValue <<= aLocale;
1387 pLangConfig->aLinguConfig.SetProperty( u"DefaultLocale_CJK", aValue );
1388 if (xLinguProp.is())
1389 xLinguProp->setDefaultLocale_CJK( aLocale );
1390 }
1391 if(pCurrentDocShell)
1392 {
1393 rSet->Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, css::i18n::ScriptType::ASIAN),
1394 SID_ATTR_CHAR_CJK_LANGUAGE));
1395 }
1396 }
1397 bValChanged = m_xComplexLanguageLB->get_active_id_changed_from_saved();
1398 if( (bCurrentDocCBChanged && !bCurrentDocCBChecked) || bValChanged)
1399 {
1400 LanguageType eSelectLang = m_xComplexLanguageLB->get_active_id();
1401 if(!bCurrentDocCBChecked)
1402 {
1403 Any aValue;
1404 Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
1405 aValue <<= aLocale;
1406 pLangConfig->aLinguConfig.SetProperty( u"DefaultLocale_CTL", aValue );
1407 if (xLinguProp.is())
1408 xLinguProp->setDefaultLocale_CTL( aLocale );
1409 }
1410 if(pCurrentDocShell)
1411 {
1412 rSet->Put(SvxLanguageItem(MsLangId::resolveSystemLanguageByScriptType(eSelectLang, css::i18n::ScriptType::COMPLEX),
1413 SID_ATTR_CHAR_CTL_LANGUAGE));
1414 }
1415 }
1416
1417 if(m_xAsianSupportCB->get_state_changed_from_saved() )
1418 {
1419 bool bChecked = m_xAsianSupportCB->get_active();
1420 SvtCJKOptions::SetAll(bChecked);
1421
1422 //iterate over all bindings to invalidate vertical text direction
1423 const sal_uInt16 STATE_COUNT = 2;
1424
1425 std::unique_ptr<SfxBoolItem> pBoolItems[STATE_COUNT];
1426 pBoolItems[0].reset(new SfxBoolItem(SID_VERTICALTEXT_STATE, false));
1427 pBoolItems[1].reset(new SfxBoolItem(SID_TEXT_FITTOSIZE_VERTICAL, false));
1428
1429 std::unique_ptr<SfxVoidItem> pInvalidItems[STATE_COUNT];
1430 pInvalidItems[0].reset(new SfxVoidItem(SID_VERTICALTEXT_STATE));
1431 pInvalidItems[1].reset(new SfxVoidItem(SID_TEXT_FITTOSIZE_VERTICAL));
1432
1433 lcl_Update(pInvalidItems, pBoolItems, STATE_COUNT);
1434 }
1435
1436 if ( m_xCTLSupportCB->get_state_changed_from_saved() )
1437 {
1438 SvtSearchOptions aOpt;
1439 aOpt.SetIgnoreDiacritics_CTL(true);
1440 aOpt.SetIgnoreKashida_CTL(true);
1441 aOpt.Commit();
1442 pLangConfig->aCTLLanguageOptions.SetCTLFontEnabled( m_xCTLSupportCB->get_active() );
1443
1444 const sal_uInt16 STATE_COUNT = 1;
1445 std::unique_ptr<SfxBoolItem> pBoolItems[STATE_COUNT];
1446 pBoolItems[0].reset(new SfxBoolItem(SID_CTLFONT_STATE, false));
1447 std::unique_ptr<SfxVoidItem> pInvalidItems[STATE_COUNT];
1448 pInvalidItems[0].reset(new SfxVoidItem(SID_CTLFONT_STATE));
1449 lcl_Update(pInvalidItems, pBoolItems, STATE_COUNT);
1450 }
1451
1452 if ( pLangConfig->aSysLocaleOptions.IsModified() )
1453 pLangConfig->aSysLocaleOptions.Commit();
1454
1455 // first release the lock on the ConfigurationBroadcaster for Locale changes
1456 // it seems that our code relies on the fact that before other changes like e.g. currency
1457 // are broadcasted locale changes have been done
1458 pLangConfig->aSysLocaleOptions.BlockBroadcasts( false );
1459 pLangConfig->aCTLLanguageOptions.BlockBroadcasts( false );
1460 pLangConfig->aLinguConfig.BlockBroadcasts( false );
1461
1462 return false;
1463}
1464
1466{
1467 LanguageTag aLanguageTag( pLangConfig->aSysLocaleOptions.GetLanguageTag());
1468 if ( aLanguageTag.isSystemLocale() )
1470 else
1471 m_xLocaleSettingLB->set_active_id( aLanguageTag.makeFallback().getLanguageType());
1472 bool bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::Locale);
1473 m_xLocaleSettingLB->set_sensitive(!bReadonly);
1474 m_xLocaleSettingFT->set_sensitive(!bReadonly);
1475
1476
1477 m_xDecimalSeparatorCB->set_active( pLangConfig->aSysLocaleOptions.IsDecimalSeparatorAsLocale());
1478 m_xDecimalSeparatorCB->save_state();
1479
1480 m_xIgnoreLanguageChangeCB->set_active( pLangConfig->aSysLocaleOptions.IsIgnoreLanguageChange());
1481 m_xIgnoreLanguageChangeCB->save_state();
1482
1483 // let LocaleSettingHdl enable/disable checkboxes for CJK/CTL support
1484 // #i15812# must be done *before* the configured currency is set
1485 // and update the decimal separator used for the given locale
1486 LocaleSettingHdl(*m_xLocaleSettingLB->get_widget());
1487
1488 // configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default
1489 const NfCurrencyEntry* pCurr = nullptr;
1490 OUString sCurrency = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
1491 if ( !sCurrency.isEmpty() )
1492 {
1493 LanguageType eLang;
1494 OUString aAbbrev;
1495 SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( aAbbrev, eLang, sCurrency );
1496 pCurr = SvNumberFormatter::GetCurrencyEntry( aAbbrev, eLang );
1497 }
1498 // if pCurr==nullptr the SYSTEM entry is selected
1499 OUString sId = !pCurr ? OUString("default") : weld::toId(pCurr);
1500 m_xCurrencyLB->set_active_id(sId);
1501 bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::Currency);
1502 m_xCurrencyLB->set_sensitive(!bReadonly);
1503 m_xCurrencyFT->set_sensitive(!bReadonly);
1504
1505 // date acceptance patterns
1506 OUString aDatePatternsString = pLangConfig->aSysLocaleOptions.GetDatePatternsConfigString();
1507 if (aDatePatternsString.isEmpty())
1508 {
1510 aDatePatternsString = lcl_getDatePatternsConfigString( rLocaleWrapper);
1511 }
1512 // Let's assume patterns are valid at this point.
1513 m_bDatePatternsValid = true;
1514 m_xDatePatternsED->set_text(aDatePatternsString);
1515 bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::DatePatterns);
1516 m_xDatePatternsED->set_sensitive(!bReadonly);
1517 m_xDatePatternsFT->set_sensitive(!bReadonly);
1518 m_xDatePatternsED->save_value();
1519
1520 //western/CJK/CLK language
1521 LanguageType eCurLang = LANGUAGE_NONE;
1522 LanguageType eCurLangCJK = LANGUAGE_NONE;
1523 LanguageType eCurLangCTL = LANGUAGE_NONE;
1524 SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current();
1525 //collect the configuration values first
1526 m_xCurrentDocCB->set_sensitive(false);
1527
1528 Any aWestLang;
1529 Any aCJKLang;
1530 Any aCTLLang;
1531 try
1532 {
1533 aWestLang = pLangConfig->aLinguConfig.GetProperty(u"DefaultLocale");
1534 Locale aLocale;
1535 aWestLang >>= aLocale;
1536
1537 eCurLang = LanguageTag::convertToLanguageType( aLocale, false);
1538
1539 aCJKLang = pLangConfig->aLinguConfig.GetProperty(u"DefaultLocale_CJK");
1540 aLocale = Locale();
1541 aCJKLang >>= aLocale;
1542 eCurLangCJK = LanguageTag::convertToLanguageType( aLocale, false);
1543
1544 aCTLLang = pLangConfig->aLinguConfig.GetProperty(u"DefaultLocale_CTL");
1545 aLocale = Locale();
1546 aCTLLang >>= aLocale;
1547 eCurLangCTL = LanguageTag::convertToLanguageType( aLocale, false);
1548 }
1549 catch (const Exception&)
1550 {
1551 }
1552 //overwrite them by the values provided by the DocShell
1553 if(pCurrentDocShell)
1554 {
1555 m_xCurrentDocCB->set_sensitive(true);
1557 if( const SvxLanguageItem* pLangItem = rSet->GetItemIfSet(SID_ATTR_LANGUAGE, false))
1558 {
1559 LanguageType eTempCurLang = pLangItem->GetValue();
1560 if (MsLangId::resolveSystemLanguageByScriptType(eCurLang, css::i18n::ScriptType::LATIN) != eTempCurLang)
1561 eCurLang = eTempCurLang;
1562 }
1563
1564 if( const SvxLanguageItem* pLang = rSet->GetItemIfSet(SID_ATTR_CHAR_CJK_LANGUAGE, false))
1565 {
1566 LanguageType eTempCurLang = pLang->GetValue();
1567 if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCJK, css::i18n::ScriptType::ASIAN) != eTempCurLang)
1568 eCurLangCJK = eTempCurLang;
1569 }
1570
1571 if( const SvxLanguageItem* pLang = rSet->GetItemIfSet(SID_ATTR_CHAR_CTL_LANGUAGE, false))
1572 {
1573 LanguageType eTempCurLang = pLang->GetValue();
1574 if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCTL, css::i18n::ScriptType::COMPLEX) != eTempCurLang)
1575 eCurLangCTL = eTempCurLang;
1576 }
1577 }
1578 if(LANGUAGE_NONE == eCurLang || LANGUAGE_DONTKNOW == eCurLang)
1579 m_xWesternLanguageLB->set_active_id(LANGUAGE_NONE);
1580 else
1581 m_xWesternLanguageLB->set_active_id(eCurLang);
1582
1583 if(LANGUAGE_NONE == eCurLangCJK || LANGUAGE_DONTKNOW == eCurLangCJK)
1584 m_xAsianLanguageLB->set_active_id(LANGUAGE_NONE);
1585 else
1586 m_xAsianLanguageLB->set_active_id(eCurLangCJK);
1587
1588 if(LANGUAGE_NONE == eCurLangCTL || LANGUAGE_DONTKNOW == eCurLangCTL)
1589 m_xComplexLanguageLB->set_active_id(LANGUAGE_NONE);
1590 else
1591 m_xComplexLanguageLB->set_active_id(eCurLangCTL);
1592
1593 m_xWesternLanguageLB->save_active_id();
1594 m_xAsianLanguageLB->save_active_id();
1595 m_xComplexLanguageLB->save_active_id();
1596 m_xIgnoreLanguageChangeCB->save_state();
1597 m_xCurrentDocCB->save_state();
1598
1599 bool bEnable = !pLangConfig->aLinguConfig.IsReadOnly( u"DefaultLocale" );
1600 m_xWesternLanguageFT->set_sensitive( bEnable );
1601 m_xWesternLanguageLB->set_sensitive( bEnable );
1602
1603 // check the box "For the current document only"
1604 // set the focus to the Western Language box
1605 const SfxBoolItem* pLang = rSet->GetItemIfSet(SID_SET_DOCUMENT_LANGUAGE, false );
1606 if ( pLang && pLang->GetValue() )
1607 {
1608 m_xWesternLanguageLB->grab_focus();
1609 m_xCurrentDocCB->set_sensitive(true);
1610 m_xCurrentDocCB->set_active(true);
1611 }
1612}
1613
1615{
1616 bool bCheck = rBox.get_active();
1617 if ( m_xAsianSupportCB.get() == &rBox )
1618 {
1619 bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly(u"DefaultLocale_CJK");
1620 bCheck = ( bCheck && !bReadonly );
1621 m_xAsianLanguageLB->set_sensitive( bCheck );
1622 if (rBox.get_sensitive())
1623 m_bOldAsian = bCheck;
1624 }
1625 else if ( m_xCTLSupportCB.get() == &rBox )
1626 {
1627 bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly(u"DefaultLocale_CTL");
1628 bCheck = ( bCheck && !bReadonly );
1629 m_xComplexLanguageLB->set_sensitive( bCheck );
1630 if (rBox.get_sensitive())
1631 m_bOldCtl = bCheck;
1632 }
1633 else
1634 SAL_WARN( "cui.options", "OfaLanguagesTabPage::SupportHdl(): wrong rBox" );
1635}
1636
1637namespace
1638{
1639 void lcl_checkLanguageCheckBox(weld::CheckButton& _rCB, bool _bNewValue, bool _bOldValue)
1640 {
1641 if ( _bNewValue )
1642 _rCB.set_active(true);
1643 else
1644 _rCB.set_active( _bOldValue );
1645// #i15082# do not call save_state() in running dialog...
1646// _rCB.save_state();
1647 _rCB.set_sensitive( !_bNewValue );
1648 }
1649}
1650
1652{
1653 LanguageType eLang = m_xLocaleSettingLB->get_active_id();
1655 // first check if CTL must be enabled
1656 // #103299# - if CTL font setting is not readonly
1657 if(!pLangConfig->aCTLLanguageOptions.IsReadOnly(SvtCTLOptions::E_CTLFONT))
1658 {
1659 bool bIsCTLFixed = bool(nType & SvtScriptType::COMPLEX);
1660 lcl_checkLanguageCheckBox(*m_xCTLSupportCB, bIsCTLFixed, m_bOldCtl);
1661 SupportHdl(*m_xCTLSupportCB);
1662 }
1663 // second check if CJK must be enabled
1664 // #103299# - if CJK support is not readonly
1666 {
1667 bool bIsCJKFixed = bool(nType & SvtScriptType::ASIAN);
1668 lcl_checkLanguageCheckBox(*m_xAsianSupportCB, bIsCJKFixed, m_bOldAsian);
1669 SupportHdl(*m_xAsianSupportCB);
1670 }
1671
1672 const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry(
1674 const OUString aDefaultID = "default";
1675 // Update the "Default ..." currency.
1676 m_xCurrencyLB->remove_id(aDefaultID);
1677 OUString aDefaultCurr = m_sSystemDefaultString + " - " + rCurr.GetBankSymbol();
1678 m_xCurrencyLB->insert(0, aDefaultCurr, &aDefaultID, nullptr, nullptr);
1679 assert(m_xCurrencyLB->find_id(aDefaultID) != -1);
1680 m_xCurrencyLB->set_active_text(aDefaultCurr);
1681
1682 // obtain corresponding locale data
1683 LocaleDataWrapper aLocaleWrapper(( LanguageTag(eLang) ));
1684
1685 // update the decimal separator key of the related CheckBox
1686 OUString sTempLabel(m_sDecimalSeparatorLabel);
1687 sTempLabel = sTempLabel.replaceFirst("%1", aLocaleWrapper.getNumDecimalSep() );
1688 m_xDecimalSeparatorCB->set_label(sTempLabel);
1689
1690 // update the date acceptance patterns
1691 OUString aDatePatternsString = lcl_getDatePatternsConfigString( aLocaleWrapper);
1692 m_bDatePatternsValid = true;
1693 m_xDatePatternsED->set_text( aDatePatternsString);
1694}
1695
1696IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
1697{
1698 const OUString aPatterns(rEd.get_text());
1699 OUStringBuffer aBuf( aPatterns);
1700 sal_Int32 nChar = 0;
1701 bool bValid = true;
1702 bool bModified = false;
1703 if (!aPatterns.isEmpty())
1704 {
1705 for (sal_Int32 nIndex=0; nIndex >= 0 && bValid; ++nChar)
1706 {
1707 const OUString aPat( aPatterns.getToken( 0, ';', nIndex));
1708 if (aPat.isEmpty() && nIndex < 0)
1709 {
1710 // Indicating failure when about to append a pattern is too
1711 // confusing. Empty patterns are ignored anyway when sequencing
1712 // to SvtSysLocale.
1713 continue; // for
1714 }
1715 else if (aPat.getLength() < 2)
1716 bValid = false;
1717 else
1718 {
1719 bool bY, bM, bD;
1720 bY = bM = bD = false;
1721 bool bSep = true;
1722 for (sal_Int32 i = 0; i < aPat.getLength() && bValid; /*nop*/)
1723 {
1724 const sal_Int32 j = i;
1725 const sal_uInt32 c = aPat.iterateCodePoints( &i);
1726 // Only one Y,M,D per pattern, separated by any character(s).
1727 switch (c)
1728 {
1729 case 'y':
1730 case 'Y':
1731 if (bY || !bSep)
1732 bValid = false;
1733 else if (c == 'y')
1734 {
1735 aBuf[nChar] = 'Y';
1736 bModified = true;
1737 }
1738 bY = true;
1739 bSep = false;
1740 break;
1741 case 'm':
1742 case 'M':
1743 if (bM || !bSep)
1744 bValid = false;
1745 else if (c == 'm')
1746 {
1747 aBuf[nChar] = 'M';
1748 bModified = true;
1749 }
1750 bM = true;
1751 bSep = false;
1752 break;
1753 case 'd':
1754 case 'D':
1755 if (bD || !bSep)
1756 bValid = false;
1757 else if (c == 'd')
1758 {
1759 aBuf[nChar] = 'D';
1760 bModified = true;
1761 }
1762 bD = true;
1763 bSep = false;
1764 break;
1765 default:
1766 // A pattern must not start with a separator (but
1767 // may end with).
1768 if (!(bY || bM || bD))
1769 bValid = false;
1770 bSep = true;
1771 }
1772 nChar += i-j;
1773 }
1774 // At least one of Y,M,D
1775 bValid &= (bY || bM || bD);
1776 }
1777 }
1778 }
1779 if (bModified)
1780 {
1781 // gtk3 keeps the cursor position on equal length set_text() but at
1782 // least the 'gen' backend does not and resets to 0.
1783 const int nCursorPos = rEd.get_position();
1784 rEd.set_text(aBuf.makeStringAndClear());
1785 rEd.set_position(nCursorPos);
1786 }
1787 if (bValid)
1788 rEd.set_message_type(weld::EntryMessageType::Normal);
1789 else
1790 rEd.set_message_type(weld::EntryMessageType::Error);
1791 m_bDatePatternsValid = bValid;
1792}
1793
1794/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SnapType
double d
const StyleSettings & GetStyleSettings() const
void SetStyleSettings(const StyleSettings &rSet)
static void MergeSystemSettings(AllSettings &rSettings)
static OUString GetToolkitName()
static bool hasNativeFileSelection()
static vcl::Window * GetNextTopLevelWindow(vcl::Window const *pWindow)
static const AllSettings & GetSettings()
static void SetSettings(const AllSettings &rSettings)
static vcl::Window * GetFirstTopLevelWindow()
void EnabledHardwareAcceleration(bool _bEnabled) const
Definition: optgdlg.cxx:495
bool mbHWAccelAvailable
Definition: optgdlg.cxx:371
bool IsHardwareAccelerationRO() const
Definition: optgdlg.cxx:484
bool IsHardwareAccelerationAvailable() const
Definition: optgdlg.cxx:430
std::vector< std::pair< OUString, Sequence< OUString > > > ServiceVector
Definition: optgdlg.cxx:367
Reference< XNameAccess > mxForceFlagNameAccess
Definition: optgdlg.cxx:369
ServiceVector maAvailableImplementations
Definition: optgdlg.cxx:370
bool mbHWAccelChecked
Definition: optgdlg.cxx:372
bool IsHardwareAccelerationEnabled() const
Definition: optgdlg.cxx:472
sal_uInt16 GetValue() const
virtual short run() override
LanguageType getLanguageType(bool bResolveSystem=true) const
bool isSystemLocale() const
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
LanguageTag & makeFallback()
static OUString convertToBcp47(LanguageType nLangID)
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
static LanguageType convertToLanguageTypeWithFallback(const OUString &rBcp47)
static css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguPropertySet()
const css::uno::Sequence< OUString > & getDateAcceptancePatterns() const
const OUString & getNumDecimalSep() const
static bool needsSequenceChecking(LanguageType nLang)
static LanguageType resolveSystemLanguageByScriptType(LanguageType nLang, sal_Int16 nType)
static LanguageType getConfiguredSystemLanguage()
size_t size() const
std::unique_ptr< weld::CheckButton > m_xCurrentDocCB
Definition: optgdlg.hxx:162
std::unique_ptr< weld::ComboBox > m_xUserInterfaceLB
Definition: optgdlg.hxx:149
std::unique_ptr< weld::CheckButton > m_xDecimalSeparatorCB
Definition: optgdlg.hxx:152
OUString m_sSystemDefaultString
Definition: optgdlg.hxx:144
std::unique_ptr< weld::Label > m_xLocaleSettingFT
Definition: optgdlg.hxx:150
std::unique_ptr< SvxLanguageBox > m_xLocaleSettingLB
Definition: optgdlg.hxx:151
OUString m_sDecimalSeparatorLabel
Definition: optgdlg.hxx:145
std::unique_ptr< SvxLanguageBox > m_xAsianLanguageLB
Definition: optgdlg.hxx:160
std::unique_ptr< weld::CheckButton > m_xCTLSupportCB
Definition: optgdlg.hxx:164
std::unique_ptr< weld::CheckButton > m_xAsianSupportCB
Definition: optgdlg.hxx:163
std::unique_ptr< weld::Label > m_xDatePatternsFT
Definition: optgdlg.hxx:155
std::unique_ptr< weld::Label > m_xWesternLanguageFT
Definition: optgdlg.hxx:159
std::unique_ptr< weld::Entry > m_xDatePatternsED
Definition: optgdlg.hxx:156
OUString m_sUserLocaleValue
Definition: optgdlg.hxx:143
std::unique_ptr< weld::CheckButton > m_xIgnoreLanguageChangeCB
Definition: optgdlg.hxx:165
std::unique_ptr< LanguageConfig_Impl > pLangConfig
Definition: optgdlg.hxx:141
virtual ~OfaLanguagesTabPage() override
Definition: optgdlg.cxx:1200
std::unique_ptr< SvxLanguageBox > m_xComplexLanguageLB
Definition: optgdlg.hxx:161
std::unique_ptr< weld::Label > m_xCurrencyFT
Definition: optgdlg.hxx:153
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optgdlg.cxx:1204
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: optgdlg.cxx:1227
std::unique_ptr< SvxLanguageBox > m_xWesternLanguageLB
Definition: optgdlg.hxx:158
OfaLanguagesTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: optgdlg.cxx:1030
std::unique_ptr< weld::ComboBox > m_xCurrencyLB
Definition: optgdlg.hxx:154
virtual void Reset(const SfxItemSet *rSet) override
Definition: optgdlg.cxx:1465
std::unique_ptr< weld::Widget > m_xQuickStarterFrame
Definition: optgdlg.hxx:47
std::unique_ptr< weld::CheckButton > m_xFileDlgCB
Definition: optgdlg.hxx:40
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optgdlg.cxx:213
OUString m_aStrDateInfo
Definition: optgdlg.hxx:33
std::unique_ptr< weld::CheckButton > m_xExtHelpCB
Definition: optgdlg.hxx:35
std::unique_ptr< weld::CheckButton > m_xDocStatusCB
Definition: optgdlg.hxx:42
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: optgdlg.cxx:102
std::unique_ptr< weld::CheckButton > m_xQuickLaunchCB
Definition: optgdlg.hxx:49
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: optgdlg.cxx:218
std::unique_ptr< weld::Widget > m_xYearFrame
Definition: optgdlg.hxx:43
std::unique_ptr< weld::Widget > m_xFileDlgFrame
Definition: optgdlg.hxx:38
std::unique_ptr< weld::CheckButton > m_xPopUpNoHelpCB
Definition: optgdlg.hxx:36
std::unique_ptr< weld::SpinButton > m_xYearValueField
Definition: optgdlg.hxx:44
std::unique_ptr< weld::Label > m_xHelpImproveLabel
Definition: optgdlg.hxx:48
virtual ~OfaMiscTabPage() override
Definition: optgdlg.cxx:209
std::unique_ptr< weld::CheckButton > m_xCrashReport
Definition: optgdlg.hxx:46
std::unique_ptr< weld::CheckButton > m_xShowTipOfTheDay
Definition: optgdlg.hxx:37
OfaMiscTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: optgdlg.cxx:154
std::unique_ptr< weld::Widget > m_xFileDlgROImage
Definition: optgdlg.hxx:39
virtual void Reset(const SfxItemSet *rSet) override
Definition: optgdlg.cxx:283
std::unique_ptr< weld::Label > m_xToYearFT
Definition: optgdlg.hxx:45
std::unique_ptr< weld::CheckButton > m_xForceSkiaRaster
Definition: optgdlg.hxx:107
std::unique_ptr< weld::ComboBox > m_xSidebarIconSizeLB
Definition: optgdlg.hxx:89
sal_Int32 nStyleLB_InitialSelection
Definition: optgdlg.hxx:81
void UpdateHardwareAccelStatus()
Definition: optgdlg.cxx:969
std::unique_ptr< weld::MetricSpinButton > m_xAAPointLimit
Definition: optgdlg.hxx:95
std::unique_ptr< SvtTabAppearanceCfg > pAppearanceCfg
Definition: optgdlg.hxx:83
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
Definition: optgdlg.cxx:663
std::unique_ptr< weld::ComboBox > m_xIconStyleLB
Definition: optgdlg.hxx:91
void HideSkiaWidgets()
Definition: optgdlg.cxx:617
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: optgdlg.cxx:668
void UpdateSkiaStatus()
Definition: optgdlg.cxx:625
std::unique_ptr< weld::ComboBox > m_xNotebookbarIconSizeLB
Definition: optgdlg.hxx:90
std::unique_ptr< weld::Label > m_xSkiaStatusDisabled
Definition: optgdlg.hxx:110
std::unique_ptr< weld::Widget > m_xMenuIconBox
Definition: optgdlg.hxx:97
std::unique_ptr< weld::ComboBox > m_xMousePosLB
Definition: optgdlg.hxx:112
std::unique_ptr< weld::ComboBox > m_xMenuIconsLB
Definition: optgdlg.hxx:98
std::unique_ptr< weld::CheckButton > m_xUseAntiAliase
Definition: optgdlg.hxx:105
std::unique_ptr< weld::Label > m_xSkiaStatusEnabled
Definition: optgdlg.hxx:109
std::unique_ptr< weld::CheckButton > m_xFontShowCB
Definition: optgdlg.hxx:102
std::unique_ptr< weld::Button > m_xRunGPTests
Definition: optgdlg.hxx:115
std::unique_ptr< weld::ComboBox > m_xContextMenuShortcutsLB
Definition: optgdlg.hxx:100
sal_Int32 nNotebookbarSizeLB_InitialSelection
Definition: optgdlg.hxx:80
std::unique_ptr< CanvasSettings > pCanvasSettings
Definition: optgdlg.hxx:84
OfaViewTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: optgdlg.cxx:521
std::unique_ptr< weld::CheckButton > m_xUseSkia
Definition: optgdlg.hxx:106
std::unique_ptr< weld::ComboBox > m_xIconSizeLB
Definition: optgdlg.hxx:88
virtual void Reset(const SfxItemSet *rSet) override
Definition: optgdlg.cxx:868
std::unique_ptr< weld::CheckButton > m_xUseHardwareAccell
Definition: optgdlg.hxx:104
std::unique_ptr< weld::Button > m_xMoreIcons
Definition: optgdlg.hxx:114
std::unique_ptr< weld::CheckButton > m_xFontAntiAliasing
Definition: optgdlg.hxx:93
sal_Int32 nSidebarSizeLB_InitialSelection
Definition: optgdlg.hxx:79
std::unique_ptr< weld::ComboBox > m_xMouseMiddleLB
Definition: optgdlg.hxx:113
std::vector< vcl::IconThemeInfo > mInstalledIconThemes
Definition: optgdlg.hxx:86
sal_Int32 nSizeLB_InitialSelection
Definition: optgdlg.hxx:78
virtual ~OfaViewTabPage() override
Definition: optgdlg.cxx:587
void SetState(const SfxItemSet &rSet)
void InvalidateAll(bool bWithMsg)
bool GetValue() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static SfxObjectShell * Current()
SfxOkDialogController * GetDialogController() const
void SetExchangeSupport()
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
weld::Window * GetFrameWeld() const
static SfxViewFrame * Current()
SfxBindings & GetBindings()
static SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
std::vector< vcl::IconThemeInfo > const & GetInstalledIconThemes() const
OUString GetAutomaticallyChosenIconTheme() const
static const NfCurrencyTable & GetTheCurrencyTable()
static const NfCurrencyEntry & GetCurrencyEntry(LanguageType)
void SetDefault(SvtCompatibilityEntry::Index rIdx, bool rValue)
static OUString GetLanguageString(const LanguageType eType)
bool IconThemeWasSetAutomatically() const
sal_Int16 GetSymbolsSize() const
void SetIconTheme(const OUString &)
OUString GetIconTheme() const
void SetSymbolsSize(sal_Int16 eSet)
void SetIgnoreKashida_CTL(bool bVal)
void SetIgnoreDiacritics_CTL(bool bVal)
void GetCurrencyAbbrevAndLanguage(OUString &rAbbrev, LanguageType &eLang) const
static OUString CreateCurrencyConfigString(const OUString &rAbbrev, LanguageType eLang)
static std::shared_ptr< ConfigurationChanges > create()
static const vcl::IconThemeInfo & FindIconThemeById(const std::vector< vcl::IconThemeInfo > &themes, const OUString &themeId)
const OUString & GetDisplayName() const
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual void set_active(bool active)=0
virtual void set_sensitive(bool sensitive)=0
int nCount
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual tools::Long GetValue() const override
float v
float u
Reference< XSingleServiceFactory > xFactory
FieldUnit
TriState
TRISTATE_FALSE
TRISTATE_INDET
TRISTATE_TRUE
SFX_SYMBOLS_SIZE_SMALL
SFX_SYMBOLS_SIZE_32
SFX_SYMBOLS_SIZE_LARGE
SFX_SYMBOLS_SIZE_AUTO
sal_Int32 nIndex
#define LANGUAGE_SYSTEM
#define LANGUAGE_NONE
#define LANGUAGE_USER_SYSTEM_CONFIG
#define LANGUAGE_DONTKNOW
OUString SVT_DLLPUBLIC getInstalledLocaleForSystemUILanguage(css::uno::Sequence< OUString > const &installed, bool bRequestInstallIfMissing, const OUString &rPreferredLocale=OUString())
SVT_DLLPUBLIC OUString ApplyLreOrRleEmbedding(const OUString &rText)
SvtScriptType
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
aStr
aBuf
VCL_DLLPUBLIC bool isVCLSkiaEnabled()
bool IsReadOnly(EOption eOption)
void SetAll(bool bSet)
bool IsAnyEnabled()
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
void SetAntiAliasing(bool bOn, bool bTemporary)
@ Exception
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
bool dispatchCommand(const OUString &rCommand, const uno::Reference< css::frame::XFrame > &rFrame, const css::uno::Sequence< css::beans::PropertyValue > &rArguments, const uno::Reference< css::frame::XDispatchResultListener > &rListener)
Reference< XMultiServiceFactory > getProcessServiceFactory()
Reference< XComponentContext > getProcessComponentContext()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
int i
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
RESTART_REASON_LANGUAGE_CHANGE
RESTART_REASON_SKIA
SVT_DLLPUBLIC bool executeRestartDialog(css::uno::Reference< css::uno::XComponentContext > const &context, weld::Window *parent, RestartReason reason)
VCL_DLLPUBLIC void LaunchRegistrationUI()
OUString toId(const void *pValue)
Reference< XNameAccess > m_xContainer
IMPL_LINK_NOARG(OfaMiscTabPage, TwoFigureHdl, weld::SpinButton &, void)
Definition: optgdlg.cxx:334
constexpr OUStringLiteral sAccessUpdSrvc
Definition: optgdlg.cxx:998
constexpr OUStringLiteral sUserLocalePath
Definition: optgdlg.cxx:1000
IMPL_LINK(OfaLanguagesTabPage, SupportHdl, weld::Toggleable &, rBox, void)
Definition: optgdlg.cxx:1614
static OUString lcl_getDatePatternsConfigString(const LocaleDataWrapper &rLocaleWrapper)
Definition: optgdlg.cxx:1004
static bool DisplayNameCompareLessThan(const vcl::IconThemeInfo &rInfo1, const vcl::IconThemeInfo &rInfo2)
Definition: optgdlg.cxx:516
static void lcl_Update(std::unique_ptr< SfxVoidItem > pInvalidItems[], std::unique_ptr< SfxBoolItem > pBoolItems[], sal_uInt16 nCount)
Definition: optgdlg.cxx:1209
constexpr OUStringLiteral sInstalledLocalesPath
Definition: optgdlg.cxx:999
constexpr OUStringLiteral sUserLocaleKey
Definition: optgdlg.cxx:1001
static Sequence< OUString > seqInstalledLanguages
Definition: optgdlg.cxx:1002
IMPL_STATIC_LINK_NOARG(OfaViewTabPage, OnMoreIconsClick, weld::Button &, void)
Definition: optgdlg.cxx:597
static bool bLanguageCurrentDoc_Impl
Definition: optgdlg.cxx:994
constexpr OUStringLiteral sAccessSrvc
Definition: optgdlg.cxx:997
SfxItemState
QPRO_FUNC_TYPE nType
MouseMiddleButtonAction
static SfxItemSet & rSet
SvtCTLOptions aCTLLanguageOptions
Definition: optgdlg.cxx:989
SvtLinguConfig aLinguConfig
Definition: optgdlg.cxx:991
SvtSysLocaleOptions aSysLocaleOptions
Definition: optgdlg.cxx:990
VCL_DLLPUBLIC Application * GetpApp()
DeactivateRC
OUString sId
ToolBoxButtonSize
RET_OK