Resolves tdf#161568 - Feedback for QFS in floating mode

As band-aid for the lack of proper toolbar resizing,
feedback is given via entry message type

Change-Id: Ic2b2a2aff93040f558775d63c18c21370fabcb39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170167
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
This commit is contained in:
Heiko Tietze 2024-07-08 16:50:37 +02:00 committed by Heiko Tietze
parent dd56ce1bbf
commit 4e606c5b38
3 changed files with 23 additions and 0 deletions

View file

@ -72,6 +72,8 @@
#include <cstdlib>
#include <memory>
#include <findtextfield.hxx>
#include <svx/labelitemwindow.hxx>
#include <svx/xdef.hxx>
#include <officecfg/Office/Common.hxx>
@ -572,6 +574,9 @@ void SvxSearchDialog::SetSearchLabel(const OUString& rStr)
m_xSearchBox->set_size_request(-1, aSize.Height());
m_xSearchBox->set_background(COL_TRANSPARENT);
}
if (rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND))
m_xSearchLB->set_entry_message_type(weld::EntryMessageType::Error);
}
void SvxSearchDialog::ApplyTransliterationFlags_Impl( TransliterationFlags nSettings )
@ -2369,6 +2374,18 @@ static void lcl_SetSearchLabelWindow(const OUString& rStr, SfxViewFrame& rViewFr
pSearchLabel->set_label(rStr, LabelItemWindowType::Info);
pSearchLabel->SetOptimalSize();
}
if (pToolBox->IsFloatingMode() && pToolBox->GetItemCommand(id) == ".uno:FindText")
{
FindTextFieldControl* pFindText = dynamic_cast<FindTextFieldControl*>(pToolBox->GetItemWindow(id));
assert(pFindText);
if (rStr == SvxResId(RID_SVXSTR_SEARCH_NOT_FOUND))
pFindText->set_entry_message_type(weld::EntryMessageType::Error);
else if (rStr == SvxResId(RID_SVXSTR_SEARCH_END) || rStr == SvxResId(RID_SVXSTR_SEARCH_START))
pFindText->set_entry_message_type(weld::EntryMessageType::Warning);
else
pFindText->set_entry_message_type(weld::EntryMessageType::Normal);
}
}
xLayoutManager->doLayout();
pToolBox->Resize();

View file

@ -47,6 +47,7 @@ public:
OUString get_text(int nIndex) const;
OUString get_active_text() const;
void append_text(const OUString& rText);
void set_entry_message_type(weld::EntryMessageType eType);
private:
ImplSVEvent* m_nAsyncGetFocusId;

View file

@ -437,6 +437,11 @@ OUString FindTextFieldControl::get_active_text() const
return m_xWidget->get_active_text();
}
void FindTextFieldControl::set_entry_message_type(weld::EntryMessageType eType)
{
m_xWidget->set_entry_message_type(eType);
}
void FindTextFieldControl::append_text(const OUString& rText)
{
m_xWidget->append_text(rText);