officecfg/registry/data/org/openoffice/Office/Accelerators.xcu    |    6 +++
 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |    8 ++++
 sc/inc/sc.hrc                                                     |    1 
 sc/sdi/cellsh.sdi                                                 |    1 
 sc/sdi/scalc.sdi                                                  |   17 
++++++++++
 sc/source/ui/view/cellsh.cxx                                      |    1 
 sc/source/ui/view/cellsh1.cxx                                     |   11 ++++++
 sc/source/ui/view/tabview3.cxx                                    |    1 
 8 files changed, 46 insertions(+)

New commits:
commit ec5e0d0cd7074a912415761f779b00f8b7117fcf
Author:     Heiko Tietze <tietze.he...@gmail.com>
AuthorDate: Thu Jun 20 12:56:33 2024 +0200
Commit:     Heiko Tietze <heiko.tie...@documentfoundation.org>
CommitDate: Thu Jun 20 15:15:56 2024 +0200

    Resolves tdf#64028 - Command to retain source cell on cut
    
    .uno:CopyDelete copies the cell and deletes the content,
    assigned to shift+ctrl+X
    
    Misses to block the command while in edit mode, see tdf#161712
    
    Change-Id: I479008b0484ef8ced86b709a0dc2bdbfa6c44cb1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169266
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>

diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu 
b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
index d90357018cb0..4a3962141caf 100644
--- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
@@ -1525,6 +1525,12 @@ Ctrl+Shift+u aka U_SHIFT_MOD1 under GTK/IBUS is for 
unicode key input
             <value xml:lang="en-US" 
install:module="macosx">.uno:JumpToPrevTable</value>
           </prop>
         </node>
+        <node oor:name="X_SHIFT_MOD1" oor:op="replace">
+          <prop oor:name="Command">
+            <value xml:lang="x-no-translate">L10N SHORTCUTS - NO 
TRANSLATE</value>
+            <value xml:lang="en-US">.uno:CopyDelete</value>
+          </prop>
+        </node>
       </node>
       <node oor:name="com.sun.star.chart2.ChartDocument" oor:op="replace">
         <node oor:name="C_MOD1" oor:op="replace">
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index ad4508627230..e968764fd2c5 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -2515,6 +2515,14 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:CopyDelete" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">~Cut but Keep Format</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
     </node>
     <node oor:name="Popups">
       <node oor:name=".uno:InsertFieldMenu" oor:op="replace">
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 9ef248660d7e..57c80e62df2d 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -513,6 +513,7 @@ static_assert(SID_PREVIEW_END < SID_KEYFUNC_START, "calc 
slots ids trampling inf
 
 #define SID_ACCEPT_FORMULA      (SID_KEYFUNC_START + 42)
 #define SID_START_FORMULA       (SID_KEYFUNC_START + 43)
+#define SID_COPYDELETE          (SID_KEYFUNC_START + 44)
 
 #define SID_KEYFUNC_END         (SID_KEYFUNC_START + 50)
 
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index ebba146f998d..6f27650509d3 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -171,6 +171,7 @@ interface CellSelection
     SID_FOCUS_INPUTLINE [ ExecMethod = ExecuteMove; StateMethod = 
GetStateCursor; ]
     SID_CUT             [ ExecMethod = ExecuteEdit; StateMethod = 
GetBlockState; ]
     SID_COPY            [ ExecMethod = ExecuteEdit; StateMethod = 
GetBlockState; ]
+    SID_COPYDELETE      [ ExecMethod = ExecuteEdit; StateMethod = 
GetBlockState; ]
     SID_PASTE           [ ExecMethod = ExecuteEdit; StateMethod = 
GetClipState; ]
     SID_PASTE_SPECIAL   [ ExecMethod = ExecuteEdit; StateMethod = 
GetClipState; ]
     SID_PASTE_UNFORMATTED [ ExecMethod = ExecuteEdit; StateMethod = 
GetClipState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 3591ca10f199..d532de343600 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6700,3 +6700,20 @@ SfxVoidItem MoveKeepInsertMode FID_MOVE_KEEP_INSERT_MODE
 
     GroupId = SfxGroupId::Application;
 ]
+
+SfxVoidItem CopyDelete SID_COPYDELETE
+()
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Edit;
+]
\ No newline at end of file
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index ffffb61a5618..351868f3e95f 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -233,6 +233,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
                 bDisable = false;
                 break;
             case SID_CUT:               // cut
+            case SID_COPYDELETE:
                 bDisable = !bSimpleArea || 
GetObjectShell()->isContentExtractionLocked();
                 break;
             case FID_INS_CELL:          // insert cells, just simple selection
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 50c5635a3b18..ed879ecb62f9 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1458,6 +1458,17 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
             }
             break;
 
+        case SID_COPYDELETE:      // for graphs in DrawShell
+            {
+                weld::WaitObject aWait( GetViewData().GetDialogParent() );
+                pTabViewShell->CopyToClip( nullptr, false, false, true );
+                pTabViewShell->DeleteContents( InsertDeleteFlags::CONTENTS );
+                rReq.Done();
+                GetViewData().SetPasteMode( ScPasteFlags::Mode | 
ScPasteFlags::Border );
+                pTabViewShell->ShowCursor();
+                pTabViewShell->UpdateCopySourceOverlay();
+            }
+            break;
         case SID_PASTE:
             {
                 ScClipUtil::PasteFromClipboard( GetViewData(), pTabViewShell, 
true );
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 8b075bf45cbc..40bda51d7b58 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -606,6 +606,7 @@ void ScTabView::SelectionChanged(bool bFromPaste)
     rBindings.Invalidate( SID_PASTE );
     rBindings.Invalidate( SID_PASTE_SPECIAL );
     rBindings.Invalidate( SID_PASTE_UNFORMATTED );
+    rBindings.Invalidate( SID_COPYDELETE );
 
     rBindings.Invalidate( FID_INS_ROW );
     rBindings.Invalidate( FID_INS_COLUMN );

Reply via email to