[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - sc/source

David Tardon dtardon at redhat.com
Wed Dec 10 08:12:34 PST 2014


 sc/source/ui/view/viewfun3.cxx |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 60b069ded797e654a5a169d4e331ed01db87015d
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Dec 10 10:32:53 2014 +0100

    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).
    
    Reviewed-on: https://gerrit.libreoffice.org/13410
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 781639eb84fc09d0260092238c3f50216f15a3ff)
    Reviewed-on: https://gerrit.libreoffice.org/13421
    
    Conflicts:
    	sc/source/ui/view/viewfun3.cxx
    
    Change-Id: Ief0e05deda18928a832dca2a261f8493ac9a03a9
    Reviewed-on: https://gerrit.libreoffice.org/13424
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index be5d96c..dc05c14 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -681,8 +681,24 @@ bool ScViewFunc::PasteFromSystem( sal_uLong nFormatId, bool bApi )
         if ( !aDataHelper.GetTransferable().is() )
             return false;
 
+        SCCOL nPosX = 0;
+        SCROW nPosY = 0;
+
+        ScViewData* pViewData = GetViewData();
+        ScRange aRange;
+        if ( pViewData->GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
+        {
+            nPosX = aRange.aStart.Col();
+            nPosY = aRange.aStart.Row();
+        }
+        else
+        {
+            nPosX = pViewData->GetCurX();
+            nPosY = pViewData->GetCurY();
+        }
+
         bRet = PasteDataFormat( nFormatId, aDataHelper.GetTransferable(),
-                                GetViewData()->GetCurX(), GetViewData()->GetCurY(),
+                                nPosX, nPosY,
                                 NULL, false, !bApi );       // allow warning dialog
 
         if ( !bRet && !bApi )


More information about the Libreoffice-commits mailing list