tdf#116596 Dynamically size Findbar searchlabel
Change-Id: I74d09d439ada6d92fca396ac45c60340cb55e668
Reviewed-on: https://gerrit.libreoffice.org/52043
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 99e6823..3b7fca0 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -2369,7 +2369,6 @@ SfxChildWinInfo SvxSearchDialogWrapper::GetInfo() const
return aInfo;
}
static void lcl_SetSearchLabelWindow(const OUString& rStr)
{
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
@@ -2394,15 +2393,14 @@ static void lcl_SetSearchLabelWindow(const OUString& rStr)
{
vcl::Window* pSearchLabel = pToolBox->GetItemWindow(id);
assert(pSearchLabel);
pSearchLabel->Hide();
pSearchLabel->SetText(rStr);
if (!rStr.isEmpty())
{
if (rStr.isEmpty())
pSearchLabel->SetSizePixel(Size(16, pSearchLabel->get_preferred_size().Height()));
else
pSearchLabel->SetSizePixel(pSearchLabel->get_preferred_size());
pSearchLabel->Show();
}
}
}
xLayoutManager->doLayout();
pToolBox->Resize();
}
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index cfe346d..aa4b03f 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -1269,7 +1269,7 @@ void SAL_CALL SearchLabelToolboxController::statusChanged( const css::frame::Fea
{
OUString aStr = SvxSearchDialogWrapper::GetSearchLabel();
m_pSL->SetText(aStr);
long aWidth = !aStr.isEmpty() ? m_pSL->get_preferred_size().getWidth() : 300;
long aWidth = !aStr.isEmpty() ? m_pSL->get_preferred_size().getWidth() : 16;
m_pSL->SetSizePixel(Size(aWidth, m_pSL->get_preferred_size().getHeight()));
}
}
@@ -1277,7 +1277,7 @@ void SAL_CALL SearchLabelToolboxController::statusChanged( const css::frame::Fea
css::uno::Reference< css::awt::XWindow > SAL_CALL SearchLabelToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent )
{
m_pSL = VclPtr<FixedText>::Create(VCLUnoHelper::GetWindow( Parent ));
m_pSL->SetSizePixel(Size(300, 25));
m_pSL->SetSizePixel(Size(16, 25));
return VCLUnoHelper::GetInterface(m_pSL);
}