Writer as Java Component

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
kalyanprakash
Posts: 2
Joined: Mon Mar 28, 2011 9:31 pm

Writer as Java Component

Post by kalyanprakash »

Hi,

I would like to know whether we can use OpenOffice 3.0 writer as a component in any standalone java application. I.e., i would like to use the writer component as editor in the standalone application. Is it possible?

Thanks in advance.
OpenOffice 3.0 on Windows 7
rudolfo
Volunteer
Posts: 1488
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Re: Writer as Java Component

Post by rudolfo »

Welcome to the forum.

"Beginner" means the level of your question, not the state of your login. So this question should better be in the macro forum. Hopefully one of the moderator moves it there.

I guess you don't want just use Writer via escaping to the shell of the OS with Runtime.getRuntime().exec(...) ...
Rather like a full blown rich editor component of a GUI toolkit, right?
Difficult because toolkit components are always adjusted to follow a common exchange interface (messages, event listeners, slots, ...). Writer receives input from the user and keeps it in an internal structure which is saved to the odf xml format. Not sure how easy it is to convert the file based concept to a stream concept. I think there are some packaging UNO objects that allow access to this stream or file area.
Java can be used as macro language in Writer, so there is some chance to use callback functions into your java applicatin that are bound to buttons or menues.
Also you need to be aware that Writer is not easily separated from the OpenOffice Office suite. Meaning when you use Writer you will also have to use the core of OOo (which is quite large).
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
kalyanprakash
Posts: 2
Joined: Mon Mar 28, 2011 9:31 pm

Re: Writer as Java Component

Post by kalyanprakash »

Thanks for the reply.

I tried finding different solutions for using the GUI component in my application. I agree with you that using the Writer alone as a component is quite hectic.
Can you suggest any other options which will help me getting the Editor work for me in my app. I want the editor to be fully functional like Writer or Word, so only planning to use the OO Writer.
OpenOffice 3.0 on Windows 7
rudolfo
Volunteer
Posts: 1488
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Re: Writer as Java Component

Post by rudolfo »

Actually i depends a bit, what you want to do with your application. It is easy to guess the role of the writer component in the applcitation. But what is your application itself doing? It exchanges data with an editing component ... yes, so what is the exchange format? A stream of (encoded) bytes? Or do you want to use a set of functions (to avoid the big word API) between your app and the editor component?

Just another thought: Maybe 10 years ago, when you needed a component to display/render HTML pages or snippets, you did setup an OLE/COM container and loaded the automation COM-ActiveX-Object of the Internet Explorer to do this for you. Very easy to accomplish in Delphi and VisualBasic. A bit more complex in C++. OLE embedding is similar with the difference that it is embedding in a file (format) that could be opened by different applications and not in the application itself.
In both cases the ActiveX automation object is running inside the container with all the menubar and context menus. Acrobat Reader inside the browser, Excel inside Word documents are the better known examples.

RIght OLE embedding or COM automation is not possible in Java, because the OLE/COM technology is not platform independent.

Anyway, as it comes to Editors, my experience is that the core/main application should be the editor -- okay, this opinion is slightly biased as I am a GNU Emacs user since 10 years. Emacs and Eclipse are two well known concepts where you build anything feature that you need around the Editor with the help of plugins.
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
Post Reply