|
|
27aea6 |
From d83c1e5de554b7722d0a3161ba757e6e4785810e Mon Sep 17 00:00:00 2001
|
|
|
27aea6 |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
|
27aea6 |
Date: Tue, 20 Feb 2018 13:59:08 +0000
|
|
|
27aea6 |
Subject: [PATCH] Resolves: rhbz#1546997 'search not found' at 0,0 when window
|
|
|
27aea6 |
too narrow
|
|
|
27aea6 |
MIME-Version: 1.0
|
|
|
27aea6 |
Content-Type: text/plain; charset=UTF-8
|
|
|
27aea6 |
Content-Transfer-Encoding: 8bit
|
|
|
27aea6 |
|
|
|
27aea6 |
if the statusbar hadn't got space for the initial label, then it doesn't get set a position,
|
|
|
27aea6 |
so when later forced visible it draws at 0,0
|
|
|
27aea6 |
|
|
|
27aea6 |
call Resize on the toolbox to get it to relayout, and while we're at it
|
|
|
27aea6 |
set the required size of the label so we might have space for it if that
|
|
|
27aea6 |
text is shorter than the original len allocation
|
|
|
27aea6 |
|
|
|
27aea6 |
Change-Id: I37d20125d8195b2c75e83e9673c82c2011ceda8e
|
|
|
27aea6 |
Reviewed-on: https://gerrit.libreoffice.org/50041
|
|
|
27aea6 |
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
|
|
|
27aea6 |
Tested-by: Caolán McNamara <caolanm@redhat.com>
|
|
|
27aea6 |
---
|
|
|
27aea6 |
svx/source/dialog/srchdlg.cxx | 48 ++++++++++++++++++++-----------------------
|
|
|
27aea6 |
1 file changed, 22 insertions(+), 26 deletions(-)
|
|
|
27aea6 |
|
|
|
27aea6 |
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
|
|
|
27aea6 |
index 4cea924..50c19a3 100644
|
|
|
27aea6 |
--- a/svx/source/dialog/srchdlg.cxx
|
|
|
27aea6 |
+++ b/svx/source/dialog/srchdlg.cxx
|
|
|
27aea6 |
@@ -2375,11 +2375,11 @@ SfxChildWinInfo SvxSearchDialogWrapper::GetInfo() const
|
|
|
27aea6 |
}
|
|
|
27aea6 |
|
|
|
27aea6 |
|
|
|
27aea6 |
-static vcl::Window* lcl_GetSearchLabelWindow()
|
|
|
27aea6 |
+static void lcl_SetSearchLabelWindow(const OUString& rStr)
|
|
|
27aea6 |
{
|
|
|
27aea6 |
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
|
|
|
27aea6 |
if (!pViewFrame)
|
|
|
27aea6 |
- return nullptr;
|
|
|
27aea6 |
+ return;
|
|
|
27aea6 |
|
|
|
27aea6 |
css::uno::Reference< css::beans::XPropertySet > xPropSet(
|
|
|
27aea6 |
pViewFrame->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY_THROW);
|
|
|
27aea6 |
@@ -2388,14 +2388,28 @@ static vcl::Window* lcl_GetSearchLabelWindow()
|
|
|
27aea6 |
css::uno::Reference< css::ui::XUIElement > xUIElement =
|
|
|
27aea6 |
xLayoutManager->getElement("private:resource/toolbar/findbar");
|
|
|
27aea6 |
if (!xUIElement.is())
|
|
|
27aea6 |
- return nullptr;
|
|
|
27aea6 |
+ return;
|
|
|
27aea6 |
css::uno::Reference< css::awt::XWindow > xWindow(
|
|
|
27aea6 |
xUIElement->getRealInterface(), css::uno::UNO_QUERY_THROW);
|
|
|
27aea6 |
VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>( VCLUnoHelper::GetWindow(xWindow).get() );
|
|
|
27aea6 |
- for (size_t i = 0; pToolBox && i < pToolBox->GetItemCount(); ++i)
|
|
|
27aea6 |
+ if (!pToolBox)
|
|
|
27aea6 |
+ return;
|
|
|
27aea6 |
+ for (size_t i = 0; i < pToolBox->GetItemCount(); ++i)
|
|
|
27aea6 |
+ {
|
|
|
27aea6 |
if (pToolBox->GetItemCommand(i) == ".uno:SearchLabel")
|
|
|
27aea6 |
- return pToolBox->GetItemWindow(i);
|
|
|
27aea6 |
- return nullptr;
|
|
|
27aea6 |
+ {
|
|
|
27aea6 |
+ vcl::Window* pSearchLabel = pToolBox->GetItemWindow(i);
|
|
|
27aea6 |
+ assert(pSearchLabel);
|
|
|
27aea6 |
+ pSearchLabel->Hide();
|
|
|
27aea6 |
+ pSearchLabel->SetText(rStr);
|
|
|
27aea6 |
+ if (!rStr.isEmpty())
|
|
|
27aea6 |
+ {
|
|
|
27aea6 |
+ pSearchLabel->SetSizePixel(pSearchLabel->get_preferred_size());
|
|
|
27aea6 |
+ pSearchLabel->Show();
|
|
|
27aea6 |
+ }
|
|
|
27aea6 |
+ }
|
|
|
27aea6 |
+ }
|
|
|
27aea6 |
+ pToolBox->Resize();
|
|
|
27aea6 |
}
|
|
|
27aea6 |
|
|
|
27aea6 |
void SvxSearchDialogWrapper::SetSearchLabel(const SearchLabel& rSL)
|
|
|
27aea6 |
@@ -2410,16 +2424,7 @@ void SvxSearchDialogWrapper::SetSearchLabel(const SearchLabel& rSL)
|
|
|
27aea6 |
else if (rSL == SearchLabel::NotFound)
|
|
|
27aea6 |
sStr = SVX_RESSTR(RID_SVXSTR_SEARCH_NOT_FOUND);
|
|
|
27aea6 |
|
|
|
27aea6 |
- if (vcl::Window *pSearchLabel = lcl_GetSearchLabelWindow())
|
|
|
27aea6 |
- {
|
|
|
27aea6 |
- if (sStr.isEmpty())
|
|
|
27aea6 |
- pSearchLabel->Hide();
|
|
|
27aea6 |
- else
|
|
|
27aea6 |
- {
|
|
|
27aea6 |
- pSearchLabel->SetText(sStr);
|
|
|
27aea6 |
- pSearchLabel->Show();
|
|
|
27aea6 |
- }
|
|
|
27aea6 |
- }
|
|
|
27aea6 |
+ lcl_SetSearchLabelWindow(sStr);
|
|
|
27aea6 |
if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( SfxViewFrame::Current()->
|
|
|
27aea6 |
GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId() )))
|
|
|
27aea6 |
pWrp->getDialog()->SetSearchLabel(sStr);
|
|
|
27aea6 |
@@ -2428,16 +2433,7 @@ void SvxSearchDialogWrapper::SetSearchLabel(const SearchLabel& rSL)
|
|
|
27aea6 |
void SvxSearchDialogWrapper::SetSearchLabel(const OUString& sStr)
|
|
|
27aea6 |
{
|
|
|
27aea6 |
|
|
|
27aea6 |
- if (vcl::Window *pSearchLabel = lcl_GetSearchLabelWindow())
|
|
|
27aea6 |
- {
|
|
|
27aea6 |
- if (sStr.isEmpty())
|
|
|
27aea6 |
- pSearchLabel->Hide();
|
|
|
27aea6 |
- else
|
|
|
27aea6 |
- {
|
|
|
27aea6 |
- pSearchLabel->SetText(sStr);
|
|
|
27aea6 |
- pSearchLabel->Show();
|
|
|
27aea6 |
- }
|
|
|
27aea6 |
- }
|
|
|
27aea6 |
+ lcl_SetSearchLabelWindow(sStr);
|
|
|
27aea6 |
if (SvxSearchDialogWrapper *pWrp = static_cast<SvxSearchDialogWrapper*>( SfxViewFrame::Current()->
|
|
|
27aea6 |
GetChildWindow( SvxSearchDialogWrapper::GetChildWindowId() )))
|
|
|
27aea6 |
pWrp->getDialog()->SetSearchLabel(sStr);
|
|
|
27aea6 |
--
|
|
|
27aea6 |
2.14.3
|
|
|
27aea6 |
|