summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-06-29 22:50:22 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-06-30 06:34:58 +0000
commit6f34143dfb061cb8dda76b9e4f449f1e6b4fc181 (patch)
treeb4c477bb98ad81a8e44b30368e5d213102280bf4
parent8448d0930177da0014b7faa99bb124227ae1c16e (diff)
tdf#89616 Find toolbar: Activate search arrows when input has text
Not only when input is modfified Change-Id: Ic6b94dbfba34ec6eb88c9c385aaa36a7bac19de7 Reviewed-on: https://gerrit.libreoffice.org/26782 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r--svx/inc/tbunosearchcontrollers.hxx2
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx29
2 files changed, 11 insertions, 20 deletions
diff --git a/svx/inc/tbunosearchcontrollers.hxx b/svx/inc/tbunosearchcontrollers.hxx
index efa07beeec3e..5b38ff7b02c8 100644
--- a/svx/inc/tbunosearchcontrollers.hxx
+++ b/svx/inc/tbunosearchcontrollers.hxx
@@ -117,6 +117,8 @@ public:
private:
+ void textfieldChanged();
+
VclPtr<FindTextFieldControl> m_pFindTextFieldControl;
sal_uInt16 m_nDownSearchId; // item position of findbar
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index f050ca6487e7..77c747416339 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -450,15 +450,9 @@ void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< c
{
OUString sItemCommand = pToolBox->GetItemCommand(i);
if ( sItemCommand == COMMAND_DOWNSEARCH )
- {
- pToolBox->EnableItem(i, false);
m_nDownSearchId = i;
- }
else if ( sItemCommand == COMMAND_UPSEARCH )
- {
- pToolBox->EnableItem(i, false);
m_nUpSearchId = i;
- }
}
}
@@ -497,29 +491,24 @@ void SAL_CALL FindTextToolbarController::statusChanged( const css::frame::Featur
{
m_pFindTextFieldControl->Remember_Impl(m_pFindTextFieldControl->GetText());
}
+ // enable up/down buttons in case there is already text (from the search history)
+ textfieldChanged();
}
IMPL_LINK_NOARG_TYPED(FindTextToolbarController, EditModifyHdl, Edit&, void)
{
+ textfieldChanged();
+}
+
+void FindTextToolbarController::textfieldChanged() {
// enable or disable item DownSearch/UpSearch of findbar
vcl::Window* pWindow = VCLUnoHelper::GetWindow( getParent() );
ToolBox* pToolBox = static_cast<ToolBox*>(pWindow);
if ( pToolBox && m_pFindTextFieldControl )
{
- if (!m_pFindTextFieldControl->GetText().isEmpty())
- {
- if ( !pToolBox->IsItemEnabled(m_nDownSearchId) )
- pToolBox->EnableItem(m_nDownSearchId);
- if ( !pToolBox->IsItemEnabled(m_nUpSearchId) )
- pToolBox->EnableItem(m_nUpSearchId);
- }
- else
- {
- if ( pToolBox->IsItemEnabled(m_nDownSearchId) )
- pToolBox->EnableItem(m_nDownSearchId, false);
- if ( pToolBox->IsItemEnabled(m_nUpSearchId) )
- pToolBox->EnableItem(m_nUpSearchId, false);
- }
+ bool enableButtons = !m_pFindTextFieldControl->GetText().isEmpty();
+ pToolBox->EnableItem(m_nDownSearchId, enableButtons);
+ pToolBox->EnableItem(m_nUpSearchId, enableButtons);
}
}