To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=84139
Issue #|84139
Summary|XTextDocument.getCurrentSelection() returns one object
| to many
Component|Word processor
Version|OOo 2.3
Platform|All
URL|
OS/Version|Windows XP
Status|UNCONFIRMED
Status whiteboard|
Keywords|
Resolution|
Issue type|DEFECT
Priority|P3
Subcomponent|code
Assigned to|mru
Reported by|schnuckyschuster
------- Additional comments from [EMAIL PROTECTED] Fri Nov 30 20:53:09 +0000
2007 -------
Abstract
========
If more then one text sections are selected, the method
XTextDocument.getCurrentSelection() returns one more XTextRange then selected
Test case 1
===========
a) Open a text document
b) Select one and only one text section
c) Call getTextRangeFromSelection(xTextDocument.getCurrentSelection())
=> The method returns one XTextRamge element
Test case 2
===========
a) Open a text document
b) Select n [n > 1] text sections
c) Call getTextRangeFromSelection(xTextDocumentgetCurrentSelection())
=> The method returns n + 1 XTextRamge elements
=> The first element will be a collpsed range representing the position of the
cursor
This behaviour is inconsistent.
Either the corsor position is always returned or never.
I would prefer the cursor XTextRange never to be returned.
Code
====
public static ArrayList<XTextRange> getTextRangeFromSelection(
Object selection) {
ArrayList<XTextRange> result = new ArrayList();
try {
if (isServiceSupported(selection, "com.sun.star.text.TextRanges")) {
XIndexAccess xIndexAccess =
(com.sun.star.container.XIndexAccess) UnoRuntime
.queryInterface(
com.sun.star.container.XIndexAccess.class,
selection);
int count = xIndexAccess.getCount();
XTextRange xTextRange = null;
for (int i = 1; i < count; i++) {
xTextRange = (XTextRange) UnoRuntime.queryInterface(
XTextRange.class, xIndexAccess.getByIndex(i));
result.add(xTextRange);
}
}
return result;
} catch (Exception e) {
return null;
}
}
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]