summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-06-17 17:40:48 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-06-24 16:13:11 +0200
commitff6911b3afdacc82ed6a42f3a7a1b852931840d0 (patch)
tree5de9bce1f0d6047af119788ae1a786e7e79f0d79
parentc968ba362412cc0d2abba56dedce21e2990d1dbc (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> (cherry picked from commit 4de190d55900387bc07971bac84f7cd52e329146) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96578 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 7866336f1ce3d5b686847e98a218e6b4d4ca9db5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96805 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Miklos Vajna <vmiklos@collabora.com>
-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 99e242ba61de..ed46482bf933 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -232,7 +232,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, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ) || bRet;