[Libreoffice-commits] core.git: sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed May 19 19:37:26 UTC 2021


 sc/source/ui/inc/crnrdlg.hxx      |    3 --
 sc/source/ui/miscdlgs/crnrdlg.cxx |   57 +++++++++++++++++---------------------
 2 files changed, 27 insertions(+), 33 deletions(-)

New commits:
commit 0ab9c2f1d763dd805eb63ba3a5ffa16e63bf7734
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 19 15:46:09 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed May 19 21:36:44 2021 +0200

    use toggle instead of click for RadioButton
    
    only listen for one toggle for the button grouping
    
    Change-Id: I4c7f84eda2dfdb873371ae7ba8ede710f373dbda
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115819
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/inc/crnrdlg.hxx b/sc/source/ui/inc/crnrdlg.hxx
index eaf0d1eb4598..6162eb3f76ca 100644
--- a/sc/source/ui/inc/crnrdlg.hxx
+++ b/sc/source/ui/inc/crnrdlg.hxx
@@ -83,8 +83,7 @@ private:
     DECL_LINK( RemoveBtnHdl, weld::Button&, void );
     DECL_LINK( Range1SelectHdl, weld::TreeView&, void );
     DECL_LINK( Range1DataModifyHdl, formula::RefEdit&, void );
-    DECL_LINK( ColClickHdl, weld::Button&, void );
-    DECL_LINK( RowClickHdl, weld::Button&, void );
+    DECL_LINK( ColRowToggleHdl, weld::ToggleButton&, void );
     DECL_LINK( Range2DataModifyHdl, formula::RefEdit&, void );
     DECL_LINK( GetEditFocusHdl, formula::RefEdit&, void );
     DECL_LINK( LoseEditFocusHdl, formula::RefEdit&, void );
diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx
index c037405ef078..09ca326e6d9a 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -102,8 +102,7 @@ void ScColRowNameRangesDlg::Init()
     m_xBtnRemove->connect_clicked  ( LINK( this, ScColRowNameRangesDlg, RemoveBtnHdl ) );
     m_xLbRange->connect_changed( LINK( this, ScColRowNameRangesDlg, Range1SelectHdl ) );
     m_xEdAssign->SetModifyHdl  ( LINK( this, ScColRowNameRangesDlg, Range1DataModifyHdl ) );
-    m_xBtnColHead->connect_clicked ( LINK( this, ScColRowNameRangesDlg, ColClickHdl ) );
-    m_xBtnRowHead->connect_clicked ( LINK( this, ScColRowNameRangesDlg, RowClickHdl ) );
+    m_xBtnColHead->connect_toggled ( LINK( this, ScColRowNameRangesDlg, ColRowToggleHdl ) );
     m_xEdAssign2->SetModifyHdl ( LINK( this, ScColRowNameRangesDlg, Range2DataModifyHdl ) );
 
     Link<formula::RefEdit&,void> aEditLink = LINK( this, ScColRowNameRangesDlg, GetEditFocusHdl );
@@ -729,40 +728,36 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range2DataModifyHdl, formula::RefEdit&, v
     }
 }
 
-// handler for the radio button for columns, adjust ranges
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, ColClickHdl, weld::Button&, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, ColRowToggleHdl, weld::ToggleButton&, void)
 {
-    if (!m_xBtnColHead->get_active())
-        return;
-
-    if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == rDoc.MaxRow() )
+    if (m_xBtnColHead->get_active())
     {
-        theCurArea.aEnd.SetRow( rDoc.MaxRow() - 1 );
-        OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
-        m_xEdAssign->SetText( aStr );
+        // handler for the radio button for columns, adjust ranges
+        if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == rDoc.MaxRow() )
+        {
+            theCurArea.aEnd.SetRow( rDoc.MaxRow() - 1 );
+            OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
+            m_xEdAssign->SetText( aStr );
+        }
+        ScRange aRange( theCurData );
+        aRange.aStart.SetRow( std::min( static_cast<tools::Long>(theCurArea.aEnd.Row() + 1), static_cast<tools::Long>(rDoc.MaxRow()) ) );
+        aRange.aEnd.SetRow( rDoc.MaxRow() );
+        AdjustColRowData( aRange );
     }
-    ScRange aRange( theCurData );
-    aRange.aStart.SetRow( std::min( static_cast<tools::Long>(theCurArea.aEnd.Row() + 1), static_cast<tools::Long>(rDoc.MaxRow()) ) );
-    aRange.aEnd.SetRow( rDoc.MaxRow() );
-    AdjustColRowData( aRange );
-}
-
-// handler for the radio button for columns, adjust range
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, RowClickHdl, weld::Button&, void)
-{
-    if (!m_xBtnRowHead->get_active())
-        return;
-
-    if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == rDoc.MaxCol() )
+    else if (m_xBtnRowHead->get_active())
     {
-        theCurArea.aEnd.SetCol( rDoc.MaxCol() - 1 );
-        OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
-        m_xEdAssign->SetText( aStr );
+        // handler for the radio button for columns, adjust range
+        if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == rDoc.MaxCol() )
+        {
+            theCurArea.aEnd.SetCol( rDoc.MaxCol() - 1 );
+            OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
+            m_xEdAssign->SetText( aStr );
+        }
+        ScRange aRange( theCurData );
+        aRange.aStart.SetCol( static_cast<SCCOL>(std::min( static_cast<tools::Long>(theCurArea.aEnd.Col() + 1), static_cast<tools::Long>(rDoc.MaxCol()) )) );
+        aRange.aEnd.SetCol( rDoc.MaxCol() );
+        AdjustColRowData( aRange );
     }
-    ScRange aRange( theCurData );
-    aRange.aStart.SetCol( static_cast<SCCOL>(std::min( static_cast<tools::Long>(theCurArea.aEnd.Col() + 1), static_cast<tools::Long>(rDoc.MaxCol()) )) );
-    aRange.aEnd.SetCol( rDoc.MaxCol() );
-    AdjustColRowData( aRange );
 }
 
 IMPL_LINK( ScColRowNameRangesDlg, GetEditFocusHdl, formula::RefEdit&, rCtrl, void )


More information about the Libreoffice-commits mailing list