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

[Extension] OpenOffice Thesaurus

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


Joined: 13 Apr 2009
Posts: 4

PostPosted: Mon Apr 13, 2009 6:55 am    Post subject: [Extension] OpenOffice Thesaurus Reply with quote

Hi people, i don't sure if this is the right topic, but my question is, i have a Writer Document with some words, and i want that when i click in a menu created by me, the OpenOffice show me in a window what i have write in the document. I'm portuguese sorry my poor english, i'm in a project for the thesaurus, synonims in portuguese, a big list of them and do a extension for OOo.

I leave here my code for a better compreension:


Quote:
public void dispatch( com.sun.star.util.URL aURL,
com.sun.star.beans.PropertyValue[] aArguments)
{
if ( aURL.Protocol.compareTo("Thesaurus.thesaurosooo:") == 0 )
{
if ( aURL.Path.compareTo("Command0") == 0 )
{

XTextDocument xDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, m_xFrame.getController().getModel());
XText xtext= xDoc.getText();






// add your own code here
return;
}
}
}


In bold is the code that i have added, but now i don't know what i have to do...

i want use to show in a window:

JOptionPane.showMessageDialog(null, (...))


Cheers.
Back to top
View user's profile Send private message
ivansimao
Newbie
Newbie


Joined: 13 Apr 2009
Posts: 4

PostPosted: Mon Apr 13, 2009 7:07 am    Post subject: Reply with quote

problem solved.

Solution:

Quote:
public void dispatch( com.sun.star.util.URL aURL,
com.sun.star.beans.PropertyValue[] aArguments)
{
if ( aURL.Protocol.compareTo("Thesaurus.thesaurosooo:") == 0 )
{
if ( aURL.Path.compareTo("Command0") == 0 )
{
XTextDocument xDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, m_xFrame.getController().getModel());
XText xtext= xDoc.getText();
XTextRange xRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xtext);
String word = xRange.getString().toString();
JOptionPane.showMessageDialog(null, word);







// add your own code here
return;
}
}
}
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