summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2014-12-10 10:32:53 +0100
committerEike Rathke <erack@redhat.com>2014-12-10 16:03:37 +0000
commit548e9d43c2f171263b7b53c00b48b3b732226919 (patch)
tree34f3611319729f741800eea13a7384c7cb1abeb2
parenta27bb66382687ce348db5f57a1e64ee6afcb5c43 (diff)
paste from system from the top left of selection
For example, 1. echo -e "5,6\n7,8" 2. select the lines and copy them to clipboard 3. select an area in Calc, starting from bottom right 4. paste 5. select comma as data separator in the CSV import dialog I think most people would expect the data to appear in the selected area, but currently it would be inserted starting from active cell (which is the bottom right cell of the selection). Change-Id: Ief0e05deda18928a832dca2a261f8493ac9a03a9 Reviewed-on: https://gerrit.libreoffice.org/13410 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 781639eb84fc09d0260092238c3f50216f15a3ff) Reviewed-on: https://gerrit.libreoffice.org/13421
-rw-r--r--sc/source/ui/view/viewfun3.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 8244e605ccc8..562135a0d5e0 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -676,8 +676,24 @@ bool ScViewFunc::PasteFromSystem( sal_uLong nFormatId, bool bApi )
if ( !aDataHelper.GetTransferable().is() )
return false;
+ SCCOL nPosX = 0;
+ SCROW nPosY = 0;
+
+ ScViewData& rViewData = GetViewData();
+ ScRange aRange;
+ if ( rViewData.GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
+ {
+ nPosX = aRange.aStart.Col();
+ nPosY = aRange.aStart.Row();
+ }
+ else
+ {
+ nPosX = rViewData.GetCurX();
+ nPosY = rViewData.GetCurY();
+ }
+
bRet = PasteDataFormat( nFormatId, aDataHelper.GetTransferable(),
- GetViewData().GetCurX(), GetViewData().GetCurY(),
+ nPosX, nPosY,
NULL, false, !bApi ); // allow warning dialog
if ( !bRet && !bApi )