[Libreoffice-commits] core.git: sc/source
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 16 17:06:00 UTC 2019
sc/source/ui/inc/tabview.hxx | 4 ++--
sc/source/ui/view/tabview3.cxx | 18 +++++-------------
sc/source/ui/view/viewfun3.cxx | 2 +-
3 files changed, 8 insertions(+), 16 deletions(-)
New commits:
commit ee4953cf6c2d5106dd71c3488da9e3f41eafee84
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Jun 10 02:10:43 2019 +0200
Commit: Eike Rathke <erack at redhat.com>
CommitDate: Tue Jul 16 19:05:01 2019 +0200
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 at redhat.com>
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index d2be9e94a35a..f00bd76ff337 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -390,7 +390,7 @@ public:
SC_DLLPUBLIC void SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew = false );
SC_DLLPUBLIC void CellContentChanged();
- void SelectionChanged();
+ void SelectionChanged( bool bFromPaste = false );
void CursorPosChanged();
void UpdateInputContext();
@@ -404,7 +404,7 @@ public:
Point GetChartInsertPos( const Size& rSize, const ScRange& rCellRange );
Point GetChartDialogPos( const Size& rDialogSize, const tools::Rectangle& rLogicChart );
- void UpdateAutoFillMark();
+ void UpdateAutoFillMark( bool bFromPaste = false );
void ShowCursor();
void HideAllCursors();
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();
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 89aa916d26ab..06ebd51f1d9a 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1784,7 +1784,7 @@ void ScViewFunc::PostPasteFromClip(const ScRangeList& rPasteRanges, const ScMark
ScDocShell* pDocSh = rViewData.GetDocShell();
pDocSh->UpdateOle(&rViewData);
- SelectionChanged();
+ SelectionChanged(true);
ScModelObj* pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh);
if (!pModelObj)
More information about the Libreoffice-commits
mailing list