summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-09-26 21:18:48 -0800
committerJim Raykowski <raykowj@gmail.com>2020-09-30 05:22:02 +0200
commitf4f0ea6a41e99e12812a791f732694c8e86acb8c (patch)
tree6b6c6ef257024dc14b49f85893d6eaeb5e8892bb
parent28ed472e4e15348cb9a7ee9b43a22b1c92836471 (diff)
tdf#137013 fix Writer find toolbar ui regressions
introduced by enhancement patch tdf#132366 Change-Id: I951fcd7891c75e7fbf715581c316b4446d967cd9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103499 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
-rw-r--r--include/svl/hint.hxx2
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx5
-rw-r--r--sw/source/uibase/inc/conttree.hxx1
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx2
-rw-r--r--sw/source/uibase/utlui/content.cxx139
5 files changed, 81 insertions, 68 deletions
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index 77e838a5d21c..adff3fa6239d 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -112,6 +112,7 @@ enum class SfxHintId {
SwDrawViewsCreated,
SwSplitNodeOperation,
SwSectionFrameMoveAndDelete,
+ SwNavigatorUpdateTracking,
SwNavigatorSelectOutlinesWithSelections,
ThisIsAnSdrHint // used to avoid dynamic_cast
@@ -193,6 +194,7 @@ inline std::basic_ostream<charT, traits> & operator <<(
case SfxHintId::SwDrawViewsCreated: return stream << "SwDrawViewsCreated";
case SfxHintId::SwSplitNodeOperation: return stream << "SwSplitNodeOperation";
case SfxHintId::SwSectionFrameMoveAndDelete: return stream << "SwSectionFrameMoveAndDelete";
+ case SfxHintId::SwNavigatorUpdateTracking: return stream << "SwNavigatorUpdateTracking";
case SfxHintId::SwNavigatorSelectOutlinesWithSelections:
return stream << "SwNavigatorSelectOutlinesWithSelections";
case SfxHintId::ThisIsAnSdrHint: return stream << "SdrHint";
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 20430681de7a..931f5d72d51a 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -144,9 +144,7 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
{
sFindText = pItemWin->get_active_text();
if (aFindAll)
- pItemWin->GrabFocus();
- else
- pItemWin->GrabFocusToDocument();
+ pItemWin->GetFocus();
}
} else if ( sItemCommand == COMMAND_MATCHCASE )
{
@@ -302,6 +300,7 @@ IMPL_LINK(FindTextFieldControl, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
else if ( KEY_RETURN == nCode || (bMod1 && (KEY_G == nCode)) || (KEY_F3 == nCode) )
{
ActivateFind(bShift);
+ m_xWidget->grab_focus();
bRet = true;
}
else
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index 80b9d8d69bbe..77ef2ef4c0c3 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -225,6 +225,7 @@ public:
void Select();
+ void UpdateTracking();
void SelectOutlinesWithSelection();
// return true if it has any children
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index de7f0be5b369..578d02f296d4 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -236,7 +236,7 @@ void SwView::ExecSearch(SfxRequest& rReq)
}
rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
- m_pEditWin->GrabFocus();
+ GetDocShell()->Broadcast(SfxHint(SfxHintId::SwNavigatorUpdateTracking));
}
break;
case SvxSearchCmd::FIND_ALL:
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 353ee2bad359..422133559c45 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2719,6 +2719,9 @@ void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint)
}
switch (rHint.GetId())
{
+ case SfxHintId::SwNavigatorUpdateTracking:
+ UpdateTracking();
+ break;
case SfxHintId::SwNavigatorSelectOutlinesWithSelections:
{
if (m_nRootType == ContentTypeId::OUTLINE)
@@ -3115,82 +3118,90 @@ IMPL_LINK_NOARG(SwContentTree, TimerUpdate, Timer *, void)
Display(true);
}
- // track document outline position at cursor
- if (m_nOutlineTracking == 3) // no outline tracking
- return;
-
- const SwOutlineNodes::size_type nActPos = GetWrtShell()->GetOutlinePos(MAXLEVEL); // find out where the cursor is
- if (nActPos == SwOutlineNodes::npos)
- return;
-
- // only track if selection is already an outline
- std::unique_ptr<weld::TreeIter> xFirstSelected(m_xTreeView->make_iterator());
- if (!m_xTreeView->get_selected(xFirstSelected.get()))
- xFirstSelected.reset();
- if (xFirstSelected && lcl_IsContent(*xFirstSelected, *m_xTreeView) &&
- reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xFirstSelected).toInt64())->GetParent()->GetType() != ContentTypeId::OUTLINE)
- return;
- if (xFirstSelected && lcl_IsContentType(*xFirstSelected, *m_xTreeView) &&
- reinterpret_cast<SwContentType*>(m_xTreeView->get_id(*xFirstSelected).toInt64())->GetType() != ContentTypeId::OUTLINE)
- return;
-
- int nSelectedRows = m_xTreeView->count_selected_rows();
-
- // find the outline in the tree and select it
- m_xTreeView->all_foreach([this, nSelectedRows, nActPos, &xFirstSelected](weld::TreeIter& rEntry){
- bool bRet = false;
-
- if (lcl_IsContent(rEntry, *m_xTreeView) &&
- reinterpret_cast<SwContent*>(m_xTreeView->get_id(rEntry).toInt64())->GetParent()->GetType() == ContentTypeId::OUTLINE)
+ UpdateTracking();
+ }
+ else if (!pView && State::ACTIVE == m_eState && !m_bIsIdleClear)
+ {
+ if(m_pActiveShell)
+ {
+ SetActiveShell(nullptr);
+ }
+ clear();
+ m_bIsIdleClear = true;
+ }
+}
+
+void SwContentTree::UpdateTracking()
+{
+ if (State::HIDDEN == m_eState)
+ return;
+
+ // track document outline position at cursor
+ if (m_nOutlineTracking == 3) // no outline tracking
+ return;
+
+ const SwOutlineNodes::size_type nActPos = GetWrtShell()->GetOutlinePos(MAXLEVEL); // find out where the cursor is
+ if (nActPos == SwOutlineNodes::npos)
+ return;
+
+ // only track if selection is already an outline
+ std::unique_ptr<weld::TreeIter> xFirstSelected(m_xTreeView->make_iterator());
+ if (!m_xTreeView->get_selected(xFirstSelected.get()))
+ xFirstSelected.reset();
+ if (xFirstSelected && lcl_IsContent(*xFirstSelected, *m_xTreeView) &&
+ reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xFirstSelected).toInt64())->GetParent()->GetType() != ContentTypeId::OUTLINE)
+ return;
+ if (xFirstSelected && lcl_IsContentType(*xFirstSelected, *m_xTreeView) &&
+ reinterpret_cast<SwContentType*>(m_xTreeView->get_id(*xFirstSelected).toInt64())->GetType() != ContentTypeId::OUTLINE)
+ return;
+
+ int nSelectedRows = m_xTreeView->count_selected_rows();
+
+ // find the outline in the tree and select it
+ m_xTreeView->all_foreach([this, nSelectedRows, nActPos, &xFirstSelected](weld::TreeIter& rEntry){
+ bool bRet = false;
+
+ if (lcl_IsContent(rEntry, *m_xTreeView) &&
+ reinterpret_cast<SwContent*>(m_xTreeView->get_id(rEntry).toInt64())->GetParent()->GetType() == ContentTypeId::OUTLINE)
+ {
+ // might have been scrolled out of view by the user so leave it that way
+ if (reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos() == nActPos)
{
- // might have been scrolled out of view by the user so leave it that way
- if (reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos() == nActPos)
+ // only select if not already selected or tree has multiple entries selected
+ if (nSelectedRows != 1 || m_xTreeView->iter_compare(rEntry, *xFirstSelected) != 0)
{
- // only select if not already selected or tree has multiple entries selected
- if (nSelectedRows != 1 || m_xTreeView->iter_compare(rEntry, *xFirstSelected) != 0)
+ if (m_nOutlineTracking == 2) // focused outline tracking
{
- if (m_nOutlineTracking == 2) // focused outline tracking
+ // collapse to children of root node
+ std::unique_ptr<weld::TreeIter> xChildEntry(m_xTreeView->make_iterator());
+ if (m_xTreeView->get_iter_first(*xChildEntry) && m_xTreeView->iter_children(*xChildEntry))
{
- // collapse to children of root node
- std::unique_ptr<weld::TreeIter> xChildEntry(m_xTreeView->make_iterator());
- if (m_xTreeView->get_iter_first(*xChildEntry) && m_xTreeView->iter_children(*xChildEntry))
+ do
{
- do
- {
- if (reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xChildEntry).toInt64())->GetParent()->GetType() == ContentTypeId::OUTLINE)
- m_xTreeView->collapse_row(*xChildEntry);
- else
- break;
- }
- while (m_xTreeView->iter_next(*xChildEntry));
+ if (reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xChildEntry).toInt64())->GetParent()->GetType() == ContentTypeId::OUTLINE)
+ m_xTreeView->collapse_row(*xChildEntry);
+ else
+ break;
}
+ while (m_xTreeView->iter_next(*xChildEntry));
}
- m_xTreeView->set_cursor(rEntry); // unselect all entries, make pEntry visible, and select
- Select();
}
- bRet = true;
+ m_xTreeView->set_cursor(rEntry); // unselect all entries, make pEntry visible, and select
+ Select();
}
+ bRet = true;
}
- else
- {
- // use of this break assumes outline content type is first in tree
- if (lcl_IsContentType(rEntry, *m_xTreeView) &&
- reinterpret_cast<SwContentType*>(m_xTreeView->get_id(rEntry).toInt64())->GetType() != ContentTypeId::OUTLINE)
- bRet = true;
- }
-
- return bRet;
- });
- }
- else if (!pView && State::ACTIVE == m_eState && !m_bIsIdleClear)
- {
- if(m_pActiveShell)
+ }
+ else
{
- SetActiveShell(nullptr);
+ // use of this break assumes outline content type is first in tree
+ if (lcl_IsContentType(rEntry, *m_xTreeView) &&
+ reinterpret_cast<SwContentType*>(m_xTreeView->get_id(rEntry).toInt64())->GetType() != ContentTypeId::OUTLINE)
+ bRet = true;
}
- clear();
- m_bIsIdleClear = true;
- }
+
+ return bRet;
+ });
}
void SwContentTree::SelectOutlinesWithSelection()