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