[Libreoffice-commits] .: 2 commits - sw/inc sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Fri Feb 11 07:37:57 PST 2011


 sw/inc/dbgoutsw.hxx               |    1 +
 sw/source/core/docnode/ndcopy.cxx |   26 +++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit fe30ec866eee53a3f2b438a6cfb2a29d0501328c
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Fri Feb 11 16:37:34 2011 +0100

    Fixed start position of undo when copy-pasting tables, fdo#32089

diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index acdb007..1ef6a19 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -889,6 +889,17 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
     // die Position nicht "verschoben"
     aCpyPam.SetMark();
     BOOL bCanMoveBack = aCpyPam.Move( fnMoveBackward, fnGoCntnt );
+    // If the position was shifted from more than one node, an end node has been skipped
+    bool bAfterTable = false;
+    if ( ( rPos.nNode.GetIndex() - aCpyPam.GetPoint()->nNode.GetIndex() ) > 1 )
+    {
+        // First go back to the original place
+        aCpyPam.GetPoint()->nNode = rPos.nNode;
+        aCpyPam.GetPoint()->nContent = rPos.nContent;
+
+        bCanMoveBack = false;
+        bAfterTable = true;
+    }
     if( !bCanMoveBack )
         aCpyPam.GetPoint()->nNode--;
 
@@ -1253,7 +1264,20 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
     else
         *aCpyPam.GetMark() = rPos;
 
-    aCpyPam.Move( fnMoveForward, bCanMoveBack ? fnGoCntnt : fnGoNode );
+    if ( !bAfterTable )
+        aCpyPam.Move( fnMoveForward, bCanMoveBack ? fnGoCntnt : fnGoNode );
+    else
+    {
+        // Reset the offset to 0 as it was before the insertion
+        aCpyPam.GetPoint( )->nContent -= aCpyPam.GetPoint( )->nContent;
+
+        aCpyPam.GetPoint( )->nNode++;
+        // If the next node is a start node, then step back: the start node
+        // has been copied and needs to be in the selection for the undo
+        if ( aCpyPam.GetPoint()->nNode.GetNode().IsStartNode() )
+            aCpyPam.GetPoint( )->nNode--;
+
+    }
     aCpyPam.Exchange();
 
     // dann kopiere noch alle Bookmarks
commit a68fad150e3765ed2008e1447555bcd9e7e3a0d3
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Fri Feb 11 16:36:04 2011 +0100

    sw: fixed missing include for using dbg_out functions

diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx
index 71088ea..5c8ef3e 100644
--- a/sw/inc/dbgoutsw.hxx
+++ b/sw/inc/dbgoutsw.hxx
@@ -32,6 +32,7 @@
 
 #include <boost/unordered_map.hpp>
 #include <tox.hxx>
+#include <cstdio>
 class String;
 
 namespace rtl


More information about the Libreoffice-commits mailing list