Issue 109360 - XTextCursor: bExpand doesn't work for go-Methods anymore
Summary: XTextCursor: bExpand doesn't work for go-Methods anymore
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: OOo 3.2
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2010-02-17 10:27 UTC by eberlein
Modified: 2017-05-20 11:17 UTC (History)
4 users (show)

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

file to reproduce (9.14 KB, application/vnd.oasis.opendocument.text)
2010-02-17 10:28 UTC, eberlein
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description eberlein 2010-02-17 10:27:51 UTC
To reproduce execute the attached macro.
There's a bookmark "a" spanned over 2 chars.
The goLeft(1, true) method should extend the range of the cursor to 3 chars.
So it does in OpenOffice 2.2
This is an incompatible API Change.
Comment 1 eberlein 2010-02-17 10:28:51 UTC
Created attachment 67873 [details]
file to reproduce
Comment 2 eberlein 2010-02-17 10:31:32 UTC
target and blocker set.
Comment 3 eberlein 2010-02-17 10:39:20 UTC
meant goRight(1,true) like in the example of course.
Comment 4 michael.ruess 2010-02-17 14:38:59 UTC
This did not even work in OOo 2.4 thus it is not qualified as a stopper for OOo
Comment 5 michael.ruess 2010-02-17 14:56:25 UTC
Comment 6 eberlein 2010-02-17 15:02:52 UTC
I consider this a really heavy bug.
It prevents our users (6,500 in Berlins tax administration) from updating to
version 3.
Is there really a rule that only regressions introduced with 3.2 must be fixed
in 3.2.1?
Comment 7 eberlein 2010-02-17 15:05:26 UTC
Comment 8 Oliver Specht 2010-02-17 16:16:03 UTC
->eberlein: It is unclear what the cursor should do in such cases. 
As there is a selection a goLeft/goRight can either move the left or the right
selected position. The cursor implementation in the core has a fix point and a
movable point. This cursor allows to determine which one is left/right.
The API TextCursor needs an additional interface to make this also possible.

Changed issue type to Enhancement.
Comment 9 eberlein 2010-02-17 16:37:13 UTC
@os: Disagree.
the idl says clear here:
Parameter bExpand
    specifies if the current selection of the cursor should be expanded or not.
If you have "abc" and the current range of the cursor is "b", then
goRight(1,true) cannot mean an negative expansion (moveable point cannot be the
left one resp this means a collapseToEnd()).
That is one point.
The other is: Why breaking existing code here?
Of course you can introduce an additional interface to make it clear. But what
has worked in OpenOffice 1 and 2 should work in OpenOffice 3 too.
The XTextCursor Interface is a central point in swriter and should be touched

Comment 10 Oliver Specht 2010-02-17 16:55:16 UTC
->eberlein: There was no change I just checked the code below in a 2.0:
If the first paragraph contains "123456789"
it prints: 56 6 456
If the two marked changes are done: 56 567 5
The two move commands at the beginning determine which position of the cursor
moves and which one is fixed.

Following the description of the Expand parameter it might make sense to always
expand but it doesn't help much if you want to reduce the selection. That's why
a new interface is necessary. 

Sub Main
xtextcursor = thiscomponent.gettext.createtextcursor
xtextcursor.goright( 6, false )'replace with 4
xtextcursor.goleft( 2, true )'replace with goright
print xtextcursor.getstring
xtextcursor.goright( 1, true )
print xtextcursor.getstring
xtextcursor.goleft( 2, true )
print xtextcursor.getstring
End Sub
Comment 11 Oliver Brinzing 2010-02-17 17:21:02 UTC
at least something must have changed since oo 1.1.5, cause
eberlein's example has a different result if run with oo 1.1.5 ...

added me to cc
Comment 12 eberlein 2010-02-18 08:00:33 UTC
Your example works in OpenOffice 1, 2, 3 identically.
So I guess the changes are made in createTextCursorByRange() (see my example).
I propose to file a new issue for introducing a new Interface and to handle this
one as a bug. Maybe the summary has to be corrected.
Comment 13 Oliver Brinzing 2010-03-04 16:30:39 UTC
> eberlein: There was no change I just checked the code below in a 2.0:

seems not to be true, XTextCursor will be expanded in 
OO 2.3.1 Linux,  OO 2.4.1 Win XP and OO 2.4.3 Win 2000 too
(same as in OO 1.1.5) ...

Comment 14 Marcus 2017-05-20 11:17:49 UTC
Reset assigne to the default "".