summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-04 15:37:14 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-04 22:20:46 +0200
commit78010a4db197ac44fb729a122464847931ee0e5b (patch)
tree99a15ef7c5d061db7c404b80e59330794858eb55
parent90bf93135e9eff21eda2c0b4e94ed727a2449a72 (diff)
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 <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--svx/source/dialog/srchdlg.cxx66
1 files changed, 55 insertions, 11 deletions
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 )
{