diff options
author | scito <info@scito.ch> | 2021-04-30 14:41:00 +0200 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2021-05-03 11:39:20 +0200 |
commit | 02b72784e5601636d26c8e4592958c262efb1a7d (patch) | |
tree | d8e69282a79d4e5e0193f3c1e0e618e27be54452 | |
parent | 357b36c7797ca7ac249714e5ddca1f04e0228c0e (diff) |
tdf#102255 add .uno:PasteTransposed
The transpose uno command is added to the same places as .uno:PasteOnlyValue:
- menubar
- cell
- pagebreak
The icons are added with tdf#141866
Change-Id: I35a54390ee82ab1059007545188e9d175c3ea750
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114911
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
-rw-r--r-- | include/sfx2/sfxsids.hrc | 1 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 11 | ||||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 34 | ||||
-rw-r--r-- | sc/sdi/cellsh.sdi | 1 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 15 | ||||
-rw-r--r-- | sc/uiconfig/scalc/menubar/menubar.xml | 2 | ||||
-rw-r--r-- | sc/uiconfig/scalc/popupmenu/cell.xml | 2 | ||||
-rw-r--r-- | sc/uiconfig/scalc/popupmenu/pagebreak.xml | 2 | ||||
-rw-r--r-- | sfx2/sdi/sfx.sdi | 17 |
10 files changed, 88 insertions, 0 deletions
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index c6073a795b80..3d33e4369d6e 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -435,6 +435,7 @@ class SvxSearchItem; #define SID_PASTE_ONLY_FORMULA (SID_SFX_START + 803) #define SID_PASTE_ONLY_VALUE (SID_SFX_START + 804) #define SID_PASTE_TEXTIMPORT_DIALOG (SID_SFX_START + 805) +#define SID_PASTE_TRANSPOSED (SID_SFX_START + 812) // Used for redaction #define SID_SHAPE_NAME (SID_SFX_START + 808) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu index b61385b8572d..2c09285c5195 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu @@ -2610,6 +2610,17 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:PasteTransposed" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Paste Transposed </value> + </prop> + <prop oor:name="PopupLabel" oor:type="xs:string"> + <value xml:lang="en-US">Trans~pose</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:PasteTextImportDialog" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Use Text Import Dialog</value> diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 29417a3c4778..9b587a894af6 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -510,6 +510,40 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMultiRangeCol) CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(2, 0, 0))); } +// Test the call of .uno:PasteTransposed (tdf#102255) +// Note: the transpose functionaly is tested in ucalc +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteTransposed) +{ + mxComponent = loadFromDesktop("private:factory/scalc"); + ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); + CPPUNIT_ASSERT(pModelObj); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + insertStringToCell(*pModelObj, "A1", "1"); + insertStringToCell(*pModelObj, "A2", "2"); + insertStringToCell(*pModelObj, "A3", "3"); + + goToCell("A1:A3"); + + dispatchCommand(mxComponent, ".uno:Copy", {}); + + mxComponent->dispose(); + + // Open a new document + mxComponent = loadFromDesktop("private:factory/scalc"); + pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); + CPPUNIT_ASSERT(pModelObj); + pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + dispatchCommand(mxComponent, ".uno:PasteTransposed", {}); + + CPPUNIT_ASSERT_EQUAL(OUString("1"), pDoc->GetString(ScAddress(0, 0, 0))); // A1 + CPPUNIT_ASSERT_EQUAL(OUString("2"), pDoc->GetString(ScAddress(1, 0, 0))); // B1 + CPPUNIT_ASSERT_EQUAL(OUString("3"), pDoc->GetString(ScAddress(2, 0, 0))); // C1 +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131442) { mxComponent = loadFromDesktop("private:factory/scalc"); diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index e75d9b3fcc11..0790f8c583e5 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -177,6 +177,7 @@ interface CellSelection SID_PASTE_ONLY_TEXT [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_PASTE_ONLY_FORMULA [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_PASTE_ONLY_VALUE [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] + SID_PASTE_TRANSPOSED [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_PASTE_TEXTIMPORT_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_EXTERNAL_SOURCE [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 99478b302ec9..d677e6a33aca 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -222,6 +222,7 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) case SID_PASTE_ONLY_VALUE: case SID_PASTE_ONLY_TEXT: case SID_PASTE_ONLY_FORMULA: + case SID_PASTE_TRANSPOSED: case SID_PASTE_TEXTIMPORT_DIALOG: bDisable = GetViewData().SelectionForbidsCellFill(); break; @@ -526,6 +527,7 @@ IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper, rBindings.Invalidate( SID_PASTE_ONLY_VALUE ); rBindings.Invalidate( SID_PASTE_ONLY_TEXT ); rBindings.Invalidate( SID_PASTE_ONLY_FORMULA ); + rBindings.Invalidate( SID_PASTE_TRANSPOSED ); rBindings.Invalidate( SID_PASTE_TEXTIMPORT_DIALOG ); rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); } @@ -620,6 +622,7 @@ void ScCellShell::GetClipState( SfxItemSet& rSet ) rSet.DisableItem( SID_PASTE_ONLY_VALUE ); rSet.DisableItem( SID_PASTE_ONLY_TEXT ); rSet.DisableItem( SID_PASTE_ONLY_FORMULA ); + rSet.DisableItem( SID_PASTE_TRANSPOSED ); rSet.DisableItem( SID_PASTE_TEXTIMPORT_DIALOG ); rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS ); } diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index fd329898818e..efa1e4dae4c8 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1511,6 +1511,21 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail break; } + case SID_PASTE_TRANSPOSED: + { + if (ScTransferObj::GetOwnClipboard( + ScTabViewShell::GetClipData(GetViewData().GetActiveWin()))) // own cell data + { + rReq.SetSlot(FID_INS_CELL_CONTENTS); + rReq.AppendItem(SfxBoolItem(FN_PARAM_3, true)); // transpose + ExecuteSlot(rReq, GetInterface()); + rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success + pTabViewShell->CellContentChanged(); + } + else + rReq.SetReturnValue(SfxInt16Item(nSlot, 0)); // 0 = fail + break; + } case SID_PASTE_TEXTIMPORT_DIALOG: { vcl::Window* pWin = GetViewData().GetActiveWin(); diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml index e8ed1b24c34c..17916a541c63 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -93,6 +93,8 @@ <menu:menuitem menu:id=".uno:PasteOnlyValue"/> <menu:menuitem menu:id=".uno:PasteOnlyFormula"/> <menu:menuseparator/> + <menu:menuitem menu:id=".uno:PasteTransposed"/> + <menu:menuseparator/> <menu:menuitem menu:id=".uno:PasteSpecial"/> </menu:menupopup> </menu:menu> diff --git a/sc/uiconfig/scalc/popupmenu/cell.xml b/sc/uiconfig/scalc/popupmenu/cell.xml index 8b503e6c492e..fd086d0af975 100644 --- a/sc/uiconfig/scalc/popupmenu/cell.xml +++ b/sc/uiconfig/scalc/popupmenu/cell.xml @@ -19,6 +19,8 @@ <menu:menuitem menu:id=".uno:PasteOnlyValue"/> <menu:menuitem menu:id=".uno:PasteOnlyFormula"/> <menu:menuseparator/> + <menu:menuitem menu:id=".uno:PasteTransposed"/> + <menu:menuseparator/> <menu:menuitem menu:id=".uno:PasteSpecial"/> </menu:menupopup> </menu:menu> diff --git a/sc/uiconfig/scalc/popupmenu/pagebreak.xml b/sc/uiconfig/scalc/popupmenu/pagebreak.xml index 57b8b5ef900a..bdcdd4d7d183 100644 --- a/sc/uiconfig/scalc/popupmenu/pagebreak.xml +++ b/sc/uiconfig/scalc/popupmenu/pagebreak.xml @@ -19,6 +19,8 @@ <menu:menuitem menu:id=".uno:PasteOnlyValue"/> <menu:menuitem menu:id=".uno:PasteOnlyFormula"/> <menu:menuseparator/> + <menu:menuitem menu:id=".uno:PasteTransposed"/> + <menu:menuseparator/> <menu:menuitem menu:id=".uno:PasteSpecial"/> </menu:menupopup> </menu:menu> diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index ae37ce14448f..0de7ed400c78 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3143,6 +3143,23 @@ SfxVoidItem PasteOnlyValue SID_PASTE_ONLY_VALUE GroupId = SfxGroupId::Edit; ] +SfxVoidItem PasteTransposed SID_PASTE_TRANSPOSED + +[ + AutoUpdate = FALSE, + FastCall = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Edit; +] + SfxVoidItem PasteTextImportDialog SID_PASTE_TEXTIMPORT_DIALOG [ |