include/svx/srchdlg.hxx       |    2 +-
 svx/source/dialog/srchdlg.cxx |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 96bf1e53fba51ad42742bba66469bea911b57325
Author:     Rasmus Jonsson <was...@zom.bi>
AuthorDate: Mon Apr 15 11:17:22 2019 +0200
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Thu Apr 18 03:11:57 2019 +0200

    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: Heiko Tietze <tietze.he...@gmail.com>
    Tested-by: Heiko Tietze <tietze.he...@gmail.com>
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index 5786c1e84c74..3d19b6e7cae5 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -130,7 +130,7 @@ public:
     bool GetSrchFlag() { return mbSuccess; }
     void            SetSaveToModule(bool b);
 
-    void SetSearchLabel(const OUString& rStr) { 
m_xSearchLabel->set_label(rStr); }
+    void SetSearchLabel(const OUString& rStr);
 
 private:
     bool            mbSuccess;
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 5ba428cf433c..a0af88237f15 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -73,6 +73,7 @@
 #include <svx/svxdlg.hxx>
 #include <vcl/toolbox.hxx>
 #include <o3tl/typed_flags_set.hxx>
+#include <vcl/combobox.hxx>
 
 #include <cstdlib>
 #include <memory>
@@ -543,6 +544,13 @@ void SvxSearchDialog::SetSaveToModule(bool 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 )
 {
@@ -2174,7 +2182,11 @@ void SvxSearchDialog::PaintAttrText_Impl()
 void SvxSearchDialog::SetModifyFlag_Impl( const weld::Widget* pCtrl )
 {
     if (m_xSearchLB.get() == pCtrl)
+    {
         nModifyFlag |= ModifyFlags::Search;
+        m_xSearchLB->set_entry_error(false);
+        SvxSearchDialogWrapper::SetSearchLabel("");
+    }
     else if ( m_xReplaceLB.get() == pCtrl )
         nModifyFlag |= ModifyFlags::Replace;
     else if ( m_xWordBtn.get() == pCtrl )
@@ -2353,6 +2365,8 @@ static void lcl_SetSearchLabelWindow(const OUString& rStr)
     if (!pViewFrame)
         return;
 
+    bool bNotFound = rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND);
+
     css::uno::Reference< css::beans::XPropertySet > xPropSet(
             pViewFrame->GetFrame().GetFrameInterface(), 
css::uno::UNO_QUERY_THROW);
     css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
@@ -2377,6 +2391,17 @@ static void lcl_SetSearchLabelWindow(const OUString& 
rStr)
             else
                 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();
     pToolBox->Resize();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to