21
edits
Changes
no edit summary
This is tutorial is to set up a Java development platform on Windows.
You will need the following software:
[http://download.openoffice.org OpenOffice.org]
[http://download.openoffice.org/sdk/index.html OpenOffice.org SDK]
[http://netbeans.org/downloads/index.html Netbeans]
Make sure you install OpenOffice and the SDK before running Netbeans.
First Open Netbeans and go to:
Tools -> Plugins
Go the Available Plugins tab and look for OpenOffice.org API Plugin and check the box beside it.
It will prompt you to install and click the Install button on the bottom of the list.
The plugin will install. To change the setting for the plugin go to:
Tools -> Options -> Miscellaneous -> OOo API Plugin
There you will see the directory path to the installation of both OO and The SDK. If you need to change it then you can make the corrections here.
===Mac===
===Solaris ?===
==Programming languages for developing an extension==
===Java===
===Python===
===StarBasic===
===Javascript===
===C++===
===CLI===
[http://blog.nkadesign.com/2008/net-working-with-openoffice-3/ .Net Resources]
=OpenOffice.org SDK (Software Development Kit)=
=OpenOffice.org API (Application Programming Interface)=
http://api.openoffice.org/
----
OpenOffice.org objects and methods, such as paragraphs, spreadsheets, and fonts, are accessible to OpenOffice.org Basic through the OpenOffice.org application programming interface, or API. Through the API, for example, documents can be created, opened, modified and printed. The API can be used not only by OpenOffice.org Basic, but also by other programming languages, such as Java and C++. The interface between the API and various programming languages is provided by something called Universal Network Objects (UNO).
=UNO (Universal Network Objects)=
==Introduction==
[http://wiki.services.openoffice.org/wiki/Uno/Article/Understanding_Uno Understanding UNO]
<!-- [[User:Asamimi|asa]] no need for this, it is already set as your work :) -->
==UNO Concepts==
[http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/UNO_Concepts UNO Concepts]
[http://api.openoffice.org/docs/DevelopersGuide/DevelopersGuide.xhtml Developers Guide]
# [http://api.openoffice.org/docs/DevelopersGuide/Preface/ReadersGuide.xhtml Introduction]
# [http://api.openoffice.org/docs/DevelopersGuide/FirstSteps/FirstSteps.xhtml First Steps]
# [http://api.openoffice.org/docs/DevelopersGuide/ProfUNO/ProfUNO.xhtml Professional UNO]
# [http://api.openoffice.org/docs/DevelopersGuide/Components/Components.xhtml Writing UNO Components]
# [http://api.openoffice.org/docs/DevelopersGuide/Extensions/Extensions.xhtml Extensions]
# [http://api.openoffice.org/docs/DevelopersGuide/AdvancedUNO/AdvancedUNO.xhtml Advanced UNO]
# [http://api.openoffice.org/docs/DevelopersGuide/AdvancedUNO/AdvancedUNO.xhtml Office Development]
# [http://api.openoffice.org/docs/DevelopersGuide/Text/Text.xhtml Text Documents]
# [http://api.openoffice.org/docs/DevelopersGuide/Spreadsheet/Spreadsheet.xhtml Spreadsheet Documents]
# [http://api.openoffice.org/docs/DevelopersGuide/Drawing/Drawing.xhtml Drawing and Presentation]
# [http://api.openoffice.org/docs/DevelopersGuide/Charts/Charts.xhtml Charts]
# [http://api.openoffice.org/docs/DevelopersGuide/BasicAndDialogs/BasicAndDialogs.xhtml OOo Basic and Dialogs]
# [http://api.openoffice.org/docs/DevelopersGuide/Database/Database.xhtml Database Access]
# [http://api.openoffice.org/docs/DevelopersGuide/Forms/Forms.xhtml Forms]
# [http://api.openoffice.org/docs/DevelopersGuide/UCB/UCB.xhtml Universal Control Broker]
# [http://api.openoffice.org/docs/DevelopersGuide/Config/Config.xhtml Configuration Management]
# [http://api.openoffice.org/docs/DevelopersGuide/OfficeBean/OfficeBean.xhtml Java Beans for Office Componets]
# [http://api.openoffice.org/docs/DevelopersGuide/Accessibility/Accessibility.xhtml Accessibility]
# [http://api.openoffice.org/docs/DevelopersGuide/ScriptingFramework/ScriptingFramework.xhtml Scripting Framework]
# [http://api.openoffice.org/docs/DevelopersGuide/GUI/GUI.xhtml GUI]
# [http://api.openoffice.org/docs/DevelopersGuide/Appendix/IDLDesignGuide/IDLDesignGuide.xhtml Design Guidelines]
# [http://api.openoffice.org/docs/DevelopersGuide/Appendix/IDLDocumentationGuide/IDLDocumentationGuide.xhtml IDL Documentation Guidelines]
# [http://api.openoffice.org/docs/DevelopersGuide/Appendix/UCPs/UCPs.xhtml Universal Content Providers]
# [http://api.openoffice.org/docs/DevelopersGuide/Appendix/IDLSyntax/IDLSyntax.xhtml UNOIDL Syntax/Grammer]
==UNO Architecture Introduction==
==UNO Architecture Diagrams==
==Related technologies/ frameworks==
===Factory method design pattern===
OpenOffice.org development heavily uses the Factory method design pattern.
Design patterns are conventional templates that describes how to solve common software problems. Since most developers are familiar with the patterns, they can recognize a pattern in others source code. That makes working in teams easier. There are many popular design patterns. One of them is Factory method pattern.
Factory method pattern is a type of creational pattern. Creational pattern pattern solves problems related to creating. Factory pattern solves two major problem generally faced by developers.
1. To reduce too many new operator usage
:When working on a large software, numerous instances of classes are created continuously at the runtime. The programmer cannot predict what the user is going to do. So at any given time, the programmer doesn't know what object is create. For example, To create a new document, the user might click new text document or new spreadsheet document. There would several possibilities about what the user is going to do. So, a factory class is assigned to do all these repetitive work of creating a new instance of what the user wants. By separating these repetitive object creations into a factory class, when new classes are added, only the factory class need to be updated.
2. To create object without knowing its class name.
:When using the concrete classes, the developer has to remember the class names. In factory pattern, choosing what type of object to be created is delegated to the factory class. Usually this is done by sending a parameter. Based on the parameter passed to the factory, the factory creates an instance of a certain type/class.
[[Image:factorypattern.gif|border|none|thumb|300px|Factory Method Pattern]]
<pre>
public final class DocumentFactory {
XDocument document;
XDocument getDocument(String type){
if(type.equals("text"){
document = new TextDocument();
}
else if(type.equals("sheet"){
document = new SpreadSheet();
}
return document;
}
}
</pre>
<pre>
public interface XDocument{
open();
}
</pre>
<pre>
public class TextDocument implements XDocument{
//concrete class for Text documents
open(){
//method to open text document
System.out.println("opening a text document...");
}
}
</pre>
<pre>
public class SpreadSheet implements XDocument{
//concrete class for spreadsheet documents
open(){
//method to open spreadsheet document
System.out.println("opening a spreadsheet document...");
}
}
</pre>
<pre>
class DocumentProgram{
public static void main(String[] args){
XDocument doc = df.getDocument("text"); //this just created an instance of TextDocument without knowing its class name.
doc.open();
}
}
</pre>
===Singleton Pattern===
In Singleton Pattern, the class can only create a single instance. We want a class to have only a single instance for various reasons.
Sometimes, we want use a global object to keep information about your program. This object should not have any copies. This information might be things like configuration of the program, or a master object that manages pools of resources. So when you need a resource, you ask the master object to get it for you. Now if there were many copies of this master object, you would not know whom to ask for that resource. This single object should not be allowed to have copies. Singleton Pattern forces this rule so that programmer doesn't have to remember about not creating copies. Singleton pattern will create an instance if it doesn't exist and will not create any new instance if an instance already exist. It will just return a reference to that single instance.
<pre>
class ProgramConfiguration{
public ProgramConfiguraiton(){
//default constructor code
}
}
</pre>
A new instance of a class is created by the constructor. Most of the time, we have a public constructor, which is called to create a new instance. Since we want to prohibit multiple instance, we have to restrict access to the constructor. This is done by making the constructor private.
<pre>
class ProgramConfiguration{
private ProgramConfiguration(){
//default private constructor code
}
}
</pre>
then we create a static public method that will make sure that only one instance lives in the whole program.
<pre>
class ProgramConfiguration{
private static ProgramConfiguration _configObject;
private ProgramConfiguration(){
//default private constructor code
}
public getInstance(){
/*
if an instance exist return that instance otherwise
call the constructor to create an instance and return it.
*/
if(_configObject = null){
_configObject = ProgramConfiguration();
}
return _configObject;
}
}
</pre>
So anytime you want to get that single object, you call the getInstance() method.
<pre>
main(){
/*
no access to default constructor. so if you did
ProgramConfiguration pc = new ProgramConfiguration();
you will get compilation error.
*/
ProgramConfiguration pc = ProgramConfiguration.getInstance();
ProgramConfiguration newpc = ProgramConfiguration.getInstance();
/*
in the above code pc and newpc both point to the same static object. when
getinstance() is called for the second time, it finds that _configObject is not null
anymore, so it doesn't call the constructor to create any new instance.
*/
}
</pre>
===...===
==UNO Interfaces==
==UNO Language Bindings==
==Tutorials==
===Creating a simple Hello World extension for OpenOffice.org Writer===
===Creating a simple extension for OpenOffice.org Calc===
Calc programming API and sample code:<br/>
http://wiki.services.openoffice.org/wiki/Calc/API/Programming
===Creating a simple extension for OpenOffice.org Base===
===Creating a simple extension for OpenOffice.org Impress===
==Sample codes==
Some example source codes can be found in the OpenOffice sdk folder.
For Ubuntu distribution: <code>/usr/lib/openoffice/basis3.1/sdk/examples</code>
===sample code 1===
===sample code 2===
===sample code 3===
=== API Samples ===
http://wiki.services.openoffice.org/wiki/API/Samples
==Resources / Links==
under construction...
=OpenOffice Smart Tags=
[http://wiki.services.openoffice.org/wiki/Writer/Smart_Tags Smart Tag Resources]
[http://marketing.openoffice.org/ooocon2007/programme/thursday_128.pdf Smart Tag Presentation]
=Resources / Links=
==Development Resources==
[http://api.openoffice.org/ OpenOffice.org API site]<br/>
[http://download.openoffice.org/sdk/index.html OpenOffice.org SDK site]<br/>
[http://wiki.services.openoffice.org/wiki/Main_Page OpenOfice.org Wiki Projects]
==Other Resources==
[http://en.wikipedia.org/wiki/Help:Wiki_markup Wiki Markup]
===Syntax highlighting in WikiMedia===
use <syntaxhighlight lang="">code here</syntaxhighlight>
<syntaxhighlight lang="csharp">
int main(){
int i;
for(i=0;i<10;i++){
printf("%d\n", i);
}
return 0;
}
</syntaxhighlight>