sc/source/ui/view/cellsh1.cxx |   37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

New commits:
commit d2fcdc25d077aa81aa0e5993234ee822189e6c58
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Feb 9 11:53:28 2026 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue Feb 24 09:23:03 2026 +0100

    nFlags is InsertDeleteFlags::NONE in the error case
    
    Change-Id: Iae1f64b43c6ad6b290a9ccfb5156be54fc2f72c0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198977
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200116
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 04cb0bcd4440..6c4517cce733 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -487,17 +487,18 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 
         case SID_DELETE:
             {
-                InsertDeleteFlags nFlags = InsertDeleteFlags::NONE;
-
                 if ( pReqArgs!=nullptr && pTabViewShell->SelectionEditable() )
                 {
                     const   SfxPoolItem* pItem;
                     OUString aFlags('A');
 
+                    InsertDeleteFlags nFlags = InsertDeleteFlags::NONE;
                     if( pReqArgs->HasItem( SID_DELETE, &pItem ) )
                         aFlags = static_cast<const 
SfxStringItem*>(pItem)->GetValue();
 
                     nFlags |= FlagsFromString(aFlags, InsertDeleteFlags::ALL);
+
+                    DeleteContents(pTabViewShell, rReq, nFlags);
                 }
                 else
                 {
@@ -513,14 +514,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                             pDlg->DisableObjects();
                         if (pDlg->Execute() == RET_OK)
                         {
-                            nFlags = pDlg->GetDelContentsCmdBits();
+                            InsertDeleteFlags nFlags = 
pDlg->GetDelContentsCmdBits();
+                            DeleteContents(pTabViewShell, rReq, nFlags);
                         }
                     }
                     else
                         pTabViewShell->ErrorMessage(aTester.GetMessageId());
                 }
-
-                DeleteContents(pTabViewShell, rReq, nFlags);
             }
             break;
 
commit bbad515225c40fa7c6ee85f2d7cc94b1cf93afdc
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Feb 9 11:51:14 2026 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Tue Feb 24 09:22:55 2026 +0100

    split out a DeleteContents
    
    Change-Id: I5d99a03d7c59f851b1e84772bccf087ce2d80622
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198976
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200115
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 5570e6da5281..04cb0bcd4440 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -272,6 +272,22 @@ void DeleteCells(ScTabViewShell* pTabViewShell, SfxRequest 
&rReq, DelCellCmd eCm
         }
     }
 }
+
+void DeleteContents(ScTabViewShell* pTabViewShell, SfxRequest &rReq, 
InsertDeleteFlags nFlags)
+{
+    if( nFlags != InsertDeleteFlags::NONE )
+    {
+        pTabViewShell->DeleteContents( nFlags );
+
+        if( ! rReq.IsAPI() )
+        {
+            OUString aFlags = FlagsToString( nFlags, InsertDeleteFlags::ALL );
+
+            rReq.AppendItem( SfxStringItem( SID_DELETE, aFlags ) );
+            rReq.Done();
+        }
+    }
+}
 }
 
 void ScCellShell::ExecuteEdit( SfxRequest& rReq )
@@ -504,18 +520,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                         pTabViewShell->ErrorMessage(aTester.GetMessageId());
                 }
 
-                if( nFlags != InsertDeleteFlags::NONE )
-                {
-                    pTabViewShell->DeleteContents( nFlags );
-
-                    if( ! rReq.IsAPI() )
-                    {
-                        OUString aFlags = FlagsToString( nFlags, 
InsertDeleteFlags::ALL );
-
-                        rReq.AppendItem( SfxStringItem( SID_DELETE, aFlags ) );
-                        rReq.Done();
-                    }
-                }
+                DeleteContents(pTabViewShell, rReq, nFlags);
             }
             break;
 

Reply via email to