summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-06-09 16:55:14 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-06-09 20:28:42 +0200
commit3bcb8c3d6d028f76817039f2aad57cab5a6e524b (patch)
treec91dee398ae9ebc667d0eaad631b6636a648e5e4
parent01ded1e6d362dbcd7148334c6965d6ad00981d4a (diff)
tdf#142721 restore SwShellTableCursor if the orig selection was a single cell
where the previous attempt of commit 4d52d2bc81f9d27472fe368785912a530489d046 tdf#142165 restore a SwShellTableCursor if the orig selection described that so that we are operating on the same selection that existed when the dialog was originally launched wasn't sufficient to restore a single cell selection. we continue to need to avoid the assert of commit 6db71f70a3b200d4074f6cda8ce445e9861d3296 tdf#140977 drop possible table-cursor before setting the new one and support the multi-selection of commit e08b446e46f56e15af58fdd4396afba1a316f9e5 tdf#140257 duplicate entire PaM ring when making copy and support not scrolling to a different location on changing a table page break style of commit 9c61732677d038e32b73fc9fb883aced14c0febf tdf#135916 just set the target table as selection and keep making it possible to remove a page break on a table of commit 81f91196b98af38e29af451b86c26a893a109abc tdf#135636 the selection at dialog-launch time is lost by dialog-apply time all of which is necessitated by commit c3a085d22742f88e91ff92f319a26d6e8d1d9a98 lokdialog: Convert the Table -> Properties... to async exec. Though; since 4d52d2bc81f9d27472fe368785912a530489d046 where we started using rSh.GetTableCrs if IsTableMode() then in practice 6db71f70a3b200d4074f6cda8ce445e9861d3296 probably cannot arise. The scenario of rSh.IsTableMode() changing between launch of the dialog and applying the result of the dialog is presumably maybe theoretically possible in e.g. an online scenario, but not in the normal user case, but handled here anyway. Change-Id: I12f0b6bc7e0e2f5bad45a88007bf6fe2cd3d3b0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116933 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/uibase/shells/tabsh.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 3eb0e9b6ed4f..3599a569466a 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -597,18 +597,22 @@ void SwTableShell::Execute(SfxRequest &rReq)
auto pRequest = std::make_shared<SfxRequest>(rReq);
rReq.Ignore(); // the 'old' request is not relevant any more
- SwPaM* pCursor = rSh.IsTableMode() ? rSh.GetTableCrs() : rSh.GetCursor(); // tdf#142165 use table cursor if in table mode
+ const bool bTableMode = rSh.IsTableMode();
+ SwPaM* pCursor = bTableMode ? rSh.GetTableCrs() : rSh.GetCursor(); // tdf#142165 use table cursor if in table mode
auto vCursors = CopyPaMRing(*pCursor); // tdf#135636 make a copy to use at later apply
- pDlg->StartExecuteAsync([pDlg, pRequest, pTableRep, &rBindings, &rSh, vCursors](sal_Int32 nResult){
+ pDlg->StartExecuteAsync([pDlg, pRequest, pTableRep, &rBindings, &rSh, vCursors, bTableMode](sal_Int32 nResult){
if (RET_OK == nResult)
{
- if (rSh.IsTableMode()) // tdf#140977 drop possible table-cursor before setting the new one
- rSh.TableCursorToCursor();
+ if (!bTableMode && rSh.IsTableMode()) // tdf#140977 drop current table-cursor if setting a replacement
+ rSh.TableCursorToCursor(); // non-table one
- // tdf#135636 set the table selected at dialog launch as current selection
+ // tdf#135636 set the selection at dialog launch as current selection
rSh.SetSelection(*vCursors->front()); // UpdateCursor() will be called which in the case
// of a table selection should recreate a
- // SwShellTableCursor
+ // SwShellTableCursor if the selection is more than a single cell
+
+ if (bTableMode && !rSh.IsTableMode()) // tdf#142721 ensure the new selection is a SwShellTableCursor in
+ rSh.SelTableBox(); // the case of of a single cell
const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();