Difference between revisions of "OpenOffice temporary template"

From CDOT Wiki
Jump to: navigation, search
(Factory Pattern Design)
(Factory Pattern Design)
Line 212: Line 212:
 
=====Factory Pattern Design=====
 
=====Factory Pattern Design=====
  
OpenOffice.org development heavily uses the Factory 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 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 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

Revision as of 03:31, 9 June 2010

Contents

Introduction to OpenOffice

OpenOffice.org Overview

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

  • Then open OpenOffice Writer or Calc. On the top menu, click Tools->Extension Manager...
Installing an Extension
  • Click Add... and select the .oxt file (extension file) you downloaded.
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.

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

.Net Resources

OpenOffice.org SDK (Software Development Kit)

OpenOffice.org API (Application Programming Interface)

UNO (Universal Network Objects)

Introduction

Understanding UNO

UNO Concepts

UNO Concepts Developers Guide

  1. Introduction
  2. First Steps
  3. Professional UNO
  4. Writing UNO Components
  5. Extensions
  6. Advanced UNO
  7. Office Development
  8. Text Documents
  9. Spreadsheet Documents
  10. Drawing and Presentation
  11. Charts
  12. OOo Basic and Dialogs
  13. Database Access
  14. Forms
  15. Universal Control Broker
  16. Configuration Management
  17. Java Beans for Office Componets
  18. Accessibility
  19. Scripting Framework
  20. GUI
  21. Design Guidelines
  22. IDL Documentation Guidelines
  23. Universal Content Providers
  24. UNOIDL Syntax/Grammer

UNO Architecture

UNO Architecture Introduction

UNO Architecture Diagrams

Related technologies/ frameworks

Factory Pattern Design

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.
Factory Method Pattern

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();

   }

}

Singletons
...

UNO Interfaces

UNO Language Bindings

Tutorials

Creating a simple Hello World extension for OpenOffice.org Writer

Creating a simple extension for OpenOffice.org Calc

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.

/usr/lib/openoffice/basis3.1/sdk/examples

sample code 1

sample code 2

sample code 3

Resources / Links

OpenOffice UX (User Experience)

under construction...

OpenOffice UI (User Interface)

under construction...

Resources / Links

Development Resources

OpenOffice.org API site OpenOffice.org SDK site

Other Resources

Wiki Markup