Although I cannot speak authoritatively, I added my opinion in the text:

On 07/07/2010 09:53 AM, Patrick Bernard wrote:
Hi

OOo (version 3.2.1 on Ubuntu 9.10 64 bit) behaves in a strange way. Here are a
few examples.


1) The String property of the view cursor doesn't seem to work when text is
selected in a table cell.

The following macro displays the selected text. When the selected text is
inside a table cell, nothing is displayed.

Option Explicit

Sub Main
   dim viewCursor : viewCursor = ThisComponent.CurrentController.ViewCursor
   MsgBox viewCursor.string
End Sub

I concur that this is very string. I fully expected the view cursor to function inside of a text table. Notice, however, that the following will work for this specific example:

ThisComponent.CurrentController.getSelection().getByIndex(0).getString()

You might also notice that the view cursor fails to return a string when there is more than one selection, so, the argument could be made that you must rely on the selection rather than the view cursor.

2) The GotoNextWord function has a strange behavior: when there is no next
word in the current paragraph, it moves the cursor to the next paragraph,
even if the paragraph is empty and is followed by a non empty paragraph.
Furthermore, when the current paragraph is followed by a table instead of an
empty paragraph, the function skips the table completely.

Option Explicit

Sub Main

   dim viewCursor : viewCursor = ThisComponent.CurrentController.ViewCursor

   dim textCursor : textCursor = _
viewCursor.Text.CreateTextCursorByRange(viewCursor.Start)

   textCursor.GotoNextWord(False)

   ThisComponent.CurrentController.Select(textCursor)

End Sub

A text cursor is tied to a specific text object and cannot work in a different text object. Each cell in a table contains its own text object. Your text cursor, therefore MUST skip things such as frames and tables. Even more unusual, if you place the cursor in a cell, you can not use GotoNextWord to jump out of that cell (because the next cell uses a different text object).

As for jumping to an empty paragraph... I must sit on the fence for that one. I can argue either way that a paragraph start signals the start of a word...

3) The GotoEndOfWord function doesn't work when the word ends with a @.

Option Explicit

Sub Main

   dim viewCursor : viewCursor = ThisComponent.CurrentController.ViewCursor

   dim textCursor : textCursor = _
viewCursor.Text.CreateTextCursorByRange(viewCursor.Start)

   textCursor.GotoEndOfWord(True)

   MsgBox textCursor.String

end sub

On the contrary, the function GotoStartOfWord works as expected when the view
cursor is after the @.

I assume that this is because it treats email addresses as a single word, so, there is special treatment for @. This sure feels like a bug to me (that it cannot find the word end). The trick, however, is, should it then include the @ as it does for an email address?

start of word is consistent in that it fails if the @ is at the start of the word.



4) The GotoEndOfWord function works when the view cursor is at the beginning a
field, while the GotoStartOfWord function doesn't work when the view cursor
is at the end of the field (same macro as above).


Could someone please tell me whether or not this behavior is normal?

OK, I stopped testing, but, this sounds like a bug to me.


Regards,

Patrick



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org


--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to