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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 9 18:29:57 UTC 2021


 sw/source/uibase/shells/tabsh.cxx |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 3bcb8c3d6d028f76817039f2aad57cab5a6e524b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jun 9 16:55:14 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jun 9 20:28:42 2021 +0200

    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 at redhat.com>

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();
 


More information about the Libreoffice-commits mailing list