summaryrefslogtreecommitdiff
path: root/sw/source/uibase/shells
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/shells')
-rw-r--r--sw/source/uibase/shells/basesh.cxx12
-rw-r--r--sw/source/uibase/shells/tabsh.cxx6
-rw-r--r--sw/source/uibase/shells/textsh1.cxx6
3 files changed, 18 insertions, 6 deletions
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index e0af002ba981..359dea043183 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -3039,4 +3039,16 @@ void SwBaseShell::ExecField( SfxRequest const & rReq )
}
}
+std::shared_ptr<std::vector<std::unique_ptr<SwPaM>>> SwBaseShell::CopyPaMRing(SwPaM& rOrig)
+{
+ auto vCursors = std::make_shared<std::vector<std::unique_ptr<SwPaM>>>();
+ vCursors->emplace_back(std::make_unique<SwPaM>(rOrig, nullptr));
+ for (auto& rCursor : rOrig.GetRingContainer())
+ {
+ if (&rCursor != &rOrig)
+ vCursors->emplace_back(std::make_unique<SwPaM>(rCursor, vCursors->front().get()));
+ }
+ return vCursors;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 247d5b4955d6..34d98f61edd9 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -596,11 +596,11 @@ void SwTableShell::Execute(SfxRequest &rReq)
auto pRequest = std::make_shared<SfxRequest>(rReq);
rReq.Ignore(); // the 'old' request is not relevant any more
- auto xPaM(std::make_shared<SwPaM>(*rSh.GetCursor(), nullptr)); // tdf#135636 make a copy to use at later apply
- pDlg->StartExecuteAsync([pDlg, pRequest, pTableRep, &rBindings, &rSh, xPaM](sal_Int32 nResult){
+ auto vCursors = CopyPaMRing(*rSh.GetCursor()); // tdf#135636 make a copy to use at later apply
+ pDlg->StartExecuteAsync([pDlg, pRequest, pTableRep, &rBindings, &rSh, vCursors](sal_Int32 nResult){
if (RET_OK == nResult)
{
- rSh.SetSelection(*xPaM); // tdf#135636 set the table selected at dialog launch as current selection
+ rSh.SetSelection(*vCursors->front()); // tdf#135636 set the table selected at dialog launch as current selection
const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index b7d3d60f2d97..a41c9e9d3d9c 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1079,8 +1079,8 @@ void SwTextShell::Execute(SfxRequest &rReq)
auto pRequest = std::make_shared<SfxRequest>(rReq);
rReq.Ignore(); // the 'old' request is not relevant any more
- auto xPaM(std::make_shared<SwPaM>(*pPaM, nullptr)); // tdf#134439 make a copy to use at later apply
- pDlg->StartExecuteAsync([pDlg, &rWrtSh, pRequest, nDefDist, xPaM](sal_Int32 nResult){
+ auto vCursors = CopyPaMRing(*pPaM); // tdf#134439 make a copy to use at later apply
+ pDlg->StartExecuteAsync([pDlg, &rWrtSh, pRequest, nDefDist, vCursors](sal_Int32 nResult){
if (nResult == RET_OK)
{
// Apply defaults if necessary.
@@ -1110,7 +1110,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName));
}
- sw_ParagraphDialogResult(pSet, rWrtSh, *pRequest, xPaM.get());
+ sw_ParagraphDialogResult(pSet, rWrtSh, *pRequest, vCursors->front().get());
}
pDlg->disposeOnce();
});