summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-06-17 17:40:48 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-06-18 10:16:52 +0200
commit310271df2e4dc67d223dbec4b23e39ea4a67c042 (patch)
tree3d0107055e14eedb84004d5a0082d862ed4e7b48 /sw
parent102a99e46bca9fb292cc1b2e7604020eb9ca43f4 (diff)
tdf#133982 sw: fix Copy of document that starts with nested table
Started to assert with ef8427d12a63127a2eb867637699343d630545dd because a bookmark was created on the wrong node but this never worked. Change-Id: Ife01a3c8041b4c7d08b2d749dde77ced388f7215 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96556 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/edit/edglss.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index b9fd1e234a70..b71c9fde5d9a 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -231,7 +231,12 @@ bool SwEditShell::CopySelToDoc( SwDoc* pInsDoc )
// 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();
+ // tdf#133982 tables can be nested
+ while (SwTableNode const* pTableNode =
+ aPaM.Start()->nNode.GetNode().StartOfSectionNode()->FindTableNode())
+ {
+ aPaM.Start()->nNode = *pTableNode;
+ }
aPaM.Start()->nContent.Assign(nullptr, 0);
}
bRet = GetDoc()->getIDocumentContentOperations().CopyRange( aPaM, aPos, SwCopyFlags::CheckPosInFly)