[Libreoffice-commits] core.git: sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Sep 19 02:43:24 PDT 2013
sw/source/core/edit/edglss.cxx | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
New commits:
commit 49505336a629a75f4fb48bbe0c532b402e857ed4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Sep 19 10:55:38 2013 +0200
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
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 554583c..18ea2fe 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()
More information about the Libreoffice-commits
mailing list