sw/source/core/frmedt/fetab.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 6d1fda2be75adbbb4a47b16aa6ef68cea98f7ece
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Thu Sep 22 10:33:43 2022 -0400
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Sat Oct 1 08:53:52 2022 +0200

    tdf#46733 sw: don't double-select column during deleteCol
    
    The problem here was that under IsNewModel tables were
    selecting the entire column (including merged cells)
    and then using THAT selection to ExpandColumnSelection.
    
    Well, that ends in disaster. Since NewModel already
    expands to catch the cells that are contained inside
    the selected cells, there is no need to expand
    the selection of GetTableCell.
    
    Change-Id: I43089d912cdd17b2599619a43e40fecc2f5dd3b5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140455
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    (cherry picked from commit bb47ffbc9d36e83695aa0d01767d3f83533c04e0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140609
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 678ebfc2fac7..a87e79affbc6 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -282,7 +282,15 @@ bool SwFEShell::DeleteCol()
     // search boxes via the layout
     bool bRet;
     SwSelBoxes aBoxes;
-    GetTableSel( *this, aBoxes, SwTableSearchType::Col );
+    SwTableSearchType eSearchType = SwTableSearchType::Col;
+
+    // NewModel tables already ExpandColumnSelection, so don't do it here also.
+    const SwContentNode* pContentNd = 
getShellCursor(false)->GetNode().GetContentNode();
+    const SwTableNode* pTableNd = pContentNd ? pContentNd->FindTableNode() : 
nullptr;
+    if (pTableNd && pTableNd->GetTable().IsNewModel())
+        eSearchType = SwTableSearchType::NONE;
+
+    GetTableSel(*this, aBoxes, eSearchType);
     if ( !aBoxes.empty() )
     {
         TableWait aWait( aBoxes.size(), pFrame, *GetDoc()->GetDocShell() );

Reply via email to