summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-09-19 10:55:38 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-09-19 11:43:05 +0200
commit49505336a629a75f4fb48bbe0c532b402e857ed4 (patch)
treec66613f78bf21e9fc3e0d5f6f51472bbe976b085
parent074b29c368720d6552bb5a29e1aae4b8728a7549 (diff)
fdo#37606 SwEditShell: fix copying when doc starts with a table ...
... and the whole document was selected The problem is that the cursor starts at the first cell of the starting table, but when copying, we want to copy the preceding startnode and tablenode as well. Change-Id: I890bba2ae835c4c331f90d977fe5d42fe871c922
-rw-r--r--sw/source/core/edit/edglss.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 554583cfd22a..18ea2fe89b96 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -210,6 +210,7 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
bool bColSel = _GetCrsr()->IsColumnSelection();
if( bColSel && pInsDoc->IsClipBoard() )
pInsDoc->SetColumnSelection( true );
+ bool bSelectAll = StartsWithTable() && ExtendedSelectedAll();
{
FOREACHPAM_START(this)
@@ -228,7 +229,16 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
}
else
{
- bRet = GetDoc()->CopyRange( *PCURCRSR, aPos, false ) || bRet;
+ // Make a copy, so that in case we need to adjust the selection
+ // for the purpose of copying, our shell cursor is not touched.
+ // (Otherwise we would have to restore it.)
+ SwPaM aPaM(*PCURCRSR);
+ if (bSelectAll)
+ // Selection starts at the first para of the first cell,
+ // but we want to copy the table and the start node before
+ // the first cell as well.
+ aPaM.Start()->nNode = aPaM.Start()->nNode.GetNode().FindTableNode()->GetIndex();
+ bRet = GetDoc()->CopyRange( aPaM, aPos, false ) || bRet;
}
FOREACHPAM_END()