Kaydet (Commit) 464d95ec authored tarafından Jim Raykowski's avatar Jim Raykowski Kaydeden (comit) Thorsten Behrens

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/51523Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 8b9075f8
......@@ -101,6 +101,7 @@ public:
SvxSearchDialog *getDialog () { return dialog;}
static void SetSearchLabel(const SearchLabel& rSL);
static void SetSearchLabel(const OUString& sStr);
static OUString GetSearchLabel();
SFX_DECL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper);
};
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment