sw/sdi/_navsh.sdi | 2 -- sw/source/core/crsr/crstrvl.cxx | 6 ++++++ sw/source/core/crsr/trvlfnfl.cxx | 10 ++++++++++ sw/source/uibase/wrtsh/navmgr.cxx | 4 ---- sw/source/uibase/wrtsh/wrtsh2.cxx | 4 ++++ 5 files changed, 20 insertions(+), 6 deletions(-)
New commits: commit cf8de077f885b7632967c8bdfde98279d98f4cce Author: Jim Raykowski <[email protected]> AuthorDate: Mon Oct 18 21:49:45 2021 -0800 Commit: Jim Raykowski <[email protected]> CommitDate: Wed Oct 20 02:42:57 2021 +0200 tdf#74604 tdf#54412 Make recency work for hyperlink, field and footnote cursor position changes Change-Id: I451cb5a538fd4baf00282238741011c6d4fc17b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123793 Tested-by: Jenkins Reviewed-by: V, Stuart Foote <[email protected]> Reviewed-by: Jim Raykowski <[email protected]> diff --git a/sw/sdi/_navsh.sdi b/sw/sdi/_navsh.sdi index 03ecd8498544..413355e4312f 100644 --- a/sw/sdi/_navsh.sdi +++ b/sw/sdi/_navsh.sdi @@ -13,14 +13,12 @@ interface _Navigation [ ExecMethod = Execute ; StateMethod = GetState; - DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] SfxVoidItem NavigateForward FN_NAVIGATION_FORWARD [ ExecMethod = Execute ; StateMethod = GetState; - DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] } diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index d241ba739bf8..e2e5822a3103 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -833,6 +833,9 @@ bool SwCursorShell::MoveFieldType( bool SwCursorShell::GotoFootnoteAnchor(const SwTextFootnote& rTextFootnote) { + if (SwWrtShell* pWrtSh = dynamic_cast<SwWrtShell*>(this)) + pWrtSh->addCurrentPosition(); + bool bRet = false; SwCursor* pCursor = getShellCursor(true); @@ -1482,6 +1485,9 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, bRet = true; if( bSetCursor ) { + if (SwWrtShell* pWrtSh = dynamic_cast<SwWrtShell*>(this)) + pWrtSh->addCurrentPosition(); + SwCallLink aLk( *this ); // watch Cursor-Moves SwCursorSaveState aSaveState( *m_pCurrentCursor ); m_pCurrentCursor->GetPoint()->nNode = *static_cast<SwTextFootnote*>(pTextAttr)->GetStartNode(); diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index 45dcb5415afa..62c30c55f0dc 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -30,9 +30,13 @@ #include <viscrs.hxx> #include "callnk.hxx" #include <svx/srchdlg.hxx> +#include <wrtsh.hxx> bool SwCursorShell::CallCursorShellFN( FNCursorShell fnCursor ) { + if (SwWrtShell* pWrtSh = dynamic_cast<SwWrtShell*>(this)) + pWrtSh->addCurrentPosition(); + SwCallLink aLk( *this ); // watch Cursor-Moves bool bRet = (this->*fnCursor)(); if( bRet ) @@ -43,6 +47,9 @@ bool SwCursorShell::CallCursorShellFN( FNCursorShell fnCursor ) bool SwCursorShell::CallCursorFN( FNCursor fnCursor ) { + if (SwWrtShell* pWrtSh = dynamic_cast<SwWrtShell*>(this)) + pWrtSh->addCurrentPosition(); + SwCallLink aLk( *this ); // watch Cursor-Moves SwCursor* pCursor = getShellCursor( true ); bool bRet = (pCursor->*fnCursor)(); @@ -161,6 +168,9 @@ bool SwCursor::GotoFootnoteAnchor() bool SwCursorShell::GotoFootnoteAnchor() { + if (SwWrtShell* pWrtSh = dynamic_cast<SwWrtShell*>(this)) + pWrtSh->addCurrentPosition(); + // jump from footnote to anchor SwCallLink aLk( *this ); // watch Cursor-Moves bool bRet = m_pCurrentCursor->GotoFootnoteAnchor(); diff --git a/sw/source/uibase/wrtsh/navmgr.cxx b/sw/source/uibase/wrtsh/navmgr.cxx index 1960f831e4ee..db97e2919146 100644 --- a/sw/source/uibase/wrtsh/navmgr.cxx +++ b/sw/source/uibase/wrtsh/navmgr.cxx @@ -170,10 +170,6 @@ void SwNavigationMgr::goForward() { bool SwNavigationMgr::addEntry(const SwPosition& rPos) { - // For additions other than to the end, check here if the cursor position has changed - if (m_nCurrent < m_entries.size() && (rPos == *m_entries[m_nCurrent]->GetPoint())) - return false; - // Flags that will be used for refreshing the buttons bool bBackWasDisabled = !backEnabled(); bool bForwardWasEnabled = forwardEnabled(); diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index a4f050492328..77a6d4c19d28 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -338,6 +338,8 @@ void SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet) void SwWrtShell::ClickToField(const SwField& rField, bool bExecHyperlinks) { + addCurrentPosition(); + // cross reference field must not be selected because it moves the cursor if (SwFieldIds::GetRef != rField.GetTyp()->Which()) { @@ -450,6 +452,8 @@ void SwWrtShell::ClickToField(const SwField& rField, bool bExecHyperlinks) void SwWrtShell::ClickToINetAttr( const SwFormatINetFormat& rItem, LoadUrlFlags nFilter ) { + addCurrentPosition(); + if( rItem.GetValue().isEmpty() ) return ;
