|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
|
|
|
 |
|
|
 |
|
|
 |
|
|
|
|
|
 |
|
|
 |
|
|
 |
|
|
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
Writing UNO components examples
SDK home examples overview
Jobs Addon Example |
Description |
AsyncJob |
An java example showing how a job can analyze the given arguments and how the environment can
be detected, in which the job is executed.
|
Jobs.xcu |
Contains the example job configuration.
|
Addons.xcu |
Contains the configuration entries for the Jobs addon where different entries are configured.
|
ProtocolHandler Addon Java |
Description |
ProtocolHandlerAddon |
Implments a ProtocolHandler addon component in Java.
|
ProtocolHandler.xcu |
Contains the ProtocolHandler configuration.
|
Addons.xcu |
Contains the configuration entries for the ProtocolHandler addon where different entries
are configured.
|
ProtocolHandler Addon C++ |
Description |
addon.cxx |
Implments a ProtocolHandler addon component in C++.
|
addon.hxx |
Contans the class definition of the c++ ProtocolHandler example.
|
component.cxx |
Implements the administrative component functions (component_writeInfo, component_getFactory).
|
ProtocolHandler.xcu |
Contains the ProtocolHandler configuration.
|
Addons.xcu |
Contains the configuration entries for the ProtocolHandler addon where different entries
are configured.
|
C++ Component Example |
Description |
service1_impl.cxx |
Implements a simple UNO service with an own interface in C++.
|
service2_impl.cxx |
Implements another simple UNO service in C++.
|
Thumbs Example |
Description |
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
Ascii Filter Example |
Description |
AsciiReplaceFilter |
Implements 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.
|
FlatXmlFilter C++ Example |
Description |
FlatXml.cxx |
Implements an import/export filter storing the data in one xml stream instead of the normal three
streams in a sxw file. The example is implemented in C++.
|
FlatXmlFilter Java Example |
Description |
FlatXml |
Implements an import/export filter storing the data in one xml stream instead of the normal three
streams in a sxw file. The example is implemented in Java.
|
FlatXml FilterDetection Example |
Description |
filterdetect.cxx |
Implements an example filter detection for the flat xml filter.
The example is implemented in C++.
|
filterdetect.hxx |
Contains the class definition of the filter detection example.
|
fdcomp.cxx |
Implements the administrative component functions (component_writeInfo, component_getFactory).
|
Desktop Environment Example |
Description |
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.
|
Office Development Examples |
Description |
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.
|
Clipboard Example |
Description |
*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.
|
Path Settings Example |
Description |
PathsettingsTest |
This code example creates the service "com.sun.star.util.PathSettings" and retrieves all path properties from it.
It shows how a developer can change the path properties using the
XPropertySet interface.
|
Path Substitution Example |
Description |
PathSubstitutionTest |
This code example creates the path substitution service "com.sun.star.util.PathSubstitution" and retrieves the
pre-defined Office path variables. It shows the variable values on the screen. The reSubstiuteVariables function
is used to show how the service exchanges parts of a path with a path variable supporting platform independent
path usage.
|
Disable Commands Example |
Description |
DisableCommandsTest |
Implements an example showing how a developer can use the configuration API to disable/enable
commands at runtime.
|
|
 |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
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!
|
|
 |
|
|
|
 |
|
|
 |
|
|
 |
|
|
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
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 and 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 |
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 "script.slb" file → open (button)
→ Ok (button). Back on the Libraries tab page, select "ToolkitControl" 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
The Database examples use a SQL database named "MYDB0" with write access. Make sure that
you have a data source operating on such a database in your office before you run the example.
Database Examples |
Description |
*CodeSamples |
Creates the connection to [PRODUCTNAME] and executes the code SalesMan samples for database
API.
|
*OpenQuery |
Demonstrates the use of
XResultSetUpdate
and
XRowUpdate .
|
*RowSet |
Demonstrates the usage of a row set.
|
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.
|
Driver Skeleton Example |
Description |
OSubComponent.hxx |
Helper class to delegate special dispose handling.
|
OTypeInfo.hxx |
Contains the database types from the DatabaseMetaData getTypes call.
|
SConnection.hxx |
This file contains the declaration of a class implementing the service
com.sun.star.sdbc.Connection.
|
SConnection.cxx |
This file contains the implementation of the class declared in SConnection.hxx.
|
SDatabaseMetaData.hxx |
This file contains the declaration of a class implementing the interface
com.sun.star.sdbc.XDatabaseMetaData.
|
SDatabaseMetaData.cxx |
This file contains the implementation of the class declared in SDatabaseMetaData.hxx.
|
SDriver.hxx |
This file contains the declaration of a class implementing the service
com.sun.star.sdbc.Driver.
|
SDriver.cxx |
This file contains the implementation of the class declared in SDriver.hxx.
|
SPreparedStatement.hxx |
This file contains the declaration of a class implementing the service
com.sun.star.sdbc.PreparedStatement.
|
SPreparedStatement.cxx |
This file contains the implementation of the class declared in SPreparedStatement.hxx.
|
SResultSet.hxx |
This file contains the declaration of a class implementing the service
com.sun.star.sdbc.ResultSet.
|
SResultSet.cxx |
This file contains the implementation of the class declared in SResultSet.hxx.
|
SResultSetMetaData.hxx |
This file contains the declaration of a class implementing the interface
com.sun.star.sdbc.XResultSetMetaData.
|
SResultSetMetaData.cxx |
This file contains the implementation of the class declared in SResultSetMetaData.hxx.
|
SServices.cxx |
This file contains a class implementing the service needed to register the driver.
|
SStatement.hxx |
This file contains the declaration of a class implementing the service com.sun.star.sdbc.Statement.
|
SStatement.cxx |
This file contains the implementation of the class declared in SStatement.hxx.
|
propertyids.hxx |
Defines some common used strings and declare a helper class for properties.
|
propertyids.cxx |
Implements the property helper class.
|
|
 |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
Forms examples
SDK home examples overview
This example uses a SQL data source in the Office named "OO_SDK_Demo_DB" with write access. Make
sure that you have such a datasurce available in your office before you run the example.
For running the FormLayer example you should start your office with the following command:
soffice "-accept=socket,host=localhost,port=2083;urp,ForceSynchronous=1,Negotiate=0;
StarOffice.ServiceManager"
The additonal connection parameters are necessary to avoid snychronization problems.
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. Two tables will be created and a form (writer document)
with a bussiness example will fill it fields from these tables.
|
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.
|
|
 |
|
|
|
 |
|
|
 |
|
|
 |
|
|
|
|
|
 |
|
|
 |
|
|
 |
|
|
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
Accessibility examples
SDK home examples overview
Example |
Description |
ConnectionTask |
A timer task that tries to (re-)connect to a running Office application. When it can not detect
an Office application that accepts connections then it waits for some time and tries again.
|
EventHandler |
Handle all events that are used by this tool. It is called by the EventListenerProxy class
with somewhat preprocessed events.
|
EventListenerProxy |
This proxy runs in its own thread to avoid deadlocks with the Office it listens to. It waits
for top window events to be informed of new or removed top level windows and for some
accessibility events that are relevant to display the currently focused object.
|
GraphicalDisplay |
This widget displays a graphical representation of the currently focused object. The focused
object is painted as a green rectangle and its ancestors as gray rectangles to give an impression
of the relative location of the objects.
|
IAccessibleObjectDisplay |
This interface is implemented by all classes that display the currently focused object, namely
GraphicalDisplay and TextualDisplay. It allows the owner of the display classes to tell them to
display a specific object: usually the focused object.
|
MessageArea |
A text area that shows messages about what the tools is currently doing.
|
*NameProvider |
In contrast to the Java Accessibility API which uses Strings for event types, roles, states,
and relation types, the UNO Accessibility API uses numbers for this task. In order to present
them to the user in a more readable form this class returns the string name for each event,
role, state, or relation.
|
RegistrationThread |
When a new window appears or an existing one is removed the tool registers or unregisters at
all the window's children as accessibility event listener. This is handled by RegistrationThread
objects in their own threads so that the user interface is not blocked.
|
*SSR |
The main class sets up the user interface and starts the ConnectionTask object that eventually
will initiate a connection to a running Office application and in turn will create
RegistrationThread objects to register at all Office windows as accessibility event listener
and thus gets informed about the currently focused object.
|
TextualDisplay |
Show some textual information about the currently focused object like its name, description,
and role.
|
|
 |
|
|
|
 |
|
|
 |
|
|
 |
|
|
Copyright 2003 Sun Microsystems, Inc.
 
|