summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-04 15:37:14 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2018-10-07 21:41:09 +0200
commit7dbe17d5a6b866cca9b81418f3f0cd1d32214265 (patch)
tree15c63cf3d6b93ca2ab37e3352b90f9789b8c08a9
parent2e4e28004439c9d0cdd6414fbda6d41c0c000a42 (diff)
Resolves: tdf#106340 resize dialog when search/replace labels are shown/hidden
Change-Id: I1e20807f613a73c7dbefcb8e331f99d484eb5c04 Reviewed-on: https://gerrit.libreoffice.org/61394 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.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 6a999380ee7a..ec59bef81287 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -1103,6 +1103,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;
@@ -1119,7 +1121,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;
}
}
@@ -1138,11 +1144,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();
}
@@ -1569,8 +1582,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();
@@ -1596,8 +1613,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);
@@ -2093,19 +2114,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;
@@ -2221,24 +2255,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 )
{