cui/source/tabpages/chardlg.cxx | 22 ++++++ officecfg/registry/schema/org/openoffice/Office/Common.xcs | 7 ++ sw/qa/uitest/writer_tests2/formatCharacter.py | 45 +++++++++++++ 3 files changed, 74 insertions(+)
New commits: commit 8a9527e17a625bf445974e0046db07a8c8fa186e Author: Jonathan Clark <[email protected]> AuthorDate: Thu Oct 9 10:57:51 2025 -0600 Commit: Jonathan Clark <[email protected]> CommitDate: Thu Oct 9 22:54:27 2025 +0200 tdf#161205 Persist Complex/Asian tab choice in character dialog When RTL/CTL and CJK support are both enabled, the font options for those language groups are stacked into a single notebook. Previously, the GUI would always default to showing "Asian" as the selected tab, which was inconvenient for users who need to have broad language support enabled, but tend to use RTL/CTL languages more often. This change makes the user's previously-activated tab persist across sessions. Change-Id: Ie77bacb22c467349898591ddcc8ccf3cca890a2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192123 Reviewed-by: Jonathan Clark <[email protected]> Tested-by: Jenkins diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index d0d293822fb7..1d0d73dbe46c 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -1177,10 +1177,32 @@ void SvxCharNamePage::ActivatePage( const SfxItemSet& rSet ) SvxCharBasePage::ActivatePage( rSet ); UpdatePreview_Impl(); // instead of asynchronous calling in ctor + + // tdf#161205: Automatically switch between CTL and CJK tabs based on last state + if (SvtCJKOptions::IsCJKFontEnabled() && SvtCTLOptions::IsCTLFontEnabled()) + { + if (officecfg::Office::Common::I18N::CTL::PreferCTLFontTab::get()) + { + m_xCJK_CTL->set_current_page(u"nbCTL"_ustr); + } + else + { + m_xCJK_CTL->set_current_page(u"nbCJK"_ustr); + } + } } DeactivateRC SvxCharNamePage::DeactivatePage( SfxItemSet* _pSet ) { + // tdf#161205: Store last-focused CTL/CJK language tab + if (SvtCJKOptions::IsCJKFontEnabled() && SvtCTLOptions::IsCTLFontEnabled()) + { + auto xChanges = comphelper::ConfigurationChanges::create(); + officecfg::Office::Common::I18N::CTL::PreferCTLFontTab::set( + m_xCJK_CTL->get_current_page_ident() == u"nbCTL"_ustr, xChanges); + xChanges->commit(); + } + if ( _pSet ) FillItemSet( _pSet ); return DeactivateRC::LeavePage; diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 86649b3315ed..773d38f930d9 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -6802,6 +6802,13 @@ depending on the office locale.</desc> </info> </prop> + <prop oor:name="PreferCTLFontTab" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Specifies whether the CTL font tab is automatically selected when + viewing or editing character properties and styles.</desc> + </info> + <value>false</value> + </prop> </group> </group> <group oor:name="SmartTags"> diff --git a/sw/qa/uitest/writer_tests2/formatCharacter.py b/sw/qa/uitest/writer_tests2/formatCharacter.py index 73ee39da9fcf..413d4ae2dde5 100644 --- a/sw/qa/uitest/writer_tests2/formatCharacter.py +++ b/sw/qa/uitest/writer_tests2/formatCharacter.py @@ -194,4 +194,49 @@ class formatCharacter(UITestCase): xScalewidth = xDialog.getChild("scalewidthsb") self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "101%") + def test_tdf161205_cjk_ctl_tab_preserved(self): + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + xNoteBook = xDialog.getChild("nbCJKCTL") + + # Initialize CJK/CTL tab to CJK + select_pos(xNoteBook, "0") + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + xNoteBook = xDialog.getChild("nbCJKCTL") + + # Dialog should have persisted CJK state + self.assertEqual(get_state_as_dict(xNoteBook)["CurrPageId"], "1"); + + # Switch to CTL tab + select_pos(xNoteBook, "1") + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + xNoteBook = xDialog.getChild("nbCJKCTL") + + # Dialog should have persisted CTL state + self.assertEqual(get_state_as_dict(xNoteBook)["CurrPageId"], "2"); + + # Switch to CJK tab + select_pos(xNoteBook, "0") + + with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + xNoteBook = xDialog.getChild("nbCJKCTL") + + # Dialog should have persisted CJK state + self.assertEqual(get_state_as_dict(xNoteBook)["CurrPageId"], "1"); + # vim: set shiftwidth=4 softtabstop=4 expandtab:
