Kaydet (Commit) 49505336 authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst 074b29c3
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment