Difference between revisions of "OpenOffice temporary template"
(→testing sysntax) |
|||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | =Introduction to OpenOffice= | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[OpenOffice.org Overview]] | [[OpenOffice.org Overview]] | ||
− | + | = Potential Projects = | |
− | + | == Extensions == | |
− | + | == Others == | |
<!-- | <!-- | ||
− | + | ==OpenOffice.org Writer== | |
− | + | ==OpenOffice.org Calc== | |
− | + | ==OpenOffice.org Base== | |
− | + | ==OpenOffice.org Impress== | |
− | + | ==OpenOffice.org Math== | |
− | + | ==OpenOffice.org Draw== | |
− | + | ==OpenOffice.org Chart== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
--> | --> | ||
− | + | =OpenOffice Extensions= | |
− | + | ==What are extensions== | |
− | |||
− | |||
Extensions in OpenOffice extends the capability of the OpenOffice program. Extension can be for OpenOffice Writer, Calc, Presentation, Database or for the core OpenOffice. For OpenOffice writer, there may be extensions that extends the dictionary feature of OpenOffice so that user can use a French dictionary. Similarly there may be extensions that adds extra grammar features. An extension for Calc might do a complex calculation like mortgage calculation or filter data in certain way. | Extensions in OpenOffice extends the capability of the OpenOffice program. Extension can be for OpenOffice Writer, Calc, Presentation, Database or for the core OpenOffice. For OpenOffice writer, there may be extensions that extends the dictionary feature of OpenOffice so that user can use a French dictionary. Similarly there may be extensions that adds extra grammar features. An extension for Calc might do a complex calculation like mortgage calculation or filter data in certain way. | ||
− | |||
A popular extension might become part of the core program in a future release. | A popular extension might become part of the core program in a future release. | ||
− | |||
Extensions for OpenOffice can downloaded at http://extensions.services.openoffice.org | Extensions for OpenOffice can downloaded at http://extensions.services.openoffice.org | ||
− | |||
<!-- | <!-- | ||
− | + | ===OpenOffice.org Writer extensions=== | |
− | + | ===OpenOffice.org Calc extensions=== | |
− | + | ===OpenOffice.org Base extensions=== | |
− | + | ===OpenOffice.org Impress extensions=== | |
− | + | ===OpenOffice.org Math extensions=== | |
− | + | ===OpenOffice.org Draw extensions=== | |
− | + | ===OpenOffice.org Chart extensions=== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
--> | --> | ||
− | + | ==How to install extensions== | |
− | |||
To install an extension | To install an extension | ||
− | |||
* First download an extension from http://extensions.services.openoffice.org | * First download an extension from http://extensions.services.openoffice.org | ||
− | |||
* Then open OpenOffice Writer or Calc. On the top menu, click Tools->Extension Manager... | * Then open OpenOffice Writer or Calc. On the top menu, click Tools->Extension Manager... | ||
[[Image:install_extension01.png|border|none|thumb|200px|Installing an Extension]] | [[Image:install_extension01.png|border|none|thumb|200px|Installing an Extension]] | ||
Line 68: | Line 35: | ||
[[Image:install_extension02.png|border|none|thumb|200px|Installing an Extension]] | [[Image:install_extension02.png|border|none|thumb|200px|Installing an Extension]] | ||
Usually, you should see a new button or menu item related to the extension you install. Since extension can do different things, sometimes you might not see any button or menu item. That extension might only appear and work on context menu. So if you cannot find it, check the extension's read-me file or manual. | Usually, you should see a new button or menu item related to the extension you install. Since extension can do different things, sometimes you might not see any button or menu item. That extension might only appear and work on context menu. So if you cannot find it, check the extension's read-me file or manual. | ||
− | + | ==Using extensions== | |
− | + | =Developing OpenOffice.org extensions= | |
− | + | ==Checklist for Writing Extensions== | |
− | |||
− | |||
− | |||
[http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Checklist_for_Writing_Extensions Checklist for Writing Extensions] | [http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Checklist_for_Writing_Extensions Checklist for Writing Extensions] | ||
− | + | ==Preparing development environment== | |
− | + | ===Linux=== | |
− | + | ====Install OpenOffice.org and SDK==== | |
− | |||
− | |||
OpenOffice.org program and SDK can be installed through package manager program, such as apt-get, yum, merge and pacman. Also, several GUI font-end for package manager programs are available to make installation easier. On Ubuntu, Synaptic is good choice. YumEx is the best option on Fedora. | OpenOffice.org program and SDK can be installed through package manager program, such as apt-get, yum, merge and pacman. Also, several GUI font-end for package manager programs are available to make installation easier. On Ubuntu, Synaptic is good choice. YumEx is the best option on Fedora. | ||
− | |||
* Ubuntu: | * Ubuntu: | ||
** With aptitude: launch a terminal and enter following command | ** With aptitude: launch a terminal and enter following command | ||
Line 88: | Line 49: | ||
*: <pre>sudo aptitude install openoffice.org-dev-doc</pre> | *: <pre>sudo aptitude install openoffice.org-dev-doc</pre> | ||
** With Synaptic: Go to menu: System -> Administration -> Synaptic Package Manager. Search openoffice, and click openoffice.org, openoffice.org-dev, openoffice.org-dev packages, then click Mark for Installation and hit Apply on toolbar. | ** With Synaptic: Go to menu: System -> Administration -> Synaptic Package Manager. Search openoffice, and click openoffice.org, openoffice.org-dev, openoffice.org-dev packages, then click Mark for Installation and hit Apply on toolbar. | ||
− | |||
* Fedora: | * Fedora: | ||
** With Yum: | ** With Yum: | ||
Line 97: | Line 57: | ||
*: <pre>sudo yum install yumex</pre> | *: <pre>sudo yum install yumex</pre> | ||
*: After installation, launch YumEx, search openoffice, select those packages and install. | *: After installation, launch YumEx, search openoffice, select those packages and install. | ||
− | |||
''Note: On Fedora, <code>sudo</code> is not set by default. You can add you account to wheel user group so that you can use <code>sudo</code>. Also, you may use <code>su</code> to change to root, and run yum to install packages. <br/> | ''Note: On Fedora, <code>sudo</code> is not set by default. You can add you account to wheel user group so that you can use <code>sudo</code>. Also, you may use <code>su</code> to change to root, and run yum to install packages. <br/> | ||
''Note: On Ubuntu, if you use OpenOffice.org program that comes with distribution, and try to install SDK that is downloaded from OpenOffice.org website, you may encounter dependency issue. You should the SDK that come with distribution. | ''Note: On Ubuntu, if you use OpenOffice.org program that comes with distribution, and try to install SDK that is downloaded from OpenOffice.org website, you may encounter dependency issue. You should the SDK that come with distribution. | ||
− | + | ====Install NetBean, and OpenOffice.org Extension Development Plugin==== | |
− | |||
NetBean can be installed through package manager as well. Package name is netbeans. | NetBean can be installed through package manager as well. Package name is netbeans. | ||
− | |||
Ubuntu: | Ubuntu: | ||
<pre>sudo aptitude install netbeans</pre> | <pre>sudo aptitude install netbeans</pre> | ||
− | |||
Fedora: | Fedora: | ||
<pre>sudo yum install netbeans</pre> | <pre>sudo yum install netbeans</pre> | ||
− | |||
''' To-Do: need someone check if the packages name for Netbeans on Fedora is netbeans. | ''' To-Do: need someone check if the packages name for Netbeans on Fedora is netbeans. | ||
− | |||
After installation, you can install development plugin in NetBean. Lunch NetBean, select Plugins under Tool menu. Then switch to Available Plugins tab, and install OOo API plugin. Finally, select Options under Tool menu, and go to Miscellaneous -> OOo API Plugins tab. Fill in the path to OpenOffice.org program and SDK. Path is provide in following section. | After installation, you can install development plugin in NetBean. Lunch NetBean, select Plugins under Tool menu. Then switch to Available Plugins tab, and install OOo API plugin. Finally, select Options under Tool menu, and go to Miscellaneous -> OOo API Plugins tab. Fill in the path to OpenOffice.org program and SDK. Path is provide in following section. | ||
− | + | ====Install Eclipse and OpenOffice.org Extension Development Plugin==== | |
− | |||
− | |||
''' To-Do: guild on install setup Eclipse for OOo Extension Dev | ''' To-Do: guild on install setup Eclipse for OOo Extension Dev | ||
− | + | ====Path to OpenOffice.org Program and SDK==== | |
− | |||
* Ubuntu: | * Ubuntu: | ||
** Program: /usr/lib/openoffice | ** Program: /usr/lib/openoffice | ||
Line 127: | Line 78: | ||
** SDK: /usr/lib/openoffice/basis3.1/sdk | ** SDK: /usr/lib/openoffice/basis3.1/sdk | ||
** Examples: /usr/lib/openoffice/basis3.1/sdk/example | ** Examples: /usr/lib/openoffice/basis3.1/sdk/example | ||
− | |||
''' To-Do: need path on Fedora and others major distros. | ''' To-Do: need path on Fedora and others major distros. | ||
− | + | ===Windows=== | |
− | |||
This is tutorial is to set up a Java development platform on Windows. | This is tutorial is to set up a Java development platform on Windows. | ||
− | |||
You will need the following software: | You will need the following software: | ||
− | |||
[http://download.openoffice.org OpenOffice.org] | [http://download.openoffice.org OpenOffice.org] | ||
− | |||
[http://download.openoffice.org/sdk/index.html OpenOffice.org SDK] | [http://download.openoffice.org/sdk/index.html OpenOffice.org SDK] | ||
− | |||
[http://netbeans.org/downloads/index.html Netbeans] | [http://netbeans.org/downloads/index.html Netbeans] | ||
− | |||
Make sure you install OpenOffice and the SDK before running Netbeans. | Make sure you install OpenOffice and the SDK before running Netbeans. | ||
− | |||
First Open Netbeans and go to: | First Open Netbeans and go to: | ||
− | |||
Tools -> Plugins | Tools -> Plugins | ||
− | |||
Go the Available Plugins tab and look for OpenOffice.org API Plugin and check the box beside it. | 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. | 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: | The plugin will install. To change the setting for the plugin go to: | ||
− | |||
Tools -> Options -> Miscellaneous -> OOo API Plugin | 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. | 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] | [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/ | 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). | 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] | [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 :) --> | <!-- [[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://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/DevelopersGuide.xhtml Developers Guide] | ||
Line 218: | Line 139: | ||
# [http://api.openoffice.org/docs/DevelopersGuide/Appendix/UCPs/UCPs.xhtml Universal Content Providers] | # [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] | # [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. | 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. | 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. | 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 | 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. | :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. | 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. | :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]] | [[Image:factorypattern.gif|border|none|thumb|300px|Factory Method Pattern]] | ||
<pre> | <pre> | ||
− | |||
public final class DocumentFactory { | public final class DocumentFactory { | ||
− | |||
XDocument document; | XDocument document; | ||
− | |||
XDocument getDocument(String type){ | XDocument getDocument(String type){ | ||
− | |||
if(type.equals("text"){ | if(type.equals("text"){ | ||
− | |||
document = new TextDocument(); | document = new TextDocument(); | ||
− | |||
} | } | ||
− | |||
else if(type.equals("sheet"){ | else if(type.equals("sheet"){ | ||
− | |||
document = new SpreadSheet(); | document = new SpreadSheet(); | ||
− | |||
} | } | ||
− | |||
return document; | return document; | ||
− | |||
} | } | ||
− | |||
} | } | ||
− | |||
</pre> | </pre> | ||
− | |||
<pre> | <pre> | ||
− | |||
public interface XDocument{ | public interface XDocument{ | ||
− | |||
open(); | open(); | ||
− | |||
} | } | ||
− | |||
</pre> | </pre> | ||
− | |||
<pre> | <pre> | ||
− | |||
public class TextDocument implements XDocument{ | public class TextDocument implements XDocument{ | ||
− | |||
//concrete class for Text documents | //concrete class for Text documents | ||
− | |||
open(){ | open(){ | ||
− | |||
//method to open text document | //method to open text document | ||
− | |||
System.out.println("opening a text document..."); | System.out.println("opening a text document..."); | ||
− | |||
} | } | ||
− | |||
} | } | ||
− | |||
</pre> | </pre> | ||
− | |||
<pre> | <pre> | ||
− | |||
public class SpreadSheet implements XDocument{ | public class SpreadSheet implements XDocument{ | ||
− | |||
//concrete class for spreadsheet documents | //concrete class for spreadsheet documents | ||
− | |||
open(){ | open(){ | ||
− | |||
//method to open spreadsheet document | //method to open spreadsheet document | ||
− | |||
System.out.println("opening a spreadsheet document..."); | System.out.println("opening a spreadsheet document..."); | ||
− | |||
} | } | ||
− | |||
} | } | ||
− | |||
</pre> | </pre> | ||
− | |||
<pre> | <pre> | ||
− | |||
class DocumentProgram{ | class DocumentProgram{ | ||
− | |||
public static void main(String[] args){ | public static void main(String[] args){ | ||
− | |||
XDocument doc = df.getDocument("text"); //this just created an instance of TextDocument without knowing its class name. | XDocument doc = df.getDocument("text"); //this just created an instance of TextDocument without knowing its class name. | ||
− | |||
doc.open(); | doc.open(); | ||
− | |||
} | } | ||
− | |||
} | } | ||
− | |||
</pre> | </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. | 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. | 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> | <pre> | ||
− | |||
class ProgramConfiguration{ | class ProgramConfiguration{ | ||
− | |||
public ProgramConfiguraiton(){ | public ProgramConfiguraiton(){ | ||
− | |||
//default constructor code | //default constructor code | ||
− | |||
} | } | ||
− | |||
} | } | ||
− | |||
</pre> | </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. | 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> | <pre> | ||
− | |||
class ProgramConfiguration{ | class ProgramConfiguration{ | ||
− | |||
private ProgramConfiguration(){ | private ProgramConfiguration(){ | ||
− | |||
//default private constructor code | //default private constructor code | ||
− | |||
} | } | ||
− | |||
} | } | ||
− | |||
</pre> | </pre> | ||
− | |||
then we create a static public method that will make sure that only one instance lives in the whole program. | then we create a static public method that will make sure that only one instance lives in the whole program. | ||
− | |||
<pre> | <pre> | ||
− | |||
class ProgramConfiguration{ | class ProgramConfiguration{ | ||
− | |||
private static ProgramConfiguration _configObject; | private static ProgramConfiguration _configObject; | ||
− | |||
private ProgramConfiguration(){ | private ProgramConfiguration(){ | ||
− | |||
//default private constructor code | //default private constructor code | ||
− | |||
} | } | ||
− | |||
public getInstance(){ | public getInstance(){ | ||
− | |||
/* | /* | ||
− | |||
if an instance exist return that instance otherwise | if an instance exist return that instance otherwise | ||
− | |||
call the constructor to create an instance and return it. | call the constructor to create an instance and return it. | ||
− | |||
*/ | */ | ||
− | + | if(_configObject = null){ | |
− | if(_configObject | ||
− | |||
_configObject = ProgramConfiguration(); | _configObject = ProgramConfiguration(); | ||
− | |||
} | } | ||
− | |||
return _configObject; | return _configObject; | ||
− | |||
} | } | ||
− | |||
} | } | ||
− | |||
</pre> | </pre> | ||
− | |||
So anytime you want to get that single object, you call the getInstance() method. | So anytime you want to get that single object, you call the getInstance() method. | ||
− | |||
<pre> | <pre> | ||
− | |||
main(){ | main(){ | ||
− | |||
/* | /* | ||
− | |||
no access to default constructor. so if you did | no access to default constructor. so if you did | ||
− | |||
ProgramConfiguration pc = new ProgramConfiguration(); | ProgramConfiguration pc = new ProgramConfiguration(); | ||
− | |||
you will get compilation error. | you will get compilation error. | ||
− | |||
*/ | */ | ||
− | |||
ProgramConfiguration pc = ProgramConfiguration.getInstance(); | ProgramConfiguration pc = ProgramConfiguration.getInstance(); | ||
− | |||
ProgramConfiguration newpc = ProgramConfiguration.getInstance(); | ProgramConfiguration newpc = ProgramConfiguration.getInstance(); | ||
− | |||
/* | /* | ||
− | |||
in the above code pc and newpc both point to the same static object. when | 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 | 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. | anymore, so it doesn't call the constructor to create any new instance. | ||
− | |||
*/ | */ | ||
− | |||
} | } | ||
− | |||
</pre> | </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/> | Calc programming API and sample code:<br/> | ||
http://wiki.services.openoffice.org/wiki/Calc/API/Programming | 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. | Some example source codes can be found in the OpenOffice sdk folder. | ||
− | |||
For Ubuntu distribution: <code>/usr/lib/openoffice/basis3.1/sdk/examples</code> | 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 | http://wiki.services.openoffice.org/wiki/API/Samples | ||
+ | ==Resources / Links== | ||
− | + | =OpenOffice UX (User Experience)= | |
− | |||
− | |||
− | |||
− | |||
[http://ux.openoffice.org/ OpenOffice User Experience] | [http://ux.openoffice.org/ OpenOffice User Experience] | ||
− | + | =OpenOffice UI (User Interface)= | |
− | |||
− | |||
under construction... | under construction... | ||
− | + | =OpenOffice Smart Tags= | |
− | |||
[http://wiki.services.openoffice.org/wiki/Writer/Smart_Tags Smart Tag Resources] | [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://api.openoffice.org/ OpenOffice.org API site]<br/> | ||
[http://download.openoffice.org/sdk/index.html OpenOffice.org SDK 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] | [http://wiki.services.openoffice.org/wiki/Main_Page OpenOfice.org Wiki Projects] | ||
− | + | ==Other Resources== | |
[http://en.wikipedia.org/wiki/Help:Wiki_markup Wiki Markup] | [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> |
Latest revision as of 11:05, 19 July 2010
Contents
- 1 Introduction to OpenOffice
- 2 Potential Projects
- 3 OpenOffice Extensions
- 4 Developing OpenOffice.org extensions
- 5 OpenOffice.org SDK (Software Development Kit)
- 6 OpenOffice.org API (Application Programming Interface)
- 7 UNO (Universal Network Objects)
- 8 OpenOffice UX (User Experience)
- 9 OpenOffice UI (User Interface)
- 10 OpenOffice Smart Tags
- 11 Resources / Links
Introduction to OpenOffice
Potential Projects
Extensions
Others
OpenOffice Extensions
What are extensions
Extensions in OpenOffice extends the capability of the OpenOffice program. Extension can be for OpenOffice Writer, Calc, Presentation, Database or for the core OpenOffice. For OpenOffice writer, there may be extensions that extends the dictionary feature of OpenOffice so that user can use a French dictionary. Similarly there may be extensions that adds extra grammar features. An extension for Calc might do a complex calculation like mortgage calculation or filter data in certain way. A popular extension might become part of the core program in a future release. Extensions for OpenOffice can downloaded at http://extensions.services.openoffice.org
How to install extensions
To install an extension
- First download an extension from http://extensions.services.openoffice.org
- Then open OpenOffice Writer or Calc. On the top menu, click Tools->Extension Manager...
- Click Add... and select the .oxt file (extension file) you downloaded.
Usually, you should see a new button or menu item related to the extension you install. Since extension can do different things, sometimes you might not see any button or menu item. That extension might only appear and work on context menu. So if you cannot find it, check the extension's read-me file or manual.
Using extensions
Developing OpenOffice.org extensions
Checklist for Writing Extensions
Checklist for Writing Extensions
Preparing development environment
Linux
Install OpenOffice.org and SDK
OpenOffice.org program and SDK can be installed through package manager program, such as apt-get, yum, merge and pacman. Also, several GUI font-end for package manager programs are available to make installation easier. On Ubuntu, Synaptic is good choice. YumEx is the best option on Fedora.
- Ubuntu:
- With aptitude: launch a terminal and enter following command
-
sudo aptitude install openoffice.org openoffice.org-dev
- If you want SDK examples and documentations, install openoffice.org-dev-doc as well.
-
sudo aptitude install openoffice.org-dev-doc
- With Synaptic: Go to menu: System -> Administration -> Synaptic Package Manager. Search openoffice, and click openoffice.org, openoffice.org-dev, openoffice.org-dev packages, then click Mark for Installation and hit Apply on toolbar.
- Fedora:
- With Yum:
-
sudo yum install {package name}
- To-Do: replace {package name} with real package names under Fedora
- With YumEx:
- YumEx does not come with distribution. You needed to be installed manually.
-
sudo yum install yumex
- After installation, launch YumEx, search openoffice, select those packages and install.
Note: On Fedora, sudo
is not set by default. You can add you account to wheel user group so that you can use sudo
. Also, you may use su
to change to root, and run yum to install packages.
Note: On Ubuntu, if you use OpenOffice.org program that comes with distribution, and try to install SDK that is downloaded from OpenOffice.org website, you may encounter dependency issue. You should the SDK that come with distribution.
Install NetBean, and OpenOffice.org Extension Development Plugin
NetBean can be installed through package manager as well. Package name is netbeans. Ubuntu:
sudo aptitude install netbeans
Fedora:
sudo yum install netbeans
To-Do: need someone check if the packages name for Netbeans on Fedora is netbeans. After installation, you can install development plugin in NetBean. Lunch NetBean, select Plugins under Tool menu. Then switch to Available Plugins tab, and install OOo API plugin. Finally, select Options under Tool menu, and go to Miscellaneous -> OOo API Plugins tab. Fill in the path to OpenOffice.org program and SDK. Path is provide in following section.
Install Eclipse and OpenOffice.org Extension Development Plugin
To-Do: guild on install setup Eclipse for OOo Extension Dev
Path to OpenOffice.org Program and SDK
- Ubuntu:
- Program: /usr/lib/openoffice
- SDK: /usr/lib/openoffice/basis3.2/sdk
- Examples: /usr/lib/openoffice/basis3.2/sdk/example
- Mint:
- Program: /usr/lib/openoffice
- SDK: /usr/lib/openoffice/basis3.1/sdk
- Examples: /usr/lib/openoffice/basis3.1/sdk/example
To-Do: need path on Fedora and others major distros.
Windows
This is tutorial is to set up a Java development platform on Windows. You will need the following software: OpenOffice.org OpenOffice.org SDK 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
OpenOffice.org SDK (Software Development Kit)
OpenOffice.org API (Application Programming Interface)
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
UNO Concepts
- Introduction
- First Steps
- Professional UNO
- Writing UNO Components
- Extensions
- Advanced UNO
- Office Development
- Text Documents
- Spreadsheet Documents
- Drawing and Presentation
- Charts
- OOo Basic and Dialogs
- Database Access
- Forms
- Universal Control Broker
- Configuration Management
- Java Beans for Office Componets
- Accessibility
- Scripting Framework
- GUI
- Design Guidelines
- IDL Documentation Guidelines
- Universal Content Providers
- 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.
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; } }
public interface XDocument{ open(); }
public class TextDocument implements XDocument{ //concrete class for Text documents open(){ //method to open text document System.out.println("opening a text document..."); } }
public class SpreadSheet implements XDocument{ //concrete class for spreadsheet documents open(){ //method to open spreadsheet document System.out.println("opening a spreadsheet document..."); } }
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(); } }
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.
class ProgramConfiguration{ public ProgramConfiguraiton(){ //default constructor code } }
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.
class ProgramConfiguration{ private ProgramConfiguration(){ //default private constructor code } }
then we create a static public method that will make sure that only one instance lives in the whole program.
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; } }
So anytime you want to get that single object, you call the getInstance() method.
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. */ }
...
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:
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: /usr/lib/openoffice/basis3.1/sdk/examples
sample code 1
sample code 2
sample code 3
API Samples
http://wiki.services.openoffice.org/wiki/API/Samples
Resources / Links
OpenOffice UX (User Experience)
OpenOffice UI (User Interface)
under construction...
OpenOffice Smart Tags
Smart Tag Resources Smart Tag Presentation
Resources / Links
Development Resources
OpenOffice.org API site
OpenOffice.org SDK site
OpenOfice.org Wiki Projects
Other Resources
Syntax highlighting in WikiMedia
use <syntaxhighlight lang="">code here</syntaxhighlight>
int main(){
int i;
for(i=0;i<10;i++){
printf("%d\n", i);
}
return 0;
}