diff options
author | Jim Raykowski <raykowj@gmail.com> | 2018-03-18 13:10:46 -0800 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-03-27 15:30:06 +0200 |
commit | 464d95eca4e2febc0268fe3833f0596bb4ced005 (patch) | |
tree | a9f99ab494285a4ffd2913fcc8c8bfa5fd14e2e5 /svx | |
parent | 8b9075f8f4f47c469dd63c3a3bc2d55d41f5e735 (diff) |
tdf#81925 Make messages show in Findbar searchlabel overflow toolbar
...and add a bit more horizontal space for messages
Change-Id: I4a310d7a4a649860a36ce12b775bb6b275cd6ef5
Reviewed-on: https://gerrit.libreoffice.org/51523
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 29 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbunosearchcontrollers.cxx | 17 |
2 files changed, 43 insertions, 3 deletions
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 0e46b65fc6a4..99e6823b3cde 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -2406,6 +2406,35 @@ static void lcl_SetSearchLabelWindow(const OUString& rStr) pToolBox->Resize(); } +OUString SvxSearchDialogWrapper::GetSearchLabel() +{ + SfxViewFrame* pViewFrame = SfxViewFrame::Current(); + if (!pViewFrame) + return OUString(); + + css::uno::Reference< css::beans::XPropertySet > xPropSet( + pViewFrame->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; + xPropSet->getPropertyValue("LayoutManager") >>= xLayoutManager; + css::uno::Reference< css::ui::XUIElement > xUIElement = + xLayoutManager->getElement("private:resource/toolbar/findbar"); + if (!xUIElement.is()) + return OUString(); + css::uno::Reference< css::awt::XWindow > xWindow( + xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW); + VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow).get() ); + for (ToolBox::ImplToolItems::size_type i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i) + { + sal_uInt16 id = pToolBox->GetItemId(i); + if (pToolBox->GetItemCommand(id) == ".uno:SearchLabel") + { + vcl::Window* pSearchLabel = pToolBox->GetItemWindow(id); + return pSearchLabel ? pSearchLabel->GetText() : OUString(); + } + } + return OUString(); +} + void SvxSearchDialogWrapper::SetSearchLabel(const SearchLabel& rSL) { OUString sStr; diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index e41751c6beac..5177177ebca3 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -1196,6 +1196,9 @@ public: // XStatusListener virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; + +private: + VclPtr<vcl::Window> m_pSL; }; SearchLabelToolboxController::SearchLabelToolboxController( const css::uno::Reference< css::uno::XComponentContext > & rxContext ) @@ -1250,6 +1253,7 @@ void SAL_CALL SearchLabelToolboxController::dispose() SearchToolbarControllersManager::createControllersManager().freeController(m_xFrame, m_aCommandURL); svt::ToolboxController::dispose(); + m_pSL.disposeAndClear(); } // XInitialization @@ -1262,13 +1266,20 @@ void SAL_CALL SearchLabelToolboxController::initialize( const css::uno::Sequence // XStatusListener void SAL_CALL SearchLabelToolboxController::statusChanged( const css::frame::FeatureStateEvent& ) { + if (m_pSL) + { + OUString aStr = SvxSearchDialogWrapper::GetSearchLabel(); + m_pSL->SetText(aStr); + long aWidth = !aStr.isEmpty() ? m_pSL->get_preferred_size().getWidth() : 300; + m_pSL->SetSizePixel(Size(aWidth, m_pSL->get_preferred_size().getHeight())); + } } css::uno::Reference< css::awt::XWindow > SAL_CALL SearchLabelToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) { - VclPtr<vcl::Window> pSL = VclPtr<FixedText>::Create(VCLUnoHelper::GetWindow( Parent )); - pSL->SetSizePixel(Size(250, 25)); - return VCLUnoHelper::GetInterface(pSL); + m_pSL = VclPtr<FixedText>::Create(VCLUnoHelper::GetWindow( Parent )); + m_pSL->SetSizePixel(Size(300, 25)); + return VCLUnoHelper::GetInterface(m_pSL); } // protocol handler for "vnd.sun.star.findbar:*" URLs |