svx/source/dialog/srchdlg.cxx | 66 +++++++++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 11 deletions(-)
New commits: commit 78010a4db197ac44fb729a122464847931ee0e5b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Oct 4 15:37:14 2018 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Oct 4 22:20:46 2018 +0200 Resolves: tdf#106340 resize dialog when search/replace labels are shown/hidden Change-Id: I1e20807f613a73c7dbefcb8e331f99d484eb5c04 Reviewed-on: https://gerrit.libreoffice.org/61384 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 7f8595cf80ed..1d3c43ccc13a 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -1098,6 +1098,8 @@ void SvxSearchDialog::InitAttrList_Impl( const SfxItemSet* pSSet, memcpy( pImpl->pRanges.get(), pTmp, sizeof(sal_uInt16) * nCnt ); } + bool bSetOptimalLayoutSize = false; + // See to it that are the texts of the attributes are correct OUString aDesc; @@ -1113,7 +1115,11 @@ void SvxSearchDialog::InitAttrList_Impl( const SfxItemSet* pSSet, if ( !aDesc.isEmpty() ) { - m_pSearchAttrText->Show(); + if (!m_pSearchAttrText->IsVisible()) + { + m_pSearchAttrText->Show(); + bSetOptimalLayoutSize = true; + } bFormat |= true; } } @@ -1131,11 +1137,18 @@ void SvxSearchDialog::InitAttrList_Impl( const SfxItemSet* pSSet, if ( !aDesc.isEmpty() ) { - m_pReplaceAttrText->Show(); + if (!m_pReplaceAttrText->IsVisible()) + { + m_pReplaceAttrText->Show(); + bSetOptimalLayoutSize = true; + } bFormat |= true; } } } + + if (bSetOptimalLayoutSize) + setOptimalLayoutSize(); } @@ -1554,8 +1567,12 @@ IMPL_LINK_NOARG(SvxSearchDialog, TemplateHdl_Impl, Button*, void) if(!sDesc.isEmpty()) { - m_pSearchAttrText->Show(); - m_pReplaceAttrText->Show(); + if (!m_pReplaceAttrText->IsVisible() || !m_pReplaceAttrText->IsVisible()) + { + m_pSearchAttrText->Show(); + m_pReplaceAttrText->Show(); + setOptimalLayoutSize(); + } } } m_pFormatBtn->Disable(); @@ -1581,8 +1598,12 @@ IMPL_LINK_NOARG(SvxSearchDialog, TemplateHdl_Impl, Button*, void) if(!sDesc.isEmpty()) { - m_pSearchAttrText->Show(); - m_pReplaceAttrText->Show(); + if (!m_pReplaceAttrText->IsVisible() || !m_pReplaceAttrText->IsVisible()) + { + m_pSearchAttrText->Show(); + m_pReplaceAttrText->Show(); + setOptimalLayoutSize(); + } } EnableControl_Impl(m_pFormatBtn); @@ -2073,19 +2094,32 @@ IMPL_LINK_NOARG(SvxSearchDialog, NoFormatHdl_Impl, Button*, void) bFormat = false; m_pLayoutBtn->Check( false ); + bool bSetOptimalLayoutSize = false; + if ( bSearch ) { pSearchList->Clear(); m_pSearchAttrText->SetText( "" ); - m_pSearchAttrText->Hide(); + if (m_pSearchAttrText->IsVisible()) + { + m_pSearchAttrText->Hide(); + bSetOptimalLayoutSize = true; + } } else { pReplaceList->Clear(); m_pReplaceAttrText->SetText( "" ); - m_pReplaceAttrText->Hide(); + if (m_pReplaceAttrText->IsVisible()) + { + m_pReplaceAttrText->Hide(); + bSetOptimalLayoutSize = true; + } } + if (bSetOptimalLayoutSize) + setOptimalLayoutSize(); + pImpl->bSaveToModule = false; TemplateHdl_Impl(m_pLayoutBtn); pImpl->bSaveToModule = true; @@ -2197,24 +2231,34 @@ void SvxSearchDialog::PaintAttrText_Impl() if ( !bFormat && !aDesc.isEmpty() ) bFormat = true; + bool bSetOptimalLayoutSize = false; + if ( bSearch ) { m_pSearchAttrText->SetText( aDesc ); - if(!aDesc.isEmpty()) + if (!aDesc.isEmpty() && !m_pSearchAttrText->IsVisible()) + { m_pSearchAttrText->Show(); + bSetOptimalLayoutSize = true; + } FocusHdl_Impl(*m_pSearchLB); } else { m_pReplaceAttrText->SetText( aDesc ); - if(!aDesc.isEmpty()) + if (!aDesc.isEmpty() && !m_pReplaceAttrText->IsVisible()) + { m_pReplaceAttrText->Show(); + bSetOptimalLayoutSize = true; + } FocusHdl_Impl(*m_pReplaceLB); } -} + if (bSetOptimalLayoutSize) + setOptimalLayoutSize(); +} void SvxSearchDialog::SetModifyFlag_Impl( const Control* pCtrl ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits