OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Problem about XSelectionSupplier.select() (Delphi+JNI+Java)

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
xbeta
General User
General User


Joined: 05 Mar 2009
Posts: 5

PostPosted: Thu Mar 05, 2009 2:37 am    Post subject: Problem about XSelectionSupplier.select() (Delphi+JNI+Java) Reply with quote

Hi all,

I'm creating an OO extension by implement/support "com.sun.star.frame.ProtocolHandler" service.

The main logic is in Delphi code, calling Java OO API through JNI.

Everything goes ok (get XTextDocument, create text cursors by range, set cursor string...), except:

When I try to select a range, by calling xSelectionSupplier.select(aRange),
the selection was applied successfully, but right after that, I got an
"Access violation at address A2FF5881. Read of address A2FF5881"

The same code(well, translated) runs well in Java.

(The xSelectionSupplier was get from controller, and getSelection() works ok)

Actually, the aRange is an XTextCursor returned by createTextCursorByRange.
I thought it was a problem about the type "Any". According to OO API document, when they need an Any,
I should pass an UNO object. But aRange/XTextCursor IS an UNO object Sad
Then I use UnoRuntime.queryInterface to cast aRange to an XTextRange and passed to select(),
access violation Sad
Then I create a new instance of Any by passing aRange as the parameter of Any's constructor, and
passed the instance of Any to select(), access violation Sad

Since JNI defines all Java objects as Pointers in Delphi, I started to think maybe it's a reference-
counting problem. Then I tried to call acquire() on the aRange before passed it to the select().
But I can not find the MethodID of acquire() on the aRange/XTextCursor (signature: "()V"),
Then I use UnoRuntime.queryInterface to cast aRange to an XInterface, still, MethodID not found.


Any suggestions?

Thanks in advance.

Beta.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group