summaryrefslogtreecommitdiff
path: root/cui/source/tabpages
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-08-22 13:14:38 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-08-22 20:46:40 +0200
commita701a726dc3ccc174d1323a298c3550733773df9 (patch)
tree3ca8499373e3870c842b76c4fbf102240be6587b /cui/source/tabpages
parentb2247336409b7b3b0ae04356a167dcd204badb04 (diff)
tdf#101895 don't unconditionally default to ch[ar]/line
if CJK typography is available. Given that we choose to show cm vs inch based on SvtSysLocaleOptions::GetRealLanguageTag() also choose to use ch[ar] and line based on that setting when bApplyCharUnit is enabled. Change-Id: I812d05e0639f7e214d5c3d4dcca01b0709126fd9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155948 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'cui/source/tabpages')
-rw-r--r--cui/source/tabpages/paragrph.cxx26
1 files changed, 18 insertions, 8 deletions
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 957431e565a9..9f5e94833b3b 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -48,11 +48,14 @@
#include <editeng/scriptspaceitem.hxx>
#include <editeng/hngpnctitem.hxx>
#include <editeng/forbiddenruleitem.hxx>
+#include <i18nlangtag/languagetag.hxx>
+#include <i18nlangtag/mslangid.hxx>
#include <svx/dlgutil.hxx>
#include <sfx2/htmlmode.hxx>
#include <editeng/paravertalignitem.hxx>
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
+#include <unotools/syslocaleoptions.hxx>
const WhichRangesContainer SvxStdParagraphTabPage::pStdRanges(
svl::Items<
@@ -527,6 +530,19 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
return bModified;
}
+static bool UseCharUnitInUI(const SfxItemSet& rSet)
+{
+ const bool bApplyCharUnit = GetApplyCharUnit(rSet);
+ if (!bApplyCharUnit)
+ return false;
+ if (!SvtCJKOptions::IsAsianTypographyEnabled())
+ return false;
+ // tdf#101895 Given that we choose to show cm vs inch based on this Locale
+ // setting, also choose to use ch[ar] and line based on that locale when
+ // bApplyCharUnit is enabled.
+ return MsLangId::isCJK(SvtSysLocaleOptions().GetRealLanguageTag().getLanguageType());
+}
+
void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
{
SfxItemPool* pPool = rSet->GetPool();
@@ -534,10 +550,7 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
// adjust metric
FieldUnit eFUnit = GetModuleFieldUnit( *rSet );
-
- bool bApplyCharUnit = GetApplyCharUnit( *rSet );
-
- if(SvtCJKOptions::IsAsianTypographyEnabled() && bApplyCharUnit )
+ if (UseCharUnitInUI(*rSet))
eFUnit = FieldUnit::CHAR;
m_aLeftIndent.SetFieldUnit(eFUnit);
@@ -1824,10 +1837,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
// adjust metric
FieldUnit eFUnit = GetModuleFieldUnit( *rSet );
-
- bool bApplyCharUnit = GetApplyCharUnit( *rSet );
-
- if( SvtCJKOptions::IsAsianTypographyEnabled() && bApplyCharUnit )
+ if (UseCharUnitInUI(*rSet))
eFUnit = FieldUnit::CHAR;
sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );