cui/source/inc/border.hxx      |    1 +
 cui/source/tabpages/border.cxx |   11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit e8ee0651f64b49ebad4f31541a4d68d943201c65
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Jul 22 09:10:53 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Jul 22 10:27:14 2025 +0200

    tdf#167476 cui a11y: Show border preset selection while focused
    
    As discussed in tdf#167476, the logic for the "Presets" control
    is that it doesn't have a real permanent selection state beyond
    the point in time when it has focus, i.e. it is primarily meant
    to be used to allow a one-time selection of borders that can then
    be tweaked later on, in the "User-defined" control below.
    The preset used to initialize those borders is then (more or less)
    discarded and the borders shown in the "User-defined" control are used
    from that point on to manage state. (Adding or removing a border in
    that "User-defined" control would invalidate any preset previously
    selected.)
    
    However, while the control has focus, the currently selected/focused
    entry should be clearly indicated, which is not the case when
    selection is cleared (in particular visible with gtk3's implementation
    of weld::IconView).
    Therefore, don't clear selection right when it happens,
    but when focus moves out of the control.
    
    Change-Id: Id92e06cb07b7836c1826c966e81b8ad2ab488c04
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188138
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index ccd1b67d2d51..a7d3b695bafa 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -161,6 +161,7 @@ private:
     DECL_LINK(SelStyleHdl_Impl, SvtLineListBox&, void);
     DECL_LINK(SelColHdl_Impl, ColorListBox&, void);
     DECL_LINK(SelPreHdl_Impl, weld::IconView&, void);
+    DECL_LINK(FocusOutPresets_Impl, weld::Widget&, void);
     DECL_LINK(SelSdwHdl_Impl, weld::IconView&, void);
     DECL_LINK(LinesChanged_Impl, LinkParamNone*, void);
     DECL_LINK(ModifyDistanceHdl_Impl, weld::MetricSpinButton&, void);
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 0d9d2681629e..e38e0ff8100b 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -532,6 +532,7 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, 
weld::DialogControlle
     m_xLineWidthLB->connect_changed(LINK(this, SvxBorderTabPage, 
ModifyWidthLBHdl_Impl));
     m_xLineWidthMF->connect_value_changed(LINK(this, SvxBorderTabPage, 
ModifyWidthMFHdl_Impl));
     m_xWndPresets->connect_selection_changed( LINK( this, SvxBorderTabPage, 
SelPreHdl_Impl ) );
+    m_xWndPresets->connect_focus_out(LINK(this, SvxBorderTabPage, 
FocusOutPresets_Impl));
     m_xWndShadows->connect_selection_changed( LINK( this, SvxBorderTabPage, 
SelSdwHdl_Impl ) );
     m_xWndPresets->connect_query_tooltip( LINK( this, SvxBorderTabPage, 
QueryTooltipPreHdl ) );
     m_xWndShadows->connect_query_tooltip( LINK( this, SvxBorderTabPage, 
QueryTooltipSdwHdl ) );
@@ -1218,13 +1219,17 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelPreHdl_Impl, 
weld::IconView&, void)
         SelColHdl_Impl(*m_xLbLineColor);
     }
 
-    // Presets IconView does not show a selection (used as push buttons).
-    m_xWndPresets->unselect_all();
-
     LinesChanged_Impl( nullptr );
     UpdateRemoveAdjCellBorderCB( nLine + 1 );
 }
 
+IMPL_LINK_NOARG(SvxBorderTabPage, FocusOutPresets_Impl, weld::Widget&, void)
+{
+    // no longer show preset as selected, as it would become out of sync
+    // if borders are changed manually
+    m_xWndPresets->unselect_all();
+}
+
 IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, weld::IconView&, void)
 {
     OUString sSelectedId = m_xWndShadows->get_selected_id();

Reply via email to