sc/inc/scmod.hxx | 1 + sc/source/ui/app/scmod.cxx | 9 ++++++++- sc/source/ui/view/cellsh3.cxx | 8 ++++---- sfx2/source/view/viewsh.cxx | 6 ++++++ 4 files changed, 19 insertions(+), 5 deletions(-)
New commits: commit 9138afa1a53e1a7b386623e6c72d733bb37206fd Author: Jaume Pujantell <jaume.pujant...@collabora.com> AuthorDate: Thu Apr 24 16:36:21 2025 +0200 Commit: Jaume Pujantell <jaume.pujant...@collabora.com> CommitDate: Tue Apr 29 12:33:46 2025 +0200 cool#11739 lok: sc: change dialog units per user On lok different users might have different locales so they need different field units in their dialogues. Right now the metric used is always the one stored in the ScModule's AppOptions for all users. With this change, for lok SfxModule::GetFieldUnit is used because it already has the correct metric per lok user. Change-Id: If2b047874a26deecc7c43936ab267b75eae101e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184567 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184749 Reviewed-by: Jaume Pujantell <jaume.pujant...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 5725c819bb7f..5e06db44540d 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -188,6 +188,7 @@ public: svtools::ColorConfig& GetColorConfig(); static bool IsLOKViewInDarkMode(); SC_DLLPUBLIC SvtUserOptions& GetUserOptions(); + SC_DLLPUBLIC FieldUnit GetMetric(); void ModifyOptions( const SfxItemSet& rOptSet ); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 487291113747..84bc8f346d92 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -569,7 +569,7 @@ void ScModule::GetState( SfxItemSet& rSet ) rSet.Put( SfxUInt32Item( nWhich, GetAppOptions().GetStatusFunc() ) ); break; case SID_ATTR_METRIC: - rSet.Put( SfxUInt16Item( nWhich, sal::static_int_cast<sal_uInt16>(GetAppOptions().GetAppMetric()) ) ); + rSet.Put(SfxUInt16Item(nWhich, sal::static_int_cast<sal_uInt16>(GetMetric()))); break; case SID_AUTOSPELL_CHECK: rSet.Put( SfxBoolItem( nWhich, pTabViewShell->IsAutoSpell()) ); @@ -921,6 +921,13 @@ SvtUserOptions& ScModule::GetUserOptions() return *m_pUserOptions; } +FieldUnit ScModule::GetMetric() +{ + if (comphelper::LibreOfficeKit::isActive()) + return SfxModule::GetFieldUnit(); + return GetAppOptions().GetAppMetric(); +} + LanguageType ScModule::GetOptDigitLanguage() { SvtCTLOptions::TextNumerals eNumerals = SvtCTLOptions::GetCTLTextNumerals(); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index b7bd2daa4450..a4b1470196c9 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -702,7 +702,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) else { ScViewData& rData = GetViewData(); - FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); + FieldUnit eMetric = SC_MOD()->GetMetric(); sal_uInt16 nCurHeight = rData.GetDocument(). GetRowHeight( rData.GetCurY(), rData.GetTabNo() ); @@ -745,7 +745,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else { - FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); + FieldUnit eMetric = SC_MOD()->GetMetric(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); VclPtr<AbstractScMetricInputDlg> pDlg(pFact->CreateScMetricInputDlg( @@ -807,7 +807,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else { - FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); + FieldUnit eMetric = SC_MOD()->GetMetric(); ScViewData& rData = GetViewData(); sal_uInt16 nCurHeight = rData.GetDocument(). GetColWidth( rData.GetCurX(), @@ -850,7 +850,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else { - FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); + FieldUnit eMetric = SC_MOD()->GetMetric(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); VclPtr<AbstractScMetricInputDlg> pDlg(pFact->CreateScMetricInputDlg( diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 367c5c643cb4..d73ab0fd0aa3 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -3514,6 +3514,12 @@ void SfxViewShell::SetLOKAccessibilityState(bool bEnabled) void SfxViewShell::SetLOKLocale(const OUString& rBcp47LanguageTag) { maLOKLocale = LanguageTag(rBcp47LanguageTag, true).makeFallback(); + if (this == Current()) + { + // update the current LOK language and locale for the dialog tunneling + comphelper::LibreOfficeKit::setLanguageTag(GetLOKLanguageTag()); + comphelper::LibreOfficeKit::setLocale(GetLOKLocale()); + } } void SfxViewShell::NotifyCursor(SfxViewShell* /*pViewShell*/) const