Hi.
As a quick example, put the following code in place of the "your code
here" comment in the "dispatch(...)" method (not inside
addStatusListener or removeStatusListener):
try {
XMultiComponentFactory xMCF = m_xContext.getServiceManager();
// get the desktop object
Object oDesktop = xMCF.createInstanceWithContext(
"com.sun.star.frame.Desktop", m_xContext);
XDesktop xDesktop = (XDesktop)
UnoRuntime.queryInterface(XDesktop.class, oDesktop);
// get the current frame
XFrame xFrame = xDesktop.getCurrentFrame();
// get the text document
XModel xModel = xFrame.getController().getModel();
XTextDocument xTextDoc =
(XTextDocument)UnoRuntime.queryInterface(
XTextDocument.class, xModel);
// get a text object from the text document
XText xText = xTextDoc.getText();
// get the string
String text = xText.getString();
// show message box with the text
JOptionPane.showMessageDialog(new Frame(), text);
} catch (com.sun.star.uno.Exception ex) {
ex.printStackTrace();
}
This takes the text of the current document and shows it in a Java
message box. The code will fail miserably if not called from a Writer
window.
But I strongly suggest to go through the Developer's Guide for
background information on Add-Ons and general UNO programming (I cannot
put everything in the comments :-()
http://api.openoffice.org/DevelopersGuide/DevelopersGuide.html
HTH, Steffen
Vic wrote:
Can u provide me with a simple code that i would paste there that just
displays whatever i typed in the document in a message box. And if u would be
so kind can u put comments in it. I Think with this simple code i could climb
my way to learning the programming. I hope you would send any help to my email
and i would really appreciate it
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]