https://bugs.documentfoundation.org/show_bug.cgi?id=168008
Bug ID: 168008
Summary: XTextRangeCompare doesn't throw when ranges are in
different texts
Product: LibreOffice
Version: 25.2.5.2 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: sdk
Assignee: [email protected]
Reporter: [email protected]
Description:
Per docs, XTextRangeCompare.compareRegionEnds(xR1, xR2) throws
com::sun::star::lang::IllegalArgumentException if either xR1 or xR2 is not
within this text.
This is true in 24.8, but no longer true in 25.2. Zotero extension behaviour
depends on this function throwing.
Steps to Reproduce:
Option Explicit
Sub InsertFootnoteAndCompare()
Dim doc As Object, bodyText As Object, viewCurs As Object, bodyCurs As
Object
doc = ThisComponent
bodyText = doc.Text
viewCurs = doc.CurrentController.getViewCursor()
' 1) Insert a footnote at the current cursor
Dim footnote As Object
footnote = doc.createInstance("com.sun.star.text.Footnote")
bodyText.insertTextContent(viewCurs, footnote, False)
' 2) Put some sample text into the footnote
' Footnote service exports XText, so we can get its text and write into
it.
Dim fText As Object, fCur As Object
fText = footnote.getText() ' the text container inside the
footnote
fCur = fText.createTextCursor()
fText.insertString(fCur, "This is the footnote text. Alpha beta gamma
delta.", False)
' 3) Build a body range: from start of paragraph to current caret
bodyCurs = bodyText.createTextCursorByRange(viewCurs)
bodyCurs.gotoStartOfParagraph(False)
bodyCurs.gotoRange(viewCurs, True) ' select from start-of-paragraph
to caret
Dim bodyRange As Object
bodyRange = bodyCurs
' 4) Compare two ranges in different Text objects
Dim result As Integer
result = fText.compareRegionStarts(bodyRange, fCur)
MsgBox "Result " & result
End Sub
Actual Results:
A message box is shown with result
Expected Results:
An error is thrown
Reproducible: Always
User Profile Reset: No
Additional Info:
Version: 25.2.5.2 (X86_64) / LibreOffice Community
Build ID: 03d19516eb2e1dd5d4ccd751a0d6f35f35e08022
CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: lt-LT (en_US.UTF-8); UI: en-US
Calc: threaded
--
You are receiving this mail because:
You are the assignee for the bug.