| View previous topic :: View next topic |
| Author |
Message |
ivansimao Newbie

Joined: 13 Apr 2009 Posts: 4
|
Posted: Mon Apr 13, 2009 6:55 am Post subject: [Extension] OpenOffice Thesaurus |
|
|
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 |
|
 |
ivansimao Newbie

Joined: 13 Apr 2009 Posts: 4
|
Posted: Mon Apr 13, 2009 7:07 am Post subject: |
|
|
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 |
|
 |
|
|
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
|