[Bug 160784] Uno Api - Java - Cursor error when move it to beginning of the table

2024-05-12 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=160784

Mike Kaganski  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
   Keywords|regression  |
 Resolution|--- |NOTABUG

--- Comment #8 from Mike Kaganski  ---
In fact, this is not a regression. This is a user error in using the API.
The relevant Java code is:

// getRangeFromTable
final XTextRange xStartTable = xTextTable.getAnchor().getStart();

...

// moves the cursor to the line right before the table
textViewCursor.gotoRange(xStartTable, false);

...

// moves the cursor to the end of the line right before the table
xCursor.gotoRange(textViewCursor.getStart(), false);

This code relied upon an unspecified behavior when using the result of getStart
in a way that is explicitly described in the documentation [1] as wrong.
Specifically:

> Note: The anchor of the actual implementation for text tables does not have a
> position in the text. Thus that anchor can not be used for some operation like
> attach() for example or com::sun::star::text::insertTextContent or other
> function that require the object to have a position in the text.
> 
> The reason why a text table still needs an anchor is that for example tables
> should be insertable via com::sun::star::text::insertTextContent and that
> interface uses a parameter of that type.

So, again: the result of XTextTable::getStart is *not* a specific position in
text, and it can't be used in the XTextViewCursor::gotoRange call, which needs
a position in text. The previous (unspecified) behavior was to move the cursor
outside of the table in that case; the current (also unspecified) behavior is
to move into the first cell. So when the following XTextCursor::gotoRange tries
to move a cursor that belongs *to a body text* into a table, this fails (and
that is OK).

This code may be improved to work in both cases. Specifically:

1. Fix getting the position before the table: after the line

// moves the cursor to the line right before the table
textViewCursor.gotoRange(xStartTable, false);

insert these lines:


while (textViewCursor.getText() != xText)
{
textViewCursor.goLeft((short)1, false);
}

This makes sure that if textViewCursor ended up inside the table, it moves
outside. At the same time, in previous versions, this won't change the
behavior.

2. Instead of lines

textViewCursor.gotoRange(xEndTable, false);
textViewCursor.gotoEnd(false);

insert this line:

textViewCursor.goRight((short)2, true);

This selects the just-selected filed before the table, and also the next object
- which is the table (which can only be selected as a whole). This makes the
end of the selection to be immediately after the table.

[1]
https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1text_1_1XTextContent.html#ae82a8b42f6b2578549b68b4483a877d3

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 160784] Uno Api - Java - Cursor error when move it to beginning of the table

2024-05-12 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=160784

Mike Kaganski  changed:

   What|Removed |Added

   Keywords|possibleRegression  |bibisected, regression
   Hardware|x86-64 (AMD64)  |All
 OS|Linux (All) |All
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #7 from Mike Kaganski  ---
Regression after eb30df9b8e86f756ebc66be86ae2eb345fafc850

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 160784] Uno Api - Java - Cursor error when move it to beginning of the table

2024-05-09 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=160784

Stéphane Guillou (stragu)  changed:

   What|Removed |Added

 CC||mikekagan...@hotmail.com,
   ||nem...@numbertext.org

--- Comment #6 from Stéphane Guillou (stragu) 
 ---
I haven't been able to get a jar running to try to bibisect it. (Getting
"java.lang.NoClassDefFoundError: com/sun/star/text/XTextContent", not sure what
I'm doing wrong...)

Looking at: https://wiki.documentfoundation.org/Releases/7.4.2/RC1
...I'm wondering if it could have something to do with cursor position changes
by László, like 189aa05c6ea17a8e823b4eab18ea0d1131d9d73e or
24087697d5cf78aac346d4dcea0596373e15a95c. But that's with tracked changes,
which the ODT doesn't have on.

László, what do you think?

Alternatively, there's Mike's eb30df9b8e86f756ebc66be86ae2eb345fafc850. Mike?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 160784] Uno Api - Java - Cursor error when move it to beginning of the table

2024-05-09 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=160784

--- Comment #5 from Fabio Reina  ---
Created attachment 194057
  --> https://bugs.documentfoundation.org/attachment.cgi?id=194057=edit
Execution with error - v7.4.2.1

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 160784] Uno Api - Java - Cursor error when move it to beginning of the table

2024-05-09 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=160784

--- Comment #4 from Fabio Reina  ---
Created attachment 194056
  --> https://bugs.documentfoundation.org/attachment.cgi?id=194056=edit
Execution working as expected - v7.4.1.2

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 160784] Uno Api - Java - Cursor error when move it to beginning of the table

2024-05-09 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=160784

Fabio Reina  changed:

   What|Removed |Added

 Status|NEEDINFO|UNCONFIRMED
 Ever confirmed|1   |0

--- Comment #3 from Fabio Reina  ---
Hello Stéphane, thanks for your response.

We are sourcing the ooo.connector to the development environment through a
maven dependency in the pom's project.
The dependency we are using is as following:
groupId: com.github.jeremysolarz
artifactId: bootstrap-connector
version: 1.0.0


com.github.jeremysolarz
bootstrap-connector
1.0.0


org.libreoffice
*




Regarding to the version, we started noticing the problem with the version
7.4.2.1. 
We haven't tested the versions 7.4.0.0.alpha1 nor 7.4.0.0.beta1 but until the
version 7.4.1.2 it works just fine.
Therefore the latest version in which the problem did not occur is version
7.4.1.2.

Attached there are two videos, one for each of the versions: 7.4.1.2 and
7.4.2.1. 
In the first test it works as expected and in the second we get the error
reported. The code used in the tests is the one posted in the description of
this bug (https://github.com/zanonaa/TableWithDynamicCursor).

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 160784] Uno Api - Java - Cursor error when move it to beginning of the table

2024-05-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=160784

Stéphane Guillou (stragu)  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEEDINFO
 CC||stephane.guillou@libreoffic
   ||e.org
 Whiteboard| QA:needsComment|
 Ever confirmed|0   |1
   Keywords||possibleRegression

--- Comment #2 from Stéphane Guillou (stragu) 
 ---
Thanks for the report.
How do you source ooo.connector for your development environment?
Do you know which 7.4 version exactly was the earliest affected?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 160784] Uno Api - Java - Cursor error when move it to beginning of the table

2024-05-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=160784

QA Administrators  changed:

   What|Removed |Added

 Whiteboard|| QA:needsComment

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 160784] Uno Api - Java - Cursor error when move it to beginning of the table

2024-04-22 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=160784

--- Comment #1 from Arthur Zanona  ---
Created attachment 193807
  --> https://bugs.documentfoundation.org/attachment.cgi?id=193807=edit
template example

-- 
You are receiving this mail because:
You are the assignee for the bug.