[Libreoffice-commits] core.git: sw/source

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Sun Jan 17 06:11:22 UTC 2021


 sw/source/uibase/docvw/edtwin.cxx    |    1 +
 sw/source/uibase/shells/txtcrsr.cxx  |    5 +++++
 sw/source/uibase/uiview/viewmdi.cxx  |    2 ++
 sw/source/uibase/uiview/viewsrch.cxx |    2 ++
 sw/source/uibase/wrtsh/move.cxx      |    1 +
 sw/source/uibase/wrtsh/navmgr.cxx    |    8 ++++++++
 6 files changed, 19 insertions(+)

New commits:
commit 50678a771daa6cd5d3414c25930761c65aab4244
Author:     Jim Raykowski <raykowj at gmail.com>
AuthorDate: Sat Dec 26 17:32:31 2020 -0900
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Sun Jan 17 07:10:41 2021 +0100

    tdf#115817 add places that add current position to navigation manager
    
    Change-Id: If011b51fac6587b4f551a498866aa71f62ba0fcc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108529
    Reviewed-by: V, Stuart Foote <vstuart.foote at utsa.edu>
    Reviewed-by: Jim Raykowski <raykowj at gmail.com>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 2bb328138d6e..143a3259a991 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -2831,6 +2831,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
     m_rView.GetPostItMgr()->SetActiveSidebarWin(nullptr);
 
     GrabFocus();
+    rSh.addCurrentPosition();
 
     //ignore key modifiers for format paintbrush
     {
diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx
index 4ca50d6dab4e..1290c2070679 100644
--- a/sw/source/uibase/shells/txtcrsr.cxx
+++ b/sw/source/uibase/shells/txtcrsr.cxx
@@ -117,6 +117,7 @@ void SwTextShell::ExecBasicMove(SfxRequest &rReq)
 void SwTextShell::ExecMove(SfxRequest &rReq)
 {
     SwWrtShell &rSh = GetShell();
+    rSh.addCurrentPosition();
     SwEditWin& rTmpEditWin = GetView().GetEditWin();
     rTmpEditWin.FlushInBuffer();
 
@@ -175,6 +176,7 @@ void SwTextShell::ExecMove(SfxRequest &rReq)
 void SwTextShell::ExecMovePage(SfxRequest &rReq)
 {
     SwWrtShell &rSh = GetShell();
+    rSh.addCurrentPosition();
     GetView().GetEditWin().FlushInBuffer();
 
     switch( rReq.GetSlot() )
@@ -225,6 +227,7 @@ void SwTextShell::ExecMovePage(SfxRequest &rReq)
 void SwTextShell::ExecMoveCol(SfxRequest &rReq)
 {
     SwWrtShell &rSh = GetShell();
+    rSh.addCurrentPosition();
     switch ( rReq.GetSlot() )
     {
         case FN_START_OF_COLUMN:
@@ -255,6 +258,7 @@ void SwTextShell::ExecMoveCol(SfxRequest &rReq)
 void SwTextShell::ExecMoveLingu(SfxRequest &rReq)
 {
     SwWrtShell &rSh = GetShell();
+    rSh.addCurrentPosition();
     GetView().GetEditWin().FlushInBuffer();
 
     switch ( rReq.GetSlot() )
@@ -311,6 +315,7 @@ void SwTextShell::ExecMoveLingu(SfxRequest &rReq)
 void SwTextShell::ExecMoveMisc(SfxRequest &rReq)
 {
     SwWrtShell &rSh = GetShell();
+    rSh.addCurrentPosition();
     const sal_uInt16 nSlot = rReq.GetSlot();
     bool bSetRetVal = true, bRet = true;
     switch ( nSlot )
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 348a9a0d3621..541a0ba210c3 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -340,6 +340,8 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
         if (pActiveSidebarWin)
             pActiveSidebarWin->SwitchToFieldPos();
     }
+    if (NID_RECENCY != m_nMoveType && NID_PGE != m_nMoveType && NID_SRCH_REP != m_nMoveType)
+        rSh.addCurrentPosition();
     switch( m_nMoveType )
     {
         case NID_PGE:
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 66d8dfd60a3f..3b4b4375a966 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -124,6 +124,8 @@ static void lcl_emitSearchResultCallbacks(SvxSearchItem const * pSearchItem, SwW
 
 void SwView::ExecSearch(SfxRequest& rReq)
 {
+    GetWrtShell().addCurrentPosition();
+
     const SfxItemSet* pArgs = rReq.GetArgs();
     const SfxPoolItem* pItem = nullptr;
     bool bQuiet = false;
diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx
index c1873967fcb6..933bdba0f57b 100644
--- a/sw/source/uibase/wrtsh/move.cxx
+++ b/sw/source/uibase/wrtsh/move.cxx
@@ -572,6 +572,7 @@ bool SwWrtShell::PageCursor(SwTwips lOffset, bool bSelect)
 
 bool SwWrtShell::GotoPage(sal_uInt16 nPage, bool bRecord)
 {
+    addCurrentPosition();
     ShellMoveCursor aTmp( this, false);
     if( SwCursorShell::GotoPage(nPage) && bRecord)
     {
diff --git a/sw/source/uibase/wrtsh/navmgr.cxx b/sw/source/uibase/wrtsh/navmgr.cxx
index b8c1f32582d1..10130fbe4b4f 100644
--- a/sw/source/uibase/wrtsh/navmgr.cxx
+++ b/sw/source/uibase/wrtsh/navmgr.cxx
@@ -20,9 +20,12 @@
 #include <com/sun/star/frame/XLayoutManager.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 
+#include <edtwin.hxx>
+
 // This method positions the cursor to the position rPos.
 
 void SwNavigationMgr::GotoSwPosition(const SwPosition &rPos) {
+    m_rMyShell.GetView().GetEditWin().GrabFocus();
     // EnterStdMode() prevents the cursor to 'block' the current
     // shell when it should move from the image back to the normal shell
     m_rMyShell.EnterStdMode();
@@ -168,6 +171,11 @@ void SwNavigationMgr::goForward() {
 // rPos is usually the current position of the cursor in the document
 
 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();


More information about the Libreoffice-commits mailing list