diff options
author | mst <mst@openoffice.org> | 2009-11-16 12:33:38 +0000 |
---|---|---|
committer | mst <mst@openoffice.org> | 2009-11-16 12:33:38 +0000 |
commit | 5f540c2d21bafddb1aa4790eae83caf192527417 (patch) | |
tree | d16dfc7380ad0d50d78f3a8600512a8084e923de | |
parent | 8b08851a29d4bdb971c05c221cbfcc7641be1bca (diff) |
#i106930#: thints.cxx: isNestedAny: new empty hints at start/end _not_ nested
-rwxr-xr-x | sw/qa/complex/writer/TextPortionEnumerationTest.java | 13 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 6 |
2 files changed, 17 insertions, 2 deletions
diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java b/sw/qa/complex/writer/TextPortionEnumerationTest.java index aec77b891a0b..a07b3cccadef 100755 --- a/sw/qa/complex/writer/TextPortionEnumerationTest.java +++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java @@ -2099,6 +2099,19 @@ public class TextPortionEnumerationTest extends ComplexTestCase .appendChild( url4.dup().appendChild( new TextNode("7") ) ) .appendChild( new TextNode("89") ); doTest(root, false); + // empty + TreeNode url6 = new HyperlinkNode( mkName("url") ); + inserter.insertRange( new Range(7, 7, url6) ); + root = new TreeNode() + .appendChild( url2.dup().appendChild( new TextNode("12") ) ) + .appendChild( url1.dup().appendChild( new TextNode("3") ) ) + .appendChild( url4.dup().appendChild( new TextNode("4") ) ) + .appendChild( url5.dup().appendChild( new TextNode("56") ) ) + .appendChild( url4.dup().appendChild( new TextNode("7") ) ) +// this one gets eaten, but we still need to test inserting it (#i106930#) +// .appendChild( url6.dup().appendChild( new TextNode("") ) ) + .appendChild( new TextNode("89") ); + doTest(root, false); } public void testRangeHyperlinkRuby() throws Exception diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 81bdb95f0699..1222d6f2eeed 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -153,12 +153,14 @@ bool isOverlap(const xub_StrLen nStart1, const xub_StrLen nEnd1, || ((nStart1 < nStart2) && (nStart2 < nEnd1) && (nEnd1 < nEnd2)); // (2) } +/// #i106930#: now asymmetric: empty hint1 is _not_ nested, but empty hint2 is static bool isNestedAny(const xub_StrLen nStart1, const xub_StrLen nEnd1, const xub_StrLen nStart2, const xub_StrLen nEnd2) { - return (nStart1 == nStart2) // in this case ends do not matter - || ((nStart1 < nStart2) ? (nEnd1 >= nEnd2) : (nEnd1 <= nEnd2)); + return ((nStart1 == nStart2) || (nEnd1 == nEnd2)) + ? (nStart1 != nEnd1) // same start/end: nested except if hint1 empty + : ((nStart1 < nStart2) ? (nEnd1 >= nEnd2) : (nEnd1 <= nEnd2)); } static |