diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-29 16:13:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-30 08:27:52 +0200 |
commit | 5f646281f777019a4e91c467f1d6f8a7f2083ffd (patch) | |
tree | 742667b0a19517c75f1397df86ba45dd7e18b231 /sc/source/ui/dbgui/validate.cxx | |
parent | a5be8e97b7699c7d12fa3ae5404af7b2eb50fafb (diff) |
loplugin:flatten in sc/ui
Change-Id: I4e12da123924b1036c1348ad1b04eef1826ae26a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99703
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/dbgui/validate.cxx')
-rw-r--r-- | sc/source/ui/dbgui/validate.cxx | 125 |
1 files changed, 64 insertions, 61 deletions
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 33d5fcd485a7..74b9fff08716 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -139,28 +139,29 @@ void ScTPValidationValue:: SetActiveHdl() void ScTPValidationValue::RefInputStartPreHdl( formula::RefEdit* pEdit, const formula::RefButton* pButton ) { - if (ScValidationDlg *pValidationDlg = GetValidationDlg()) - { - weld::Container* pNewParent = pValidationDlg->get_refinput_shrink_parent(); - if (pEdit == m_pRefEdit && pNewParent != m_pRefEditParent) - { - m_xRefGrid->move(m_pRefEdit->GetWidget(), pNewParent); - m_pRefEditParent = pNewParent; - } + ScValidationDlg *pValidationDlg = GetValidationDlg(); + if (!pValidationDlg) + return; - if (pNewParent != m_pBtnRefParent) - { - // if Edit SetParent but button not, the tab order will be - // incorrect, so move button anyway, and restore - // parent later in order to restore the tab order. But - // hide it if it's moved but unwanted. - m_xRefGrid->move(m_xBtnRef->GetWidget(), pNewParent); - m_xBtnRef->GetWidget()->set_visible(pButton == m_xBtnRef.get()); - m_pBtnRefParent = pNewParent; - } + weld::Container* pNewParent = pValidationDlg->get_refinput_shrink_parent(); + if (pEdit == m_pRefEdit && pNewParent != m_pRefEditParent) + { + m_xRefGrid->move(m_pRefEdit->GetWidget(), pNewParent); + m_pRefEditParent = pNewParent; + } - pNewParent->show(); + if (pNewParent != m_pBtnRefParent) + { + // if Edit SetParent but button not, the tab order will be + // incorrect, so move button anyway, and restore + // parent later in order to restore the tab order. But + // hide it if it's moved but unwanted. + m_xRefGrid->move(m_xBtnRef->GetWidget(), pNewParent); + m_xBtnRef->GetWidget()->set_visible(pButton == m_xBtnRef.get()); + m_pBtnRefParent = pNewParent; } + + pNewParent->show(); } void ScTPValidationValue::RefInputDonePostHdl() @@ -530,59 +531,61 @@ ScValidationDlg * ScTPValidationValue::GetValidationDlg() void ScTPValidationValue::SetupRefDlg() { - if( ScValidationDlg *pValidationDlg = GetValidationDlg() ) - { - if( pValidationDlg->SetupRefDlg() ) - { - pValidationDlg->SetHandler( this ); - pValidationDlg->SetSetRefHdl( static_cast<ScRefHandlerHelper::PFUNCSETREFHDLTYPE>( &ScTPValidationValue::SetReferenceHdl ) ); - pValidationDlg->SetSetActHdl( static_cast<ScRefHandlerHelper::PCOMMONHDLTYPE>( &ScTPValidationValue::SetActiveHdl ) ); - pValidationDlg->SetRefInputStartPreHdl( static_cast<ScRefHandlerHelper::PINPUTSTARTDLTYPE>( &ScTPValidationValue::RefInputStartPreHdl ) ); - pValidationDlg->SetRefInputDonePostHdl( static_cast<ScRefHandlerHelper::PCOMMONHDLTYPE>( &ScTPValidationValue::RefInputDonePostHdl ) ); + ScValidationDlg *pValidationDlg = GetValidationDlg(); + if( !pValidationDlg ) + return; - weld::Label* pLabel = nullptr; + if( !pValidationDlg->SetupRefDlg() ) + return; - if (m_xEdMax->GetWidget()->get_visible()) - { - m_pRefEdit = m_xEdMax.get(); - pLabel = m_xFtMax.get(); - } - else if (m_xEdMin->GetWidget()->get_visible()) - { - m_pRefEdit = m_xEdMin.get(); - pLabel = m_xFtMin.get(); - } + pValidationDlg->SetHandler( this ); + pValidationDlg->SetSetRefHdl( static_cast<ScRefHandlerHelper::PFUNCSETREFHDLTYPE>( &ScTPValidationValue::SetReferenceHdl ) ); + pValidationDlg->SetSetActHdl( static_cast<ScRefHandlerHelper::PCOMMONHDLTYPE>( &ScTPValidationValue::SetActiveHdl ) ); + pValidationDlg->SetRefInputStartPreHdl( static_cast<ScRefHandlerHelper::PINPUTSTARTDLTYPE>( &ScTPValidationValue::RefInputStartPreHdl ) ); + pValidationDlg->SetRefInputDonePostHdl( static_cast<ScRefHandlerHelper::PCOMMONHDLTYPE>( &ScTPValidationValue::RefInputDonePostHdl ) ); - if (m_pRefEdit && !m_pRefEdit->GetWidget()->has_focus()) - m_pRefEdit->GrabFocus(); + weld::Label* pLabel = nullptr; - if( m_pRefEdit ) - m_pRefEdit->SetReferences( pValidationDlg, pLabel ); - - m_xBtnRef->SetReferences( pValidationDlg, m_pRefEdit ); - } + if (m_xEdMax->GetWidget()->get_visible()) + { + m_pRefEdit = m_xEdMax.get(); + pLabel = m_xFtMax.get(); + } + else if (m_xEdMin->GetWidget()->get_visible()) + { + m_pRefEdit = m_xEdMin.get(); + pLabel = m_xFtMin.get(); } + + if (m_pRefEdit && !m_pRefEdit->GetWidget()->has_focus()) + m_pRefEdit->GrabFocus(); + + if( m_pRefEdit ) + m_pRefEdit->SetReferences( pValidationDlg, pLabel ); + + m_xBtnRef->SetReferences( pValidationDlg, m_pRefEdit ); } void ScTPValidationValue::RemoveRefDlg(bool bRestoreModal) { - if( ScValidationDlg *pValidationDlg = GetValidationDlg() ) - { - if( pValidationDlg->RemoveRefDlg(bRestoreModal) ) - { - pValidationDlg->SetHandler( nullptr ); - pValidationDlg->SetSetRefHdl( nullptr ); - pValidationDlg->SetSetActHdl( nullptr ); - pValidationDlg->SetRefInputStartPreHdl( nullptr ); - pValidationDlg->SetRefInputDonePostHdl( nullptr ); + ScValidationDlg *pValidationDlg = GetValidationDlg(); + if( !pValidationDlg ) + return; - if( m_pRefEdit ) - m_pRefEdit->SetReferences( nullptr, nullptr ); - m_pRefEdit = nullptr; + if( !pValidationDlg->RemoveRefDlg(bRestoreModal) ) + return; - m_xBtnRef->SetReferences( nullptr, nullptr ); - } - } + pValidationDlg->SetHandler( nullptr ); + pValidationDlg->SetSetRefHdl( nullptr ); + pValidationDlg->SetSetActHdl( nullptr ); + pValidationDlg->SetRefInputStartPreHdl( nullptr ); + pValidationDlg->SetRefInputDonePostHdl( nullptr ); + + if( m_pRefEdit ) + m_pRefEdit->SetReferences( nullptr, nullptr ); + m_pRefEdit = nullptr; + + m_xBtnRef->SetReferences( nullptr, nullptr ); } IMPL_LINK_NOARG(ScTPValidationValue, EditSetFocusHdl, formula::RefEdit&, void) |