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>
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index c6073a7..3d33e43 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 b61385b..2c09285 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 29417a3..9b587a8 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 e75d9b3..0790f8c 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 99478b3..d677e6a 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 fd32989..efa1e4d 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 e8ed1b2..17916a5 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 8b503e6..fd086d0 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 57b8b5e..bdcdd4d 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 ae37ce1..0de7ed4 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
[