Issue 37416 - XTextRangeCompare sometimes gives wrong results
Summary: XTextRangeCompare sometimes gives wrong results
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: chne
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-18 18:02 UTC by pjentsch
Modified: 2013-02-24 21:08 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
sample macro (6.51 KB, application/vnd.sun.xml.writer)
2004-11-19 09:26 UTC, stephan.wunderlich
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description pjentsch 2004-11-18 18:02:44 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.
Comment 1 stephan.wunderlich 2004-11-19 09:26:14 UTC
Created attachment 19483 [details]
sample macro
Comment 2 stephan.wunderlich 2004-11-19 09:34:20 UTC
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. 
Comment 3 pjentsch 2004-11-19 10:08:29 UTC
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).
Comment 4 pjentsch 2004-11-22 16:54:32 UTC
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 ;-)
Comment 5 stephan.wunderlich 2004-11-23 12:02:16 UTC
sw->tl: please take a look at this
Comment 6 thomas.lange 2004-11-29 09:43:09 UTC
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.
Comment 7 thomas.lange 2005-03-24 14:07:13 UTC
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
Comment 8 thomas.lange 2005-04-29 06:58:04 UTC
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
Comment 9 thomas.lange 2005-04-29 06:58:07 UTC
reassign to cn
Comment 10 thomas.lange 2005-04-29 06:58:11 UTC
reset resolution to FIXED
Comment 11 chne 2005-06-01 16:14:08 UTC
verified in swbf7pp5
Comment 12 chne 2005-06-17 15:16:49 UTC
ok in srx645_m55 => zu
Comment 13 chne 2005-06-17 15:18:15 UTC
close