summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/crsrsh.hxx2
-rw-r--r--sw/source/core/crsr/crsrsh.cxx9
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx5
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx1
-rw-r--r--sw/source/uibase/wrtsh/wrtsh1.cxx9
5 files changed, 23 insertions, 3 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 6d843e7e424d..e906d732256e 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -45,6 +45,7 @@
class SfxItemSet;
class SfxPoolItem;
+class SwCallLink;
class SwContentFrame;
class SwUnoCursor;
class SwFormatField;
@@ -434,6 +435,7 @@ public:
* stack
* @return <true> if there was one on the stack, <false> otherwise
*/
+ bool Pop(PopMode, ::std::unique_ptr<SwCallLink> pLink);
bool Pop(PopMode);
/*
* Combine 2 Cursors.
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index ae7b2c81133d..8145d938752f 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2260,7 +2260,14 @@ void SwCursorShell::Push()
*/
bool SwCursorShell::Pop(PopMode const eDelete)
{
- SwCallLink aLk( *this ); // watch Cursor-Moves; call Link if needed
+ ::std::unique_ptr<SwCallLink> pLink(::std::make_unique<SwCallLink>(*this)); // watch Cursor-Moves; call Link if needed
+ return Pop(eDelete, ::std::move(pLink));
+}
+
+bool SwCursorShell::Pop(PopMode const eDelete,
+ [[maybe_unused]] ::std::unique_ptr<SwCallLink> const pLink)
+{
+ assert(pLink); // parameter exists only to be deleted before return
// are there any left?
if (nullptr == m_pStackCursor)
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 4898ba948f4e..c013c002cca0 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -140,6 +140,7 @@
#include <sfx2/event.hxx>
#include <memory>
+#include "../../core/crsr/callnk.hxx"
#include <IDocumentOutlineNodes.hxx>
#include <ndtxt.hxx>
#include <cntfrm.hxx>
@@ -6479,13 +6480,15 @@ Selection SwEditWin::GetSurroundingTextSelection() const
// around the visible cursor.
TextFrameIndex const nPos(rSh.GetCursorPointAsViewIndex());
+ // store shell state *before* Push
+ ::std::unique_ptr<SwCallLink> pLink(::std::make_unique<SwCallLink>(rSh));
rSh.Push();
rSh.HideCursor();
rSh.GoStartSentence();
TextFrameIndex const nStartPos(rSh.GetCursorPointAsViewIndex());
- rSh.Pop(SwCursorShell::PopMode::DeleteCurrent);
+ rSh.Pop(SwCursorShell::PopMode::DeleteCurrent, ::std::move(pLink));
rSh.ShowCursor();
if (bUnLockView)
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index a4ba598df693..491373236b61 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -143,6 +143,7 @@ public:
// is there a text- or frameselection?
bool HasSelection() const { return SwCursorShell::HasSelection() ||
IsMultiSelection() || IsSelFrameMode() || IsObjSelected(); }
+ bool Pop(SwCursorShell::PopMode, ::std::unique_ptr<SwCallLink> const pLink);
bool Pop(SwCursorShell::PopMode = SwCursorShell::PopMode::DeleteStack);
void EnterStdMode();
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 3fb293405387..955d9d280583 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -104,6 +104,7 @@
#include <comphelper/propertyvalue.hxx>
#include <memory>
+#include "../../core/crsr/callnk.hxx"
#include <frmtool.hxx>
#include <viewopt.hxx>
@@ -1853,7 +1854,13 @@ SwWrtShell::~SwWrtShell()
bool SwWrtShell::Pop(SwCursorShell::PopMode const eDelete)
{
- bool bRet = SwCursorShell::Pop(eDelete);
+ ::std::unique_ptr<SwCallLink> pLink(::std::make_unique<SwCallLink>(*this));
+ return Pop(eDelete, ::std::move(pLink));
+}
+
+bool SwWrtShell::Pop(SwCursorShell::PopMode const eDelete, ::std::unique_ptr<SwCallLink> pLink)
+{
+ bool bRet = SwCursorShell::Pop(eDelete, ::std::move(pLink));
if( bRet && IsSelection() )
{
if (!IsAddMode())