Hello,
What intrigues me is the structure of the selection list, and the fact that this was what caused the error in the `capitalise.py` example.
So, it is the behavior (and design logic) of `xIndexAccess` that I am struggling to understand.
Reminder:
No selection : one element at index 0 (empty)
One selected object : one element at index 0 (contains the selection)
N objects (N>1) : N+1 elements, the first (index 0) being empty.
This strange behavior (in my view) is visible in the short exercise that follows.
Can anyone explain this behavior?
API for xIndexAccess of text selection
- jeanmi2403
- Posts: 33
- Joined: Tue Jan 29, 2008 12:37 pm
- Location: Sucy en Brie (France)
API for xIndexAccess of text selection
Last edited by MrProgrammer on Fri Aug 14, 2026 4:33 am, edited 1 time in total.
Reason: Edited topic's subject
Reason: Edited topic's subject
Jean-Michel
LibO 26.2 and AOO 4.1.16 on Windows 11 & Ubuntu 22.04
LibO 26.8 on OpenSuse & Linux MX
LibO 26.2 and AOO 4.1.16 on Windows 11 & Ubuntu 22.04
LibO 26.8 on OpenSuse & Linux MX
Re: API for xIndexAccess of text selection
There is no »no Selection« in writer, at least one selection exists (probably empty) at the position of the View-Cursor!
Libreoffice 25.2… on Debian 13 (trixie) (on RaspberryPI5)
Libreoffice 25.8… flatpak on Debian 13 (trixie) (on RaspberryPI5)
Libreoffice 25.8… flatpak on Debian 13 (trixie) (on RaspberryPI5)
- jeanmi2403
- Posts: 33
- Joined: Tue Jan 29, 2008 12:37 pm
- Location: Sucy en Brie (France)
Re: API for xIndexAccess of text selection
Ok.
My question is : Why do two selections produce a 3-element array where the first element is empty?
Jean-Michel
LibO 26.2 and AOO 4.1.16 on Windows 11 & Ubuntu 22.04
LibO 26.8 on OpenSuse & Linux MX
LibO 26.2 and AOO 4.1.16 on Windows 11 & Ubuntu 22.04
LibO 26.8 on OpenSuse & Linux MX
Re: API for xIndexAccess of text selection
because your »two-selections-container« is in real a »three-selections-container« (including the »empty« …ViewCursor-object)jeanmi2403 wrote: ↑Mon Aug 17, 2026 9:43 pmOk.
My question is : Why do two selections produce a 3-element array where the first element is empty?
Libreoffice 25.2… on Debian 13 (trixie) (on RaspberryPI5)
Libreoffice 25.8… flatpak on Debian 13 (trixie) (on RaspberryPI5)
Libreoffice 25.8… flatpak on Debian 13 (trixie) (on RaspberryPI5)
- jeanmi2403
- Posts: 33
- Joined: Tue Jan 29, 2008 12:37 pm
- Location: Sucy en Brie (France)
Re: API for xIndexAccess of text selection
And doesn't a lonely selection have an empty counterpart?
It is hard to find any consistency.
It is hard to find any consistency.
Jean-Michel
LibO 26.2 and AOO 4.1.16 on Windows 11 & Ubuntu 22.04
LibO 26.8 on OpenSuse & Linux MX
LibO 26.2 and AOO 4.1.16 on Windows 11 & Ubuntu 22.04
LibO 26.8 on OpenSuse & Linux MX