summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2011-02-11 16:37:34 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2011-02-11 16:37:34 +0100
commitfe30ec866eee53a3f2b438a6cfb2a29d0501328c (patch)
treee0197b94c9ed139f6f0026817060a57df13d5c76
parenta68fad150e3765ed2008e1447555bcd9e7e3a0d3 (diff)
Fixed start position of undo when copy-pasting tables, fdo#32089
-rw-r--r--sw/source/core/docnode/ndcopy.cxx26
1 files changed, 25 insertions, 1 deletions
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index acdb007384..1ef6a19b50 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