[Libreoffice-commits] core.git: cui/source include/svx svx/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu May 20 10:23:45 UTC 2021


 cui/source/dialogs/cuifmsearch.cxx        |   53 ++++++++++++++++--------------
 cui/source/inc/cuifmsearch.hxx            |    3 +
 include/svx/srchdlg.hxx                   |    4 +-
 svx/source/dialog/SafeModeDialog.cxx      |    7 +++
 svx/source/dialog/srchdlg.cxx             |   42 +++++++++++------------
 svx/source/tbxctrls/extrusioncontrols.cxx |   19 ++++++++--
 svx/source/tbxctrls/fontworkgallery.cxx   |   41 +++++++++++++++--------
 7 files changed, 103 insertions(+), 66 deletions(-)

New commits:
commit 304b74784297df7cbd0762a2f468ba13b33402bd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 19 20:55:17 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu May 20 12:23:05 2021 +0200

    use toggle instead of click for RadioButton
    
    Change-Id: I8de3daf3799a78c63be2c560afa4a7cc02d63daa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115852
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index de7681fa7d79..2433d0d8445d 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -163,12 +163,12 @@ FmSearchDialog::~FmSearchDialog()
 void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sInitialText)
 {
     //the initialization of all the Controls
-    m_prbSearchForText->connect_clicked(LINK(this, FmSearchDialog, OnClickedFieldRadios));
-    m_prbSearchForNull->connect_clicked(LINK(this, FmSearchDialog, OnClickedFieldRadios));
-    m_prbSearchForNotNull->connect_clicked(LINK(this, FmSearchDialog, OnClickedFieldRadios));
+    m_prbSearchForText->connect_toggled(LINK(this, FmSearchDialog, OnToggledSearchRadio));
+    m_prbSearchForNull->connect_toggled(LINK(this, FmSearchDialog, OnToggledSearchRadio));
+    m_prbSearchForNotNull->connect_toggled(LINK(this, FmSearchDialog, OnToggledSearchRadio));
 
-    m_prbAllFields->connect_clicked(LINK(this, FmSearchDialog, OnClickedFieldRadios));
-    m_prbSingleField->connect_clicked(LINK(this, FmSearchDialog, OnClickedFieldRadios));
+    m_prbAllFields->connect_toggled(LINK(this, FmSearchDialog, OnToggledFieldRadios));
+    m_prbSingleField->connect_toggled(LINK(this, FmSearchDialog, OnToggledFieldRadios));
 
     m_pbSearchAgain->connect_clicked(LINK(this, FmSearchDialog, OnClickedSearchAgain));
     m_ppbApproxSettings->connect_clicked(LINK(this, FmSearchDialog, OnClickedSpecialSettings));
@@ -240,24 +240,29 @@ short FmSearchDialog::run()
     return nRet;
 }
 
-IMPL_LINK(FmSearchDialog, OnClickedFieldRadios, weld::Button&, rButton, void)
+IMPL_LINK(FmSearchDialog, OnToggledSearchRadio, weld::ToggleButton&, rButton, void)
 {
-    if ((&rButton == m_prbSearchForText.get()) || (&rButton == m_prbSearchForNull.get()) || (&rButton == m_prbSearchForNotNull.get()))
+    if (!rButton.get_active())
+        return;
+    EnableSearchForDependees(true);
+}
+
+IMPL_LINK(FmSearchDialog, OnToggledFieldRadios, weld::ToggleButton&, rButton, void)
+{
+    if (!rButton.get_active())
+        return;
+
+    // en- or disable field list box accordingly
+    if (m_prbSingleField->get_active())
     {
-        EnableSearchForDependees(true);
+        m_plbField->set_sensitive(true);
+        m_pSearchEngine->RebuildUsedFields(m_plbField->get_active());
     }
     else
-        // en- or disable field list box accordingly
-        if (&rButton == m_prbSingleField.get())
-        {
-            m_plbField->set_sensitive(true);
-            m_pSearchEngine->RebuildUsedFields(m_plbField->get_active());
-        }
-        else
-        {
-            m_plbField->set_sensitive(false);
-            m_pSearchEngine->RebuildUsedFields(-1);
-        }
+    {
+        m_plbField->set_sensitive(false);
+        m_pSearchEngine->RebuildUsedFields(-1);
+    }
 }
 
 IMPL_LINK_NOARG(FmSearchDialog, OnClickedSearchAgain, weld::Button&, void)
@@ -638,19 +643,19 @@ void FmSearchDialog::LoadParams()
         nInitialField = 0;
     m_plbField->set_active(nInitialField);
     OnFieldSelected(*m_plbField);
-    // all fields/single field (AFTER selecting the field because OnClickedFieldRadios expects a valid value there)
+    // all fields/single field (AFTER selecting the field because OnToggledFieldRadios expects a valid value there)
     if (aParams.bAllFields)
     {
         m_prbSingleField->set_active(false);
         m_prbAllFields->set_active(true);
-        OnClickedFieldRadios(*m_prbAllFields);
-        // OnClickedFieldRadios also calls to RebuildUsedFields
+        OnToggledFieldRadios(*m_prbAllFields);
+        // OnToggledFieldRadios also calls to RebuildUsedFields
     }
     else
     {
         m_prbAllFields->set_active(false);
         m_prbSingleField->set_active(true);
-        OnClickedFieldRadios(*m_prbSingleField);
+        OnToggledFieldRadios(*m_prbSingleField);
     }
 
     m_plbPosition->set_active(aParams.nPosition);
@@ -708,7 +713,7 @@ void FmSearchDialog::LoadParams()
         case 2: m_prbSearchForNotNull->set_active(true); break;
         default: m_prbSearchForText->set_active(true); break;
     }
-    OnClickedFieldRadios(*m_prbSearchForText);
+    OnToggledFieldRadios(*m_prbSearchForText);
 }
 
 void FmSearchDialog::SaveParams() const
diff --git a/cui/source/inc/cuifmsearch.hxx b/cui/source/inc/cuifmsearch.hxx
index 9b3a5f947016..0aed39b1aef4 100644
--- a/cui/source/inc/cuifmsearch.hxx
+++ b/cui/source/inc/cuifmsearch.hxx
@@ -148,7 +148,8 @@ private:
     void SaveParams() const;
 
     // Handler for the Controls
-    DECL_LINK(OnClickedFieldRadios, weld::Button&, void);
+    DECL_LINK(OnToggledSearchRadio, weld::ToggleButton&, void);
+    DECL_LINK(OnToggledFieldRadios, weld::ToggleButton&, void);
     DECL_LINK(OnClickedSearchAgain, weld::Button&, void);
     DECL_LINK(OnClickedSpecialSettings, weld::Button&, void);
 
diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index 8982e4d37a2b..973671355cbf 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -226,9 +226,9 @@ private:
     std::unique_ptr<weld::Label> m_xCalcStrFT;
 
     DECL_DLLPRIVATE_LINK( ModifyHdl_Impl, weld::ComboBox&, void );
-    DECL_DLLPRIVATE_LINK( FlagHdl_Impl, weld::Button&, void );
+    DECL_DLLPRIVATE_LINK( FlagHdl_Impl, weld::ToggleButton&, void );
     DECL_DLLPRIVATE_LINK( CommandHdl_Impl, weld::Button&, void );
-    DECL_DLLPRIVATE_LINK(TemplateHdl_Impl, weld::Button&, void);
+    DECL_DLLPRIVATE_LINK(TemplateHdl_Impl, weld::ToggleButton&, void);
     DECL_DLLPRIVATE_LINK( FocusHdl_Impl, weld::Widget&, void );
     DECL_DLLPRIVATE_LINK( LBSelectHdl_Impl, weld::ComboBox&, void );
     DECL_DLLPRIVATE_LINK(LoseFocusHdl_Impl, weld::Widget&, void);
diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx
index a3c8d453f2e3..b9affc0a755e 100644
--- a/svx/source/dialog/SafeModeDialog.cxx
+++ b/svx/source/dialog/SafeModeDialog.cxx
@@ -58,6 +58,9 @@ SafeModeDialog::SafeModeDialog(weld::Window* pParent)
 {
     m_xDialog->set_centered_on_parent(false);
     mxRadioRestore->connect_toggled(LINK(this, SafeModeDialog, RadioBtnHdl));
+    mxRadioConfigure->connect_toggled(LINK(this, SafeModeDialog, RadioBtnHdl));
+    mxRadioExtensions->connect_toggled(LINK(this, SafeModeDialog, RadioBtnHdl));
+    mxRadioReset->connect_toggled(LINK(this, SafeModeDialog, RadioBtnHdl));
 
     mxBtnContinue->connect_clicked(LINK(this, SafeModeDialog, DialogBtnHdl));
     mxBtnRestart->connect_clicked(LINK(this, SafeModeDialog, DialogBtnHdl));
@@ -193,8 +196,10 @@ void SafeModeDialog::applyChanges()
         css::uno::Reference< css::task::XInteractionHandler >());
 }
 
-IMPL_LINK_NOARG(SafeModeDialog, RadioBtnHdl, weld::ToggleButton&, void)
+IMPL_LINK(SafeModeDialog, RadioBtnHdl, weld::ToggleButton&, rButton, void)
 {
+    if (!rButton.get_active())
+        return;
     if (mxRadioRestore->get_active())
     {
         // Enable the currently selected box
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 2045730344d4..7736efae4a38 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -646,20 +646,20 @@ void SvxSearchDialog::InitControls_Impl()
     m_xSearchComponent1PB->connect_clicked( aLink2 );
     m_xSearchComponent2PB->connect_clicked( aLink2 );
 
-    aLink2 = LINK( this, SvxSearchDialog, FlagHdl_Impl );
-    m_xReplaceBackwardsCB->connect_clicked( aLink2 );
-    m_xWordBtn->connect_clicked( aLink2 );
-    m_xSelectionBtn->connect_clicked( aLink2 );
-    m_xMatchCaseCB->connect_clicked( aLink2 );
-    m_xRegExpBtn->connect_clicked( aLink2 );
-    m_xWildcardBtn->connect_clicked( aLink2 );
-    m_xNotesBtn->connect_clicked( aLink2 );
-    m_xSimilarityBox->connect_clicked( aLink2 );
-    m_xJapOptionsCB->connect_clicked( aLink2 );
-    m_xJapMatchFullHalfWidthCB->connect_clicked( aLink2 );
-    m_xIncludeDiacritics->connect_clicked( aLink2 );
-    m_xIncludeKashida->connect_clicked( aLink2 );
-    m_xLayoutBtn->connect_clicked( LINK( this, SvxSearchDialog, TemplateHdl_Impl ) );
+    Link<weld::ToggleButton&,void> aLink3 = LINK( this, SvxSearchDialog, FlagHdl_Impl );
+    m_xReplaceBackwardsCB->connect_toggled( aLink3 );
+    m_xWordBtn->connect_toggled( aLink3 );
+    m_xSelectionBtn->connect_toggled( aLink3 );
+    m_xMatchCaseCB->connect_toggled( aLink3 );
+    m_xRegExpBtn->connect_toggled( aLink3 );
+    m_xWildcardBtn->connect_toggled( aLink3 );
+    m_xNotesBtn->connect_toggled( aLink3 );
+    m_xSimilarityBox->connect_toggled( aLink3 );
+    m_xJapOptionsCB->connect_toggled( aLink3 );
+    m_xJapMatchFullHalfWidthCB->connect_toggled( aLink3 );
+    m_xIncludeDiacritics->connect_toggled( aLink3 );
+    m_xIncludeKashida->connect_toggled( aLink3 );
+    m_xLayoutBtn->connect_toggled( LINK( this, SvxSearchDialog, TemplateHdl_Impl ) );
     m_xFormatBtn->connect_clicked( LINK( this, SvxSearchDialog, FormatHdl_Impl ) );
     m_xNoFormatBtn->connect_clicked(
         LINK( this, SvxSearchDialog, NoFormatHdl_Impl ) );
@@ -804,12 +804,12 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
     {
         m_xCalcGrid->show();
         m_xSearchFormattedCB->set_active( aOpt.IsSearchFormatted() );
-        Link<weld::Button&,void> aLink = LINK( this, SvxSearchDialog, FlagHdl_Impl );
+        Link<weld::ToggleButton&,void> aLink = LINK( this, SvxSearchDialog, FlagHdl_Impl );
         m_xCalcSearchInLB->connect_changed( LINK( this, SvxSearchDialog, LBSelectHdl_Impl ) );
-        m_xRowsBtn->connect_clicked( aLink );
-        m_xColumnsBtn->connect_clicked( aLink );
-        m_xAllSheetsCB->connect_clicked( aLink );
-        m_xSearchFormattedCB->connect_clicked( aLink );
+        m_xRowsBtn->connect_toggled( aLink );
+        m_xColumnsBtn->connect_toggled( aLink );
+        m_xAllSheetsCB->connect_toggled( aLink );
+        m_xSearchFormattedCB->connect_toggled( aLink );
 
         ModifyFlags nModifyFlagCheck;
         switch ( pSearchItem->GetCellType() )
@@ -1125,7 +1125,7 @@ IMPL_LINK( SvxSearchDialog, LBSelectHdl_Impl, weld::ComboBox&, rCtrl, void )
     ClickHdl_Impl(&rCtrl);
 }
 
-IMPL_LINK( SvxSearchDialog, FlagHdl_Impl, weld::Button&, rCtrl, void )
+IMPL_LINK( SvxSearchDialog, FlagHdl_Impl, weld::ToggleButton&, rCtrl, void )
 {
     ClickHdl_Impl(&rCtrl);
 }
@@ -1479,7 +1479,7 @@ IMPL_LINK( SvxSearchDialog, ModifyHdl_Impl, weld::ComboBox&, rEd, void )
     }
 }
 
-IMPL_LINK_NOARG(SvxSearchDialog, TemplateHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(SvxSearchDialog, TemplateHdl_Impl, weld::ToggleButton&, void)
 {
     if ( pImpl->bSaveToModule )
         SaveToModule_Impl();
diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx
index 60a060085f3a..1f407f53d8b6 100644
--- a/svx/source/tbxctrls/extrusioncontrols.cxx
+++ b/svx/source/tbxctrls/extrusioncontrols.cxx
@@ -443,9 +443,9 @@ void ExtrusionDepthWindow::statusChanged(
     }
 }
 
-IMPL_LINK_NOARG(ExtrusionDepthWindow, SelectHdl, weld::ToggleButton&, void)
+IMPL_LINK(ExtrusionDepthWindow, SelectHdl, weld::ToggleButton&, rButton, void)
 {
-    if (mbSettingValue)
+    if (mbSettingValue || !rButton.get_active())
         return;
 
     if (mxCustom->get_active())
@@ -604,6 +604,8 @@ ExtrusionLightingWindow::ExtrusionLightingWindow(svt::PopupWindowController* pCo
     mxLightingSet->SetOutputSizePixel(aSize);
 
     mxBright->connect_toggled(LINK(this, ExtrusionLightingWindow, SelectToolbarMenuHdl));
+    mxNormal->connect_toggled(LINK(this, ExtrusionLightingWindow, SelectToolbarMenuHdl));
+    mxDim->connect_toggled(LINK(this, ExtrusionLightingWindow, SelectToolbarMenuHdl));
 
     AddStatusListener( g_sExtrusionLightingDirection );
     AddStatusListener( g_sExtrusionLightingIntensity );
@@ -707,8 +709,11 @@ IMPL_LINK_NOARG(ExtrusionLightingWindow, SelectValueSetHdl, ValueSet*, void)
     mxControl->EndPopupMode();
 }
 
-IMPL_LINK_NOARG(ExtrusionLightingWindow, SelectToolbarMenuHdl, weld::ToggleButton&, void)
+IMPL_LINK(ExtrusionLightingWindow, SelectToolbarMenuHdl, weld::ToggleButton&, rButton, void)
 {
+    if (!rButton.get_active())
+        return;
+
     int nLevel;
     if (mxBright->get_active())
         nLevel = 0;
@@ -798,6 +803,9 @@ ExtrusionSurfaceWindow::ExtrusionSurfaceWindow(svt::PopupWindowController* pCont
     , mxMetal(m_xBuilder->weld_radio_button("metal"))
 {
     mxWireFrame->connect_toggled(LINK(this, ExtrusionSurfaceWindow, SelectHdl));
+    mxMatt->connect_toggled(LINK(this, ExtrusionSurfaceWindow, SelectHdl));
+    mxPlastic->connect_toggled(LINK(this, ExtrusionSurfaceWindow, SelectHdl));
+    mxMetal->connect_toggled(LINK(this, ExtrusionSurfaceWindow, SelectHdl));
 
     AddStatusListener( g_sExtrusionSurface );
 }
@@ -838,8 +846,11 @@ void ExtrusionSurfaceWindow::statusChanged(
     }
 }
 
-IMPL_LINK_NOARG(ExtrusionSurfaceWindow, SelectHdl, weld::ToggleButton&, void)
+IMPL_LINK(ExtrusionSurfaceWindow, SelectHdl, weld::ToggleButton&, rButton, void)
 {
+    if (!rButton.get_active())
+        return;
+
     sal_Int32 nSurface;
     if (mxWireFrame->get_active())
         nSurface = 0;
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index f024e8524fdb..5c6ac0d1bb7f 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -479,6 +479,7 @@ private:
     std::unique_ptr<weld::CheckButton> mxKernPairs;
     bool mbSettingValue;
 
+    DECL_LINK( KernSelectHdl, weld::ToggleButton&, void );
     DECL_LINK( SelectHdl, weld::ToggleButton&, void );
 
     void    implSetCharacterSpacing( sal_Int32 nCharacterSpacing, bool bEnabled );
@@ -502,9 +503,14 @@ FontworkCharacterSpacingWindow::FontworkCharacterSpacingWindow(svt::PopupWindowC
     , mxKernPairs(m_xBuilder->weld_check_button("kernpairs"))
     , mbSettingValue(false)
 {
+    mxVeryTight->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl));
+    mxTight->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl));
     mxNormal->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl));
+    mxLoose->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl));
+    mxVeryLoose->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl));
+    mxCustom->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl));
 
-    mxKernPairs->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, SelectHdl));
+    mxKernPairs->connect_toggled(LINK(this, FontworkCharacterSpacingWindow, KernSelectHdl));
 
     AddStatusListener( gsFontworkCharacterSpacing );
     AddStatusListener( gsFontworkKernCharacterPairs );
@@ -596,11 +602,31 @@ void FontworkCharacterSpacingWindow::statusChanged( const css::frame::FeatureSta
     }
 }
 
-IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, SelectHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, KernSelectHdl, weld::ToggleButton&, void)
 {
     if (mbSettingValue)
         return;
 
+    Sequence< PropertyValue > aArgs( 1 );
+    aArgs[0].Name = OUString(gsFontworkKernCharacterPairs).copy(5);
+    bool bKernOnOff = mxKernPairs->get_active();
+    aArgs[0].Value <<= bKernOnOff;
+
+    mxControl->dispatchCommand( gsFontworkKernCharacterPairs, aArgs );
+
+    implSetKernCharacterPairs(bKernOnOff, true);
+
+    mxControl->EndPopupMode();
+}
+
+IMPL_LINK(FontworkCharacterSpacingWindow, SelectHdl, weld::ToggleButton&, rButton, void)
+{
+    if (!rButton.get_active())
+        return;
+
+    if (mbSettingValue)
+        return;
+
     if (mxCustom->get_active())
     {
         Sequence< PropertyValue > aArgs( 1 );
@@ -611,17 +637,6 @@ IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, SelectHdl, weld::ToggleButton&,
         xControl->EndPopupMode();
         xControl->dispatchCommand(".uno:FontworkCharacterSpacingDialog", aArgs);
     }
-    else if (mxKernPairs->get_active())
-    {
-        Sequence< PropertyValue > aArgs( 1 );
-        aArgs[0].Name = OUString(gsFontworkKernCharacterPairs).copy(5);
-        bool bKernOnOff = mxKernPairs->get_active();
-        aArgs[0].Value <<= bKernOnOff;
-
-        mxControl->dispatchCommand( gsFontworkKernCharacterPairs, aArgs );
-
-        implSetKernCharacterPairs(bKernOnOff, true);
-    }
     else
     {
         sal_Int32 nCharacterSpacing;


More information about the Libreoffice-commits mailing list