tdf#50746 Make "paste unformatted text" work for Calc
The same command with the same Ctrl+Shift+Alt+V hot-key
was already added inside Writer. So now Calc has it too.
Change-Id: I2b2d1b02e33288bc058c773431f029fb1d33d3be
Reviewed-on: https://gerrit.libreoffice.org/44886
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
index 475de48..b3f1954 100644
--- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
@@ -1294,6 +1294,12 @@
<value xml:lang="en-US">.uno:PasteSpecial</value>
</prop>
</node>
<node oor:name="V_SHIFT_MOD1_MOD2" oor:op="replace">
<prop oor:name="Command">
<value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
<value xml:lang="en-US">.uno:PasteUnformatted</value>
</prop>
</node>
<node oor:name="Z_SHIFT_MOD1" oor:op="replace">
<prop oor:name="Command">
<value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 90b62da..22a6631 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -171,6 +171,7 @@ interface CellSelection
SID_COPY [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ]
SID_PASTE [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ]
SID_PASTE_SPECIAL [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ]
SID_PASTE_UNFORMATTED [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ]
SID_PASTE_ONLY_TEXT [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ]
SID_PASTE_ONLY_FORMULA [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ]
SID_PASTE_ONLY_VALUE [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ]
diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi
index 2ba4c89..1cf966b 100644
--- a/sc/sdi/drtxtob.sdi
+++ b/sc/sdi/drtxtob.sdi
@@ -52,6 +52,7 @@ interface TableDrawText
SID_COPY [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_PASTE [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ]
SID_PASTE_SPECIAL [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ]
SID_PASTE_UNFORMATTED [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ]
SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ]
SID_SELECTALL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_CHARMAP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
diff --git a/sc/sdi/editsh.sdi b/sc/sdi/editsh.sdi
index ac96dbd..f854fe8 100644
--- a/sc/sdi/editsh.sdi
+++ b/sc/sdi/editsh.sdi
@@ -32,6 +32,7 @@ interface TableText
SID_COPY [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_PASTE [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ]
SID_PASTE_SPECIAL [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ]
SID_PASTE_UNFORMATTED [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ]
SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ]
SID_SELECTALL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
SID_CHARMAP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 4f71ed9c..0f398c5 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -161,6 +161,7 @@ void ScDLL::Init()
SvxLineWidthToolBoxControl ::RegisterControl(0, pMod);
SvxStyleToolBoxControl ::RegisterControl(SID_STYLE_APPLY, pMod);
SvxClipBoardControl ::RegisterControl(SID_PASTE, pMod );
SvxClipBoardControl ::RegisterControl(SID_PASTE_UNFORMATTED, pMod );
SvxUndoRedoControl ::RegisterControl(SID_UNDO, pMod );
SvxUndoRedoControl ::RegisterControl(SID_REDO, pMod );
svx::ParaLineSpacingPopup ::RegisterControl(SID_ATTR_PARA_LINESPACE, pMod );
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index cdbbba7..feb264f 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -196,6 +196,10 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
ExecutePasteContents( rReq );
break;
case SID_PASTE_UNFORMATTED:
pOutView->Paste();
break;
case SID_SELECTALL:
{
sal_Int32 nCount = pOutliner->GetParagraphCount();
@@ -476,6 +480,7 @@ IMPL_LINK( ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper*, pData
SfxBindings& rBindings = pViewData->GetBindings();
rBindings.Invalidate( SID_PASTE );
rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( SID_PASTE_UNFORMATTED );
rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
@@ -509,6 +514,7 @@ void ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet )
{
case SID_PASTE:
case SID_PASTE_SPECIAL:
case SID_PASTE_UNFORMATTED:
if( !bPastePossible )
rSet.DisableItem( nWhich );
break;
diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx
index 2805051..192f05e 100644
--- a/sc/source/ui/drawfunc/drtxtob2.cxx
+++ b/sc/source/ui/drawfunc/drtxtob2.cxx
@@ -75,6 +75,7 @@ void ScDrawTextObjectBar::ExecuteGlobal( SfxRequest &rReq )
case SID_PASTE:
case SID_PASTE_SPECIAL:
case SID_PASTE_UNFORMATTED:
case SID_CLIPBOARD_FORMAT_ITEMS:
case SID_HYPERLINK_SETLINK:
{
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index da7d1d3..086c33e 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:
case SID_PASTE_SPECIAL:
case SID_PASTE_UNFORMATTED:
case SID_PASTE_ONLY_VALUE:
case SID_PASTE_ONLY_TEXT:
case SID_PASTE_ONLY_FORMULA:
@@ -520,6 +521,7 @@ IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper,
SfxBindings& rBindings = GetViewData()->GetBindings();
rBindings.Invalidate( SID_PASTE );
rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( SID_PASTE_UNFORMATTED );
rBindings.Invalidate( SID_PASTE_ONLY_VALUE );
rBindings.Invalidate( SID_PASTE_ONLY_TEXT );
rBindings.Invalidate( SID_PASTE_ONLY_FORMULA );
@@ -576,6 +578,7 @@ void ScCellShell::GetClipState( SfxItemSet& rSet )
{
// SID_PASTE
// SID_PASTE_SPECIAL
// SID_PASTE_UNFORMATTED
// SID_CLIPBOARD_FORMAT_ITEMS
if ( !pImpl->m_xClipEvtLstnr.is() )
@@ -634,6 +637,7 @@ void ScCellShell::GetClipState( SfxItemSet& rSet )
{
rSet.DisableItem( SID_PASTE );
rSet.DisableItem( SID_PASTE_SPECIAL );
rSet.DisableItem( SID_PASTE_UNFORMATTED );
rSet.DisableItem( SID_PASTE_ONLY_VALUE );
rSet.DisableItem( SID_PASTE_ONLY_TEXT );
rSet.DisableItem( SID_PASTE_ONLY_FORMULA );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 8794364..455c3ac 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1641,6 +1641,22 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
break;
case SID_PASTE_UNFORMATTED:
// differentiate between own cell data and draw objects/external data
// this makes FID_INS_CELL_CONTENTS superfluous
{
WaitObject aWait( GetViewData()->GetDialogParent() );
bool bRet = pTabViewShell->PasteFromSystem(SotClipboardFormatId::STRING, true); // TRUE: no error messages
if ( bRet )
{
rReq.SetReturnValue(SfxInt16Item(nSlot, bRet ? 1 : 0)); // 1 = success, 0 = fail
rReq.Done();
}
pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
}
break;
// other
case FID_INS_ROWBRK:
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 632876d..9cbac20 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -310,6 +310,18 @@ void ScEditShell::Execute( SfxRequest& rReq )
}
break;
case SID_PASTE_UNFORMATTED:
{
pTableView->Paste();
if (pTopView)
{
pTopView->Paste();
pTopView->GetWindow()->GrabFocus();
}
}
break;
case SID_SELECTALL:
{
sal_Int32 nPar = pEngine->GetParagraphCount();
@@ -807,6 +819,7 @@ IMPL_LINK( ScEditShell, ClipboardChanged, TransferableDataHelper*, pDataHelper,
SfxBindings& rBindings = pViewData->GetBindings();
rBindings.Invalidate( SID_PASTE );
rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( SID_PASTE_UNFORMATTED );
rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
@@ -836,6 +849,7 @@ void ScEditShell::GetClipState( SfxItemSet& rSet )
{
case SID_PASTE:
case SID_PASTE_SPECIAL:
case SID_PASTE_UNFORMATTED:
if( !bPastePossible )
rSet.DisableItem( nWhich );
break;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index d31146d..5ea1054 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -519,6 +519,7 @@ void ScTabView::SelectionChanged()
rBindings.Invalidate( SID_COPY );
rBindings.Invalidate( SID_PASTE );
rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( SID_PASTE_UNFORMATTED );
rBindings.Invalidate( FID_INS_ROW );
rBindings.Invalidate( FID_INS_COLUMN );