Kaydet (Commit) 96bf1e53 authored tarafından Rasmus Jonsson's avatar Rasmus Jonsson Kaydeden (comit) Jim Raykowski

tdf#106723 Improve visibility of not found search term

Move SetSearchLabel definition to srchdlg.cxx
Set control foreground to red on failed search and reset on text input
modification.
For the find & replace dialog, use set_entry_error for the same.
Reset "not found" search label on modification of search term.

Change-Id: Ia89d2e8d3ca35e2c184d5b7048af8267b57f2c17
Reviewed-on: https://gerrit.libreoffice.org/70662
Tested-by: Jenkins
Reviewed-by: 's avatarHeiko Tietze <tietze.heiko@gmail.com>
Tested-by: 's avatarHeiko Tietze <tietze.heiko@gmail.com>
Reviewed-by: 's avatarJim Raykowski <raykowj@gmail.com>
üst f6dc5636
...@@ -130,7 +130,7 @@ public: ...@@ -130,7 +130,7 @@ public:
bool GetSrchFlag() { return mbSuccess; } bool GetSrchFlag() { return mbSuccess; }
void SetSaveToModule(bool b); void SetSaveToModule(bool b);
void SetSearchLabel(const OUString& rStr) { m_xSearchLabel->set_label(rStr); } void SetSearchLabel(const OUString& rStr);
private: private:
bool mbSuccess; bool mbSuccess;
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
#include <svx/svxdlg.hxx> #include <svx/svxdlg.hxx>
#include <vcl/toolbox.hxx> #include <vcl/toolbox.hxx>
#include <o3tl/typed_flags_set.hxx> #include <o3tl/typed_flags_set.hxx>
#include <vcl/combobox.hxx>
#include <cstdlib> #include <cstdlib>
#include <memory> #include <memory>
...@@ -543,6 +544,13 @@ void SvxSearchDialog::SetSaveToModule(bool b) ...@@ -543,6 +544,13 @@ void SvxSearchDialog::SetSaveToModule(bool b)
pImpl->bSaveToModule = b; pImpl->bSaveToModule = b;
} }
void SvxSearchDialog::SetSearchLabel(const OUString& rStr)
{
m_xSearchLabel->set_label(rStr);
if (rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND))
m_xSearchLB->set_entry_error(true);
}
void SvxSearchDialog::ApplyTransliterationFlags_Impl( TransliterationFlags nSettings ) void SvxSearchDialog::ApplyTransliterationFlags_Impl( TransliterationFlags nSettings )
{ {
...@@ -2174,7 +2182,11 @@ void SvxSearchDialog::PaintAttrText_Impl() ...@@ -2174,7 +2182,11 @@ void SvxSearchDialog::PaintAttrText_Impl()
void SvxSearchDialog::SetModifyFlag_Impl( const weld::Widget* pCtrl ) void SvxSearchDialog::SetModifyFlag_Impl( const weld::Widget* pCtrl )
{ {
if (m_xSearchLB.get() == pCtrl) if (m_xSearchLB.get() == pCtrl)
{
nModifyFlag |= ModifyFlags::Search; nModifyFlag |= ModifyFlags::Search;
m_xSearchLB->set_entry_error(false);
SvxSearchDialogWrapper::SetSearchLabel("");
}
else if ( m_xReplaceLB.get() == pCtrl ) else if ( m_xReplaceLB.get() == pCtrl )
nModifyFlag |= ModifyFlags::Replace; nModifyFlag |= ModifyFlags::Replace;
else if ( m_xWordBtn.get() == pCtrl ) else if ( m_xWordBtn.get() == pCtrl )
...@@ -2353,6 +2365,8 @@ static void lcl_SetSearchLabelWindow(const OUString& rStr) ...@@ -2353,6 +2365,8 @@ static void lcl_SetSearchLabelWindow(const OUString& rStr)
if (!pViewFrame) if (!pViewFrame)
return; return;
bool bNotFound = rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND);
css::uno::Reference< css::beans::XPropertySet > xPropSet( css::uno::Reference< css::beans::XPropertySet > xPropSet(
pViewFrame->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY_THROW); pViewFrame->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
...@@ -2377,6 +2391,17 @@ static void lcl_SetSearchLabelWindow(const OUString& rStr) ...@@ -2377,6 +2391,17 @@ static void lcl_SetSearchLabelWindow(const OUString& rStr)
else else
pSearchLabel->SetSizePixel(pSearchLabel->get_preferred_size()); pSearchLabel->SetSizePixel(pSearchLabel->get_preferred_size());
} }
if (pToolBox->GetItemCommand(id) == ".uno:FindText")
{
ComboBox* pFindText = dynamic_cast<ComboBox*>(pToolBox->GetItemWindow(id));
assert(pFindText);
Edit* pEdit = pFindText->GetSubEdit();
if (bNotFound)
pEdit->SetControlForeground(COL_LIGHTRED);
else
pEdit->SetControlForeground();
}
} }
xLayoutManager->doLayout(); xLayoutManager->doLayout();
pToolBox->Resize(); pToolBox->Resize();
......
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