diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2024-04-19 08:51:34 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-04-19 17:14:37 +0200 |
commit | 4ffe06a81866a2c9f8598d194e04c114cc083119 (patch) | |
tree | ce9335c961fff582c2dfd9e0439c8359267ba3e7 /sc/source/ui | |
parent | 78bd5e2523d077a67468b752d4788a2c3b43fb5f (diff) |
cool#8789 sc lok: fix copy for multi-selections
Select A1+A3 in Calc, copy, try to paste in B1, nothing happens.
This is because lok::Document::getSelectionTypeAndText() for a Calc
document ends up in ScViewFunc::CopyToTransferable(), which only handles
the SC_MARK_SIMPLE* cases.
Fix the problem by implementing support for SC_MARK_MULTI, similar to
what ScCellShell::ExecuteEdit() does in the SID_COPY case, which also
calls CopyToClip().
Keep the test highlevel as the Calc shell doesn't seem to have an easy
function to do the same as the Ctrl-click on a cell without duplicating
lots of code in the testcase.
Change-Id: I641d9db95ca391a4f39d96aeeb33422129262288
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166279
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index ee2cccf72f35..1c918ff1c04d 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -458,6 +458,14 @@ rtl::Reference<ScTransferObj> ScViewFunc::CopyToTransferable() return new ScTransferObj( std::move(pClipDoc), std::move(aObjDesc) ); } } + else if (eMarkType == SC_MARK_MULTI) + { + ScDocumentUniquePtr pClipDoc(new ScDocument(SCDOCMODE_CLIP)); + // This takes care of the input line and calls CopyToClipMultiRange() for us. + CopyToClip(pClipDoc.get(), /*bCut=*/false, /*bApi=*/true); + TransferableObjectDescriptor aObjDesc; + return new ScTransferObj(std::move(pClipDoc), std::move(aObjDesc)); + } return nullptr; } |