diff options
author | Jim Raykowski <raykowj@gmail.com> | 2020-12-29 15:12:44 -0900 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2021-01-16 23:31:18 +0100 |
commit | 602a044014b55a5a1b1a5f0e96af603590ee899f (patch) | |
tree | 40056d229c1e4687992908b2d89274e0559153cc /sw | |
parent | 63239749683ad718e10a5f561f17ca3c41ab4466 (diff) |
tdf#137358 Fix incorrect outline position returned
when the cursor position is before the first outline node and there are
outline nodes in the document model extras section.
plus fix to update Navigator tracking on Navigator show
Change-Id: Ib93ba0d460128314efef228810c06dbd929c672e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108492
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/uitest/navigator/tdf114724.py | 4 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf137274.py | 9 | ||||
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/utlui/navipi.cxx | 5 |
5 files changed, 17 insertions, 9 deletions
diff --git a/sw/qa/uitest/navigator/tdf114724.py b/sw/qa/uitest/navigator/tdf114724.py index 9c538739048f..a84bab60da60 100644 --- a/sw/qa/uitest/navigator/tdf114724.py +++ b/sw/qa/uitest/navigator/tdf114724.py @@ -22,8 +22,8 @@ class tdf114724(UITestCase): xWriterEdit.executeAction("FOCUS", tuple()) - self.ui_test.wait_until_property_is_updated(xNavigatorPanel, "selectedtext", "Headings") - self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectedtext"], "Headings") + self.ui_test.wait_until_property_is_updated(xNavigatorPanel, "selectedtext", "HEADING 1") + self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectedtext"], "HEADING 1") self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectioncount"], "1") for _ in range(0,3): xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) diff --git a/sw/qa/uitest/navigator/tdf137274.py b/sw/qa/uitest/navigator/tdf137274.py index 2c23960ddf75..f1e153992e2d 100644 --- a/sw/qa/uitest/navigator/tdf137274.py +++ b/sw/qa/uitest/navigator/tdf137274.py @@ -30,13 +30,10 @@ class tdf137274(UITestCase): xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) - xNavigatorPanel = xWriterEdit.getChild("NavigatorPanelParent") - - xWriterEdit.executeAction("FOCUS", tuple()) + # wait until the navigator panel is available + self.ui_test.wait_until_child_is_available(xMainWindow, 'NavigatorPanelParent') - # Wait until the navigator is available - self.ui_test.wait_until_property_is_updated(xNavigatorPanel, "selectedtext", "Headings") - self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectedtext"], "Headings") + xNavigatorPanel = xWriterEdit.getChild("NavigatorPanelParent") xContentTree = xNavigatorPanel.getChild("contenttree") xComments = xContentTree.getChild('10') diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index a41f3ae86799..893233c7ec1a 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1148,6 +1148,12 @@ SwOutlineNodes::size_type SwCursorShell::GetOutlinePos(sal_uInt8 nLevel, SwPaM* if (sw::IsParaPropsNode(*GetLayout(), *pNd->GetTextNode()) && pNd->GetTextNode()->GetAttrOutlineLevel()-1 <= nLevel) { + if (pNd->GetIndex() < rNds.GetEndOfExtras().GetIndex() + && pCursor->GetNode().GetIndex() > rNds.GetEndOfExtras().GetIndex()) + { + // node found in extras but cursor position is not in extras + return SwOutlineNodes::npos; + } return nPos; } } diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 5ac56dbabc43..5b3ce3b6474b 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3210,7 +3210,7 @@ IMPL_LINK_NOARG(SwContentTree, TimerUpdate, Timer *, void) void SwContentTree::UpdateTracking() { - if (State::HIDDEN == m_eState) + if (State::HIDDEN == m_eState || !m_pActiveShell) return; // m_bIgnoreViewChange is set on delete diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 725e4257ee14..7c440647e4e3 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -750,6 +750,11 @@ void SwNavigationPI::StateChanged(StateChangedType nStateChange) // show content if docked if (SfxChildWindowContext::GetFloatingWindow(GetParent()) == nullptr && IsZoomedIn()) ZoomOut(); + if (m_xContentTree) + { + m_xContentTree->SetActiveShell(GetActiveWrtShell()); + m_xContentTree->UpdateTracking(); + } } else if (nStateChange == StateChangedType::ControlFocus) { |