Apache OpenOffice (AOO) Bugzilla – Issue 37416
XTextRangeCompare sometimes gives wrong results
Last modified: 2013-02-24 21:08:34 UTC
I wrote a method that tries to determine whether a range spans the whole paragraph it's on. I have an XTextCursor "one" that points to the anchor of an XTextField and an XTextCursor "other" that points to the paragraph that contains the field. one.getString() = "blah" other.getString() = "blahAndSomeMoreText" xTextRangeCompare.compareRegionStarts(one, other) = 1 ("one" starts before "other", unlikely) xTextRangeCompare.compareRegionEnds(one, other) = -1 ("one" ends after "other", wrong) In other cases, compareRegion(Starts|Ends) works as expected.
Created attachment 19483 [details] sample macro
sw->pjentsch: with the attached I could reproduce the second problem (-1 for ends) with OOo 1.1.x, but the current milestone (m62) returns the expected 0. So I set the issue to worksforme and would like to ask you to check the macro and see if it completely covers what you noticed.
Testet with m47, which returns the expected 1 (sic) for compareRegionEnds(field, paragraph) ;-) Still, it would be great to at least have a *workaround* for this issue for OOo 1.1.x (some other way to reliably compare paragraphs and fields, or at least some rule by which to tell when extactly the wrong result will be returned).
I'd actually like to reopen this issue for two reasons: a) Is it possibly to get this fixed in OOo-1.1.4? b) Has somebody hacking on that code confirmed that this has been fixed conciously or just accidentally (but may pop up again in later build). Comparing text ranges is a crucial feature when using the api to manipulate text. I depend on it! I don't want to depend on a seems-to-work ;-)
sw->tl: please take a look at this
I fixed it conciously ^_~ some months ago since there was a bug relating to this. But AFAIR it was more a case of it "generally" didn't work and not only sometimes. And sorry! There is no workaround available and also no really good description of the cases where it occured.
Fixed in CWS swbf7pp5. Files changed: sw: - bookmrk.hxx new revision: 1.3.536.1 - unoobj2.cxx new revision: 1.37.160.1.86.1 - unoparagraph.cxx new revision: 1.27.332.1 - unotext.cxx new revision: 1.22.330.1
Ok in CWS swbf7pp5. TL->CN: I assigned this one to you because the only other API issue in that CWS is already yours, and I think it is unneccessary to have SW and you both install this CWS. re-open issue and reassign to cn
reassign to cn
reset resolution to FIXED
verified in swbf7pp5
ok in srx645_m55 => zu
close