How to get Objects in OpenOffice.org

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 09:17, 28 September 2007 by Cc208500 (Talk)

Jump to: navigation, search




An object in our context is a software artifact that has methods you can call. Objects are required to do something with OpenOffice.org. But where do you obtain them?

New objects

In general, new objects or objects which are necessary for a first access are created by service managers in OpenOffice.org In the FirstLoadComponent example, the remote service manager creates the remote Desktop object, which handles application windows and loaded documents in OpenOffice.org:

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


  Object desktop = xRemoteServiceManager.createInstanceWithContext(
                   "com.sun.star.frame.Desktop", xRemoteContext);

Document objects

Document objects represent the files that are opened with OpenOffice.org. They are created by the Desktop object, which has a loadComponentFromURL() method for this purpose.

Objects that are provided by other objects

Objects can hand out other objects. There are two cases:

  • Features which are designed to be an integral part of the object that provides the feature can be obtained by get methods in the OpenOffice.org API. It is common to get an object from a get method. For instance, getSheets() is required for every Calc document, getText() is essential for every Writer Document and getDrawpages() is an essential part of every Draw document. After loading a document, these methods are used to get the Sheets, Text and Drawpages object of the corresponding document. Object-specific get methods are an important technique to get objects.
  • Features which are not considered integral for the architecture of an object are accessible through a set of universal methods. In the OpenOffice.org API, these features are called properties, and generic methods are used, such as getPropertyValue(String propertyName) to access them. In some cases such a non-integral feature is provided as an object, therefore the method getPropertyValue() can be another source for objects. For instance, page styles for spreadsheets have the properties "RightPageHeaderContent" and "LeftPageHeaderContent", that contain objects for the page header sections of a spreadsheet document. The generic getPropertyValue() method can sometimes provide an object you need.

Sets of objects

Objects can be elements in a set of similar objects. In sets, to access an object you need to know how to get a particular element from the set. The OpenOffice.org API allows four ways to provide an element in a set. The first three ways are objects with element access methods that allow access by name, index, or enumeration. The fourth way is a sequence of elements which has no access methods but can be used as an array directly. How these sets of elements are used will be discussed later.

The designer of an object decides which of those opportunities to offer, based on special conditions of the object, such as how it performs remotely or which access methods best work with implementation.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools