diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-10-31 22:06:40 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-10-31 23:00:10 +0100 |
commit | 9b7542b0928f81b36365b13228a402e8cd64e8cd (patch) | |
tree | b77670bb966219db981b338016206ca23d7b8aa1 /sw/source/core/txtnode | |
parent | 68754260e6f3fdc91a6ab55b4fd99fbd34bf3447 (diff) |
sw: fix insertion of hyperlink inside hyperlink...
... when either the start or the end position of the new hint is equal
to an existing hint. There is not just 1 case here but 3 different
ones; don't attempt to insert hints with start > end.
Change-Id: I39cf8a352f67d77b56b0d01de5872f4d341f6bdd
Diffstat (limited to 'sw/source/core/txtnode')
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index c29f87ed597a..1494553a63c4 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -550,23 +550,31 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint ) } else { - assert((nOtherStart < nNewStart) && (nNewEnd < nOtherEnd)); + assert((nOtherStart < nNewStart) || (nNewEnd < nOtherEnd)); // scenario: there is a RUBY, and contained within that a META; // now a RUBY is inserted within the META => the exising RUBY is split: // here it is not possible to simply insert the left/right fragment // of the existing RUBY because they <em>overlap</em> with the META! Delete( *itOther ); // this also does NoteInHistory! - *(*itOther)->GetEnd() = nNewStart; - bool bSuccess( TryInsertNesting(rNode, **itOther) ); - OSL_ENSURE(bSuccess, "recursive call 1 failed?"); - SwTxtAttrNesting * const pOtherRight( - MakeTxtAttrNesting( - rNode, **itOther, nNewEnd, nOtherEnd ) ); - bSuccess = TryInsertNesting(rNode, *pOtherRight); - OSL_ENSURE(bSuccess, "recursive call 2 failed?"); - (void)bSuccess; + if (nNewEnd < nOtherEnd) + { + SwTxtAttrNesting * const pOtherRight( + MakeTxtAttrNesting( + rNode, **itOther, nNewEnd, nOtherEnd ) ); + bool const bSuccess( TryInsertNesting(rNode, *pOtherRight) ); + SAL_WARN_IF(!bSuccess, "sw.core", "recursive call 1 failed?"); + } + if (nOtherStart < nNewStart) + { + *(*itOther)->GetEnd() = nNewStart; + bool const bSuccess( TryInsertNesting(rNode, **itOther) ); + SAL_WARN_IF(!bSuccess, "sw.core", "recursive call 2 failed?"); + } + else + { + rNode.DestroyAttr(*itOther); + } } - } return true; |