diff options
Diffstat (limited to 'svx/source/tbxctrls/tbunosearchcontrollers.cxx')
-rw-r--r-- | svx/source/tbxctrls/tbunosearchcontrollers.cxx | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 1c620ef7da3e..ec8f23b7f8f0 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -59,10 +59,9 @@ #include <rtl/instance.hxx> #include <svx/srchdlg.hxx> #include <vcl/event.hxx> -#include <vcl/fixed.hxx> -#include <vcl/window.hxx> #include <findtextfield.hxx> +#include <labelitemwindow.hxx> using namespace css; @@ -1300,7 +1299,7 @@ public: virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; private: - VclPtr<vcl::Window> m_pSL; + VclPtr<LabelItemWindow> m_xSL; }; SearchLabelToolboxController::SearchLabelToolboxController( const css::uno::Reference< css::uno::XComponentContext > & rxContext ) @@ -1355,7 +1354,7 @@ void SAL_CALL SearchLabelToolboxController::dispose() SearchToolbarControllersManager::createControllersManager().freeController(m_xFrame, m_aCommandURL); svt::ToolboxController::dispose(); - m_pSL.disposeAndClear(); + m_xSL.disposeAndClear(); } // XInitialization @@ -1368,20 +1367,27 @@ void SAL_CALL SearchLabelToolboxController::initialize( const css::uno::Sequence // XStatusListener void SAL_CALL SearchLabelToolboxController::statusChanged( const css::frame::FeatureStateEvent& ) { - if (m_pSL) + if (m_xSL) { OUString aStr = SvxSearchDialogWrapper::GetSearchLabel(); - m_pSL->SetText(aStr); - long aWidth = !aStr.isEmpty() ? m_pSL->get_preferred_size().getWidth() : 16; - m_pSL->SetSizePixel(Size(aWidth, m_pSL->get_preferred_size().getHeight())); + m_xSL->set_label(aStr); + m_xSL->SetOptimalSize(); + Size aSize(m_xSL->GetSizePixel()); + long nWidth = !aStr.isEmpty() ? aSize.getWidth() : 16; + m_xSL->SetSizePixel(Size(nWidth, aSize.Height())); } } 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(16, 25)); - return VCLUnoHelper::GetInterface(m_pSL); + ToolBox* pToolBox = nullptr; + sal_uInt16 nId = 0; + if (getToolboxId(nId, &pToolBox)) + pToolBox->SetItemWindowNonInteractive(nId, true); + + m_xSL = VclPtr<LabelItemWindow>::Create(VCLUnoHelper::GetWindow(Parent), ""); + m_xSL->SetSizePixel(Size(16, m_xSL->GetSizePixel().Height())); + return VCLUnoHelper::GetInterface(m_xSL); } // protocol handler for "vnd.sun.star.findbar:*" URLs |