diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-06-10 02:10:43 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2019-07-16 19:05:01 +0200 |
commit | ee4953cf6c2d5106dd71c3488da9e3f41eafee84 (patch) | |
tree | f5d1598f5cc634f4ac1d3e11a3c6290e0e2f502c /sc/source/ui/view/tabview3.cxx | |
parent | ebd82c33c1a5867e8f46035b344c6fff6e6c389b (diff) |
tdf#104717 don't set the primary selection on paste
When pasting, Calc sets a selection for the pasted cells. But this
also includes the primary selection, which is unexpected. And that
will eventually even update the clipboard, if a clipboard manager
is configured to sync primary selection and clipboard.
I actually couldn't find any other application, which select on
paste at all. Normally they just replace a selection. But I guess
this is very known behaviour for spreadsheets. gnumeric at least
changes the primary selection on paste too.
Calc also removes the system selection when clearing the selection.
Other applicatios keep the primary selection valid, until the
application or document closes, so do the same in Calc. We still
clear the selection when we close the view in ~ScTabView().
Change-Id: I816d8caec1e0364fec20266db3fb3c63cf584865
Reviewed-on: https://gerrit.libreoffice.org/73906
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/ui/view/tabview3.cxx')
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index aa7890723393..dd67d915e674 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -176,7 +176,7 @@ void ScTabView::ClickCursor( SCCOL nPosX, SCROW nPosY, bool bControl ) } } -void ScTabView::UpdateAutoFillMark() +void ScTabView::UpdateAutoFillMark(bool bFromPaste) { // single selection or cursor ScRange aMarkRange; @@ -198,7 +198,8 @@ void ScTabView::UpdateAutoFillMark() // selection transfer object is checked together with AutoFill marks, // because it has the same requirement of a single continuous block. - CheckSelectionTransfer(); // update selection transfer object + if (!bFromPaste) + CheckSelectionTransfer(); // update selection transfer object } void ScTabView::FakeButtonUp( ScSplitPos eWhich ) @@ -486,15 +487,6 @@ void ScTabView::CheckSelectionTransfer() collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}); } } - else if ( pOld && pOld->GetView() == this ) - { - // remove own selection - - pOld->ForgetView(); - pScMod->SetSelectionTransfer( nullptr ); - TransferableHelper::ClearSelection( GetActiveWin() ); // may delete pOld - } - // else: selection from outside: leave unchanged } } @@ -521,7 +513,7 @@ void ScTabView::SetTabProtectionSymbol( SCTAB nTab, const bool bProtect ) pTabControl->SetProtectionSymbol( static_cast<sal_uInt16>(nTab)+1, bProtect); } -void ScTabView::SelectionChanged() +void ScTabView::SelectionChanged(bool bFromPaste) { SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame(); if (pViewFrame) @@ -535,7 +527,7 @@ void ScTabView::SelectionChanged() } } - UpdateAutoFillMark(); // also calls CheckSelectionTransfer + UpdateAutoFillMark(bFromPaste); // also calls CheckSelectionTransfer SfxBindings& rBindings = aViewData.GetBindings(); |