[Libreoffice-commits] core.git: sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 30 12:32:10 UTC 2020
sw/source/core/txtnode/thints.cxx | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
New commits:
commit fd9c47eda58dda5e61850e9b9f6de0f38d221b4a
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Oct 27 21:02:45 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Oct 30 13:31:19 2020 +0100
tdf#98868 re-register cloned TOXMark if the dest doc is different
if the SwTOXType is from a different document that the target, re-register the
TOXMark against a matching SwTOXType from the target document instead
Change-Id: Ib9e5a2c437a7510712a10f41c551f0813a8323db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104910
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 714214c2d360..593674ff8159 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1113,8 +1113,23 @@ SwTextAttr* MakeTextAttr(
: new SwTextRefMark( static_cast<SwFormatRefMark&>(rNew), nStt, &nEnd );
break;
case RES_TXTATR_TOXMARK:
- pNew = new SwTextTOXMark( static_cast<SwTOXMark&>(rNew), nStt, &nEnd );
+ {
+ SwTOXMark& rMark = static_cast<SwTOXMark&>(rNew);
+
+ // tdf#98868 if the SwTOXType is from a different document that the
+ // target, re-register the TOXMark against a matching SwTOXType from
+ // the target document instead
+ const SwTOXType* pTOXType = rMark.GetTOXType();
+ if (pTOXType && &pTOXType->GetDoc() != &rDoc)
+ {
+ SwTOXType* pToxType = SwHistorySetTOXMark::GetSwTOXType(rDoc, pTOXType->GetType(),
+ pTOXType->GetTypeName());
+ rMark.RegisterToTOXType(*pToxType);
+ }
+
+ pNew = new SwTextTOXMark(rMark, nStt, &nEnd);
break;
+ }
case RES_TXTATR_CJK_RUBY:
pNew = new SwTextRuby( static_cast<SwFormatRuby&>(rNew), nStt, nEnd );
break;
More information about the Libreoffice-commits
mailing list