[Libreoffice-commits] .: 2 commits - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Dec 21 10:10:42 PST 2010


 sc/source/ui/view/viewfun3.cxx |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 3529474954bedb59a455c55dd62755e6d8b362b5
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Dec 21 13:07:27 2010 -0500

    Simplified the logic a bit.
    
    * There is no need to go through those two if statement blocks when
      bNoPaste is true.  Bail out early.  This helps reduce the nest
      level.
    * Updating a range can be simplified.
    * the 'r' prefix is reserved for references. For a variable that's
      not a reference, use 'a'.

diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 10cea3a..426e6b3 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1041,7 +1041,15 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
     bool bMarkIsFiltered = (eMarkType == SC_MARK_SIMPLE_FILTERED);
     bool bNoPaste = ((eMarkType != SC_MARK_SIMPLE && !bMarkIsFiltered) ||
             (bMarkIsFiltered && (eMoveMode != INS_NONE || bAsLink)));
-    if (!bNoPaste && !rMark.IsMarked())
+
+    if (bNoPaste)
+    {
+        // Exit early when we don't want to perform pasting.
+        ErrorMessage(STR_MSSG_PASTEFROMCLIP_0);
+        return FALSE;
+    }
+
+    if (!rMark.IsMarked())
     {
         // Create a selection with clipboard row count and check that for
         // filtered.
@@ -1065,31 +1073,17 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
     }
     else
     {
-        // FIX for issue #106711 : leftover data after undo.
-        if (!bNoPaste )
+        // Expand the marked area when the destination area is larger than the
+        // current selection, to get the undo do the right thing. (i#106711)
+        ScRange aRange;
+        aFilteredMark.GetMarkArea( aRange );
+        if( (aRange.aEnd.Col() - aRange.aStart.Col()) < nDestSizeX )
         {
-            ScRange rRange;
-            aFilteredMark.GetMarkArea( rRange );
-            if( (rRange.aEnd.Col() - rRange.aStart.Col()) < nDestSizeX )
-            {
-                nStartCol = rRange.aStart.Col();
-                nStartRow = rRange.aStart.Row();
-                nStartTab = rRange.aStart.Tab();
-                nEndCol = nStartCol + nDestSizeX;
-                nEndRow = rRange.aEnd.Row();
-                nEndTab = rRange.aEnd.Tab();
-                aMarkRange = ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab);
-                aFilteredMark.SetMarkArea( aMarkRange);
-            }
+            aRange.aEnd.SetCol(aRange.aStart.Col() + nDestSizeX);
+            aFilteredMark.SetMarkArea(aRange);
         }
     }
 
-    if (bNoPaste)
-    {
-        ErrorMessage(STR_MSSG_PASTEFROMCLIP_0);
-        return FALSE;
-    }
-
     SCROW nUnfilteredRows = aMarkRange.aEnd.Row() - aMarkRange.aStart.Row() + 1;
     ScRangeList aRangeList;
     if (bMarkIsFiltered)
commit dd9af93f34efa580ca69fcffb728103da572f995
Author: Joost Wezenbeek <joost.eekhoorn at gmail.com>
Date:   Mon Dec 20 23:02:07 2010 +0100

    Leftover data after Undo operation
    
    qa issue #106711

diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 42f75c6..10cea3a 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1063,6 +1063,27 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
         }
         aFilteredMark.SetMarkArea( aMarkRange);
     }
+    else
+    {
+        // FIX for issue #106711 : leftover data after undo.
+        if (!bNoPaste )
+        {
+            ScRange rRange;
+            aFilteredMark.GetMarkArea( rRange );
+            if( (rRange.aEnd.Col() - rRange.aStart.Col()) < nDestSizeX )
+            {
+                nStartCol = rRange.aStart.Col();
+                nStartRow = rRange.aStart.Row();
+                nStartTab = rRange.aStart.Tab();
+                nEndCol = nStartCol + nDestSizeX;
+                nEndRow = rRange.aEnd.Row();
+                nEndTab = rRange.aEnd.Tab();
+                aMarkRange = ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab);
+                aFilteredMark.SetMarkArea( aMarkRange);
+            }
+        }
+    }
+
     if (bNoPaste)
     {
         ErrorMessage(STR_MSSG_PASTEFROMCLIP_0);


More information about the Libreoffice-commits mailing list