summaryrefslogtreecommitdiff
path: root/cui/source/options/optgdlg.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/options/optgdlg.cxx')
-rw-r--r--cui/source/options/optgdlg.cxx598
1 files changed, 399 insertions, 199 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 30b98e8de55f..1b8e6f58fde7 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
@@ -38,6 +38,7 @@
#include <unotools/syslocaleoptions.hxx>
#include <sfx2/objsh.hxx>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <svtools/langtab.hxx>
#include <editeng/unolingu.hxx>
#include <editeng/langitem.hxx>
@@ -47,13 +48,14 @@
#include <editeng/editids.hrc>
#include <svx/svxids.hrc>
#include <svl/intitem.hxx>
+#include <svl/voiditem.hxx>
#include <GraphicsTestsDialog.hxx>
#include <unotools/searchopt.hxx>
#include <sal/log.hxx>
#include <officecfg/Office/Common.hxx>
#include <officecfg/Setup.hxx>
#include <comphelper/configuration.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#if HAVE_FEATURE_BREAKPAD
#include <desktop/crashreport.hxx>
#endif
@@ -80,13 +82,18 @@
#include <vcl/window.hxx>
#include <vcl/IconThemeInfo.hxx>
#include <vcl/skia/SkiaHelper.hxx>
+#include <bitmaps.hlst>
+
#include "optgdlg.hxx"
#include <svtools/apearcfg.hxx>
#include <svtools/optionsdrawinglayer.hxx>
#include <svtools/restartdialog.hxx>
#include <svtools/imgdef.hxx>
+#include <com/sun/star/datatransfer/clipboard/SystemClipboard.hpp>
+#include <vcl/unohelp2.hxx>
#if defined(_WIN32)
+#include <systools/win32/winstoreutil.hxx>
#include <vcl/fileregistration.hxx>
#endif
using namespace ::com::sun::star::uno;
@@ -153,48 +160,46 @@ bool lcl_HasSystemFilePicker()
OfaMiscTabPage::OfaMiscTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/optgeneralpage.ui", "OptGeneralPage", &rSet)
, m_xExtHelpCB(m_xBuilder->weld_check_button("exthelp"))
+ , m_xExtHelpImg(m_xBuilder->weld_widget("lockexthelp"))
, m_xPopUpNoHelpCB(m_xBuilder->weld_check_button("popupnohelp"))
+ , m_xPopUpNoHelpImg(m_xBuilder->weld_widget("lockpopupnohelp"))
, m_xShowTipOfTheDay(m_xBuilder->weld_check_button("cbShowTipOfTheDay"))
+ , m_xShowTipOfTheDayImg(m_xBuilder->weld_widget("lockcbShowTipOfTheDay"))
, m_xFileDlgFrame(m_xBuilder->weld_widget("filedlgframe"))
, m_xFileDlgROImage(m_xBuilder->weld_widget("lockimage"))
, m_xFileDlgCB(m_xBuilder->weld_check_button("filedlg"))
- , m_xPrintDlgCB(m_xBuilder->weld_check_button("printdlg"))
, m_xDocStatusCB(m_xBuilder->weld_check_button("docstatus"))
+ , m_xDocStatusImg(m_xBuilder->weld_widget("lockdocstatus"))
, m_xYearFrame(m_xBuilder->weld_widget("yearframe"))
+ , m_xYearLabel(m_xBuilder->weld_label("yearslabel"))
, m_xYearValueField(m_xBuilder->weld_spin_button("year"))
, m_xToYearFT(m_xBuilder->weld_label("toyear"))
+ , m_xYearFrameImg(m_xBuilder->weld_widget("lockyears"))
+#if HAVE_FEATURE_BREAKPAD
+ , m_xPrivacyFrame(m_xBuilder->weld_widget("privacyframe"))
, m_xCrashReport(m_xBuilder->weld_check_button("crashreport"))
- , m_xQuickStarterFrame(m_xBuilder->weld_widget("quickstarter"))
- , m_xHelpImproveLabel(m_xBuilder->weld_label("label7")) //"Help Improve"
-#if defined(UNX)
- , m_xQuickLaunchCB(m_xBuilder->weld_check_button("systray"))
-#else
- , m_xQuickLaunchCB(m_xBuilder->weld_check_button("quicklaunch"))
+ , m_xCrashReportImg(m_xBuilder->weld_widget("lockcrashreport"))
#endif
#if defined(_WIN32)
+ , m_xQuickStarterFrame(m_xBuilder->weld_widget("quickstarter"))
+ , m_xQuickLaunchCB(m_xBuilder->weld_check_button("quicklaunch"))
+ , m_xQuickLaunchImg(m_xBuilder->weld_widget("lockquicklaunch"))
, m_xFileAssocFrame(m_xBuilder->weld_widget("fileassoc"))
, m_xFileAssocBtn(m_xBuilder->weld_button("assocfiles"))
, m_xPerformFileExtCheck(m_xBuilder->weld_check_button("cbPerformFileExtCheck"))
+ , m_xPerformFileExtImg(m_xBuilder->weld_widget("lockcbPerformFileExtCheck"))
#endif
{
- if (!lcl_HasSystemFilePicker())
- m_xFileDlgFrame->hide();
- else if (officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly())
- {
- m_xFileDlgROImage->show();
- m_xFileDlgCB->set_sensitive(false);
- }
-
- m_xQuickLaunchCB->show();
-
- //Only available in Win or if building the gtk systray
-#if !defined(_WIN32)
- m_xQuickStarterFrame->hide();
- //Hide frame label in case of no content
- m_xHelpImproveLabel->hide();
+#if HAVE_FEATURE_BREAKPAD
+ m_xPrivacyFrame->show();
#endif
#if defined(_WIN32)
+ // Store-packaged apps (located under the protected Program Files\WindowsApps) can't use normal
+ // shell shortcuts to their exe. TODO: show a button to open "Startup Apps" system applet?
+ if (!sal::systools::IsStorePackagedApp())
+ m_xQuickStarterFrame->show();
+
m_xFileAssocFrame->show();
m_xFileAssocBtn->connect_clicked(LINK(this, OfaMiscTabPage, FileAssocClick));
#endif
@@ -214,6 +219,34 @@ std::unique_ptr<SfxTabPage> OfaMiscTabPage::Create( weld::Container* pPage, weld
return std::make_unique<OfaMiscTabPage>( pPage, pController, *rAttrSet );
}
+OUString OfaMiscTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label1", "label2", "label4", "label5", "yearslabel",
+ "toyear", "label7", "label8", "label9" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[]
+ = { "exthelp", "popupnohelp", "cbShowTipOfTheDay", "filedlg",
+ "docstatus", "crashreport", "quicklaunch", "cbPerformFileExtCheck" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ if (const auto& pString = m_xBuilder->weld_button("assocfiles"))
+ sAllStrings += pString->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
{
bool bModified = false;
@@ -243,7 +276,7 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
bModified = true;
}
- const SfxUInt16Item* pUInt16Item = dynamic_cast< const SfxUInt16Item* >( GetOldItem( *rSet, SID_ATTR_YEAR2000 ) );
+ const SfxUInt16Item* pUInt16Item = GetOldItem( *rSet, SID_ATTR_YEAR2000 );
sal_uInt16 nNum = static_cast<sal_uInt16>(m_xYearValueField->get_text().toInt32());
if ( pUInt16Item && pUInt16Item->GetValue() != nNum )
{
@@ -266,38 +299,66 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
m_xPerformFileExtCheck->get_active(), batch);
bModified = true;
}
-#endif
-
- batch->commit();
if( m_xQuickLaunchCB->get_state_changed_from_saved())
{
rSet->Put(SfxBoolItem(SID_ATTR_QUICKLAUNCHER, m_xQuickLaunchCB->get_active()));
bModified = true;
}
+#endif
+
+ batch->commit();
return bModified;
}
void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
{
+ bool bEnable = !officecfg::Office::Common::Help::ExtendedTip::isReadOnly();
m_xExtHelpCB->set_active( officecfg::Office::Common::Help::Tip::get() &&
officecfg::Office::Common::Help::ExtendedTip::get() );
+ m_xExtHelpCB->set_sensitive(bEnable);
+ m_xExtHelpImg->set_visible(!bEnable);
m_xExtHelpCB->save_state();
+
+ bEnable = !officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::isReadOnly();
m_xPopUpNoHelpCB->set_active( officecfg::Office::Common::Help::BuiltInHelpNotInstalledPopUp::get() );
+ m_xPopUpNoHelpCB->set_sensitive(bEnable);
+ m_xPopUpNoHelpImg->set_visible(!bEnable);
m_xPopUpNoHelpCB->save_state();
+
+ bEnable = !officecfg::Office::Common::Misc::ShowTipOfTheDay::isReadOnly();
m_xShowTipOfTheDay->set_active( officecfg::Office::Common::Misc::ShowTipOfTheDay::get() );
+ m_xShowTipOfTheDay->set_sensitive(bEnable);
+ m_xShowTipOfTheDayImg->set_visible(!bEnable);
m_xShowTipOfTheDay->save_state();
- m_xFileDlgCB->set_active( !officecfg::Office::Common::Misc::UseSystemFileDialog::get() );
+
+ if (!lcl_HasSystemFilePicker())
+ m_xFileDlgFrame->hide();
+ else
+ {
+ bEnable = !officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly();
+ m_xFileDlgCB->set_sensitive(bEnable);
+ m_xFileDlgROImage->set_visible(!bEnable);
+ }
+ m_xFileDlgCB->set_active(!officecfg::Office::Common::Misc::UseSystemFileDialog::get());
m_xFileDlgCB->save_state();
+ bEnable = !officecfg::Office::Common::Print::PrintingModifiesDocument::isReadOnly();
m_xDocStatusCB->set_active(officecfg::Office::Common::Print::PrintingModifiesDocument::get());
+ m_xDocStatusCB->set_sensitive(bEnable);
+ m_xDocStatusImg->set_visible(!bEnable);
m_xDocStatusCB->save_state();
- const SfxPoolItem* pItem = nullptr;
- if ( SfxItemState::SET == rSet->GetItemState( SID_ATTR_YEAR2000, false, &pItem ) )
+ bEnable = !officecfg::Office::Common::DateFormat::TwoDigitYear::isReadOnly();
+ m_xYearLabel->set_sensitive(bEnable);
+ m_xYearValueField->set_sensitive(bEnable);
+ m_xToYearFT->set_sensitive(bEnable);
+ m_xYearFrameImg->set_visible(!bEnable);
+
+ if ( const SfxUInt16Item* pYearItem = rSet->GetItemIfSet( SID_ATTR_YEAR2000, false ) )
{
- m_xYearValueField->set_value( static_cast<const SfxUInt16Item*>(pItem)->GetValue() );
+ m_xYearValueField->set_value( pYearItem->GetValue() );
TwoFigureHdl(*m_xYearValueField);
}
else
@@ -306,11 +367,12 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
#if HAVE_FEATURE_BREAKPAD
m_xCrashReport->set_active(officecfg::Office::Common::Misc::CrashReport::get() && CrashReporter::IsDumpEnable());
m_xCrashReport->set_sensitive(!officecfg::Office::Common::Misc::CrashReport::isReadOnly() && CrashReporter::IsDumpEnable());
+ m_xCrashReportImg->set_visible(officecfg::Office::Common::Misc::CrashReport::isReadOnly() && CrashReporter::IsDumpEnable());
m_xCrashReport->save_state();
-#else
- m_xCrashReport->hide();
#endif
+#if defined(_WIN32)
+ const SfxPoolItem* pItem = nullptr;
SfxItemState eState = rSet->GetItemState( SID_ATTR_QUICKLAUNCHER, false, &pItem );
if ( SfxItemState::SET == eState )
m_xQuickLaunchCB->set_active( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
@@ -322,10 +384,11 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
m_xQuickLaunchCB->save_state();
-#if defined(_WIN32)
m_xPerformFileExtCheck->set_active(
officecfg::Office::Common::Misc::PerformFileExtCheck::get());
m_xPerformFileExtCheck->save_state();
+ m_xPerformFileExtCheck->set_sensitive(!officecfg::Office::Common::Misc::PerformFileExtCheck::isReadOnly());
+ m_xPerformFileExtImg->set_visible(officecfg::Office::Common::Misc::PerformFileExtCheck::isReadOnly());
#endif
}
@@ -522,39 +585,69 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
, nSidebarSizeLB_InitialSelection(0)
, nNotebookbarSizeLB_InitialSelection(0)
, nStyleLB_InitialSelection(0)
- , pAppearanceCfg(new SvtTabAppearanceCfg)
, pCanvasSettings(new CanvasSettings)
+ , m_xIconSizeLabel(m_xBuilder->weld_label("label14"))
, m_xIconSizeLB(m_xBuilder->weld_combo_box("iconsize"))
+ , m_xIconSizeImg(m_xBuilder->weld_widget("lockiconsize"))
+ , m_xSidebarIconSizeLabel(m_xBuilder->weld_label("label9"))
, m_xSidebarIconSizeLB(m_xBuilder->weld_combo_box("sidebariconsize"))
+ , m_xSidebarIconSizeImg(m_xBuilder->weld_widget("locksidebariconsize"))
+ , m_xNotebookbarIconSizeLabel(m_xBuilder->weld_label("label8"))
, m_xNotebookbarIconSizeLB(m_xBuilder->weld_combo_box("notebookbariconsize"))
+ , m_xNotebookbarIconSizeImg(m_xBuilder->weld_widget("locknotebookbariconsize"))
+ , m_xDarkModeFrame(m_xBuilder->weld_widget("darkmode"))
+ , m_xAppearanceStyleLabel(m_xBuilder->weld_label("label7"))
+ , m_xAppearanceStyleLB(m_xBuilder->weld_combo_box("appearance"))
+ , m_xAppearanceStyleImg(m_xBuilder->weld_widget("lockappearance"))
+ , m_xIconStyleLabel(m_xBuilder->weld_label("label6"))
, m_xIconStyleLB(m_xBuilder->weld_combo_box("iconstyle"))
+ , m_xIconStyleImg(m_xBuilder->weld_widget("lockiconstyle"))
, m_xFontAntiAliasing(m_xBuilder->weld_check_button("aafont"))
+ , m_xFontAntiAliasingImg(m_xBuilder->weld_widget("lockaafont"))
, m_xAAPointLimitLabel(m_xBuilder->weld_label("aafrom"))
+ , m_xAAPointLimitLabelImg(m_xBuilder->weld_widget("lockaafrom"))
, m_xAAPointLimit(m_xBuilder->weld_metric_spin_button("aanf", FieldUnit::PIXEL))
- , m_xMenuIconBox(m_xBuilder->weld_widget("menuiconsbox"))
- , m_xMenuIconsLB(m_xBuilder->weld_combo_box("menuicons"))
- , m_xContextMenuShortcutsLB(m_xBuilder->weld_combo_box("contextmenushortcuts"))
, m_xFontShowCB(m_xBuilder->weld_check_button("showfontpreview"))
+ , m_xFontShowImg(m_xBuilder->weld_widget("lockshowfontpreview"))
, m_xUseHardwareAccell(m_xBuilder->weld_check_button("useaccel"))
+ , m_xUseHardwareAccellImg(m_xBuilder->weld_widget("lockuseaccel"))
, m_xUseAntiAliase(m_xBuilder->weld_check_button("useaa"))
+ , m_xUseAntiAliaseImg(m_xBuilder->weld_widget("lockuseaa"))
, m_xUseSkia(m_xBuilder->weld_check_button("useskia"))
+ , m_xUseSkiaImg(m_xBuilder->weld_widget("lockuseskia"))
, m_xForceSkiaRaster(m_xBuilder->weld_check_button("forceskiaraster"))
+ , m_xForceSkiaRasterImg(m_xBuilder->weld_widget("lockforceskiaraster"))
, m_xSkiaStatusEnabled(m_xBuilder->weld_label("skiaenabled"))
, m_xSkiaStatusDisabled(m_xBuilder->weld_label("skiadisabled"))
- , m_xMousePosLB(m_xBuilder->weld_combo_box("mousepos"))
+ , m_xSkiaLog(m_xBuilder->weld_button("btnSkialog"))
+ , m_xMouseMiddleLabel(m_xBuilder->weld_label("label12"))
, m_xMouseMiddleLB(m_xBuilder->weld_combo_box("mousemiddle"))
+ , m_xMouseMiddleImg(m_xBuilder->weld_widget("lockmousemiddle"))
, m_xMoreIcons(m_xBuilder->weld_button("btnMoreIcons"))
, m_xRunGPTests(m_xBuilder->weld_button("btn_rungptest"))
+ , m_sAutoStr(m_xIconStyleLB->get_text(0))
{
- if (Application::GetToolkitName().startsWith("gtk"))
- m_xMenuIconBox->hide();
+ OUString sToolKitName(Application::GetToolkitName());
+ const bool bHasDarkMode = sToolKitName.startsWith("gtk") || sToolKitName == "osx" || sToolKitName == "win";
+ if (!bHasDarkMode)
+ m_xDarkModeFrame->hide();
m_xFontAntiAliasing->connect_toggled( LINK( this, OfaViewTabPage, OnAntialiasingToggled ) );
m_xUseSkia->connect_toggled(LINK(this, OfaViewTabPage, OnUseSkiaToggled));
+ m_xSkiaLog->connect_clicked(LINK(this, OfaViewTabPage, OnCopySkiaLog));
+ UpdateIconThemes();
+
+ m_xIconStyleLB->set_active(0);
+
+ m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
+ m_xRunGPTests->connect_clicked( LINK( this, OfaViewTabPage, OnRunGPTestClick));
+}
+
+void OfaViewTabPage::UpdateIconThemes()
+{
// Set known icon themes
- OUString sAutoStr( m_xIconStyleLB->get_text( 0 ) );
m_xIconStyleLB->clear();
StyleSettings aStyleSettings = Application::GetSettings().GetStyleSettings();
mInstalledIconThemes = aStyleSettings.GetInstalledIconThemes();
@@ -564,9 +657,7 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
OUString autoThemeId = aStyleSettings.GetAutomaticallyChosenIconTheme();
const vcl::IconThemeInfo& autoIconTheme = vcl::IconThemeInfo::FindIconThemeById(mInstalledIconThemes, autoThemeId);
- OUString entryForAuto = sAutoStr + " (" +
- autoIconTheme.GetDisplayName() +
- ")";
+ OUString entryForAuto = m_sAutoStr + " (" + autoIconTheme.GetDisplayName() + ")";
m_xIconStyleLB->append("auto", entryForAuto); // index 0 means choose style automatically
// separate auto and other icon themes
@@ -574,12 +665,6 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, weld::DialogController* p
for (auto const& installIconTheme : mInstalledIconThemes)
m_xIconStyleLB->append(installIconTheme.GetThemeId(), installIconTheme.GetDisplayName());
-
- m_xIconStyleLB->set_active(0);
-
- m_xMoreIcons->set_from_icon_name("cmd/sc_additionsdialog.png");
- m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, OnMoreIconsClick));
- m_xRunGPTests->connect_clicked( LINK( this, OfaViewTabPage, OnRunGPTestClick));
}
OfaViewTabPage::~OfaViewTabPage()
@@ -594,15 +679,14 @@ IMPL_LINK_NOARG(OfaViewTabPage, OnRunGPTestClick, weld::Button&, void)
IMPL_STATIC_LINK_NOARG(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void)
{
- css::uno::Sequence<css::beans::PropertyValue> aArgs(1);
- aArgs[0].Name = "AdditionsTag";
- aArgs[0].Value <<= OUString("Icons");
+ css::uno::Sequence<css::beans::PropertyValue> aArgs{ comphelper::makePropertyValue(
+ "AdditionsTag", OUString("Icons")) };
comphelper::dispatchCommand(".uno:AdditionsDialog", aArgs);
}
IMPL_LINK_NOARG( OfaViewTabPage, OnAntialiasingToggled, weld::Toggleable&, void )
{
- bool bAAEnabled = m_xFontAntiAliasing->get_active();
+ bool bAAEnabled = m_xFontAntiAliasing->get_active() && !officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::isReadOnly();
m_xAAPointLimitLabel->set_sensitive(bAAEnabled);
m_xAAPointLimit->set_sensitive(bAAEnabled);
@@ -613,12 +697,25 @@ IMPL_LINK_NOARG(OfaViewTabPage, OnUseSkiaToggled, weld::Toggleable&, void)
UpdateSkiaStatus();
}
+IMPL_LINK_NOARG(OfaViewTabPage, OnCopySkiaLog, weld::Button&, void)
+{
+#if HAVE_FEATURE_SKIA
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard =
+ css::datatransfer::clipboard::SystemClipboard::create(
+ comphelper::getProcessComponentContext());
+ OUString sInfo = SkiaHelper::readLog();
+ vcl::unohelper::TextDataObject::CopyStringTo(sInfo, xClipboard);
+ m_xSkiaLog->set_from_icon_name(RID_SVXBMP_COPY);
+#endif
+}
+
void OfaViewTabPage::HideSkiaWidgets()
{
m_xUseSkia->hide();
m_xForceSkiaRaster->hide();
m_xSkiaStatusEnabled->hide();
m_xSkiaStatusDisabled->hide();
+ m_xSkiaLog->hide();
}
void OfaViewTabPage::UpdateSkiaStatus()
@@ -647,9 +744,11 @@ void OfaViewTabPage::UpdateSkiaStatus()
m_xSkiaStatusEnabled->set_visible(bEnabled);
m_xSkiaStatusDisabled->set_visible(!bEnabled);
- // FIXME: should really add code to show a 'lock' icon here.
m_xUseSkia->set_sensitive(!officecfg::Office::Common::VCL::UseSkia::isReadOnly());
+ m_xUseSkiaImg->set_visible(officecfg::Office::Common::VCL::UseSkia::isReadOnly());
m_xForceSkiaRaster->set_sensitive(m_xUseSkia->get_active() && !officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
+ m_xForceSkiaRasterImg->set_visible(officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
+ m_xSkiaLog->set_sensitive(bEnabled);
// Technically the 'use hardware acceleration' option could be used to mean !forceSkiaRaster, but the implementation
// of the option is so tied to the implementation of the canvas module that it's simpler to ignore it.
@@ -664,10 +763,37 @@ std::unique_ptr<SfxTabPage> OfaViewTabPage::Create( weld::Container* pPage, weld
return std::make_unique<OfaViewTabPage>(pPage, pController, *rAttrSet);
}
+OUString OfaViewTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[] = { "label16", "label7", "label1", "label6", "label15",
+ "label14", "label8", "label9", "label4", "label12",
+ "label2", "skiaenabled", "skiadisabled", "label5", "aafrom" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[]
+ = { "useaccel", "useaa", "useskia", "forceskiaraster", "showfontpreview", "aafont" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ sAllStrings += m_xSkiaLog->get_label() + " " + m_xRunGPTests->get_label() + " ";
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool OfaViewTabPage::FillItemSet( SfxItemSet* )
{
bool bModified = false;
- bool bMenuOptModified = false;
+ bool bDarkModeOptModified = false;
bool bRepaintWindows(false);
std::shared_ptr<comphelper::ConfigurationChanges> xChanges(comphelper::ConfigurationChanges::create());
@@ -684,7 +810,7 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
case 2: eSet = SFX_SYMBOLS_SIZE_LARGE; break;
case 3: eSet = SFX_SYMBOLS_SIZE_32; break;
default:
- OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_xIconSizeLB should not be possible!" );
+ SAL_WARN("cui.options", "OfaViewTabPage::FillItemSet(): This state of m_xIconSizeLB should not be possible!");
}
aMiscOptions.SetSymbolsSize( eSet );
}
@@ -700,7 +826,7 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
case 1: eSet = ToolBoxButtonSize::Small; break;
case 2: eSet = ToolBoxButtonSize::Large; break;
default:
- OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_xSidebarIconSizeLB should not be possible!" );
+ SAL_WARN("cui.options", "OfaViewTabPage::FillItemSet(): This state of m_xSidebarIconSizeLB should not be possible!");
}
officecfg::Office::Common::Misc::SidebarIconSize::set(static_cast<sal_Int16>(eSet), xChanges);
}
@@ -716,7 +842,7 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
case 1: eSet = ToolBoxButtonSize::Small; break;
case 2: eSet = ToolBoxButtonSize::Large; break;
default:
- OSL_FAIL( "OfaViewTabPage::FillItemSet(): This state of m_xNotebookbarIconSizeLB should not be possible!" );
+ SAL_WARN("cui.options", "OfaViewTabPage::FillItemSet(): This state of m_xNotebookbarIconSizeLB should not be possible!");
}
officecfg::Office::Common::Misc::NotebookbarIconSize::set(static_cast<sal_Int16>(eSet), xChanges);
}
@@ -729,40 +855,31 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
}
bool bAppearanceChanged = false;
-
- // Mouse Snap Mode
- SnapType eOldSnap = pAppearanceCfg->GetSnapMode();
- SnapType eNewSnap = static_cast<SnapType>(m_xMousePosLB->get_active());
- if(eNewSnap > SnapType::NONE)
- eNewSnap = SnapType::NONE;
-
- if ( eNewSnap != eOldSnap )
- {
- pAppearanceCfg->SetSnapMode(eNewSnap );
- bAppearanceChanged = true;
- }
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
// Middle Mouse Button
- MouseMiddleButtonAction eOldMiddleMouse = pAppearanceCfg->GetMiddleMouseButton();
+ MouseMiddleButtonAction eOldMiddleMouse = static_cast<MouseMiddleButtonAction>(officecfg::Office::Common::View::Dialog::MiddleMouseButton::get());
short eNewMiddleMouse = m_xMouseMiddleLB->get_active();
if(eNewMiddleMouse > 2)
eNewMiddleMouse = 2;
if ( eNewMiddleMouse != static_cast<short>(eOldMiddleMouse) )
{
- pAppearanceCfg->SetMiddleMouseButton( static_cast<MouseMiddleButtonAction>(eNewMiddleMouse) );
+ officecfg::Office::Common::View::Dialog::MiddleMouseButton::set(eNewMiddleMouse, batch);
bAppearanceChanged = true;
}
if (m_xFontAntiAliasing->get_state_changed_from_saved())
{
- pAppearanceCfg->SetFontAntiAliasing(m_xFontAntiAliasing->get_active());
+ bool b = m_xFontAntiAliasing->get_active();
+ officecfg::Office::Common::View::FontAntiAliasing::Enabled::set(b, batch);
bAppearanceChanged = true;
}
if (m_xAAPointLimit->get_value_changed_from_saved())
{
- pAppearanceCfg->SetFontAntialiasingMinPixelHeight(m_xAAPointLimit->get_value(FieldUnit::PIXEL));
+ sal_Int64 i = m_xAAPointLimit->get_value(FieldUnit::PIXEL);
+ officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::set(i, batch);
bAppearanceChanged = true;
}
@@ -772,30 +889,10 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
bModified = true;
}
- if (m_xMenuIconsLB->get_value_changed_from_saved())
+ if (m_xAppearanceStyleLB->get_value_changed_from_saved())
{
- TriState eMenuIcons = m_xMenuIconsLB->get_active() == 0 ?
- TRISTATE_INDET :
- static_cast<TriState>(m_xMenuIconsLB->get_active() - 1);
- // Output cache of current setting as possibly modified by System Theme for older version
- bool bMenuIcons = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus();
- officecfg::Office::Common::View::Menu::IsSystemIconsInMenus::set(eMenuIcons == TRISTATE_INDET, xChanges);
- officecfg::Office::Common::View::Menu::ShowIconsInMenues::set(bMenuIcons, xChanges);
+ bDarkModeOptModified = true;
bModified = true;
- bMenuOptModified = true;
- bAppearanceChanged = true;
- }
-
- if (m_xContextMenuShortcutsLB->get_value_changed_from_saved())
- {
- officecfg::Office::Common::View::Menu::ShortcutsInContextMenus::set(
- m_xContextMenuShortcutsLB->get_active() == 0 ?
- TRISTATE_INDET :
- static_cast<TriState>(m_xContextMenuShortcutsLB->get_active() - 1),
- xChanges);
- bModified = true;
- bMenuOptModified = true;
- bAppearanceChanged = true;
}
// #i95644# if disabled, do not use value, see in ::Reset()
@@ -829,20 +926,13 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
xChanges->commit();
- if( bMenuOptModified )
- {
- // Set changed settings to the application instance
- AllSettings aAllSettings = Application::GetSettings();
- StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
- aAllSettings.SetStyleSettings(aStyleSettings);
- Application::MergeSystemSettings( aAllSettings );
- Application::SetSettings(aAllSettings);
- }
+ if (bDarkModeOptModified)
+ MiscSettings::SetDarkMode(m_xAppearanceStyleLB->get_active());
if ( bAppearanceChanged )
{
- pAppearanceCfg->Commit();
- pAppearanceCfg->SetApplicationDefaults ( GetpApp() );
+ batch->commit();
+ SvtTabAppearanceCfg::SetApplicationDefaults ( GetpApp() );
}
if(bRepaintWindows)
@@ -872,17 +962,23 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
void OfaViewTabPage::Reset( const SfxItemSet* )
{
SvtMiscOptions aMiscOptions;
+ bool bEnable = true;
- if (aMiscOptions.GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO)
+ if (SvtMiscOptions::GetSymbolsSize() != SFX_SYMBOLS_SIZE_AUTO)
{
nSizeLB_InitialSelection = 1;
- if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
+ if (SvtMiscOptions::GetSymbolsSize() == SFX_SYMBOLS_SIZE_LARGE)
nSizeLB_InitialSelection = 2;
- else if (aMiscOptions.GetSymbolsSize() == SFX_SYMBOLS_SIZE_32)
+ else if (SvtMiscOptions::GetSymbolsSize() == SFX_SYMBOLS_SIZE_32)
nSizeLB_InitialSelection = 3;
}
+ bEnable = !officecfg::Office::Common::Misc::SymbolSet::isReadOnly();
m_xIconSizeLB->set_active( nSizeLB_InitialSelection );
+ m_xIconSizeLabel->set_sensitive(bEnable);
+ m_xIconSizeLB->set_sensitive(bEnable);
+ m_xMoreIcons->set_sensitive(bEnable);
+ m_xIconSizeImg->set_visible(!bEnable);
m_xIconSizeLB->save_value();
ToolBoxButtonSize eSidebarIconSize = static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::SidebarIconSize::get());
@@ -892,8 +988,14 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
nSidebarSizeLB_InitialSelection = 1;
else if( eSidebarIconSize == ToolBoxButtonSize::Large )
nSidebarSizeLB_InitialSelection = 2;
+
+ bEnable = !officecfg::Office::Common::Misc::SidebarIconSize::isReadOnly();
m_xSidebarIconSizeLB->set_active( nSidebarSizeLB_InitialSelection );
+ m_xSidebarIconSizeLabel->set_sensitive(bEnable);
+ m_xSidebarIconSizeLB->set_sensitive(bEnable);
+ m_xSidebarIconSizeImg->set_visible(!bEnable);
m_xSidebarIconSizeLB->save_value();
+
ToolBoxButtonSize eNotebookbarIconSize = static_cast<ToolBoxButtonSize>(officecfg::Office::Common::Misc::NotebookbarIconSize::get());
if( eNotebookbarIconSize == ToolBoxButtonSize::DontCare )
; // do nothing
@@ -901,45 +1003,67 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
nNotebookbarSizeLB_InitialSelection = 1;
else if( eNotebookbarIconSize == ToolBoxButtonSize::Large )
nNotebookbarSizeLB_InitialSelection = 2;
+
+ bEnable = !officecfg::Office::Common::Misc::NotebookbarIconSize::isReadOnly();
m_xNotebookbarIconSizeLB->set_active(nNotebookbarSizeLB_InitialSelection);
+ m_xNotebookbarIconSizeLabel->set_sensitive(bEnable);
+ m_xNotebookbarIconSizeLB->set_sensitive(bEnable);
+ m_xNotebookbarIconSizeImg->set_visible(!bEnable);
m_xNotebookbarIconSizeLB->save_value();
+ // tdf#153497 set name of automatic icon theme, it may have changed due to "Apply" while this page is visible
+ UpdateIconThemes();
+
if (aMiscOptions.IconThemeWasSetAutomatically()) {
nStyleLB_InitialSelection = 0;
}
else {
- const OUString& selected = aMiscOptions.GetIconTheme();
+ const OUString& selected = SvtMiscOptions::GetIconTheme();
const vcl::IconThemeInfo& selectedInfo =
vcl::IconThemeInfo::FindIconThemeById(mInstalledIconThemes, selected);
nStyleLB_InitialSelection = m_xIconStyleLB->find_text(selectedInfo.GetDisplayName());
}
+ bEnable = !officecfg::Office::Common::Misc::SymbolStyle::isReadOnly();
m_xIconStyleLB->set_active(nStyleLB_InitialSelection);
+ m_xIconStyleLabel->set_sensitive(bEnable);
+ m_xIconStyleLB->set_sensitive(bEnable);
+ m_xIconStyleImg->set_visible(!bEnable);
m_xIconStyleLB->save_value();
- // Mouse Snap
- m_xMousePosLB->set_active(static_cast<sal_Int32>(pAppearanceCfg->GetSnapMode()));
- m_xMousePosLB->save_value();
+ bEnable = !officecfg::Office::Common::Misc::Appearance::isReadOnly();
+ m_xAppearanceStyleLB->set_active(officecfg::Office::Common::Misc::Appearance::get());
+ m_xAppearanceStyleLabel->set_sensitive(bEnable);
+ m_xAppearanceStyleLB->set_sensitive(bEnable);
+ m_xAppearanceStyleImg->set_visible(!bEnable);
+ m_xAppearanceStyleLB->save_value();
- // Mouse Snap
- m_xMouseMiddleLB->set_active(static_cast<short>(pAppearanceCfg->GetMiddleMouseButton()));
+ // Middle Mouse Button
+ bEnable = !officecfg::Office::Common::View::Dialog::MiddleMouseButton::isReadOnly();
+ sal_Int16 nMiddleMouseButton = officecfg::Office::Common::View::Dialog::MiddleMouseButton::get();
+ m_xMouseMiddleLB->set_active(static_cast<short>(nMiddleMouseButton));
+ m_xMouseMiddleLabel->set_sensitive(bEnable);
+ m_xMouseMiddleLB->set_sensitive(bEnable);
+ m_xMouseMiddleImg->set_visible(!bEnable);
m_xMouseMiddleLB->save_value();
- m_xFontAntiAliasing->set_active( pAppearanceCfg->IsFontAntiAliasing() );
- m_xAAPointLimit->set_value(pAppearanceCfg->GetFontAntialiasingMinPixelHeight(), FieldUnit::PIXEL);
+ bEnable = !officecfg::Office::Common::View::FontAntiAliasing::Enabled::isReadOnly();
+ bool bFontAntiAliasing = officecfg::Office::Common::View::FontAntiAliasing::Enabled::get();
+ m_xFontAntiAliasing->set_active( bFontAntiAliasing );
+ m_xFontAntiAliasing->set_sensitive(bEnable);
+ m_xFontAntiAliasingImg->set_visible(!bEnable);
+
+ bEnable = !officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::isReadOnly();
+ sal_Int16 nFontAntiAliasingMinPixelHeight = officecfg::Office::Common::View::FontAntiAliasing::MinPixelHeight::get();
+ m_xAAPointLimit->set_value(nFontAntiAliasingMinPixelHeight, FieldUnit::PIXEL);
+ m_xAAPointLimit->set_sensitive(bEnable);
+ m_xAAPointLimitLabelImg->set_visible(!bEnable);
// WorkingSet
+ bEnable = !officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::isReadOnly();
m_xFontShowCB->set_active(officecfg::Office::Common::Font::View::ShowFontBoxWYSIWYG::get());
- bool bMenuIcons = officecfg::Office::Common::View::Menu::ShowIconsInMenues::get();
- bool bSystemMenuIcons = officecfg::Office::Common::View::Menu::IsSystemIconsInMenus::get();
- TriState eMenuIcons = bSystemMenuIcons ? TRISTATE_INDET : static_cast<TriState>(bMenuIcons);
- m_xMenuIconsLB->set_active(eMenuIcons == 2 ? 0 : eMenuIcons + 1);
- m_xMenuIconsLB->save_value();
-
- TriState eContextMenuShortcuts = static_cast<TriState>(officecfg::Office::Common::View::Menu::ShortcutsInContextMenus::get());
- bool bContextMenuShortcutsNonDefault = eContextMenuShortcuts == TRISTATE_FALSE || eContextMenuShortcuts == TRISTATE_TRUE;
- m_xContextMenuShortcutsLB->set_active(bContextMenuShortcutsNonDefault ? eContextMenuShortcuts + 1 : 0);
- m_xContextMenuShortcutsLB->save_value();
+ m_xFontShowCB->set_sensitive(bEnable);
+ m_xFontShowImg->set_visible(!bEnable);
UpdateHardwareAccelStatus();
m_xUseHardwareAccell->save_state();
@@ -953,8 +1077,12 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
{
m_xUseAntiAliase->set_active(false);
m_xUseAntiAliase->set_sensitive(false);
+ m_xUseAntiAliaseImg->set_visible(true);
}
+ bEnable = !officecfg::Office::Common::Drawinglayer::AntiAliasing::isReadOnly();
+ m_xUseAntiAliase->set_sensitive(bEnable);
+ m_xUseAntiAliaseImg->set_visible(!bEnable);
m_xUseAntiAliase->save_state();
}
@@ -978,11 +1106,13 @@ void OfaViewTabPage::UpdateHardwareAccelStatus()
{
m_xUseHardwareAccell->set_active(pCanvasSettings->IsHardwareAccelerationEnabled());
m_xUseHardwareAccell->set_sensitive(!pCanvasSettings->IsHardwareAccelerationRO());
+ m_xUseHardwareAccellImg->set_visible(pCanvasSettings->IsHardwareAccelerationRO());
}
else
{
m_xUseHardwareAccell->set_active(false);
m_xUseHardwareAccell->set_sensitive(false);
+ m_xUseHardwareAccellImg->set_visible(true);
}
#if HAVE_FEATURE_SKIA
m_xUseHardwareAccell->set_sensitive(!m_xUseSkia->get_active());
@@ -999,11 +1129,11 @@ struct LanguageConfig_Impl
static bool bLanguageCurrentDoc_Impl = false;
// some things we'll need...
-constexpr OUStringLiteral sAccessSrvc = u"com.sun.star.configuration.ConfigurationAccess";
+constexpr OUString sAccessSrvc = u"com.sun.star.configuration.ConfigurationAccess"_ustr;
constexpr OUStringLiteral sAccessUpdSrvc = u"com.sun.star.configuration.ConfigurationUpdateAccess";
-constexpr OUStringLiteral sInstalledLocalesPath = u"org.openoffice.Setup/Office/InstalledLocales";
-constexpr OUStringLiteral sUserLocalePath = u"org.openoffice.Office.Linguistic/General";
-constexpr OUStringLiteral sUserLocaleKey = u"UILocale";
+constexpr OUString sInstalledLocalesPath = u"org.openoffice.Setup/Office/InstalledLocales"_ustr;
+constexpr OUString sUserLocalePath = u"org.openoffice.Office.Linguistic/General"_ustr;
+constexpr OUString sUserLocaleKey = u"UILocale"_ustr;
static Sequence< OUString > seqInstalledLanguages;
static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocaleWrapper )
@@ -1017,7 +1147,7 @@ static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocal
const OUString* pPatterns = aDateAcceptancePatterns.getConstArray();
aBuf.append( pPatterns[0]);
for (sal_Int32 i=1; i < nPatterns; ++i)
- aBuf.append(';').append( pPatterns[i]);
+ aBuf.append(";" + pPatterns[i]);
}
return aBuf.makeStringAndClear();
}
@@ -1039,19 +1169,28 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
, m_xUserInterfaceLB(m_xBuilder->weld_combo_box("userinterface"))
, m_xLocaleSettingFT(m_xBuilder->weld_label("localesettingFT"))
, m_xLocaleSettingLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("localesetting")))
+ , m_xLocaleSettingImg(m_xBuilder->weld_widget("locklocalesetting"))
+ , m_xDecimalSeparatorFT(m_xBuilder->weld_label("label6"))
, m_xDecimalSeparatorCB(m_xBuilder->weld_check_button("decimalseparator"))
+ , m_xDecimalSeparatorImg(m_xBuilder->weld_widget("lockdecimalseparator"))
, m_xCurrencyFT(m_xBuilder->weld_label("defaultcurrency"))
, m_xCurrencyLB(m_xBuilder->weld_combo_box("currencylb"))
+ , m_xCurrencyImg(m_xBuilder->weld_widget("lockcurrencylb"))
, m_xDatePatternsFT(m_xBuilder->weld_label("dataaccpatterns"))
, m_xDatePatternsED(m_xBuilder->weld_entry("datepatterns"))
+ , m_xDatePatternsImg(m_xBuilder->weld_widget("lockdatepatterns"))
, m_xWesternLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("westernlanguage")))
, m_xWesternLanguageFT(m_xBuilder->weld_label("western"))
+ , m_xWesternLanguageImg(m_xBuilder->weld_widget("lockwesternlanguage"))
, m_xAsianLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("asianlanguage")))
, m_xComplexLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("complexlanguage")))
, m_xCurrentDocCB(m_xBuilder->weld_check_button("currentdoc"))
, m_xAsianSupportCB(m_xBuilder->weld_check_button("asiansupport"))
+ , m_xAsianSupportImg(m_xBuilder->weld_widget("lockasiansupport"))
, m_xCTLSupportCB(m_xBuilder->weld_check_button("ctlsupport"))
+ , m_xCTLSupportImg(m_xBuilder->weld_widget("lockctlsupport"))
, m_xIgnoreLanguageChangeCB(m_xBuilder->weld_check_button("ignorelanguagechange"))
+ , m_xIgnoreLanguageChangeImg(m_xBuilder->weld_widget("lockignorelanguagechange"))
{
// tdf#125483 save original default label
m_sDecimalSeparatorLabel = m_xDecimalSeparatorCB->get_label();
@@ -1070,12 +1209,9 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
Reference< XMultiServiceFactory > theConfigProvider(
css::configuration::theDefaultProvider::get(
comphelper::getProcessComponentContext()));
- Sequence< Any > theArgs(1);
- Reference< XNameAccess > theNameAccess;
-
// find out which locales are currently installed and add them to the listbox
- theArgs[0] <<= NamedValue("nodepath", Any(OUString(sInstalledLocalesPath)));
- theNameAccess.set(
+ Sequence< Any > theArgs{ Any(NamedValue("nodepath", Any(sInstalledLocalesPath))) };
+ Reference< XNameAccess > theNameAccess(
theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs ), UNO_QUERY_THROW );
seqInstalledLanguages = theNameAccess->getElementNames();
LanguageType aLang = LANGUAGE_DONTKNOW;
@@ -1093,7 +1229,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
std::sort(aUILanguages.begin(), aUILanguages.end(), [](const auto& l1, const auto& l2) {
static const auto aSorter = comphelper::string::NaturalStringSorter(
comphelper::getProcessComponentContext(),
- Application::GetSettings().GetLanguageTag().getLocale());
+ Application::GetSettings().GetUILanguageTag().getLocale());
return aSorter.compare(l1.second, l2.second) < 0;
});
@@ -1106,8 +1242,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
m_xUserInterfaceLB->set_active(0);
// find out whether the user has a specific locale specified
- Sequence< Any > theArgs2(1);
- theArgs2[0] <<= NamedValue("nodepath", Any(OUString(sUserLocalePath)));
+ Sequence< Any > theArgs2{ Any(NamedValue("nodepath", Any(sUserLocalePath))) };
theNameAccess.set(
theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs2 ), UNO_QUERY_THROW );
if (theNameAccess->hasByName(sUserLocaleKey))
@@ -1177,7 +1312,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
aStr_ = ApplyLreOrRleEmbedding( aStr_ ) +
aTwoSpace +
ApplyLreOrRleEmbedding( SvtLanguageTable::GetLanguageString( v->GetLanguage() ) );
- m_xCurrencyLB->append(OUString::number(reinterpret_cast<sal_Int64>(v)), aStr_);
+ m_xCurrencyLB->append(weld::toId(v), aStr_);
}
m_xCurrencyLB->set_active(0);
@@ -1192,15 +1327,17 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon
m_bOldAsian = SvtCJKOptions::IsAnyEnabled();
m_xAsianSupportCB->set_active(m_bOldAsian);
m_xAsianSupportCB->save_state();
- bool bReadonly = SvtCJKOptions::IsReadOnly(SvtCJKOptions::E_ALL);
+ bool bReadonly = SvtCJKOptions::IsAnyReadOnly();
m_xAsianSupportCB->set_sensitive(!bReadonly);
+ m_xAsianSupportImg->set_visible(bReadonly);
SupportHdl(*m_xAsianSupportCB);
- m_bOldCtl = pLangConfig->aCTLLanguageOptions.IsCTLFontEnabled();
+ m_bOldCtl = SvtCTLOptions::IsCTLFontEnabled();
m_xCTLSupportCB->set_active(m_bOldCtl);
m_xCTLSupportCB->save_state();
bReadonly = pLangConfig->aCTLLanguageOptions.IsReadOnly(SvtCTLOptions::E_CTLFONT);
m_xCTLSupportCB->set_sensitive(!bReadonly);
+ m_xCTLSupportImg->set_visible(bReadonly);
SupportHdl(*m_xCTLSupportCB);
m_xIgnoreLanguageChangeCB->set_active( pLangConfig->aSysLocaleOptions.IsIgnoreLanguageChange() );
@@ -1233,6 +1370,31 @@ static void lcl_Update(std::unique_ptr<SfxVoidItem> pInvalidItems[], std::unique
}
}
+OUString OfaLanguagesTabPage::GetAllStrings()
+{
+ OUString sAllStrings;
+ OUString labels[]
+ = { "label1", "label4", "label7", "localesettingFT", "defaultcurrency",
+ "label6", "dataaccpatterns", "label2", "western", "label3" };
+
+ for (const auto& label : labels)
+ {
+ if (const auto& pString = m_xBuilder->weld_label(label))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ OUString checkButton[] = { "decimalseparator", "asiansupport", "ctlsupport", "currentdoc",
+ "ignorelanguagechange" };
+
+ for (const auto& check : checkButton)
+ {
+ if (const auto& pString = m_xBuilder->weld_check_button(check))
+ sAllStrings += pString->get_label() + " ";
+ }
+
+ return sAllStrings.replaceAll("_", "");
+}
+
bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
{
// lock configuration broadcasters so that we can coordinate the notifications
@@ -1276,8 +1438,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
Reference< XMultiServiceFactory > theConfigProvider(
css::configuration::theDefaultProvider::get(
comphelper::getProcessComponentContext()));
- Sequence< Any > theArgs(1);
- theArgs[0] <<= NamedValue("nodepath", Any(OUString(sUserLocalePath)));
+ Sequence< Any > theArgs{ Any(NamedValue("nodepath", Any(sUserLocalePath))) };
Reference< XPropertySet >xProp(
theConfigProvider->createInstanceWithArguments(sAccessUpdSrvc, theArgs ), UNO_QUERY_THROW );
if ( m_sUserLocaleValue != aLangString)
@@ -1333,8 +1494,10 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
SvtScriptType nNewType = SvtLanguageOptions::GetScriptTypeOfLanguage( eNewLocale );
bool bNewCJK = bool( nNewType & SvtScriptType::ASIAN );
- SvtCompatibilityOptions aCompatOpts;
- aCompatOpts.SetDefault( SvtCompatibilityEntry::Index::ExpandWordSpace, !bNewCJK );
+ auto batch = comphelper::ConfigurationChanges::create();
+ SvtCompatibilityDefault aCompatOpts(batch);
+ aCompatOpts.set(u"ExpandWordSpace"_ustr, !bNewCJK);
+ batch->commit();
}
if(m_xDecimalSeparatorCB->get_state_changed_from_saved())
@@ -1346,7 +1509,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
// Configured currency, for example, USD-en-US or EUR-de-DE, or empty for locale default.
OUString sOldCurr = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
OUString sId = m_xCurrencyLB->get_active_id();
- const NfCurrencyEntry* pCurr = sId == "default" ? nullptr : reinterpret_cast<const NfCurrencyEntry*>(sId.toInt64());
+ const NfCurrencyEntry* pCurr = sId == "default" ? nullptr : weld::fromId<const NfCurrencyEntry*>(sId);
OUString sNewCurr;
if ( pCurr )
sNewCurr = SvtSysLocaleOptions::CreateCurrencyConfigString(
@@ -1375,7 +1538,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
Any aValue;
Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
aValue <<= aLocale;
- pLangConfig->aLinguConfig.SetProperty( "DefaultLocale", aValue );
+ pLangConfig->aLinguConfig.SetProperty( u"DefaultLocale", aValue );
if (xLinguProp.is())
xLinguProp->setDefaultLocale( aLocale );
}
@@ -1394,7 +1557,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
Any aValue;
Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
aValue <<= aLocale;
- pLangConfig->aLinguConfig.SetProperty( "DefaultLocale_CJK", aValue );
+ pLangConfig->aLinguConfig.SetProperty( u"DefaultLocale_CJK", aValue );
if (xLinguProp.is())
xLinguProp->setDefaultLocale_CJK( aLocale );
}
@@ -1413,7 +1576,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
Any aValue;
Locale aLocale = LanguageTag::convertToLocale( eSelectLang, false);
aValue <<= aLocale;
- pLangConfig->aLinguConfig.SetProperty( "DefaultLocale_CTL", aValue );
+ pLangConfig->aLinguConfig.SetProperty( u"DefaultLocale_CTL", aValue );
if (xLinguProp.is())
xLinguProp->setDefaultLocale_CTL( aLocale );
}
@@ -1482,12 +1645,20 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
bool bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::Locale);
m_xLocaleSettingLB->set_sensitive(!bReadonly);
m_xLocaleSettingFT->set_sensitive(!bReadonly);
+ m_xLocaleSettingImg->set_visible(bReadonly);
m_xDecimalSeparatorCB->set_active( pLangConfig->aSysLocaleOptions.IsDecimalSeparatorAsLocale());
+ bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::DecimalSeparator);
+ m_xDecimalSeparatorCB->set_sensitive(!bReadonly);
+ m_xDecimalSeparatorFT->set_sensitive(!bReadonly);
+ m_xDecimalSeparatorImg->set_visible(bReadonly);
m_xDecimalSeparatorCB->save_state();
m_xIgnoreLanguageChangeCB->set_active( pLangConfig->aSysLocaleOptions.IsIgnoreLanguageChange());
+ bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::IgnoreLanguageChange);
+ m_xIgnoreLanguageChangeCB->set_sensitive(!bReadonly);
+ m_xIgnoreLanguageChangeImg->set_visible(bReadonly);
m_xIgnoreLanguageChangeCB->save_state();
// let LocaleSettingHdl enable/disable checkboxes for CJK/CTL support
@@ -1506,11 +1677,12 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
pCurr = SvNumberFormatter::GetCurrencyEntry( aAbbrev, eLang );
}
// if pCurr==nullptr the SYSTEM entry is selected
- OUString sId = !pCurr ? OUString("default") : OUString::number(reinterpret_cast<sal_Int64>(pCurr));
+ OUString sId = !pCurr ? OUString("default") : weld::toId(pCurr);
m_xCurrencyLB->set_active_id(sId);
bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::Currency);
m_xCurrencyLB->set_sensitive(!bReadonly);
m_xCurrencyFT->set_sensitive(!bReadonly);
+ m_xCurrencyImg->set_visible(bReadonly);
// date acceptance patterns
OUString aDatePatternsString = pLangConfig->aSysLocaleOptions.GetDatePatternsConfigString();
@@ -1518,13 +1690,21 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
{
const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
aDatePatternsString = lcl_getDatePatternsConfigString( rLocaleWrapper);
+ // Let's assume patterns are valid at this point.
+ m_bDatePatternsValid = true;
+ }
+ else
+ {
+ bool bModified = false;
+ m_bDatePatternsValid = validateDatePatterns( bModified, aDatePatternsString);
}
- // Let's assume patterns are valid at this point.
- m_bDatePatternsValid = true;
m_xDatePatternsED->set_text(aDatePatternsString);
+ m_xDatePatternsED->set_message_type( m_bDatePatternsValid ?
+ weld::EntryMessageType::Normal : weld::EntryMessageType::Error);
bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::DatePatterns);
m_xDatePatternsED->set_sensitive(!bReadonly);
m_xDatePatternsFT->set_sensitive(!bReadonly);
+ m_xDatePatternsImg->set_visible(bReadonly);
m_xDatePatternsED->save_value();
//western/CJK/CLK language
@@ -1540,18 +1720,18 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
Any aCTLLang;
try
{
- aWestLang = pLangConfig->aLinguConfig.GetProperty("DefaultLocale");
+ aWestLang = pLangConfig->aLinguConfig.GetProperty(u"DefaultLocale");
Locale aLocale;
aWestLang >>= aLocale;
eCurLang = LanguageTag::convertToLanguageType( aLocale, false);
- aCJKLang = pLangConfig->aLinguConfig.GetProperty("DefaultLocale_CJK");
+ aCJKLang = pLangConfig->aLinguConfig.GetProperty(u"DefaultLocale_CJK");
aLocale = Locale();
aCJKLang >>= aLocale;
eCurLangCJK = LanguageTag::convertToLanguageType( aLocale, false);
- aCTLLang = pLangConfig->aLinguConfig.GetProperty("DefaultLocale_CTL");
+ aCTLLang = pLangConfig->aLinguConfig.GetProperty(u"DefaultLocale_CTL");
aLocale = Locale();
aCTLLang >>= aLocale;
eCurLangCTL = LanguageTag::convertToLanguageType( aLocale, false);
@@ -1564,24 +1744,23 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
{
m_xCurrentDocCB->set_sensitive(true);
m_xCurrentDocCB->set_active(bLanguageCurrentDoc_Impl);
- const SfxPoolItem* pLang;
- if( SfxItemState::SET == rSet->GetItemState(SID_ATTR_LANGUAGE, false, &pLang))
+ if( const SvxLanguageItem* pLangItem = rSet->GetItemIfSet(SID_ATTR_LANGUAGE, false))
{
- LanguageType eTempCurLang = static_cast<const SvxLanguageItem*>(pLang)->GetValue();
+ LanguageType eTempCurLang = pLangItem->GetValue();
if (MsLangId::resolveSystemLanguageByScriptType(eCurLang, css::i18n::ScriptType::LATIN) != eTempCurLang)
eCurLang = eTempCurLang;
}
- if( SfxItemState::SET == rSet->GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, false, &pLang))
+ if( const SvxLanguageItem* pLang = rSet->GetItemIfSet(SID_ATTR_CHAR_CJK_LANGUAGE, false))
{
- LanguageType eTempCurLang = static_cast<const SvxLanguageItem*>(pLang)->GetValue();
+ LanguageType eTempCurLang = pLang->GetValue();
if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCJK, css::i18n::ScriptType::ASIAN) != eTempCurLang)
eCurLangCJK = eTempCurLang;
}
- if( SfxItemState::SET == rSet->GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, false, &pLang))
+ if( const SvxLanguageItem* pLang = rSet->GetItemIfSet(SID_ATTR_CHAR_CTL_LANGUAGE, false))
{
- LanguageType eTempCurLang = static_cast<const SvxLanguageItem*>(pLang)->GetValue();
+ LanguageType eTempCurLang = pLang->GetValue();
if (MsLangId::resolveSystemLanguageByScriptType(eCurLangCTL, css::i18n::ScriptType::COMPLEX) != eTempCurLang)
eCurLangCTL = eTempCurLang;
}
@@ -1607,14 +1786,15 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
m_xIgnoreLanguageChangeCB->save_state();
m_xCurrentDocCB->save_state();
- bool bEnable = !pLangConfig->aLinguConfig.IsReadOnly( "DefaultLocale" );
+ bool bEnable = !pLangConfig->aLinguConfig.IsReadOnly( u"DefaultLocale" );
m_xWesternLanguageFT->set_sensitive( bEnable );
m_xWesternLanguageLB->set_sensitive( bEnable );
+ m_xWesternLanguageImg->set_visible( !bEnable );
// check the box "For the current document only"
// set the focus to the Western Language box
- const SfxPoolItem* pLang = nullptr;
- if ( SfxItemState::SET == rSet->GetItemState(SID_SET_DOCUMENT_LANGUAGE, false, &pLang ) && static_cast<const SfxBoolItem*>(pLang)->GetValue() )
+ const SfxBoolItem* pLang = rSet->GetItemIfSet(SID_SET_DOCUMENT_LANGUAGE, false );
+ if ( pLang && pLang->GetValue() )
{
m_xWesternLanguageLB->grab_focus();
m_xCurrentDocCB->set_sensitive(true);
@@ -1627,7 +1807,7 @@ IMPL_LINK(OfaLanguagesTabPage, SupportHdl, weld::Toggleable&, rBox, void)
bool bCheck = rBox.get_active();
if ( m_xAsianSupportCB.get() == &rBox )
{
- bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly("DefaultLocale_CJK");
+ bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly(u"DefaultLocale_CJK");
bCheck = ( bCheck && !bReadonly );
m_xAsianLanguageLB->set_sensitive( bCheck );
if (rBox.get_sensitive())
@@ -1635,7 +1815,7 @@ IMPL_LINK(OfaLanguagesTabPage, SupportHdl, weld::Toggleable&, rBox, void)
}
else if ( m_xCTLSupportCB.get() == &rBox )
{
- bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly("DefaultLocale_CTL");
+ bool bReadonly = pLangConfig->aLinguConfig.IsReadOnly(u"DefaultLocale_CTL");
bCheck = ( bCheck && !bReadonly );
m_xComplexLanguageLB->set_sensitive( bCheck );
if (rBox.get_sensitive())
@@ -1673,7 +1853,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
}
// second check if CJK must be enabled
// #103299# - if CJK support is not readonly
- if(!SvtCJKOptions::IsReadOnly(SvtCJKOptions::E_ALL))
+ if(!SvtCJKOptions::IsAnyReadOnly())
{
bool bIsCJKFixed = bool(nType & SvtScriptType::ASIAN);
lcl_checkLanguageCheckBox(*m_xAsianSupportCB, bIsCJKFixed, m_bOldAsian);
@@ -1682,7 +1862,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry(
(eLang == LANGUAGE_USER_SYSTEM_CONFIG) ? MsLangId::getConfiguredSystemLanguage() : eLang);
- const OUString aDefaultID = "default";
+ constexpr OUString aDefaultID = u"default"_ustr;
// Update the "Default ..." currency.
m_xCurrencyLB->remove_id(aDefaultID);
OUString aDefaultCurr = m_sSystemDefaultString + " - " + rCurr.GetBankSymbol();
@@ -1691,8 +1871,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
m_xCurrencyLB->set_active_text(aDefaultCurr);
// obtain corresponding locale data
- LanguageTag aLanguageTag( eLang);
- LocaleDataWrapper aLocaleWrapper( aLanguageTag );
+ LocaleDataWrapper aLocaleWrapper(( LanguageTag(eLang) ));
// update the decimal separator key of the related CheckBox
OUString sTempLabel(m_sDecimalSeparatorLabel);
@@ -1703,20 +1882,39 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
OUString aDatePatternsString = lcl_getDatePatternsConfigString( aLocaleWrapper);
m_bDatePatternsValid = true;
m_xDatePatternsED->set_text( aDatePatternsString);
+ m_xDatePatternsED->set_message_type(weld::EntryMessageType::Normal);
}
IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
{
- const OUString aPatterns(rEd.get_text());
- OUStringBuffer aBuf( aPatterns);
- sal_Int32 nChar = 0;
- bool bValid = true;
+ OUString aPatterns(rEd.get_text());
bool bModified = false;
- if (!aPatterns.isEmpty())
+ const bool bValid = validateDatePatterns( bModified, aPatterns);
+ if (bModified)
{
+ // gtk3 keeps the cursor position on equal length set_text() but at
+ // least the 'gen' backend does not and resets to 0.
+ const int nCursorPos = rEd.get_position();
+ rEd.set_text(aPatterns);
+ rEd.set_position(nCursorPos);
+ }
+ if (bValid)
+ rEd.set_message_type(weld::EntryMessageType::Normal);
+ else
+ rEd.set_message_type(weld::EntryMessageType::Error);
+ m_bDatePatternsValid = bValid;
+}
+
+bool OfaLanguagesTabPage::validateDatePatterns( bool& rbModified, OUString& rPatterns )
+{
+ bool bValid = true;
+ if (!rPatterns.isEmpty())
+ {
+ OUStringBuffer aBuf( rPatterns);
+ sal_Int32 nChar = 0;
for (sal_Int32 nIndex=0; nIndex >= 0 && bValid; ++nChar)
{
- const OUString aPat( aPatterns.getToken( 0, ';', nIndex));
+ const OUString aPat( rPatterns.getToken( 0, ';', nIndex));
if (aPat.isEmpty() && nIndex < 0)
{
// Indicating failure when about to append a pattern is too
@@ -1731,6 +1929,18 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
bool bY, bM, bD;
bY = bM = bD = false;
bool bSep = true;
+ if (aPat.getLength() == 3)
+ {
+ // Disallow a pattern that would match a numeric input with
+ // decimal separator, like M.D
+ const LanguageType eLang = m_xLocaleSettingLB->get_active_id();
+ const LocaleDataWrapper aLocaleWrapper(( LanguageTag(eLang)));
+ if ( aPat[1] == aLocaleWrapper.getNumDecimalSep().toChar()
+ || aPat[1] == aLocaleWrapper.getNumDecimalSepAlt().toChar())
+ {
+ bValid = false;
+ }
+ }
for (sal_Int32 i = 0; i < aPat.getLength() && bValid; /*nop*/)
{
const sal_Int32 j = i;
@@ -1745,7 +1955,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
else if (c == 'y')
{
aBuf[nChar] = 'Y';
- bModified = true;
+ rbModified = true;
}
bY = true;
bSep = false;
@@ -1757,7 +1967,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
else if (c == 'm')
{
aBuf[nChar] = 'M';
- bModified = true;
+ rbModified = true;
}
bM = true;
bSep = false;
@@ -1769,7 +1979,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
else if (c == 'd')
{
aBuf[nChar] = 'D';
- bModified = true;
+ rbModified = true;
}
bD = true;
bSep = false;
@@ -1787,20 +1997,10 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, weld::Entry&, rEd, void )
bValid &= (bY || bM || bD);
}
}
+ if (rbModified)
+ rPatterns = aBuf.makeStringAndClear();
}
- if (bModified)
- {
- // gtk3 keeps the cursor position on equal length set_text() but at
- // least the 'gen' backend does not and resets to 0.
- const int nCursorPos = rEd.get_position();
- rEd.set_text(aBuf.makeStringAndClear());
- rEd.set_position(nCursorPos);
- }
- if (bValid)
- rEd.set_message_type(weld::EntryMessageType::Normal);
- else
- rEd.set_message_type(weld::EntryMessageType::Error);
- m_bDatePatternsValid = bValid;
+ return bValid;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */