| |
|
 |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
| |
| Developer's Guide Examples
SDK home
|
| |
|
The Developer's Guide comes with a wide range of examples from all application areas which
shows the use of the API in the context of the different functional areas. Furthermore the
examples can be used as a first starting point to modify an existing example to their own
needs.
In order to connect most of the following client programs to the running office server,
before running those programs, you should invoke the office with the following command:
soffice "-accept=socket,host=localhost,port=8100;urp;
StarOffice.ServiceManager"
You could also customize the mentioned host and port to your needs.
All examples marked with a ∗ are executables which can
be executed using a run target in the makefile. The name of the binary (C++) can differ compared
to the source file, please see the run target in the appropriate makefile.
Some of the examples which create a component have no run target. In these cases a document is
provided which instantiates and runs the component (see the makefile output). Also the Basic
examples provide documents which use and shows the implemented functionality. The database and
forms examples need a running database, please see the description below. But note that is
not described in detail how to create a working data source (see the office help).
|
| |
|
First Steps
|
Text Documents
|
[PRODUCTNAME] Basic and Dialogs
|
|
Professional UNO
|
Spreadsheet Documents
|
Database Access
|
|
Writing UNO components
|
Office Bean
|
Forms
|
|
Advanced UNO (no examples available)
|
Drawing and Presentation Documents
|
Universal Content Broker (UCB)
|
|
Office Development
|
Charts
|
Configuration Management
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
FirstSteps examples
SDK home examples overview
| Example |
Description |
|
∗FirstConnection |
Shows how to set up a connection to a [PRODUCTNAME] in a different process space or even on a
remote machine.
|
|
∗FirstLoadComponent |
Demonstrates how to load a component into [PRODUCTNAME] by a Java application.
|
|
∗HelloTextTableShape |
Performs some generic text and shape operations on a text document, a spreadsheet document
and a drawing document.
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Professional UNO examples
SDK home examples overview
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Writing UNO components examples
SDK home examples overview
| Example |
Description |
|
∗RunComponent |
Demonstrates how to extend the service provider with a new factory and instantiates the
example components.
|
| TestComponentA |
Shows a simple demo component which implements
XTypeProvider,
XServiceInfo and
an own interface XSomethingA.
|
| TestComponentB |
Shows a simple demo component which implements
XTypeProvider,
XServiceInfo and an own interface XSomethingB.
|
| TestServiceProvider |
Implements a factory (service provider) which can create the two test components.
|
|
service1_impl.cxx |
Implements a simple UNO service with an own interface in C++.
|
|
service2_impl.cxx |
Implements another simple UNO service in C++.
|
|
ImageShrink |
Contains a framework for a component which scales images in a directory and stores them to
another directory. This code does not really do anything, it just contains the framework.
|
| Thumbs |
This example registers a factory for the image shrink component and instantiates it.
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Office Development examples
SDK home examples overview
| Example |
Description |
| AsciiReplaceFilter |
Implements the an example for an import/export filter service.
|
| Factory |
Implements a factory class which can be registered for the UNO service manager. It is used
to create new instances of the filter service.
|
| FilterOptions |
Offers some helper methods to analyze and prepare the arguments of the filter method.
|
| CustomizeView |
Offers a view which allows hiding and showing of the menubar, toolbar and objectbar of the
related document component.
|
|
∗Desk |
This is the main part of a demo application based on the framework APIs. It mainly shows the
mechanisms to load, store and convert documents, as well as dispatch and dispatch interception.
It integrates windows from [PRODUCTNAME] via system window handle. This is the same mechanism
as used by the OfficeBean, but the OfficeBean itself is not used here, just the JNI window
handle access.
|
| DocumentView |
Deals with the application window and it's actions.
|
| FunctionHelper |
This helper comprises all [PRODUCTNAME] API calls. Thus it is possible to learn about these
aspects separately from the rest of the application example.
|
| IOnewayLink |
This is an interface to receive asynchronous events from UNO oneway calls.
|
|
IShutdownListener |
This is a listener interface to clean up on shutdown of [PRODUCTNAME].
|
| Interceptor |
This implements a dispatch interceptor for a specific URL.
|
|
JavaWindowPeerFake |
Fakes an
XWindowPeer for the Java native window handle to create a child window
for the office frame.
|
| NativeView |
Implements native JNI methods to get the window handle of the Java window.
|
| OfficeConnect |
Builds the remote bridge to [PRODUCTNAME] and exports its UNO service manager for the Java
side of the application.
|
| OnewayExecutor |
Implements IOnewayLink to decouple asynchronous oneway calls in the Java process.
|
| StatusListener |
Implements a listener for a
FeatureStateEvent.
|
| StatusView |
Shows the current status for which the application is registered as an event listener.
|
| ViewContainer |
Performs a clean up on the Java side on [PRODUCTNAME] shutdown.
|
| OfficeConnect |
Builds the remote bridge to [PRODUCTNAME] and exports its UNO service manager to the Java side.
|
|
∗ContextMenuInterceptor |
This example shows a context menu interceptor that creates a new menu entry that has a
sub menu. This sub menu is in inserted into the context menu on the topmost position.
It provides some helper functions to the user that are reachable through the menu Help.
|
| MenuElement |
A helper class for the context menu interceptor example. It determines the menu element type.
|
|
∗Number_Formats |
Demonstrates the use of number formats in a spreadsheet document.
|
|
∗TerminationTest |
This example uses the TerminateListener and shows the use of them in a running program.
|
|
TerminateListener |
An example implementation of
XTerminateListener. It is called when [PRODUCTNAME] terminates.
|
|
∗Clipboard |
Demonstrates the usage of the clipboard service by registering a clipboard listener, getting
a list of formats from the current clipboard content and copying some data to the clipboard.
|
| ClipboardListener |
Implements a clipboard listener for the Clipboard example. In such a class, actions can be
implemented which happen whenever the clipboard content changes.
|
| ClipboardOwner |
Implements a clipboard owner for the Clipboard example. This class is notified when it loses
ownership of the clipboard.
|
| TextTransferable |
Implements a data object for the Clipboard example. Such classes supply clients with data
in a variety of formats.
|
|
∗LinguisticExamples |
A short example that uses most of the functionality from the [PRODUCTNAME] linguistic API.
|
| OneInstanceFactory |
This class is used to provide a service factory for the linguistic services. It enforces that
the actual implementations are only instantiated once.
|
| PropChgHelper |
The base class for several property change helpers which are used to keep track of the
changes of the service relevant linguistic properties. It is also used by the thesaurus directly.
|
| PropChgHelper_Hyph |
The property change helper that is tracking the hyphenation relevant properties.
|
|
PropChgHelper_Spell |
The property change helper that is tracking the spell checking relevant properties.
|
| SampleHyphenator |
A simple implementation for a
Hyphenator service.
|
| SampleSpellChecker |
A simple implementation for a
SpellChecker service.
|
| SampleThesaurus |
A simple implementation for a
Thesaurus service.
|
|
XHyphenatedWord_impl |
An object implementing the
XHyphenatedWord interface. An instance of this type may be returned by
the hyphenator.
|
| XMeaning_impl |
An object implementing the
XMeaning interface. An instance of this type may be returned by the thesaurus.
|
|
XPossibleHyphens_impl |
An object implementing the
XPossibleHyphens interface. An instance of this type may be returned by
the hyphenator.
|
|
XSpellAlternatives_impl |
An object implementing the
XSpellAlternatives interface. An instance of this type may be returned
by the spell checker.
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Text Documents examples
SDK home examples overview
| Example |
Description |
|
∗TextDocuments |
Demonstrates a wide variety of API functions in text documents and text document views.
- use of templates
- using the view cursor, including visible text selections
- changing the paragraph style
- using various editing facilities like text insertion
- using various cursor interfaces
- creating text contents, like tables, sections and frames, well as text fields and
columns
- using stylesheets
- applying numbering styles
- using references, indexes, footnotes and autotext
- loading, storing and printing a text document
Adjust the strings at the beginning of the class definition to match your installation!
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Spreadsheet Documents examples
SDK home examples overview
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Office Bean examples
SDK home examples overview
| Example |
Description |
| OfficeCommand |
A helper class to send UI events (see
XDispatch) to [PRODUCTNAME].
|
| BasicOfficeBean |
Shows a JavaBean which can contain arbitrary [PRODUCTNAME] documents.
|
| BeanInfoAdapter |
Implements a helper class to make it easier to create BeanInfo classes.
|
| SimpleBean |
Extends the BasicOfficeBean by a method to show and hide the menu bar.
|
| SimpleBeanBeanInfo |
Implements BeanInfo for the SimpleBean example.
|
|
∗SimpleViewer |
A Java wrapper application which makes it possible to view [PRODUCTNAME] documents in
[PRODUCTNAME] beans.
|
|
∗DocViewer |
Demonstrates a JavaBean with which arbitrary [PRODUCTNAME] documents can be viewed.
|
| Office |
A generic base class for the OfficeWrite JavaBean example. This class could
be used as a base class for other specialized JavaBeans too.
|
| OfficeBeanInfo |
Example implementation of a BeanInfo object for an office JavaBean.
|
| OfficeWriter |
Demonstrates how an specialized JavaBean can look like. This example is for the text
document component.
|
|
OfficeWriterBeanInfo |
Implementation of the BeanInfo for the OficeWriter JavaBean example.
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Drawing and Presentation Documents examples
SDK home examples overview
| Example |
Description |
|
∗ChangeOrderDemo |
Shows how to change the painting order of shapes.
|
|
∗ControlAndSelectDemo |
Demonstrates the creation of a control shape and selects it in the current view.
|
|
∗CustomShowDemo |
Creates two custom shows and selects one of these.
|
|
∗DrawViewDemo |
Prints the view data properties and the controller properties of a drawing view and
shows an example of setting such a property.
|
|
∗DrawingDemo |
Creates several shapes on several slides. Nice pattern included!
|
|
∗FillAndLineStyleDemo |
Demonstrates usage of area fill an line style properties.
|
|
∗GluePointDemo |
Creates two shapes with glue points and connects them with two connectors.
|
|
∗GraphicExportDemo |
Loads a drawing document and exports it to a GIF file. Run this program with source URL,
target URL and page index on the command line, where the URLs are fully qualified URLs.
|
| Helper |
Contains a helper class for the other examples to connect to [PRODUCTNAME] and open or
create a drawing document.
|
|
∗LayerDemo |
Creates shapes in different layers to show how to protect shapes from modifications.
|
|
∗ObjectTransformationDemo |
Shows geometric transformations on a shape using a homogenous matrix.
|
|
∗Organigram |
Demonstrates the creation of an organigram consisting of shapes and connectors.
|
| PageHelper |
Contains a helper class for accessing several kinds of draw pages in a presentation or
drawing document.
|
|
∗PresentationDemo |
Creates a presentation and runs it with some user interaction.
|
| ShapeHelper |
Contains a helper class for accessing and creating shapes for the other examples.
|
|
∗StyleDemo |
Creates a shape and applies a predefined shape stylesheet.
|
|
∗TextDemo |
Demonstrates usage of text and text styles in shapes.
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Charts examples
SDK home examples overview
| Example |
Description |
| CalcHelper |
Contains some helper methods for charts in spreadsheet documents, like accessing sheets by
name, inserting a chart into a sheet, filling cell ranges with random numbers etc.
|
| ChartHelper |
Contains some helper methods for charts, like creating a chart as an embedded object.
|
|
∗ChartInCalc |
Demonstrates how to create an embedded chart object with a random scatter chart within a
spreadsheet.
|
|
∗ChartInDraw |
Inserts a 3D-bar chart into a drawing document.
|
|
∗ChartInWriter |
Inserts an embedded chart object with a random bar chart in a text document. This example
does not really work, because the API for embedding objects into text documents is not
implemented. To be more
precise.
|
| Helper |
Shows how to connect to [PRODUCTNAME] and create text, drawing or spreadsheet document.
This class is used as a helper class for the other examples.
|
| JavaSampleChartAddIn |
Gives an example of how to implement chart add-ins to create new or specialized diagram types.
The resulting component has to be deployed before it can be used.
|
|
∗ListenAtCalcRangeInDraw |
This helper class is used to build connection between an embedded chart object in a
drawing document and a data range in a spreadsheet document.
|
|
∗SelectionChangeListener |
Shows how to register a handler which is called when the selection within an embedded
chart object changes.
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
[PRODUCTNAME] Basic and Dialogs examples
SDK home examples overview
| Example |
Description |
| FirstStepsBasic.sxw |
This StarBasc example shows how to create an own dialog which inserts a graphics object
into a text document.
|
|
SampleDialog.java |
This example builds a Java component which creates a simple dialog.
|
|
CreatingDialogs.sxw |
This document contains a simple Basic macro which loads the SampleDialog component. The
macro will be executed by pressing a Push button.
|
|
ToolkitControls |
In this directory you find a Basic library which implements several examples using
toolkit controls. You can install this Basic library in the internal Basic IDE.
Navigate to Tools → Macro → Organizer...(button) → Libraries (tab page)
→ Append... (button) and choose the "e;script.slb"e; file → open (button)
→ Ok (button). Back on the Libraries tab page, select "e;ToolkitControl"e; and
press the Edit button. In the Basic IDE you will find several modules which contains the
examples and the necessary dialogs.
Select one of the following modules and press the Run button:
- FileDialog = simple dialog which ask for a filename (nothing else)
- MultiPage = a more complex dialog with several tab pages
- ProgressBar = a dialog which shows a progress bar
- ScrollBar = a dialog which shows a scroll bar
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Database Access examples
SDK home examples overview
| Example |
Description |
|
∗CodeSamples |
Creates the connection to [PRODUCTNAME] and executes the code SalesMan samples for database
API. This example uses a database "MYDB0", make sure that you have created a data
source which operates on a database "MYDB0".
|
|
∗OpenQuery |
Demonstrates
XResultSetUpdate
and
XRowUpdate. This example uses a database "MYDB0", make sure
that you have created a data source which operates on a database "MYDB0".
|
|
∗RowSet |
Demonstrates the usage of a row set. This example uses a database "MYDB0", make
sure that you have created a data source which operates on a database "MYDB0".
|
| RowSetEventListener |
Demonstrates how to define listener for the row set example.
|
| Sales |
Creates a simple database table.
|
| SalesMan |
Creates a simple database table.
|
| sdbcx |
Demonstrates the usage of the SDBCX layer services.
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Forms examples
SDK home examples overview
For running the Forms example you should start your office with the following command:
soffice "-accept=socket,host=localhost,port=8100;urp,ForceSynchronous=1,Negotiate=0;
StarOffice.ServiceManager"
| Example |
Description |
| ButtonOperator |
The form created by the sample program contains various buttons which are tied to certain
functionality. The class ButtonOperator, well, operates these buttons.
|
| ComponentTreeTraversal |
Helper classes for traveling through a tree of
FormComponent's.
|
| ControlLock |
Helper class for implementing the locking of control depending on the state of the underlying
RowSet.
|
| DocumentHelper |
Helper class for encapsulating working with a (logical) form document.
|
| DocumentType |
A simple enumeration class for classifying a document.
|
| DocumentViewHelper |
Helper class for encapsulating working with a view for a form document.
|
| FLTools |
Various small tools for the form layer sample program.
|
|
∗FormLayer |
Main class for central form operation. This example uses a data source "OO_SDK_Demo_DB
", make sure that you have created a data source with this name "OO_SDK_Demo_DB".
|
| GridFieldValidator |
GridFieldValidator is responsible for validating the input in a specific grid
control column.
|
| InteractionRequest |
A simple implementation of a
XInteractionRequest. Not tied to the form layer example, but a general helper.
|
| KeyGenerator |
Helper class which is able to generate (unique) keys for a
(RowSet) column.
An instance of this class can be tied to a specific row set column. It then monitors the state
of the underlying row set, and upon inserting a new record into it (two operation modi are
possible here), it automatically inserts a newly created (two modi, too) key into the column.
|
| SalesFilter |
Helper class operating the on-the-fly filter control in the sample document. The document
contains several controls which can be used to interactively change the filter of the form.
The class SalesFilter operates these controls.
|
| UNO |
A small UNO-syntax related helper class.
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Universal Content Broker (UCB) examples
SDK home examples overview
| Example |
Description |
|
∗ChildrenRetriever |
Shows child entries of a given folder. Try -help or -? on the command line to view optional
parameters.
|
|
∗DataStreamComposer |
Demonstrates usage of the data stream by copying the data from one UCB node to another.
|
|
∗DataStreamRetriever |
Shows how to obtain the data stream from a document resource.
|
| Helper |
Some helper methods to access the UCB which are used by the other examples.
|
| MyActiveDataSink |
A helper class for the DataStreamRetriever example which implements a data sink.
|
|
∗PropertiesComposer |
Shows how to set property values of an UCB resource.
|
|
∗PropertiesRetriever |
Shows how to access property values of an UCB resource.
|
|
∗ResourceCreator |
Creates a new file in an existing file system folder.
|
|
∗ResourceManager |
Demonstrates how to copy and move UCB resources.
|
|
∗ResourceRemover |
Demonstrates how to remove UCB resources.
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
Configuration Management examples
SDK home examples overview
| Example |
Description |
|
∗ConfigExamples |
This example connects to a [PRODUCTNAME], gets the configuration manager and accesses the
configuration in various ways.
|
|
| |
|
 |
|
|
 |
|
|
 |
|
|
|
Copyright 2003 Sun Microsystems, Inc.
 
|