<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JZA</id>
	<title>Apache OpenOffice Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JZA"/>
	<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/wiki/Special:Contributions/JZA"/>
	<updated>2026-05-15T00:30:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Product_Release&amp;diff=236252</id>
		<title>Product Release</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Product_Release&amp;diff=236252"/>
		<updated>2015-05-14T17:24:22Z</updated>

		<summary type="html">&lt;p&gt;JZA: /* Apache OpenOffice */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Apache OpenOffice ==&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org was [http://incubator.apache.org/projects/openofficeorg.html transferred] to the [http://www.apache.org/foundation/ Apache Software Foundation] on June 1st, 2011 and it [https://blogs.apache.org/OOo/entry/openoffice_graduates_from_the_apache became an Apache Top-Level Project] on October 17, 2012.&lt;br /&gt;
&lt;br /&gt;
The development model of the popular productivity suite changed to benefit from the huge experience the Foundation has with managing open source projects.&lt;br /&gt;
&lt;br /&gt;
New releases of the product are accordingly named &amp;#039;&amp;#039;&amp;#039;Apache OpenOffice&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
=== Apache OpenOffice 4.x ===&lt;br /&gt;
&lt;br /&gt;
* [https://blogs.apache.org/OOo/entry/announcing_apache_openoffice_4_1 Apache OpenOffice 4.1.1] (Aug, 23rd 2014)&lt;br /&gt;
* [https://blogs.apache.org/OOo/entry/the_apache_openoffice_project_announce Apache OpenOffice 4.1.0] (Apr. 29th, 2014)&lt;br /&gt;
* [https://blogs.apache.org/OOo/entry/announcing_apache_openoffice_4_0 Apache OpenOffice 4.0.1] (Oct. 1st, 2013)&lt;br /&gt;
* [https://blogs.apache.org/OOo/entry/a_short_celebration_and_then Apache OpenOffice 4.0.0] (Juli 23rd, 2013)&lt;br /&gt;
&lt;br /&gt;
=== Apache OpenOffice 3.4 ===&lt;br /&gt;
&lt;br /&gt;
* [http://blogs.apache.org/OOo/entry/announcing_apache_openoffice_3_41 Apache OpenOffice 3.4.1] (August 23rd, 2012)&lt;br /&gt;
** additional languages Danish, Norwegian, Swedish, Korean, Polish, Basque, Asturian and Scottish Gaelic (January 30th, 2013)&lt;br /&gt;
* [http://ooo-site.staging.apache.org/news/aoo34.html Apache OpenOffice 3.4.0] (May 8th 2012)&lt;br /&gt;
&lt;br /&gt;
== Older Product Releases of OpenOffice.org ==&lt;br /&gt;
&lt;br /&gt;
For release information please see the technical [http://development.openoffice.org/releases/index.html Release Notes] and a detailed [http://www.openoffice.org/dev_docs/features/index.html feature overview].&lt;br /&gt;
&lt;br /&gt;
For a list of uploaded Developer Snapshots and Release Candidates/Releases see the [[Product_Release/builds_uploaded | table of uploaded builds]]. The most recent builds can be downloaded on the [http://download.openoffice.org download webpage].&lt;br /&gt;
&lt;br /&gt;
For guidance on announcing new releases see [[PolicyMirrorLinking]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Released OpenOffice.org 3.x.x ===&lt;br /&gt;
&lt;br /&gt;
* [[OOoRelease33|OpenOffice.org 3.3.0]] (January 26th, 2011)&lt;br /&gt;
* [[OOoRelease321|OpenOffice.org 3.2.1]] (June 4th, 2010)&lt;br /&gt;
* [[OOoRelease32|OpenOffice.org 3.2.0]] (February 11th, 2010)&lt;br /&gt;
* [[OOoRelease311|OpenOffice.org 3.1.1]] (August 31st, 2009)&lt;br /&gt;
* [[OOoRelease31|OpenOffice.org 3.1.0]] (May 7th, 2009)&lt;br /&gt;
* [[OOoRelease301|OpenOffice.org 3.0.1]] (January 27th, 2009)&lt;br /&gt;
* [[OOoRelease30|OpenOffice.org 3.0.0]] (October 13th, 2008)&lt;br /&gt;
&lt;br /&gt;
=== Released OpenOffice.org 2.x.x ===&lt;br /&gt;
&lt;br /&gt;
* [[OOoRelease243|OpenOffice.org 2.4.3]] (September 04th, 2009)&lt;br /&gt;
* [[OOoRelease242|OpenOffice.org 2.4.2]] (October 28th, 2008)&lt;br /&gt;
* [[OOoRelease241|OpenOffice.org 2.4.1]] (June 10th, 2008)&lt;br /&gt;
* [[OOoRelease24|OpenOffice.org 2.4]] (March 27th, 2008)&lt;br /&gt;
* [[OOoRelease231|OpenOffice.org 2.3.1]] (December 4th, 2007)&lt;br /&gt;
* [[OOoRelease23|OpenOffice.org 2.3]] (September 17th, 2007)&lt;br /&gt;
* [[OOoRelease221|OpenOffice.org 2.2.1]] (June 12th, 2007)&lt;br /&gt;
* [[OOoRelease22|OpenOffice.org 2.2]] (March 29th, 2007)&lt;br /&gt;
* [[OOoRelease205|OpenOffice.org 2.1]] (December 12th, 2006)&lt;br /&gt;
* [[OOoRelease204|OpenOffice.org 2.0.4]] (October 13th, 2006)&lt;br /&gt;
* [[OOoRelease203|OpenOffice.org 2.0.3]] (June 29th, 2006)&lt;br /&gt;
* [[OOoRelease202|OpenOffice.org 2.0.2]] (March 8th, 2006)&lt;br /&gt;
* [[OOoRelease201|OpenOffice.org 2.0.1]] (December 21st, 2005)&lt;br /&gt;
* OpenOffice.org 2.0.0 (October 21st, 2005)&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org 1.1 ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org 1.1.5 (September 9th, 2005)&lt;br /&gt;
* OpenOffice.org 1.1.4 (December 22th, 2004)&lt;br /&gt;
* OpenOffice.org 1.1.3 (October 4th, 2004)&lt;br /&gt;
* OpenOffice.org 1.1.2 (June 18th, 2004)&lt;br /&gt;
* OpenOffice.org 1.1.1 &lt;br /&gt;
* OpenOffice.org 1.1.0 (October 1st, 2003)&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org 1.0 ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org 1.0.3 (April 10th, 2003)&lt;br /&gt;
* OpenOffice.org 1.0.2 (January 20th, 2003) (tag &amp;quot;OpenOffice_1_0_2&amp;quot;)&lt;br /&gt;
* OpenOffice.org 1.0.1 (July 17th, 2002) (tag &amp;quot;OpenOffice_1_0_1&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Older releases can be retrieved via the [ftp://archive.services.openoffice.org/pub/openoffice-archive/stable Archive Server].&lt;br /&gt;
&lt;br /&gt;
[[Category:Releases]]&lt;br /&gt;
[[Category:Quality Assurance]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/Building_Guide_AOO/Step_by_step&amp;diff=235940</id>
		<title>Documentation/Building Guide AOO/Step by step</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/Building_Guide_AOO/Step_by_step&amp;diff=235940"/>
		<updated>2015-03-28T01:11:32Z</updated>

		<summary type="html">&lt;p&gt;JZA: Update to 4.1&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Step by step building guides for different platforms}}&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This page is intended as a collection of simple step-by-step recipes to build Apache OpenOffice from source code.  A more thorough explanation of what the individual steps do and why they are necessary can be found in the [[Documentation/Building_Guide_AOO|building guide]].&lt;br /&gt;
=Ubuntu 14.04=&lt;br /&gt;
The basic building steps under Ubuntu 12.04 (see below) are to be followed in Ubuntu 14.04 as well; however, there are some minor build issues that any developer, using this OS, needs to be aware of, if he gets stuck while building. The following is the list of issues, with their fixes, that a developer may face with:&lt;br /&gt;
&lt;br /&gt;
* Issue 124712 (build broken in svl); see the link https://issues.apache.org/ooo/show_bug.cgi?id=124712 for detailed information.&lt;br /&gt;
If you are building trunk, the patch is already applied; if you are building from a release tag or tarball, the patch needs to be applied for all releases &amp;lt;= 4.1.1.&lt;br /&gt;
&lt;br /&gt;
* Issue 125475; see the link https://issues.apache.org/ooo/show_bug.cgi?id=125475 for detailed information. This happens if you explicitly upgraded your GCC and related tools to version 4.9; it will not appear if you use GCC 4.8.x.&lt;br /&gt;
&lt;br /&gt;
As the BZ says, it is because of buggy toolchain g++4.9. So for now in Ubuntu Linux 14.04, build the source using g++4.8.2, gcc4.8.2; these are the default compilers in Ubuntu Linux 14.04 anyway; please check it using the following commands:&lt;br /&gt;
  g++ -v&lt;br /&gt;
  gcc -v&lt;br /&gt;
if not, you&amp;#039;ve to download them.&lt;br /&gt;
  sudo apt-get install g++-4.8&lt;br /&gt;
  cd /usr/bin&lt;br /&gt;
  rm gcc&lt;br /&gt;
  rm g++&lt;br /&gt;
  ln -s gcc-4.8 gcc&lt;br /&gt;
  ln -s g++-4.8 g++&lt;br /&gt;
&lt;br /&gt;
* Failed to find ./solver/420/unxlngx6.pro/lib/x86_64-linux-gnu/libstdc++.so.6.0.20 error.&lt;br /&gt;
&lt;br /&gt;
  cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20 ./solver/420/unxlngx6.pro/lib/&lt;br /&gt;
  rm ./solver/420/unxlngx6.pro/lib/libstdc++.so.6&lt;br /&gt;
  ln -s ./solver/420/unxlngx6.pro/lib/libstdc++.so.6.0.20 ./solver/420/unxlngx6.pro/lib/libstdc++.so.6&lt;br /&gt;
&lt;br /&gt;
* No such file or directory - connectivity/virtualdbtools.hxx while building svx.&lt;br /&gt;
&lt;br /&gt;
if you get an error like this, then that means connectivity is not built properly. Build connectivity using build --all:connectivity and this error will go away.&lt;br /&gt;
&lt;br /&gt;
=Ubuntu 12.04=&lt;br /&gt;
&lt;br /&gt;
*Setup VirtualBox with Ubuntu 12.04 64 bit on Windows7 64bit host.  A native installation is of course fine, too.&lt;br /&gt;
*Let updater update ca. 380 packages. Restart.&lt;br /&gt;
*Get the source.  You can start with the source release or by checking out from SVN:&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Source release&lt;br /&gt;
! SVN&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| Build from source release if you want to build OpenOffice once but don&amp;#039;t want to do any development.&lt;br /&gt;
| Build from SVN if you want to development work with OpenOffice.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| &lt;br /&gt;
* Download AOO 4.1.1 source tarball from&lt;br /&gt;
http://people.apache.org/~jsc/developer-snapshots/r1372282/src/aoo-4.1.1-incubating-src.tar.bz2&lt;br /&gt;
&lt;br /&gt;
* Optional: Download signature from&lt;br /&gt;
http://people.apache.org/~jsc/developer-snapshots/r1372282/src/aoo-4.1.1-incubating-src.tar.bz2.asc&lt;br /&gt;
&lt;br /&gt;
and verify the source tarball with&lt;br /&gt;
 gpg --verify aoo-4.1.1-incubating-src.tar.bz2.asc \&lt;br /&gt;
              aoo-4.1.1-incubating-src.tar.bz2&lt;br /&gt;
Note that you have to have the keys already imported to your key chain.&lt;br /&gt;
The keys can be found on the download page:&lt;br /&gt;
&lt;br /&gt;
http://www.apache.org/dist/incubator/ooo/KEYS&lt;br /&gt;
&lt;br /&gt;
* Unpack source:&lt;br /&gt;
  cd /tmp&lt;br /&gt;
  tar -xjf ~/Downloads/aoo-4.1.1-incubating-src.tar.bz2&lt;br /&gt;
  cd aoo-4.1.1/main&lt;br /&gt;
| &lt;br /&gt;
* Start with creating a parent directory for the source code.  Don&amp;#039;t use &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; because that is deleted on every boot:&lt;br /&gt;
  sudo mkdir /source&lt;br /&gt;
  sudo chown &amp;lt;your-user-name&amp;gt; /source&lt;br /&gt;
  cd /source&lt;br /&gt;
* Install subversion and checkout the source:&lt;br /&gt;
  sudo apt-get install subversion&lt;br /&gt;
  svn co https://svn.apache.org/repos/asf/openoffice/trunk aoo-trunk&lt;br /&gt;
  cd aoo-trunk/main&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Install requirements (this will also install packages that are not listed):&lt;br /&gt;
  sudo apt-get install g++ gcc bison flex libarchive-zip-perl libcups2-dev \&lt;br /&gt;
       libpam0g-dev gperf libfreetype6-dev libxaw7-dev libfontconfig1-dev \&lt;br /&gt;
       libxrandr-dev patch libgconf2-dev libgnomevfs2-dev ant libgtk2.0-dev \&lt;br /&gt;
       junit junit4 libidl-dev liborbit2-dev openjdk-6-jdk libwww-perl \&lt;br /&gt;
       libxml-parser-perl autoconf libssl-dev&lt;br /&gt;
&lt;br /&gt;
* Run autoconf to generate configure script:&lt;br /&gt;
  autoconf&lt;br /&gt;
&lt;br /&gt;
* Configure (see the building guide section on [[Documentation/Building_Guide_AOO#Configuration_and_bootstrapping|configuration]] for further options):&lt;br /&gt;
  ./configure \&lt;br /&gt;
      --with-dmake-url=http://dmake.apache-extras.org.codespot.com/files/dmake-4.12.tar.bz2 \&lt;br /&gt;
      --with-epm-url=http://www.msweet.org/files/project2/epm-3.7-source.tar.gz \&lt;br /&gt;
      --disable-odk \&lt;br /&gt;
      --disable-binfilter&lt;br /&gt;
&lt;br /&gt;
* Finish configuration and download missing tarballs and extensions:&lt;br /&gt;
  ./bootstrap&lt;br /&gt;
&lt;br /&gt;
* Include the configured environment:&lt;br /&gt;
  source LinuxX86-64Env.Set.sh&lt;br /&gt;
&lt;br /&gt;
* Build:&lt;br /&gt;
  cd instsetoo_native/&lt;br /&gt;
  build --all&lt;br /&gt;
This may take a while to complete.  Several hours are not uncommon.  To speed things up you may want to run &amp;#039;build&amp;#039; like this&lt;br /&gt;
  build --all -P&amp;lt;n&amp;gt; -- -P&amp;lt;n&amp;gt;&lt;br /&gt;
to start a parallel build.  Replace &amp;lt;n&amp;gt; with the number of CPU cores. &lt;br /&gt;
&lt;br /&gt;
* Install:&lt;br /&gt;
  sudo dpkg -i unxlngx6.pro/Apache_OpenOffice/deb/install/en-US/DEBS/*.deb&lt;br /&gt;
  sudo dpkg -i unxlngx6.pro/Apache_OpenOffice/deb/install/en-US/DEBS/desktop-integration/openoffice.org4.1-debian-menus_4.1-9593_all.deb&lt;br /&gt;
&lt;br /&gt;
* Start Apache OpenOffice:&lt;br /&gt;
  /opt/openoffice.org3/program/soffice&lt;br /&gt;
&lt;br /&gt;
=Windows 7=&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Complete requirements found at [http://wiki.openoffice.org/wiki/Documentation/Building_Guide_AOO#General_Build_Requirements General Build Requirements] and [http://wiki.openoffice.org/wiki/Documentation/Building_Guide_AOO/Building_on_Windows Building on Windows].&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This is a &amp;#039;&amp;#039;&amp;#039;sample&amp;#039;&amp;#039;&amp;#039; step-by-step guide - check the complete requirements and report on dev@openoffice.apache.org, if problems with this step-by-step guide occurs.&lt;br /&gt;
&lt;br /&gt;
*Install cygwin, &amp;#039;&amp;#039;&amp;#039;32bit version&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
**Browse to http://cygwin.com.&lt;br /&gt;
**Click on the setup.exe link (most recent Cygwin DLL at the moment is 1.7.16-1) to download the installer and run it.&lt;br /&gt;
**Click through the questions.&lt;br /&gt;
**On the &amp;quot;Choose A Download Site&amp;quot; select a nearby download server.&lt;br /&gt;
**Expect a &amp;quot;Setup Alert&amp;quot; dialog box on the first cygwin install on the computer.&lt;br /&gt;
**Click OK to close it.&lt;br /&gt;
**On the page that allows you to select additional packages just select wget (enter wget in the Search box and select the wget enty in the Web/Default section.&lt;br /&gt;
**Click Next to finish package selection.&lt;br /&gt;
**Click Next to resolve dependencies.&lt;br /&gt;
**After installation is finished click the Finish button to close the dialog. &lt;br /&gt;
&lt;br /&gt;
*Start cygwin bash in a terminal&lt;br /&gt;
::One way to do this is:&lt;br /&gt;
::*Press WindowsKey-R&lt;br /&gt;
::*Enter c:\cygwin\Cygwin.bat&lt;br /&gt;
::*Hit Return.&lt;br /&gt;
&lt;br /&gt;
* Install Java.&lt;br /&gt;
::Choose between JDK 1.7 or OpenJDK.&lt;br /&gt;
&lt;br /&gt;
* Install Ant&lt;br /&gt;
**Browse to http://ant.apache.org/bindownload.cgi&lt;br /&gt;
**Chose a mirror near you.&lt;br /&gt;
**Download the zip archive (currently that is apache-ant-1.8.4-bin.zip).&lt;br /&gt;
**Open downloaded archive in file explorer and unzip it to a location of your choice, eg &amp;lt;code&amp;gt;c:\&amp;lt;/code&amp;gt;.  Note that &amp;lt;code&amp;gt;C:\Program Files (x86)&amp;lt;/code&amp;gt; will not work due to problems of quoting the spaces and parentheses.&lt;br /&gt;
  &lt;br /&gt;
* Prepare to install missing cygwin packages by installing apt-cyg from googlecode.com&amp;lt;pre&amp;gt;cd to /cygdrive/c/temp&amp;lt;/pre&amp;gt;(or any other temporary directory of your choice)&amp;lt;pre&amp;gt;wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg&amp;amp;#10;chmod +x apt-cyg&amp;amp;#10;mv apt-cyg /usr/local/bin/&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Use apt-cyg to install missing cygwin packages&amp;lt;pre&amp;gt;apt-cyg install perl zip unzip gperf autoconf rsync gcc4-g++ bison flex patch subversion&amp;lt;/pre&amp;gt;or alternatively run setup and select the packages&amp;lt;br /&amp;gt;If you will use git, you need in addition the packages&amp;lt;pre&amp;gt;git git-svn&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Replace symlinked awk with copy of gawk.exe:&amp;lt;pre&amp;gt;rm /usr/bin/awk&amp;amp;#10;mv /usr/bin/gawk.exe /usr/bin/awk.exe&amp;lt;/pre&amp;gt;Note that if the &amp;lt;code&amp;gt;rm&amp;lt;/code&amp;gt; command fails then the &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; is not necessary.&lt;br /&gt;
    &lt;br /&gt;
* Install Microsoft Windows SDK for Windows 7 and .NET Framework 3.5. SP1 (recommend by Microsoft) &lt;br /&gt;
** Browse to http://www.microsoft.com/en-us/download/details.aspx?id=3138.&lt;br /&gt;
** Download Setup.exe and run the web installer (note that it will be saved as Setup(1).exe to disambiguate from the previously downloaded cygwin installer.)  You can use the default values in the installation dialog.&lt;br /&gt;
** Alternatively download the iso image http://www.microsoft.com/en-us/download/details.aspx?id=18950. Burn it to a dvd or unzip it.&lt;br /&gt;
&lt;br /&gt;
* Download MS Visual C++ 2008 SP1 Redistributable Package (x86)&lt;br /&gt;
** http://www.microsoft.com/en-us/download/details.aspx?id=26368 ( There have been security updates, which are not included in older versions.)&lt;br /&gt;
**Download files vcredist_x86.exe and vcrestist_x64.exe&amp;lt;br /&amp;gt;  If you download the most actual version of Apache OpenOffice and unpack it, you will find the files vcredist_x86.exe and vcredist_x64.exe in folder redist. You can use them as well.&lt;br /&gt;
&lt;br /&gt;
* Optional: Install DirectX SDK (for graphics hardware support in the slide show)&lt;br /&gt;
** Browse to http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;amp;id=6812&lt;br /&gt;
** Download and run DXSDK_Jun10.exe&lt;br /&gt;
&lt;br /&gt;
* Optional: Install NSIS installer (for creating the EXE installer)&lt;br /&gt;
** Browse to http://nsis.sourceforge.net&lt;br /&gt;
** Download and run the installer.&lt;br /&gt;
&lt;br /&gt;
* Get AOO source code. You can use the source release or check out from SVN. Build from source release if you want to build OpenOffice once but don&amp;#039;t want to contribute patches. If you will contribute patches, you need to generate them against an actual version of trunk. In this case check out from SVN to be able to rebase before generating patches. You can work with subversion or with git-svn.&lt;br /&gt;
&lt;br /&gt;
::; Source release : &lt;br /&gt;
::* Browse to http://www.openoffice.org/download/other.html#tested-sdk and locate the table row that starts with &amp;quot;Source code&amp;quot;&lt;br /&gt;
::* Download source code in an archive format of your choice (note that tar.bz2 is typically smaller than tar.gz and zip)&lt;br /&gt;
::* Optional: Verify the archive - following given link or instructions.&lt;br /&gt;
::* Unpack source (in cygwin-terminal). Use the file name exactly as downloaded.&amp;lt;pre&amp;gt;cd /tmp&amp;amp;#10;tar -xjf &amp;lt;download-location&amp;gt;/&amp;lt;downloaded-source-release.tar.bz2&amp;gt;&amp;amp;#10;cd &amp;lt;unpacked-source&amp;gt;/main&amp;amp;#10;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::; Checkout from SVN using subversion :&lt;br /&gt;
::*Get subversion (only first time)&amp;lt;pre&amp;gt;apt-cyg install subversion&amp;lt;/pre&amp;gt; &lt;br /&gt;
::*Start with creating a parent directory for the source code: &amp;lt;pre&amp;gt;mkdir /cygdrive/c/source&amp;amp;#10;cd /cygdrive/c/source&amp;lt;/pre&amp;gt;&lt;br /&gt;
::*Check out source from Apache SVN repository&amp;lt;pre&amp;gt;svn co https://svn.apache.org/repos/asf/openoffice/trunk aoo-trunk&amp;amp;#10;cd aoo-trunk/main&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::; Checkout from SVN using git-svn :&lt;br /&gt;
::*Get git and git-svn (only first time)&amp;lt;pre&amp;gt;apt-cyg install git git-svn&amp;lt;/pre&amp;gt;&lt;br /&gt;
::*Get the actual revision number from http://svn.apache.org/viewvc/OpenOffice/trunk/, e.g. 1234567&lt;br /&gt;
::*Create an empty directory and change to it, e.g.&amp;lt;pre&amp;gt;mkdir /cygdrive/c/source&amp;amp;#10;cd /cygdrive/c/source&amp;lt;/pre&amp;gt;&lt;br /&gt;
::*Check out source from Apache SVN repository&amp;lt;pre&amp;gt;git svn clone --revision 1234567:HEAD https://svn.apache.org/repos/asf/openoffice/trunk&amp;amp;#10;cd trunk/main&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Remember the source path (this is optional, it keeps the following lines short):&amp;lt;pre&amp;gt;SourceMain=`pwd`&amp;lt;/pre&amp;gt; [Why? I have not used it. [[User:Regina|Regina]] ([[User talk:Regina|talk]]) 21:42, 24 February 2013 (UTC)]&lt;br /&gt;
:[Added explanation above [[User:Andre|Andre]]]&lt;br /&gt;
&lt;br /&gt;
* Optional: Get dbghelp.dll (for using the &amp;lt;code&amp;gt;--enable-dbgutil&amp;lt;/code&amp;gt; configure option)&lt;br /&gt;
** This dll is part of MS Visual Studio.&lt;br /&gt;
** Copy file to &amp;lt;code&amp;gt;main/external/dbghelp&amp;lt;/code&amp;gt;. Use Windows file manager or in cygwin terminal&amp;lt;pre&amp;gt;cp /cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 9.0/Common7/IDE/dbghelp.dll $SourceMain/external/dbghelp&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Copy vcredist_x86.exe and vcredist_x64.exe (see above) to main/external/vcredist.&lt;br /&gt;
** Use Windows file manager or in cygwin terminal&amp;lt;pre&amp;gt;cp &amp;lt;download-location&amp;gt;/vcredist_x86.exe $SourceMain/external/vcredist&amp;amp;#10;cp &amp;lt;download-location&amp;gt;/vcredist_x64.exe $SourceMain/external/vcredist&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Get GDI+ redistributable.&lt;br /&gt;
**Browse to http://www.microsoft.com/en-us/download/details.aspx?id=18909&lt;br /&gt;
**Download WindowsXP-KB975337-x86-ENU.exe&lt;br /&gt;
**Run WindowsXP-KB975337-x86-ENU.exe&lt;br /&gt;
**Enter a temporary path (eg c:\temp\gdiplus) in the dialog and click OK to extract files&lt;br /&gt;
**Copy gdiplus.dll to main/external&amp;lt;pre&amp;gt;cp /cygdrive/c/temp/gdiplus/asms/10/msft/windows/gdiplus/gdiplus.dll $SourceMain/external/gdiplus/&amp;lt;/pre&amp;gt;&lt;br /&gt;
** Remove the temporary path&amp;lt;pre&amp;gt;rm -fr /cygdrive/c/temp/gdiplus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Get msvcr100.dll:&amp;lt;pre&amp;gt;cp /cygdrive/c/Windows/System32/msvcr100.dll $SourceMain/external/msvcp100&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Make sure that you are in the main source directory:&amp;lt;pre&amp;gt;cd $SourceMain&amp;lt;/pre&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
* Run autoconf to create the configure script:&amp;lt;pre&amp;gt;autoconf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Call configure&lt;br /&gt;
** Run configure (adapt paths as necessary)&amp;lt;pre&amp;gt;SDK_PATH=&amp;quot;/cygdrive/c/Program Files/Microsoft SDKs/Windows/v7.0&amp;quot;&amp;amp;#10;./configure \&amp;amp;#10;    --with-frame-home=&amp;quot;$SDK_PATH&amp;quot; \&amp;amp;#10;    --with-psdk-home=&amp;quot;$SDK_PATH&amp;quot; \&amp;amp;#10;    --with-midl-path=&amp;quot;$SDK_PATH/bin&amp;quot; \&amp;amp;#10;    --with-directx-home=&amp;quot;C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)&amp;quot; \&amp;amp;#10;    --with-ant-home=&amp;quot;/cygdrive/c/apache-ant-1.8.4&amp;quot; \&amp;amp;#10;    --with-dmake-url=&amp;quot;http://dmake.apache-extras.org.codespot.com/files/dmake-4.12.tar.bz2&amp;quot; \&amp;amp;#10;    --with-epm-url=&amp;quot;http://www.msweet.org/files/project2/epm-3.7-source.tar.gz&amp;quot; \&amp;amp;#10;    --enable-pch \&amp;amp;#10;    --disable-atl \&amp;amp;#10;    --disable-activex \&amp;amp;#10;    --without-junit&amp;lt;/pre&amp;gt;If you have not installed the optional DirectX SDK then remove the &amp;lt;code&amp;gt;--with-directx-home switch&amp;lt;/code&amp;gt;&lt;br /&gt;
*Finish configuration and download missing external source tarballs and extensions&amp;lt;pre&amp;gt;./bootstrap&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Include the configured environment&amp;lt;pre&amp;gt;source winenv.set.sh&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Build&amp;lt;pre&amp;gt;cd instsetoo_native/&amp;amp;#10;build --all&amp;lt;/pre&amp;gt;Depending on your computer this will take one or more hours to finish.&lt;br /&gt;
&lt;br /&gt;
* Install&amp;lt;br/&amp;gt;There are three options:&lt;br /&gt;
*# Regular install with integration into Windows.&amp;lt;br/&amp;gt;This allows only one instance of AOO to be installed.&lt;br /&gt;
*#* Start setup.exe and click through dialog:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;$SourceMain/instsetoo_native/wntmsci12.pro/OpenOffice/msi/install/en-US/setup.exe&amp;lt;/pre&amp;gt;&lt;br /&gt;
*#* Apache OpenOffice can be started via the Windows start menu.&lt;br /&gt;
*# Install without integration into Windows.&amp;lt;br/&amp;gt;This allows several instance of AOO, based on the same version, to be installed side by side.&amp;lt;br/&amp;gt;It still requires Administrator permissions.&lt;br /&gt;
*#* Start &amp;lt;code&amp;gt;setup.exe&amp;lt;/code&amp;gt; with option &amp;lt;code&amp;gt;-a&amp;lt;/code&amp;gt;:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;$SourceMain/instsetoo_native/wntmsci12.pro/OpenOffice/msi/install/en-US/setup.exe -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
*#* Enter an installation path into the dialog and click through the dialog to finish installation.&lt;br /&gt;
*#* Start AOO by running&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;&amp;lt;installation-path&amp;gt;/program/soffice.exe&amp;lt;/pre&amp;gt;&lt;br /&gt;
*# Unpack archive without installation.&amp;lt;br/&amp;gt;This does not require Administrator permissions&lt;br /&gt;
*#* Go to installation directory:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;cd &amp;lt;installation-target&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
*#* Unzip archive:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;unzip $SourceMain/instsetoo_native/wntmsci12.pro/OpenOffice/archive/install/en-US/Apache_OpenOffice_4.0.1_Win_x86_install-arc_en-US.zip&amp;lt;/pre&amp;gt;&lt;br /&gt;
*#* Start AOO by running:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;./Apache_OpenOffice_4.0.1_Win_x86_install-arc_en-US/program/soffice.exe&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=[https://wiki.openoffice.org/wiki/Documentation/Building_Guide/Building_on_MacOSX Mac OS/X]=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]][[Category:Development]][[Category:Porting]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=CellCustomAtributes&amp;diff=235924</id>
		<title>CellCustomAtributes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=CellCustomAtributes&amp;diff=235924"/>
		<updated>2015-02-18T03:00:20Z</updated>

		<summary type="html">&lt;p&gt;JZA: Python modules&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I created a spreadsheet with a user defined attribute like this.... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; import Danny.OOo.OOoLib &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from Danny.OOo.OOoLib import * &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oCell = oSheet.getCellByPosition( 2, 5 ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes = oShape.UserDefinedAttributes &lt;br /&gt;
&lt;br /&gt;
Traceback (most recent call last): &lt;br /&gt;
  File &amp;quot;&amp;lt;pyshell#5&amp;gt;&amp;quot;, line 1, in -toplevel- &lt;br /&gt;
    oUserDefinedAttributes = oShape.UserDefinedAttributes &lt;br /&gt;
NameError: name &amp;#039;oShape&amp;#039; is not defined &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes = oCell.UserDefinedAttributes &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes.hasByName( &amp;quot;MeowMix&amp;quot; ) &lt;br /&gt;
False &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oMyAttribute = createUnoStruct( &amp;quot;com.sun.star.xml.AttributeData&amp;quot; ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oMyAttribute.Type = &amp;quot;CDATA&amp;quot; &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oMyAttribute.Value = &amp;quot;Giddy Gat&amp;quot; &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes.insertByName( &amp;quot;MeowMix&amp;quot;, oMyAttribute ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oCell.UserDefinedAttributes = oUserDefinedAttributes &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oDoc.storeToURL( convertToURL( &amp;quot;C:\\Documents and Settings\\dbrewer\\Desktop\Test.sxc&amp;quot; ), Array() ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oDoc.close( True ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please note that it is IMPORTANT to store the collection of user attributes back to the property like so.... &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;oCell.UserDefinedAttributes = oUserDefinedAttributes&amp;lt;/source&amp;gt;&lt;br /&gt;
in the example above. &lt;br /&gt;
&lt;br /&gt;
Then, using a new python session, I reloaded the document and verified that it had my custom attribute.... &amp;lt;source lang=python&amp;gt;&amp;gt;&amp;gt;&amp;gt; from Danny.OOo.OOoLib import * &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oDoc = StarDesktop.loadComponentFromURL( convertToURL( &amp;quot;C:\\Documents and Settings\\dbrewer\\Desktop\Test.sxc&amp;quot; ), &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oCell = oSheet.getCellByPosition( 2, 5 ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes = oCell.UserDefinedAttributes &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes.hasByName( &amp;quot;MeowMix&amp;quot; ) &lt;br /&gt;
True &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oMyAttribute = oUserDefinedAttributes.getByName( &amp;quot;MeowMix&amp;quot; ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oMyAttribute.Value &lt;br /&gt;
u&amp;#039;Giddy Gat&amp;#039; &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oDoc.close( True ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=CellCustomAtributes&amp;diff=235923</id>
		<title>CellCustomAtributes</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=CellCustomAtributes&amp;diff=235923"/>
		<updated>2015-02-18T02:59:24Z</updated>

		<summary type="html">&lt;p&gt;JZA: Python modules&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I created a spreadsheet with a user defined attribute like this.... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; import Danny.OOo.OOoLib &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; from Danny.OOo.OOoLib import * &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oCell = oSheet.getCellByPosition( 2, 5 ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes = oShape.UserDefinedAttributes &lt;br /&gt;
&lt;br /&gt;
Traceback (most recent call last): &lt;br /&gt;
  File &amp;quot;&amp;lt;pyshell#5&amp;gt;&amp;quot;, line 1, in -toplevel- &lt;br /&gt;
    oUserDefinedAttributes = oShape.UserDefinedAttributes &lt;br /&gt;
NameError: name &amp;#039;oShape&amp;#039; is not defined &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes = oCell.UserDefinedAttributes &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes.hasByName( &amp;quot;MeowMix&amp;quot; ) &lt;br /&gt;
False &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oMyAttribute = createUnoStruct( &amp;quot;com.sun.star.xml.AttributeData&amp;quot; ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oMyAttribute.Type = &amp;quot;CDATA&amp;quot; &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oMyAttribute.Value = &amp;quot;Giddy Gat&amp;quot; &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes.insertByName( &amp;quot;MeowMix&amp;quot;, oMyAttribute ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oCell.UserDefinedAttributes = oUserDefinedAttributes &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oDoc.storeToURL( convertToURL( &amp;quot;C:\\Documents and Settings\\dbrewer\\Desktop\Test.sxc&amp;quot; ), Array() ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oDoc.close( True ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please note that it is IMPORTANT to store the collection of user attributes back to the property like so.... &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;oCell.UserDefinedAttributes = oUserDefinedAttributes&amp;lt;/source&amp;gt;&lt;br /&gt;
in the example above. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, using a new python session, I reloaded the document and verified that it had my custom attribute.... &amp;lt;source lang=python&amp;gt;&amp;gt;&amp;gt;&amp;gt; from Danny.OOo.OOoLib import * &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oDoc = StarDesktop.loadComponentFromURL( convertToURL( &amp;quot;C:\\Documents and Settings\\dbrewer\\Desktop\Test.sxc&amp;quot; ), &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oCell = oSheet.getCellByPosition( 2, 5 ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes = oCell.UserDefinedAttributes &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oUserDefinedAttributes.hasByName( &amp;quot;MeowMix&amp;quot; ) &lt;br /&gt;
True &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oMyAttribute = oUserDefinedAttributes.getByName( &amp;quot;MeowMix&amp;quot; ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oMyAttribute.Value &lt;br /&gt;
u&amp;#039;Giddy Gat&amp;#039; &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; oDoc.close( True ) &lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Python&amp;diff=235922</id>
		<title>Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Python&amp;diff=235922"/>
		<updated>2015-02-18T02:55:58Z</updated>

		<summary type="html">&lt;p&gt;JZA: /* Hacking Around */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Extensions}}&lt;br /&gt;
[[image:Py-uno_128.png|PyUNO Logo]] [[image:Pyuno_logo_a.jpg]] &lt;br /&gt;
&lt;br /&gt;
=== Python and OpenOffice ===&lt;br /&gt;
Apache OpenOffice 4 ships with the Python scripting language, version 2.7. OpenOffice.org 3.1 and above shipped with Python version 2.6.1 and older OpenOffice.org releases shipped with Python version 2.3.4. This Python distribution via OpenOffice comes with the [[Uno]] module, which connects the [[API|UNO API]] to the python scripting language.  To run this version of Python on Linux, you can go directly to the OpenOffice PATH.  And as one would expect with any distribution of Python, AOO-Python can be run from the command line as well.&lt;br /&gt;
&lt;br /&gt;
If you already have a separate Python installation, you can import the uno module (the Python-UNO bridge) to it using [http://forum.openoffice.org/en/forum/viewtopic.php?f=45&amp;amp;t=36370&amp;amp;p=166783 these instructions].&lt;br /&gt;
&lt;br /&gt;
If you already have a different version of Python installed on Windows, you can also access the [[API|UNO API]] using the [http://forum.openoffice.org//en/forum/viewtopic.php?f=45&amp;amp;t=36608&amp;amp;p=167909 COM bridge] instead of the Python bridge. Requires the [http://sourceforge.net/projects/pywin32/ add-on pywin32] module so Python can talk to COM. Note that while the UNO API is uniform, the implementation by the two bridges is slightly different, so the syntax required by each is also sometimes different.&lt;br /&gt;
&lt;br /&gt;
==== Where is the IDE ? ====&lt;br /&gt;
OpenOffice&amp;#039;s IDE doesn&amp;#039;t support Python, so development has to be done from another editor that does.  Any volunteer for a binding is welcomed. Here is a nice [http://pythonconquerstheuniverse.wordpress.com/category/the-python-debugger/ blog post] about using [http://www.vim.org VIM] a common Unix/Linux text editor configured in a way that acts like an IDE. Windows users can use [http://www.vim.org/download.php#pc Gvim] and [http://macvim.org/ MacVim] for OSX users.&lt;br /&gt;
&lt;br /&gt;
==== Tips &amp;amp; Tricks ====&lt;br /&gt;
&lt;br /&gt;
Here is some useful information about using python in AOO.&lt;br /&gt;
&lt;br /&gt;
===== Debug output =====&lt;br /&gt;
&lt;br /&gt;
If you launch a python script, any error will silently break the execution, making your extension hard to debug.  To change this behaviour, one can change the&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;LogLevel&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
Have a look in &lt;br /&gt;
&amp;#039;&amp;#039;/path/to/aoo/program/&amp;#039;&amp;#039;&amp;#039;pythonscript.py&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
and replace &lt;br /&gt;
&amp;#039;&amp;#039;LogLevel.use = LogLevel.&amp;#039;&amp;#039;&amp;#039;NONE&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
with&lt;br /&gt;
&amp;#039;&amp;#039;LogLevel.use = LogLevel.&amp;#039;&amp;#039;&amp;#039;DEBUG&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
There are also currently-undocumented environment variables that tell the pyUno bridge to log every call.  Set the environment variable&lt;br /&gt;
&amp;#039;&amp;#039;export PYUNO_LOGLEVEL=ARGS&amp;#039;&amp;#039;&lt;br /&gt;
.  The output may be a little hard to read, but helpful nonetheless.&lt;br /&gt;
&lt;br /&gt;
Note that his applies only to Linux.  For Windows, you need some more switches, and the output gets written to files (there is no stdout on windows :-( ).&lt;br /&gt;
&lt;br /&gt;
There are still some error messages that won&amp;#039;t appear in these logs; this will improve in the near future (cws pyunofixes4).  Once the cws is integrated, I will document these switches on the official pyuno site. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Thanks to Joerg Budischewski&amp;#039;&amp;#039;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
=== Python specific information for Extension creation ===&lt;br /&gt;
To create extensions for python, it is important that you have enough familiarity with the UNO components, as well as with packaging your code for easy distribution through the &amp;#039;&amp;#039;OpenOffice package manager&amp;#039;&amp;#039;.  Please check the tutorials to learn how to component-ize your code, and how to deploy remote scripting through a service implementation.&lt;br /&gt;
&lt;br /&gt;
To learn to run Python on Windows, visit [[Using Python on Windows| this link]] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot; style=&amp;quot;border: 0px solid rgb(134, 194, 230);&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| style=&amp;quot;width: 35%; padding-right: 15px;&amp;quot; | &amp;lt;div style=&amp;quot;border-style: solid solid none; border-color: rgb(134, 194, 230) rgb(134, 194, 230) -moz-use-text-color; border-width: 1px 1px medium; padding: 5px; font-size: 120%; font-weight: bold; background-color: rgb(203, 222, 250);&amp;quot;&amp;gt;Getting Started&amp;lt;/div&amp;gt; &amp;lt;div style=&amp;quot;border: 1px solid rgb(155, 192, 245); padding: 5px 5px 10px;&amp;quot;&amp;gt;&lt;br /&gt;
*[[Python/Python_Language_Binding|Python Language Binding]]&lt;br /&gt;
*[[Python/Python_Loader|Python Loader]]&lt;br /&gt;
*[[Using Python on Windows]] - New to Python? Learn how to use python on Windows&lt;br /&gt;
*[[Using Python on Linux]] - A must read for an overview on Python and AOO relations&lt;br /&gt;
* [[pyUNO bridge]] - Official page of the PyUNO bridge at the [http://udk.openoffice.org/ UDK site] - ([http://www.fatcow.com/edu/mathtex-be/ &amp;#039;&amp;#039;Belorussian translation&amp;#039;&amp;#039;])&lt;br /&gt;
* [[Python as a macro language]] in OpenOffice.org 2.x - How to use the Python scripting framework&lt;br /&gt;
* [[Python/Transfer_from_Basic_to_Python|Transfer from Basic to Python]]&lt;br /&gt;
* [http://lucasmanual.com/mywiki/OpenOffice PyUNO Manual] Lukasz created a pyUNO manual. &amp;#039;&amp;#039;&amp;#039;new&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* [[SQLAlquemyPyUNO|SQLAlchemy and PyUNO]] connecting OpenOffice to any database&lt;br /&gt;
* [http://www.linuxjournal.com/content/starting-stopping-and-connecting-openoffice-python Starting/Stopping and connecting using Python] From Linux Journal&lt;br /&gt;
* Introduction on testing pyUNO programs with [[doctests]]&lt;br /&gt;
* Create a [[PythonDialogBox|dialog box]] in PyUNO.&lt;br /&gt;
* [http://codesnippets.services.openoffice.org/Office/Office.ConnectViaPipe.snip Connect to Openoffice] from PyUNO&lt;br /&gt;
* [[PyUNO samples]] currently shipping with OpenOffice.org and the explanation.&lt;br /&gt;
* Enhanced [http://www.oooforum.org/forum/viewtopic.phtml?p=257496#257496 Capitalized.py] script by &amp;#039;&amp;#039;The gray Cardinal&amp;#039;&amp;#039; at the OpenOffice forum.&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;width: 35%; padding-right: 15px;&amp;quot; | &amp;lt;div style=&amp;quot;border-style: solid solid none; border-color: rgb(134, 194, 230) rgb(134, 194, 230) -moz-use-text-color; border-width: 1px 1px medium; padding: 5px; font-size: 120%; font-weight: bold; background-color: rgb(203, 222, 250);&amp;quot;&amp;gt;PYUNO Modules&amp;lt;/div&amp;gt; &amp;lt;div style=&amp;quot;border: 1px solid rgb(155, 192, 245); padding: 5px 5px 10px;&amp;quot;&amp;gt;&lt;br /&gt;
*[[Danny&amp;#039;s Python Modules]] - Collection guide from DannyB&amp;#039;s modules.&lt;br /&gt;
*[[PrinttoWriter.py]] - This makes it easy and convenient to print a bunch of text into a Writer document.&lt;br /&gt;
*[[CalcFunctions]] - Learn how Python can be used to develop Calc functions in Python&lt;br /&gt;
*[[Python-Calc]] - Various scripts to deal with Calc&lt;br /&gt;
*[[PythonContainers]] - Python container components&lt;br /&gt;
*[[PyUNOServer]] - The PyUNOServer is a script that works as an XML server for OpenOffice.org Calc&lt;br /&gt;
*[[calcParser]] - calcParser is a small parser using the native SAX utilities within the OpenOffice.org python&lt;br /&gt;
*[[OoConfig]] - OoConfig is a Python extension that seeks to provide a configuration editing facility similar to Mozilla&amp;#039;s about:config&lt;br /&gt;
*[[Bibliographic/Hints and Tips/OOoRISExport.py|OOoRISExport.py]] - Exports the bibliographic database in RIS format. Also [http://bibliographic.openoffice.org/files/documents/124/3078/RISImport.py RISImport.py]&lt;br /&gt;
*[[Zotero_Plugin |Zotero Plugin]] - The Zotero plugin provides citation and bibliographic table insertion and editing functions for Writer documents.&lt;br /&gt;
*[http://oosheet.hacklab.com.br/ OOSheet] - High level python library to develop spreadsheet macros without the complexity of Uno. Focuses on spreadsheets, but may be useful for other documents.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Hacking Around ===&lt;br /&gt;
*[[UNO component packaging]] - How to create UNO components as well as the basics of script componentizing&lt;br /&gt;
*[http://www.oooforum.org/forum/viewtopic.phtml?p=38234#38234 Python component to parse XML] - Python is great to parse XML, PyUNO is also excellent when working with XML&lt;br /&gt;
*[[Example of Service in Python]] - Learn how to run Python as a service, this is useful for remote scripting.&lt;br /&gt;
*[[CellCustomAtributes]] - Example of storing and retrieving a custom attribute on a spreadsheet cell.&lt;br /&gt;
*A simple [[daemon in Python]] - Learn how to run Python as a daemon&lt;br /&gt;
*[[Loook.py]] - a simple Python tool that searches for text strings in OpenOffice.org.&lt;br /&gt;
*[[odt2txt.py]] - convert ODF to plain text using python (and convert the txt to html).&lt;br /&gt;
&lt;br /&gt;
=== Python rules OpenOffice (by B. Bois) ===&lt;br /&gt;
[[image:python_power_for_OOo.png|Python rules OpenOffice :-)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.OOoLib.py&amp;diff=235921</id>
		<title>Danny.OOo.OOoLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.OOoLib.py&amp;diff=235921"/>
		<updated>2015-02-17T20:05:36Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding bold strings.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module makes programming OOo in Python much more like programming OOo in Basic. It also contains some frequently used functions that I typically write in Basic, such as &amp;#039;&amp;#039;&amp;#039;makePropertyValue()&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
When I write Components in Python, the first function in this module, the &amp;#039;&amp;#039;&amp;#039;getServiceManager()&amp;#039;&amp;#039;&amp;#039; function is replaced by a completely different implementation. Otherwise, even in a component, the features of this module are available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.OOoLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-07-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
import string &lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Uno ServiceManager access &lt;br /&gt;
#   A different version of this routine and global variable &lt;br /&gt;
#    is needed for code running inside a component. &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The ServiceManager of the running OOo. &lt;br /&gt;
# It is cached in a global variable. &lt;br /&gt;
goServiceManager = False &lt;br /&gt;
def getServiceManager( cHost=&amp;quot;localhost&amp;quot;, cPort=&amp;quot;8100&amp;quot; ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Get the ServiceManager from the running OpenOffice.org. &lt;br /&gt;
        Then retain it in the global variable goServiceManager for future use. &lt;br /&gt;
        This is similar to the GetProcessServiceManager() in OOo Basic. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    global goServiceManager &lt;br /&gt;
    if not goServiceManager: &lt;br /&gt;
        # Get the uno component context from the PyUNO runtime &lt;br /&gt;
        oLocalContext = uno.getComponentContext() &lt;br /&gt;
        # Create the UnoUrlResolver on the Python side. &lt;br /&gt;
        oLocalResolver = oLocalContext.ServiceManager.createInstanceWithContext( &lt;br /&gt;
                                    &amp;quot;com.sun.star.bridge.UnoUrlResolver&amp;quot;, oLocalContext ) &lt;br /&gt;
        # Connect to the running OpenOffice.org and get its context. &lt;br /&gt;
        oContext = oLocalResolver.resolve( &amp;quot;uno:socket,host=&amp;quot; + cHost + &amp;quot;,port=&amp;quot; + cPort + &amp;quot;;urp;StarOffice.ComponentContext&amp;quot; ) &lt;br /&gt;
        # Get the ServiceManager object &lt;br /&gt;
        goServiceManager = oContext.ServiceManager &lt;br /&gt;
    return goServiceManager &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Uno convenience functions &lt;br /&gt;
#   The stuff in this section is just to make &lt;br /&gt;
#    python progrmaming of OOo more like using OOo Basic. &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This is the same as ServiceManager.createInstance( ... ) &lt;br /&gt;
def createUnoService( cClass ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;A handy way to create a global objects within the running OOo. &lt;br /&gt;
    Similar to the function of the same name in OOo Basic. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oServiceManager = getServiceManager() &lt;br /&gt;
    oObj = oServiceManager.createInstance( cClass ) &lt;br /&gt;
    return oObj &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The StarDesktop object.  (global like in OOo Basic) &lt;br /&gt;
# It is cached in a global variable. &lt;br /&gt;
StarDesktop = None &lt;br /&gt;
def getDesktop(): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;An easy way to obtain the Desktop object from a running OOo. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    global StarDesktop &lt;br /&gt;
    if StarDesktop == None: &lt;br /&gt;
        StarDesktop = createUnoService( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ) &lt;br /&gt;
    return StarDesktop &lt;br /&gt;
# preload the StarDesktop variable. &lt;br /&gt;
getDesktop() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The CoreReflection object. &lt;br /&gt;
# It is cached in a global variable. &lt;br /&gt;
goCoreReflection = False &lt;br /&gt;
def getCoreReflection(): &lt;br /&gt;
    global goCoreReflection &lt;br /&gt;
    if not goCoreReflection: &lt;br /&gt;
        goCoreReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; ) &lt;br /&gt;
    return goCoreReflection &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def createUnoStruct( cTypeName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a UNO struct and return it. &lt;br /&gt;
    Similar to the function of the same name in OOo Basic. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oCoreReflection = getCoreReflection() &lt;br /&gt;
    # Get the IDL class for the type name &lt;br /&gt;
    oXIdlClass = oCoreReflection.forName( cTypeName ) &lt;br /&gt;
    # Create the struct. &lt;br /&gt;
    oReturnValue, oStruct = oXIdlClass.createObject( None ) &lt;br /&gt;
    return oStruct &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#def newConnectionToOOo( cHost=&amp;quot;localhost&amp;quot;, cPort=&amp;quot;8100&amp;quot; ): &lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;Call this to establish, or re-establish a connection to OOo.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
#    global goServiceManager &lt;br /&gt;
#    global StarDesktop &lt;br /&gt;
#    global goCoreReflection &lt;br /&gt;
#    goServiceManager = False &lt;br /&gt;
#    StarDesktop = None &lt;br /&gt;
#    goCoreReflection = False &lt;br /&gt;
#    getServiceManager( cHost, cPort ) &lt;br /&gt;
#    getDesktop() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   API helpers &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
def hasUnoInterface( oObject, cInterfaceName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Similar to Basic&amp;#039;s HasUnoInterfaces() function, but singular not plural.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # Get the Introspection service. &lt;br /&gt;
    oIntrospection = createUnoService( &amp;quot;com.sun.star.beans.Introspection&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Now inspect the object to learn about it.    &lt;br /&gt;
    oObjInfo = oIntrospection.inspect( oObject ) &lt;br /&gt;
    &lt;br /&gt;
    # Obtain an array describing all methods of the object. &lt;br /&gt;
    oMethods = oObjInfo.getMethods( uno.getConstantByName( &amp;quot;com.sun.star.beans.MethodConcept.ALL&amp;quot; ) ) &lt;br /&gt;
    # Now look at every method. &lt;br /&gt;
    for oMethod in oMethods: &lt;br /&gt;
        # Check the method&amp;#039;s interface to see if &lt;br /&gt;
        #  these aren&amp;#039;t the droids you&amp;#039;re looking for. &lt;br /&gt;
        cMethodInterfaceName = oMethod.getDeclaringClass().getName() &lt;br /&gt;
        if cMethodInterfaceName == cInterfaceName: &lt;br /&gt;
            return True &lt;br /&gt;
    return False &lt;br /&gt;
&lt;br /&gt;
def hasUnoInterfaces( oObject, *cInterfaces ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Similar to the function of the same name in OOo Basic.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    for cInterface in cInterfaces: &lt;br /&gt;
        if not hasUnoInterface( oObject, cInterface ): &lt;br /&gt;
            return False &lt;br /&gt;
    return True &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   High level general purpose functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makePropertyValue( cName=None, uValue=None, nHandle=None, nState=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.beans.PropertyValue struct and return it. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oPropertyValue = createUnoStruct( &amp;quot;com.sun.star.beans.PropertyValue&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    if cName != None: &lt;br /&gt;
        oPropertyValue.Name = cName &lt;br /&gt;
    if uValue != None: &lt;br /&gt;
        oPropertyValue.Value = uValue &lt;br /&gt;
    if nHandle != None: &lt;br /&gt;
        oPropertyValue.Handle = nHandle &lt;br /&gt;
    if nState != None: &lt;br /&gt;
        oPropertyValue.State = nState &lt;br /&gt;
&lt;br /&gt;
    return oPropertyValue &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makePoint( nX, nY ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.awt.Point struct.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oPoint = createUnoStruct( &amp;quot;com.sun.star.awt.Point&amp;quot; ) &lt;br /&gt;
    oPoint.X = nX &lt;br /&gt;
    oPoint.Y = nY &lt;br /&gt;
    return oPoint &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeSize( nWidth, nHeight ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.awt.Size struct.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oSize = createUnoStruct( &amp;quot;com.sun.star.awt.Size&amp;quot; ) &lt;br /&gt;
    oSize.Width = nWidth &lt;br /&gt;
    oSize.Height = nHeight &lt;br /&gt;
    return oSize &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeRectangle( nX, nY, nWidth, nHeight ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.awt.Rectangle struct.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oRect = createUnoStruct( &amp;quot;com.sun.star.awt.Rectangle&amp;quot; ) &lt;br /&gt;
    oRect.X = nX &lt;br /&gt;
    oRect.Y = nY &lt;br /&gt;
    oRect.Width = nWidth &lt;br /&gt;
    oRect.Height = nHeight &lt;br /&gt;
    return oRect &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def Array( *args ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;This is just sugar coating so that code from OOoBasic which &lt;br /&gt;
    contains the Array() function can work perfectly in python.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    tArray = () &lt;br /&gt;
    for arg in args: &lt;br /&gt;
        tArray += (arg,) &lt;br /&gt;
    return tArray &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def loadComponentFromURL( cUrl, tProperties=() ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Open or Create a document from it&amp;#039;s URL. &lt;br /&gt;
    New documents are created from URL&amp;#039;s such as: &lt;br /&gt;
        private:factory/sdraw &lt;br /&gt;
        private:factory/swriter &lt;br /&gt;
        private:factory/scalc &lt;br /&gt;
        private:factory/simpress &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    StarDesktop = getDesktop() &lt;br /&gt;
    oDocument = StarDesktop.loadComponentFromURL( cUrl, &amp;quot;_blank&amp;quot;, 0, tProperties ) &lt;br /&gt;
    return oDocument &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#def makeWriterDocument(): &lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;Create a new OOo Writer document.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
#    return loadComponentFromURL( &amp;quot;private:factory/swriter&amp;quot; ) &lt;br /&gt;
# &lt;br /&gt;
# &lt;br /&gt;
#def makeCalcDocument(): &lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;Create a new OOo Calc document.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
#    return loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Styles &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def defineStyle( oDrawDoc, cStyleFamily, cStyleName, cParentStyleName=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Add a new style to the style catalog if it is not already present. &lt;br /&gt;
    This returns the style object so that you can alter its properties. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    oStyleFamily = oDrawDoc.getStyleFamilies().getByName( cStyleFamily ) &lt;br /&gt;
&lt;br /&gt;
    # Does the style already exist? &lt;br /&gt;
    if oStyleFamily.hasByName( cStyleName ): &lt;br /&gt;
        # then get it so we can return it. &lt;br /&gt;
        oStyle = oStyleFamily.getByName( cStyleName ) &lt;br /&gt;
    else: &lt;br /&gt;
        # Create new style object. &lt;br /&gt;
        oStyle = oDrawDoc.createInstance( &amp;quot;com.sun.star.style.Style&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
        # Set its parent style &lt;br /&gt;
        if cParentStyleName != None: &lt;br /&gt;
            oStyle.setParentStyle( cParentStyleName ) &lt;br /&gt;
&lt;br /&gt;
        # Add the new style to the style family. &lt;br /&gt;
        oStyleFamily.insertByName( cStyleName, oStyle ) &lt;br /&gt;
&lt;br /&gt;
    return oStyle &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def getStyle( oDrawDoc, cStyleFamily, cStyleName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Lookup and return a style from the document. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return oDrawDoc.getStyleFamilies().getByName( cStyleFamily ).getByName( cStyleName ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   General Utility functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def convertToURL( cPathname ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Convert a Windows or Linux pathname into an OOo URL.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    if len( cPathname ) &amp;gt; 1: &lt;br /&gt;
        if cPathname[1:2] == &amp;quot;:&amp;quot;: &lt;br /&gt;
            cPathname = &amp;quot;/&amp;quot; + cPathname[0] + &amp;quot;|&amp;quot; + cPathname[2:] &lt;br /&gt;
    cPathname = string.replace( cPathname, &amp;quot;\\&amp;quot;, &amp;quot;/&amp;quot; ) &lt;br /&gt;
    cPathname = &amp;quot;file://&amp;quot; + cPathname &lt;br /&gt;
    return cPathname &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny%27s_Python_Modules&amp;diff=235920</id>
		<title>Danny&#039;s Python Modules</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny%27s_Python_Modules&amp;diff=235920"/>
		<updated>2015-02-17T20:04:47Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding link on DrawLib.py&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this thread I am going to post some various Python modules from my growing library. The following links take you directly to the message where a particular class is posted. &lt;br /&gt;
&lt;br /&gt;
[http://www.oooforum.org/forum/viewtopic.phtml?t=14409 Click here to see original posting]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.OOoLib.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This module makes programming OOo in Python much more like programming OOo in Basic. It also contains some frequently used functions that I typically write in Basic, such as &amp;#039;&amp;#039;&amp;#039;makePropertyValue()&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.DrawLib.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This module has routines to make programming OOo Drawing documents easier. Much of this code was derrived from Basic code, that also appears in Danny&amp;#039;s Draw Power Tools found at OOoMacros.org. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.HSBConversions.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
HSB to RGB color space conversion routines. This module is a prerequisite for the module [[Danny.OOo.DrawLib.py]]. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.PrintToWriter.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This makes it easy and convenient to print a bunch of text into a Writer document. See the example routine in the module that shows how easy this module is to use, and how useful it can be. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.ConfigLib.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Routines for working with the Configuration Manager. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.DialogLib.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
A class to build a dialog box from the com.sun.star.awt.* services. This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, this just makes it much easier. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.WindowLib.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
A class to build a modeless window from the com.sun.star.awt.* services. This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, this just makes it much easier. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.Listeners.ListenerProcAdapters.py]]&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
This module has various helpers that make it extremely easy to create listeners on the fly, and make them call an arbitrary python procedure. See quick example that appears with the code. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.Listeners.TopWindowListener.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
When you need to add a window listener to a top window, this class makes is easy to create such a listener. You can use this class, or your own subclass of it. If you create a subclass, you don&amp;#039;t need to bother to implement every one of the methods, because you can inherit the empty implementations of methods from this class for the methods you are not interested in. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.HeapSort]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
A simple implementation of HeapSort. Yet, it allows a customizable notion of &amp;quot;comparison&amp;quot; and &amp;quot;swapping&amp;quot; by passing in your own compareGreaterProc, and swapProc. &lt;br /&gt;
This is NOT an OOo specific module. It can be used for any type of Python code.&lt;br /&gt;
&lt;br /&gt;
[[Category:Python]][[Category:External Project]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.WindowLib.py&amp;diff=235919</id>
		<title>Danny.OOo.WindowLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.WindowLib.py&amp;diff=235919"/>
		<updated>2015-02-17T20:01:03Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A class to build a modeless window from the com.sun.star.awt.* services. This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, this just makes it much easier. &lt;br /&gt;
&lt;br /&gt;
This class IS NOT the actual OOo window, but you can get the OOo window or frame by calling getWindow() or getFrame() on this class. &lt;br /&gt;
&lt;br /&gt;
You can change the window size, position, title, etc. You can add controls, and listeners for those controls to the window. This class can be used by subclassing it, or without subclassing it. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.WindowLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-05-02 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
# Danny&amp;#039;s libraries &lt;br /&gt;
from Danny.OOo.OOoLib import createUnoService, createUnoStruct &lt;br /&gt;
from Danny.OOo.OOoLib import makeRectangle, StarDesktop &lt;br /&gt;
# &lt;br /&gt;
from Danny.OOo.Listeners.ListenerProcAdapters import * &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#---------- &lt;br /&gt;
#   com.sun.star.awt.WindowAttribute &lt;br /&gt;
# &lt;br /&gt;
# specifies that the window is initially visible. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_SHOW        = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.SHOW&amp;quot; ) &lt;br /&gt;
# specifies that the window fills the complete desktop area. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_FULLSIZE    = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.FULLSIZE&amp;quot; ) &lt;br /&gt;
com_sun_star_awt_WindowAttribute_OPTIMUMSIZE = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.OPTIMUMSIZE&amp;quot; ) &lt;br /&gt;
com_sun_star_awt_WindowAttribute_MINSIZE     = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.MINSIZE&amp;quot; ) &lt;br /&gt;
# specifies that the window has visible borders. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_BORDER      = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.BORDER&amp;quot; ) &lt;br /&gt;
# specifies that the size of the window can be changed by the user. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_SIZEABLE    = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.SIZEABLE&amp;quot; ) &lt;br /&gt;
# specifies that the window can be moved by the user. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_MOVEABLE    = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.MOVEABLE&amp;quot; ) &lt;br /&gt;
# specifies that the window can be closed by the user. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_CLOSEABLE   = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.CLOSEABLE&amp;quot; ) &lt;br /&gt;
#[ DEPRECATED ] specifies that the window should support the XSystemDependentWindowPeer interface. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_SYSTEMDEPENDENT = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.SYSTEMDEPENDENT&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Default window attributes. &lt;br /&gt;
# The DBWindow class (and subclasses) use this as the default window attributes &lt;br /&gt;
#  when you don&amp;#039;t specify any window attributes on the constructor. &lt;br /&gt;
gnDefaultWindowAttributes = \ &lt;br /&gt;
        com_sun_star_awt_WindowAttribute_SHOW + \ &lt;br /&gt;
        com_sun_star_awt_WindowAttribute_BORDER + \ &lt;br /&gt;
        com_sun_star_awt_WindowAttribute_MOVEABLE + \ &lt;br /&gt;
        com_sun_star_awt_WindowAttribute_CLOSEABLE &lt;br /&gt;
        # we could have addedd... &lt;br /&gt;
        #com_sun_star_awt_WindowAttribute_SIZEABLE &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The global Awt Toolkit. &lt;br /&gt;
# This is initialized the first time it is needed. &lt;br /&gt;
#goAwtToolkit = createUnoService( &amp;quot;com.sun.star.awt.Toolkit&amp;quot; ) &lt;br /&gt;
goAwtToolkit = None &lt;br /&gt;
# &lt;br /&gt;
def getAwtToolkit(): &lt;br /&gt;
    global goAwtToolkit &lt;br /&gt;
    if goAwtToolkit == None: &lt;br /&gt;
        goAwtToolkit = createUnoService( &amp;quot;com.sun.star.awt.Toolkit&amp;quot; ) &lt;br /&gt;
    return goAwtToolkit &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This class is a sugar coated abstraction for OOo&amp;#039;s Awt Window. &lt;br /&gt;
# This can be used in two different ways... &lt;br /&gt;
# 1. by subclassing it (elegant) &lt;br /&gt;
# 2. without subclassing it (less elegant) &lt;br /&gt;
class DBWindow: &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Class to build a modeless window from the com.sun.star.awt.* services. &lt;br /&gt;
    This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, &lt;br /&gt;
     this just makes it much easier. &lt;br /&gt;
    This class IS NOT the actual OOo window, but you can get the OOo window or frame by calling getWindow() or getFrame() on this class. &lt;br /&gt;
    You can change the window size, position, title, etc. &lt;br /&gt;
    You can add controls, and listeners for those controls to the window. &lt;br /&gt;
    This class can be used by subclassing it, or without subclassing it. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    def __init__( self, cTitle=None, tBoundsRect=None, nWindowAttributes=None ): &lt;br /&gt;
        oAwtToolkit = getAwtToolkit() &lt;br /&gt;
        oWindowDesc = self.createMyWindowDescriptor( tBoundsRect, nWindowAttributes ) &lt;br /&gt;
        self.oWindow = oAwtToolkit.createWindow( oWindowDesc ) &lt;br /&gt;
        &lt;br /&gt;
        # At this point, if you stop the program, you will have a &lt;br /&gt;
        #  new OOo window on the screen, but you cannot do anything &lt;br /&gt;
        #  with it.  You cannot even close it! &lt;br /&gt;
        # In fact, you have to kill the OOo process, as even OOo &lt;br /&gt;
        #  cannot close this window since it has no Frame and &lt;br /&gt;
        #  therefore is not integrated into the desktop environment. &lt;br /&gt;
        # So we need to create a Frame for our window.... &lt;br /&gt;
&lt;br /&gt;
        # Create a new frame. &lt;br /&gt;
        self.oFrame = createUnoService( &amp;quot;com.sun.star.frame.Frame&amp;quot; ) &lt;br /&gt;
        # Initialize this frame with our new window. &lt;br /&gt;
        self.oFrame.initialize( self.oWindow ) &lt;br /&gt;
        # Tell the frame that its parent is the Desktop. &lt;br /&gt;
        self.oFrame.setCreator( StarDesktop ) &lt;br /&gt;
&lt;br /&gt;
        if cTitle != None: &lt;br /&gt;
            self.setWindowTitle( cTitle ) &lt;br /&gt;
&lt;br /&gt;
        # A collection of controls on this window.  (NOT control models, but controls.) &lt;br /&gt;
        self.controls = {} &lt;br /&gt;
&lt;br /&gt;
    def createMyWindowDescriptor( self, tBoundsRect=None, nWindowAttributes=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;This returns the com.sun.star.awt.WindowDescriptor that will be used to create this window. &lt;br /&gt;
        Your subclass can override this method to provide a modified window descriptor.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        if tBoundsRect == None: &lt;br /&gt;
            tBoundsRect = makeRectangle( 100, 200, 300, 400 ) &lt;br /&gt;
        if nWindowAttributes == None: &lt;br /&gt;
            nWindowAttributes = gnDefaultWindowAttributes &lt;br /&gt;
        oAwtToolkit = getAwtToolkit() &lt;br /&gt;
        &lt;br /&gt;
        oWindowDesc = createUnoStruct( &amp;quot;com.sun.star.awt.WindowDescriptor&amp;quot; ) &lt;br /&gt;
        &lt;br /&gt;
        # specifies a top level window on the desktop. It is also a container. &lt;br /&gt;
        oWindowDesc.Type = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowClass.TOP&amp;quot; ) &lt;br /&gt;
        &lt;br /&gt;
        # specifies the name of the component service. &lt;br /&gt;
        # A zero length name means that the vcl creates a blank top, &lt;br /&gt;
        #  a container, or a simple window. &lt;br /&gt;
        oWindowDesc.WindowServiceName = &amp;quot;&amp;quot; &lt;br /&gt;
        &lt;br /&gt;
        # specifies the parent of the component. &lt;br /&gt;
        # If Parent == 0 &amp;amp;&amp;amp; ParentIndex == -1 , then the window is on the desktop. &lt;br /&gt;
        oWindowDesc.Parent = oAwtToolkit.getDesktopWindow() &lt;br /&gt;
        # specifies the index of the parent window, if available. &lt;br /&gt;
        # If Parent == 0 and this struct is a member of an array, &lt;br /&gt;
        #  then this is the offset from the beginning of the array to the parent. &lt;br /&gt;
        #  A value of -1 means desktop. &lt;br /&gt;
        oWindowDesc.ParentIndex = -1 &lt;br /&gt;
        &lt;br /&gt;
        # specifies the position and size of the window. &lt;br /&gt;
        # This member is ignored if the window attribute has &lt;br /&gt;
        #  WindowAttribute::FULLSIZE . &lt;br /&gt;
        oWindowDesc.Bounds = tBoundsRect &lt;br /&gt;
        &lt;br /&gt;
        # specifies the window attributes. &lt;br /&gt;
        oWindowDesc.WindowAttributes = nWindowAttributes &lt;br /&gt;
&lt;br /&gt;
        return oWindowDesc &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   The following two methods &lt;br /&gt;
    #   getWindow() and getFrame() &lt;br /&gt;
    #   return the two objects that this class manages. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def getWindow( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return the OOo Awt Window that this object represents. &lt;br /&gt;
        The window object returned has the following interfaces... &lt;br /&gt;
            com.sun.star.awt.XTopWindow &lt;br /&gt;
            com.sun.star.awt.XWindow &lt;br /&gt;
            com.sun.star.awt.XWindowPeer &lt;br /&gt;
            com.sun.star.awt.XVclContainer      [deprecated] &lt;br /&gt;
            com.sun.star.awt.XVclContainerPeer  [deprecated] &lt;br /&gt;
            com.sun.star.awt.XVclWindowPeer     [deprecated] &lt;br /&gt;
            com.sun.star.awt.XLayoutConstraints &lt;br /&gt;
            com.sun.star.awt.XView &lt;br /&gt;
            com.sun.star.awt.XDevice &lt;br /&gt;
            com.sun.star.lang.XEventListener &lt;br /&gt;
            com.sun.star.lang.XComponent &lt;br /&gt;
            com.sun.star.lang.XTypeProvider &lt;br /&gt;
            com.sun.star.accessibility.XAccessible &lt;br /&gt;
        Properties... &lt;br /&gt;
            &amp;lt;object&amp;gt;    MenuBar &lt;br /&gt;
            &amp;lt;array&amp;gt;     Windows &lt;br /&gt;
            &amp;lt;array&amp;gt;     Group &lt;br /&gt;
            &amp;lt;object&amp;gt;    PosSize &lt;br /&gt;
            Boolean     Visible &lt;br /&gt;
            Boolean     Enable &lt;br /&gt;
            &amp;lt;object&amp;gt;    Toolkit &lt;br /&gt;
            &amp;lt;object&amp;gt;    Pointer &lt;br /&gt;
            Long        Background &lt;br /&gt;
            Boolean     DesignMode &lt;br /&gt;
            Long        Foreground &lt;br /&gt;
            &amp;lt;object&amp;gt;    ControlFont &lt;br /&gt;
            &amp;lt;object&amp;gt;    MinimumSize &lt;br /&gt;
            &amp;lt;object&amp;gt;    PreferredSize &lt;br /&gt;
            &amp;lt;object&amp;gt;    AccessibleContext &lt;br /&gt;
            &amp;lt;object&amp;gt;    Graphics &lt;br /&gt;
            &amp;lt;object&amp;gt;    Size &lt;br /&gt;
            &amp;lt;object&amp;gt;    Info &lt;br /&gt;
            &amp;lt;array&amp;gt;     FontDescriptors &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.oWindow &lt;br /&gt;
    &lt;br /&gt;
    def getFrame( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return the Frame for the OOo Awt Window that this object represents.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.oFrame &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   The following methods represent part of the sugar coating &lt;br /&gt;
    #    that this class provides to manage the window. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def windowClose( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Close the window frame.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getFrame().close( True ) &lt;br /&gt;
        self.oFrame = None &lt;br /&gt;
        self.oWindow = None &lt;br /&gt;
&lt;br /&gt;
    def windowToFront( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;places this window at the top of the stacking order and shows it in front of any other windows.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        # By looking at the following line of code, &lt;br /&gt;
        #  and by looking at the list of interfaces from the comment in the getWindow() method, &lt;br /&gt;
        #  you should be able to figure out how to do lots of other things to this window. &lt;br /&gt;
        self.getWindow().toFront() &lt;br /&gt;
&lt;br /&gt;
    def windowToBack( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; places this window at the bottom of the stacking order and makes the corresponding adjustment to other visible windows.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().toBack() &lt;br /&gt;
&lt;br /&gt;
    def setWindowTitle( self, cTitle ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the title of the window that this object represents.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        # By looking at the following line of code, &lt;br /&gt;
        #  and by looking at the com.sun.star.frame.Frame service, &lt;br /&gt;
        #  you should be able to figure out how to do lots of other things to this window. &lt;br /&gt;
        self.getFrame().Title = cTitle &lt;br /&gt;
&lt;br /&gt;
    def getWindowTitle( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the title of the window that this object represents&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getFrame().Title &lt;br /&gt;
&lt;br /&gt;
    def setWindowBackground( self, nColor ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the background color of the window that this object represents.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setBackground( nColor ) &lt;br /&gt;
&lt;br /&gt;
    def getWindowGraphics( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns a com.sun.star.awt.XGraphics for the window that this object represents. &lt;br /&gt;
        You can then call methods on the XGraphics to draw things into this window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getWindow().getGraphics() &lt;br /&gt;
&lt;br /&gt;
    def setWindowPosSize( self, nX, nY, nWidth, nHeight ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position and size of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setPosSize( nX, nY, nWidth, nHeight, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.POSSIZE&amp;quot; ) ) &lt;br /&gt;
    def setWindowPosition( self, nX, nY ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setPosSize( nX, nY, 0, 0, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.POS&amp;quot; ) ) &lt;br /&gt;
    def setWindowSize( self, nWidth, nHeight ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position and size of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setPosSize( 0, 0, nWidth, nHeight, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.SIZE&amp;quot; ) ) &lt;br /&gt;
    def getWindowPosSize( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns a com.sun.star.awt.Rectangle that contains the position and size of this window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getWindow().getPosSize() &lt;br /&gt;
&lt;br /&gt;
    def setWindowVisible( self, bVisible ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Make this window (in)visible.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setVisible( bVisible ) &lt;br /&gt;
    def setWindowEnable( self, bEnable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Make this window (dis)enabled.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setEnable( bEnable ) &lt;br /&gt;
&lt;br /&gt;
    def setWindowFocus( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the focus to this window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setFocus() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlButton &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addButton( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cLabel=None, &lt;br /&gt;
                        actionListenerProc=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a Button control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlButtonModel&amp;quot; ) &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if cLabel != None: &lt;br /&gt;
            oControlModel.Label = cLabel &lt;br /&gt;
&lt;br /&gt;
        if actionListenerProc != None: &lt;br /&gt;
            self.addActionListenerProc( cCtrlName, actionListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def setButtonLabel( self, cCtrlName, cLabel ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the label of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setLabel( cLabel ) &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlCheckBox &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addCheckBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cLabel=None, &lt;br /&gt;
                        itemListenerProc=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a CheckBox control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlCheckBoxModel&amp;quot; ) &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if cLabel != None: &lt;br /&gt;
            oControlModel.Label = cLabel &lt;br /&gt;
&lt;br /&gt;
        if itemListenerProc != None: &lt;br /&gt;
            self.addItemListenerProc( cCtrlName, itemListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def setCheckBoxLabel( self, cCtrlName, cLabel ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the label of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setLabel( cLabel ) &lt;br /&gt;
&lt;br /&gt;
    def getCheckBoxState( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the state of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getState(); &lt;br /&gt;
&lt;br /&gt;
    def setCheckBoxState( self, cCtrlName, nState ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the state of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setState( nState ) &lt;br /&gt;
&lt;br /&gt;
    def enableCheckBoxTriState( self, cCtrlName, bTriStateEnable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Enable or disable the tri state mode of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.enableTriState( bTriStateEnable ) &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlComboBox &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addComboBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        bDropdown=True, &lt;br /&gt;
                        itemListenerProc=None, &lt;br /&gt;
                        actionListenerProc=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a ComboBox control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlComboBoxModel&amp;quot; ) &lt;br /&gt;
        oControlModel.Dropdown = bDropdown &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if itemListenerProc != None: &lt;br /&gt;
            self.addItemListenerProc( cCtrlName, itemListenerProc ) &lt;br /&gt;
        if actionListenerProc != None: &lt;br /&gt;
            self.addActionListenerProc( cCtrlName, actionListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def addComboBoxItem( self, cCtrlName, cItemText, nPosition=-1 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add an item to the ComboBox at specified position.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        if nPosition == -1: nPosition = self.getComboBoxItemCount( cCtrlName ) &lt;br /&gt;
        oControl.addItem( cItemText, nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def addComboBoxItems( self, cCtrlName, tcItemTexts, nPosition=0 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a tupple of items to the ComboBox at specified position.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.addItems( tcItemTexts, nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def removeComboBoxItems( self, cCtrlName, nPosition, nCount=1 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Remove items from a ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.removeItems( nPosition, nCount ) &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxItemCount( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the number of items in a ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItemCount() &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxItem( self, cCtrlName, nPosition ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return the item at specified position within the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItem( nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxItems( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return a tupple of all items in the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItems() &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxDropDownLineCount( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns the number of visible lines in the drop down mode.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getDropDownLineCount() &lt;br /&gt;
&lt;br /&gt;
    def setComboBoxDropDownLineCount( self, cCtrlName, nNumLines ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Sets the number of visible lines in the drop down mode.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setDropDownLineCount( nNumLines ) &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the text of the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getText(); &lt;br /&gt;
&lt;br /&gt;
    def setComboBoxText( self, cCtrlName, cText ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the text of the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setText( cText ) &lt;br /&gt;
&lt;br /&gt;
    def insertComboBoxText( self, cCtrlName, cText, nMinSelection, nMaxSelection ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Insert text at specified position in the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        tSelection = Selection() &lt;br /&gt;
        tSelection.Min = nMinSelection &lt;br /&gt;
        tSelection.Max = nMaxSelection &lt;br /&gt;
        oControl.insertText( tSelection, cText ) &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxSelectedText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the selected text of the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedText(); &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxSelection( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the selection of the ComboBox. &lt;br /&gt;
        This is a com.sun.star.awt.Selection struct with members Min and Max.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelection() &lt;br /&gt;
&lt;br /&gt;
    def isComboBoxEditable( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Indicate whether the text in the ComboBox is editable by the user.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isEditable() &lt;br /&gt;
&lt;br /&gt;
    def setComboBoxEditable( self, cCtrlName, bEditable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set whether the text in the ComboBox is editable by the user.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setEditable( bEditable ) &lt;br /&gt;
&lt;br /&gt;
    def setComboBoxMaxTextLen( self, cCtrlName, nMaxLen ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the maximum text length the ComboBox can have.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setMaxTextLen( nMaxLen ) &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxMaxTextLen( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the maximum text length the ComboBox can have.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.getMaxTextLen() &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlEdit &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addEdit( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cText=None, &lt;br /&gt;
                        textListenerProc=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a Edit control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlEditModel&amp;quot; ) &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if cText != None: &lt;br /&gt;
            self.setEditText( cCtrlName, cText ) &lt;br /&gt;
        if textListenerProc != None: &lt;br /&gt;
            self.addTextListenerProc( cCtrlName, textListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def getEditText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the text of the edit box.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getText(); &lt;br /&gt;
&lt;br /&gt;
    def setEditText( self, cCtrlName, cText ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the text of the edit box.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setText( cText ) &lt;br /&gt;
&lt;br /&gt;
    def insertEditText( self, cCtrlName, cText, nMinSelection, nMaxSelection ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Insert text at specified position in the edit box.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        tSelection = Selection() &lt;br /&gt;
        tSelection.Min = nMinSelection &lt;br /&gt;
        tSelection.Max = nMaxSelection &lt;br /&gt;
        oControl.insertText( tSelection, cText ) &lt;br /&gt;
&lt;br /&gt;
    def getEditSelectedText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the selected text of the edit box.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedText(); &lt;br /&gt;
&lt;br /&gt;
    def getEditSelection( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the selection of the edit box. &lt;br /&gt;
        This is a com.sun.star.awt.Selection struct with members Min and Max.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelection() &lt;br /&gt;
&lt;br /&gt;
    def isEditEditable( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Indicate whether the text in the edit box is editable by the user.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isEditable() &lt;br /&gt;
&lt;br /&gt;
    def setEditEditable( self, cCtrlName, bEditable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set whether the text in the edit box is editable by the user.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setEditable( bEditable ) &lt;br /&gt;
&lt;br /&gt;
    def setEditMaxTextLen( self, cCtrlName, nMaxLen ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the maximum text length the edit box can have.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setMaxTextLen( nMaxLen ) &lt;br /&gt;
&lt;br /&gt;
    def getEditMaxTextLen( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the maximum text length the edit box can have.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.getMaxTextLen() &lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlFixedText &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addFixedText( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cLabel=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a FixedText control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlFixedTextModel&amp;quot; ) &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if cLabel != None: &lt;br /&gt;
            oControlModel.Label = cLabel &lt;br /&gt;
&lt;br /&gt;
    def getFixedTextText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the text of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getText(); &lt;br /&gt;
&lt;br /&gt;
    def setFixedTextText( self, cCtrlName, cText ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the text of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setText( cText ) &lt;br /&gt;
&lt;br /&gt;
    def getFixedTextAlignment( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the alignment of the control.  0:left, 1:center, 2:right&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getAlignment(); &lt;br /&gt;
&lt;br /&gt;
    def setFixedTextAlignment( self, cCtrlName, nAlignment ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the alignment of the control.  0:left, 1:center, 2:right&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setAlignment( nAlignment ) &lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlImageControl &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addImageControl( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                         nBorder=1 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add an ImageControl control to the window. &lt;br /&gt;
        nBorder = 0:none, 1:3D border, 2:simple border&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlImageControlModel&amp;quot; ) &lt;br /&gt;
        oControlModel.Border = nBorder &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
    def getImageControlImageURL( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the ImageURL of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getControlModelProperty( cCtrlName, &amp;quot;ImageURL&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setImageControlImageURL( self, cCtrlName, cImageURL ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the ImageURL of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;ImageURL&amp;quot;, cImageURL ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlListBox &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addListBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        bDropdown=False, &lt;br /&gt;
                        itemListenerProc=None, &lt;br /&gt;
                        actionListenerProc=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a ComboBox control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlListBoxModel&amp;quot; ) &lt;br /&gt;
        oControlModel.Dropdown = bDropdown &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if itemListenerProc != None: &lt;br /&gt;
            self.addItemListenerProc( cCtrlName, itemListenerProc ) &lt;br /&gt;
        if actionListenerProc != None: &lt;br /&gt;
            self.addActionListenerProc( cCtrlName, actionListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def addListBoxItem( self, cCtrlName, cItemText, nPosition=-1 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add an item to the ListBox at specified position.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        if nPosition == -1: nPosition = self.getComboBoxItemCount( cCtrlName ) &lt;br /&gt;
        oControl.addItem( cItemText, nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def addListBoxItems( self, cCtrlName, tcItemTexts, nPosition=0 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a tupple of items to the ListBox at specified position.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.addItems( tcItemTexts, nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def removeListBoxItems( self, cCtrlName, nPosition, nCount=1 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Remove items from a ListBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.removeItems( nPosition, nCount ) &lt;br /&gt;
&lt;br /&gt;
    def getListBoxItemCount( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the number of items in a ListBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItemCount() &lt;br /&gt;
&lt;br /&gt;
    def getListBoxItem( self, cCtrlName, nPosition ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return the item at specified position within the ListBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItem( nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def getListBoxItems( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return a tupple of all items in the ListBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItems() &lt;br /&gt;
&lt;br /&gt;
    def getListBoxSelectedItemPos( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns the position of the currently selected item.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedItemPos() &lt;br /&gt;
&lt;br /&gt;
    def getListBoxSelectedItemsPos( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns the positions of all currently selected items.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedItemsPos() &lt;br /&gt;
&lt;br /&gt;
    def getListBoxSelectedItem( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns the currently selected item.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedItem() &lt;br /&gt;
&lt;br /&gt;
    def getListBoxSelectedItems( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns all currently selected items.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedItems() &lt;br /&gt;
&lt;br /&gt;
    def selectListBoxItemPos( self, cCtrlName, nItemPos, bSelect=True ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Select/Deselect the item at the specified position.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.selectItemPos( nItemPos, bSelect ) &lt;br /&gt;
&lt;br /&gt;
    def selectListBoxItemsPos( self, cCtrlName, tnItemPos, bSelect=True ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Selects/Deselects the items at the specified positions.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.selectItemsPos( tnItemPos, bSelect ) &lt;br /&gt;
&lt;br /&gt;
    def selectListBoxItem( self, cCtrlName, cItemText, bSelect=True ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Selects/Deselects the ispecified item.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.selectItem( cItemText, bSelect ) &lt;br /&gt;
&lt;br /&gt;
    def isListBoxMultipleMode( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Selects/Deselects the ispecified item.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isMutipleMode() &lt;br /&gt;
&lt;br /&gt;
    def setListBoxMultipleMode( self, cCtrlName, bMultipleMode ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Selects/Deselects the ispecified item.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.setMutipleMode( bMultipleMode ) &lt;br /&gt;
&lt;br /&gt;
    def getListBoxDropDownLineCount( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns the number of visible lines in the drop down mode.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getDropDownLineCount() &lt;br /&gt;
&lt;br /&gt;
    def setListBoxDropDownLineCount( self, cCtrlName, nNumLines ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Sets the number of visible lines in the drop down mode.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setDropDownLineCount( nNumLines ) &lt;br /&gt;
&lt;br /&gt;
    def makeListBoxItemVisible( self, nItemPos ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Makes the item at the specified position visible by scrolling the list box.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.makeVisible( nItemPos ) &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Access controls and control models &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def getControl( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the control (not its model) for a particular control name. &lt;br /&gt;
        The control returned includes the service com.sun.star.awt.UnoControl, &lt;br /&gt;
         and another control-specific service which inherits from it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.controls[ cCtrlName ] &lt;br /&gt;
        return oControl &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    def getControlModel( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the control model (not the control) for a particular control name. &lt;br /&gt;
        The model returned includes the service UnoControlModel, &lt;br /&gt;
         and another control-specific service which inherits from it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControlModel = oControl.getModel() &lt;br /&gt;
        return oControlModel &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Adjust properties of control models &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def setControlModelProperty( self, cCtrlName, cPropertyName, uValue ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the value of a property of a control&amp;#039;s model. &lt;br /&gt;
        This affects the control model, not the control. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = self.getControlModel( cCtrlName ) &lt;br /&gt;
        oControlModel.setPropertyValue( cPropertyName, uValue ) &lt;br /&gt;
&lt;br /&gt;
    def getControlModelProperty( self, cCtrlName, cPropertyName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the value of a property of a control&amp;#039;s model. &lt;br /&gt;
        This affects the control model, not the control. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = self.getControlModel( cCtrlName ) &lt;br /&gt;
        return oControlModel.getPropertyValue( cPropertyName ) &lt;br /&gt;
      &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Adjust controls (not models) &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # The following apply to all controls which are a &lt;br /&gt;
    #   com.sun.star.awt.UnoControl &lt;br /&gt;
    # (which means all controls) &lt;br /&gt;
&lt;br /&gt;
    def setDesignMode( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setDesignMode( bDesignMode ) &lt;br /&gt;
&lt;br /&gt;
    def isDesignMode( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isDesignMode() &lt;br /&gt;
  &lt;br /&gt;
    def isTransparent( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isTransparent() &lt;br /&gt;
&lt;br /&gt;
    def setPosSize( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position and size of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        # if negative coordinates are given for X or Y position, &lt;br /&gt;
        #  then make that coordinate be relative to the right/bottom &lt;br /&gt;
        #  edge of the window instead of to the left/top. &lt;br /&gt;
        if nPositionX &amp;lt; 0  or  nPositionY &amp;lt; 0: &lt;br /&gt;
            oWindowPosSizeRect = self.getWindowPosSize() &lt;br /&gt;
            if nPositionX &amp;lt; 0: nPositionX = oWindowPosSizeRect.Width  + nPositionX - nWidth &lt;br /&gt;
            if nPositionY &amp;lt; 0: nPositionY = oWindowPosSizeRect.Height + nPositionY - nHeight &lt;br /&gt;
        oControl.setPosSize( nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.POSSIZE&amp;quot; ) ) &lt;br /&gt;
    def setPosition( self, cCtrlName, nPositionX, nPositionY ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        # if negative coordinates are given for X or Y position, &lt;br /&gt;
        #  then make that coordinate be relative to the right/bottom &lt;br /&gt;
        #  edge of the window instead of to the left/top. &lt;br /&gt;
        if nPositionX &amp;lt; 0  or  nPositionY &amp;lt; 0: &lt;br /&gt;
            oCtrlPosSizeRect = oControl.getPosSize() &lt;br /&gt;
            oWindowPosSizeRect = self.getWindowPosSize() &lt;br /&gt;
            if nPositionX &amp;lt; 0: nPositionX = oWindowPosSizeRect.Width  + nPositionX - oCtrlPosSizeRect.Width &lt;br /&gt;
            if nPositionY &amp;lt; 0: nPositionY = oWindowPosSizeRect.Height + nPositionY - oCtrlPosSizeRect.Height &lt;br /&gt;
        oControl.setPosSize( nPositionX, nPositionY, 0, 0, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.POS&amp;quot; ) ) &lt;br /&gt;
    def setSize( self, cCtrlName, nWidth, nHeight ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position and size of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setPosSize( 0, 0, nWidth, nHeight, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.SIZE&amp;quot; ) ) &lt;br /&gt;
    def getPosSize( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns a com.sun.star.awt.Rectangle that contains the position and size of this window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getPosSize() &lt;br /&gt;
&lt;br /&gt;
    def setVisible( self, cCtrlName, bVisible ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Show or hide the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setVisible( bVisible ) &lt;br /&gt;
&lt;br /&gt;
    def setEnable( self, cCtrlName, bEnable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Enable or disable the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setEnable( bEnable ) &lt;br /&gt;
&lt;br /&gt;
    def setFocus( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set focus to the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setFocus() &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Add listeners to controls. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # This applies to... &lt;br /&gt;
    #   UnoControlButton &lt;br /&gt;
    #   UnoControlComboBox &lt;br /&gt;
    def addActionListenerProc( self, cCtrlName, actionListenerProc ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create an com.sun.star.awt.XActionListener object and add it to a control. &lt;br /&gt;
        A listener object is created which will call the python procedure actionListenerProc. &lt;br /&gt;
        The actionListenerProc can be either a method or a global procedure. &lt;br /&gt;
        The following controls support XActionListener: &lt;br /&gt;
            UnoControlButton &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oActionListener = ActionListenerProcAdapter( actionListenerProc ) &lt;br /&gt;
        oControl.addActionListener( oActionListener ) &lt;br /&gt;
&lt;br /&gt;
    # This applies to... &lt;br /&gt;
    #   UnoControlCheckBox &lt;br /&gt;
    #   UnoControlComboBox &lt;br /&gt;
    def addItemListenerProc( self, cCtrlName, itemListenerProc ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create an com.sun.star.awt.XItemListener object and add it to a control. &lt;br /&gt;
        A listener object is created which will call the python procedure itemListenerProc. &lt;br /&gt;
        The itemListenerProc can be either a method or a global procedure. &lt;br /&gt;
        The following controls support XActionListener: &lt;br /&gt;
            UnoControlCheckBox &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oActionListener = ItemListenerProcAdapter( itemListenerProc ) &lt;br /&gt;
        oControl.addItemListener( oActionListener ) &lt;br /&gt;
&lt;br /&gt;
    # This applies to... &lt;br /&gt;
    #   UnoControlEdit &lt;br /&gt;
    def addTextListenerProc( self, cCtrlName, textListenerProc ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create an com.sun.star.awt.XTextListener object and add it to a control. &lt;br /&gt;
        A listener object is created which will call the python procedure textListenerProc. &lt;br /&gt;
        The textListenerProc can be either a method or a global procedure. &lt;br /&gt;
        The following controls support XTextListener: &lt;br /&gt;
            UnoControlEdit &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oTextListener = TextListenerProcAdapter( textListenerProc ) &lt;br /&gt;
        oControl.addTextListener( oTextListener ) &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
from com.sun.star.awt import XTopWindowListener &lt;br /&gt;
from com.sun.star.awt import XWindowListener &lt;br /&gt;
from com.sun.star.awt import XFocusListener &lt;br /&gt;
from com.sun.star.awt import XKeyListener &lt;br /&gt;
from com.sun.star.awt import XMouseListener &lt;br /&gt;
from com.sun.star.awt import XPaintListener &lt;br /&gt;
from com.sun.star.lang import XEventListener &lt;br /&gt;
class DBListenerWindow( DBWindow, unohelper.Base, &lt;br /&gt;
                            XKeyListener, XMouseListener, XPaintListener, &lt;br /&gt;
                            XFocusListener, XWindowListener, XTopWindowListener, &lt;br /&gt;
                            XEventListener ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;This is like a DBWindow, but has useful listener methods implemented directly in this class. &lt;br /&gt;
    You can easily subclass this class, and override the various listener methods from the interfaces implemented by this class. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    def __init__( self, cTitle=None, tBoundsRect=None, nWindowAttributes=None ): &lt;br /&gt;
        DBWindow.__init__( self, &lt;br /&gt;
                    cTitle=cTitle, &lt;br /&gt;
                    tBoundsRect=tBoundsRect, &lt;br /&gt;
                    nWindowAttributes=nWindowAttributes ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XTopWindowListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addTopWindowListener( self ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XWindowListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addWindowListener( self ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XFocusListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addFocusListener( self ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XKeyListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addKeyListener( self ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XMouseListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addMouseListener( self ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XPaintListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addPaintListener( self ) &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XTopWindowListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.lang.EventObject has the following members: &lt;br /&gt;
    #       Source  which is a  com.sun.star.uno.XInterface &lt;br /&gt;
    #           refers to the object that fired the event. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowOpened( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowOpened( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window has been opened.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowClosing( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowClosing( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is in the process of being closed. &lt;br /&gt;
        The close operation can be overridden at this point.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().dispose() &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowClosed( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowClosed( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window has been closed.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowMinimized( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowMinimized( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is iconified.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowNormalized( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowNormalized( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is de-iconified.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowActivated( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowActivated( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is activated.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowDeactivated( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowDeactivated( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is de-activated.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XWindowListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.awt.WindowEvent has the following members: &lt;br /&gt;
    #       long X      long Y &lt;br /&gt;
    #       long Width  long Height &lt;br /&gt;
    #       long LeftInset  long TopInset   long RightInset     long BottomInset &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # windowResized( [in] WindowEvent tEvent ); &lt;br /&gt;
    def windowResized( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the window has been resized.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # windowMoved( [in] WindowEvent tEvent ); &lt;br /&gt;
    def windowMoved( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the window has been moved.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # windowShown( [in] EventObject tEvent ); &lt;br /&gt;
    def windowShown( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the window has been shown.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        # please note the type of parameter is described &lt;br /&gt;
        #  above in the comment for XTopWindowListener. &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # windowHidden( [in] EventObject tEvent ); &lt;br /&gt;
    def windowHidden( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the window has been hidden.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        # please note the type of parameter is described &lt;br /&gt;
        #  above in the comment for XTopWindowListener. &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XFocusListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.awt.FocusEvent has the following members: &lt;br /&gt;
    #       short FocusFlags &lt;br /&gt;
    #       com.sun.star.uno.XInterface NextFocus &lt;br /&gt;
    #       boolean Temporary &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # focusGained( [in] FocusEvent tEvent ); &lt;br /&gt;
    def focusGained( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; is invoked when a window gains the keyboard focus.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # focusLost( [in] FocusEvent tEvent ); &lt;br /&gt;
    def focusLost( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; is invoked when a window loses the keyboard focus.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XKeyListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.awt.KeyEvent has the following members: &lt;br /&gt;
    #       short KeyCode   (constant from com.sun.star.awt.Key) &lt;br /&gt;
    #       char  KeyChar &lt;br /&gt;
    #       short KeyFunc   (constant from com.sun.star.awt.KeyFunction) &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # keyPressed( [in] com.sun.star.awt.KeyEvent tEvent ); &lt;br /&gt;
    def keyPressed( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; is invoked when a key has been pressed.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # keyReleased( [in] com.sun.star.awt.KeyEvent tEvent ); &lt;br /&gt;
    def keyReleased( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; is invoked when a key has been released.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XMouseListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.awt.MouseEvent has the following members: &lt;br /&gt;
    #       short Buttons       (constant from com.sun.star.awt.MouseButton) &lt;br /&gt;
    #       short X     short Y &lt;br /&gt;
    #       long ClickCount &lt;br /&gt;
    #       boolean PupupTrigger &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # mousePressed( [in] com.sun.star.awt.MouseEvent tEvent ); &lt;br /&gt;
    def mousePressed( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a mouse button has been pressed on a window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # mouseReleased( [in] com.sun.star.awt.MouseEvent tEvent ); &lt;br /&gt;
    def mouseReleased( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a mouse button has been released on a window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # mouseEntered( [in] com.sun.star.awt.MouseEvent tEvent ); &lt;br /&gt;
    def mouseEntered( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the mouse enters a window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # mouseExited( [in] com.sun.star.awt.MouseEvent tEvent ); &lt;br /&gt;
    def mouseExited( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the mouse exits a window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XPaintListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.awt.PaintEvent has the following members: &lt;br /&gt;
    #       com.sun.star.awt.Rectangle UpdateRect &lt;br /&gt;
    #       short Count &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowPaint( [in] PaintEvent tEvent ); &lt;br /&gt;
    def windowPaint( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; is invoked when a region of the window became invalid, e.g. when another window has been moved away.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XEventListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.lang.EventObject has the following members: &lt;br /&gt;
    #       Source  which is a  com.sun.star.uno.XInterface &lt;br /&gt;
    #           refers to the object that fired the event. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # disposing( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def disposing( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;gets called when the broadcaster is about to be disposed.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# import Danny.OOo.WindowLib &lt;br /&gt;
# reload( Danny.OOo.WindowLib ); from Danny.OOo.WindowLib import * &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.Listeners.ListenerProcAdapters.py&amp;diff=235918</id>
		<title>Danny.OOo.Listeners.ListenerProcAdapters.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.Listeners.ListenerProcAdapters.py&amp;diff=235918"/>
		<updated>2015-02-17T20:00:45Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module has various helpers that make it extremely easy to create listeners on the fly, and make them call an arbitrary python procedure. &lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.Listeners.ListenerProcAdapters.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-05-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# An ActionListener adapter. &lt;br /&gt;
# This object implements com.sun.star.awt.XActionListener. &lt;br /&gt;
# When actionPerformed is called, this will call an arbitrary &lt;br /&gt;
#  python procedure, passing it... &lt;br /&gt;
#   1. the oActionEvent &lt;br /&gt;
#   2. any other parameters you specified to this object&amp;#039;s constructor (as a tuple). &lt;br /&gt;
from com.sun.star.awt import XActionListener &lt;br /&gt;
class ActionListenerProcAdapter( unohelper.Base, XActionListener ): &lt;br /&gt;
    def __init__( self, oProcToCall, tParams=() ): &lt;br /&gt;
        self.oProcToCall = oProcToCall # a python procedure &lt;br /&gt;
        self.tParams = tParams # a tuple &lt;br /&gt;
&lt;br /&gt;
    # oActionEvent is a com.sun.star.awt.ActionEvent struct. &lt;br /&gt;
    def actionPerformed( self, oActionEvent ): &lt;br /&gt;
        if callable( self.oProcToCall ): &lt;br /&gt;
            apply( self.oProcToCall, (oActionEvent,) + self.tParams ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# An ItemListener adapter. &lt;br /&gt;
# This object implements com.sun.star.awt.XItemListener. &lt;br /&gt;
# When itemStateChanged is called, this will call an arbitrary &lt;br /&gt;
#  python procedure, passing it... &lt;br /&gt;
#   1. the oItemEvent &lt;br /&gt;
#   2. any other parameters you specified to this object&amp;#039;s constructor (as a tuple). &lt;br /&gt;
from com.sun.star.awt import XItemListener &lt;br /&gt;
class ItemListenerProcAdapter( unohelper.Base, XItemListener ): &lt;br /&gt;
    def __init__( self, oProcToCall, tParams=() ): &lt;br /&gt;
        self.oProcToCall = oProcToCall # a python procedure &lt;br /&gt;
        self.tParams = tParams # a tuple &lt;br /&gt;
&lt;br /&gt;
    # oItemEvent is a com.sun.star.awt.ItemEvent struct. &lt;br /&gt;
    def itemStateChanged( self, oItemEvent ): &lt;br /&gt;
        if callable( self.oProcToCall ): &lt;br /&gt;
            apply( self.oProcToCall, (oItemEvent,) + self.tParams ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# An TextListener adapter. &lt;br /&gt;
# This object implements com.sun.star.awt.XTextistener. &lt;br /&gt;
# When textChanged is called, this will call an arbitrary &lt;br /&gt;
#  python procedure, passing it... &lt;br /&gt;
#   1. the oTextEvent &lt;br /&gt;
#   2. any other parameters you specified to this object&amp;#039;s constructor (as a tuple). &lt;br /&gt;
from com.sun.star.awt import XTextListener &lt;br /&gt;
class TextListenerProcAdapter( unohelper.Base, XTextListener ): &lt;br /&gt;
    def __init__( self, oProcToCall, tParams=() ): &lt;br /&gt;
        self.oProcToCall = oProcToCall # a python procedure &lt;br /&gt;
        self.tParams = tParams # a tuple &lt;br /&gt;
&lt;br /&gt;
    # oTextEvent is a com.sun.star.awt.TextEvent struct. &lt;br /&gt;
    def textChanged( self, oTextEvent ): &lt;br /&gt;
        if callable( self.oProcToCall ): &lt;br /&gt;
            apply( self.oProcToCall, (oTextEvent,) + self.tParams ) &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.Listeners.TopWindowListener.py&amp;diff=235917</id>
		<title>Danny.OOo.Listeners.TopWindowListener.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.Listeners.TopWindowListener.py&amp;diff=235917"/>
		<updated>2015-02-17T20:00:31Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is similar in purpose to the Danny.OOo.Listeners.ListenerProcAdapters.py module. &lt;br /&gt;
&lt;br /&gt;
This one is NOT an adapter however. It is a class that you subclass. Your subclass does not need to implement every possible listener method, because you inherit the empty implementations from this class. So when you need to add a window listener to a TopWindow, this class comes in very handy. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.Listeners.TopWindowListener.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-05-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
from com.sun.star.awt import XTopWindowListener &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class TopWindowListener( XTopWindowListener ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;An empty implementation of com.sun.star.awt.XTopWindowListener. &lt;br /&gt;
    It is useful for you to be able to subclass from this. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    # NOTE: &lt;br /&gt;
    # If you subclass from this, you must either: &lt;br /&gt;
    #  1. also subclass from unohelper.Base. &lt;br /&gt;
    #  2. or otherwise implement com.sun.star.lang.XTypeProvider. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface:  XTopWindowListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.lang.EventObject has the following members: &lt;br /&gt;
    #       Source  which is a  com.sun.star.uno.XInterface &lt;br /&gt;
    #           refers to the object that fired the event. &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowOpened( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowOpened( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window has been opened.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowClosing( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowClosing( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is in the process of being closed. &lt;br /&gt;
        The close operation can be overridden at this point.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowClosed( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowClosed( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window has been closed.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowMinimized( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowMinimized( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is iconified.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowNormalized( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowNormalized( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is de-iconified.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowActivated( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowActivated( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is activated.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowDeactivated( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowDeactivated( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is de-activated.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.HeapSort&amp;diff=235916</id>
		<title>Danny.HeapSort</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.HeapSort&amp;diff=235916"/>
		<updated>2015-02-17T20:00:19Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is my HeapSort module. This is NOT an OOo related module, but I am posting it because someone asked..... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.HeapSort.py &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2005 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2005-03-29 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def SwapItems( items, nIndex1, nIndex2 ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Swap two items in the sequence.  Return a new sequence with the swap. &lt;br /&gt;
    nIndex1 and nIndex2 are zero based.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    item1 = items[nIndex1] &lt;br /&gt;
    item2 = items[nIndex2] &lt;br /&gt;
    items[nIndex1] = item2 &lt;br /&gt;
    items[nIndex2] = item1 &lt;br /&gt;
    return items &lt;br /&gt;
&lt;br /&gt;
def ItemsCompareGreater( items, nIndex1, nIndex2 ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return True if the item at nIndex1 is greater than the item at nIndex2. &lt;br /&gt;
    nIndex1 and nIndex2 are zero based.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return items[nIndex1] &amp;gt; items[nIndex2] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def HeapSort( items, &lt;br /&gt;
                      compareGreaterProc=ItemsCompareGreater, &lt;br /&gt;
                      swapProc=SwapItems ): &lt;br /&gt;
    MakeHeap( items, compareGreaterProc, swapProc ) &lt;br /&gt;
    nNumItems = len( items ) &lt;br /&gt;
    for i in range( nNumItems-1, -1, -1 ): &lt;br /&gt;
        swapProc( items, 0, i ) &lt;br /&gt;
        SiftHeap( items, i, 0, compareGreaterProc, swapProc ) &lt;br /&gt;
    return items &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def MakeHeap( items, &lt;br /&gt;
                      compareGreaterProc=ItemsCompareGreater, &lt;br /&gt;
                      swapProc=SwapItems ): &lt;br /&gt;
    nNumItems = len( items ) &lt;br /&gt;
    for i in range( nNumItems-1, -1, -1 ): &lt;br /&gt;
        SiftHeap( items, nNumItems, i, compareGreaterProc, swapProc ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def SiftHeap( items, nHeapSize, nTheNode, &lt;br /&gt;
                      compareGreaterProc=ItemsCompareGreater, &lt;br /&gt;
                      swapProc=SwapItems ): &lt;br /&gt;
    nLargestNode = nTheNode &lt;br /&gt;
    while True: &lt;br /&gt;
        bNeedSwap = False &lt;br /&gt;
        nParentNode = nLargestNode &lt;br /&gt;
&lt;br /&gt;
        nChildNode = nParentNode+nParentNode+1 # left child &lt;br /&gt;
        if( nChildNode &amp;lt; nHeapSize and compareGreaterProc( items, nChildNode, nLargestNode ) ): &lt;br /&gt;
            nLargestNode = nChildNode &lt;br /&gt;
            bNeedSwap = True &lt;br /&gt;
&lt;br /&gt;
        nChildNode = nChildNode + 1 # right child &lt;br /&gt;
        if( nChildNode &amp;lt; nHeapSize and compareGreaterProc( items, nChildNode, nLargestNode ) ): &lt;br /&gt;
            nLargestNode = nChildNode &lt;br /&gt;
            bNeedSwap = True &lt;br /&gt;
&lt;br /&gt;
        if bNeedSwap: &lt;br /&gt;
            swapProc( items, nParentNode, nLargestNode ) &lt;br /&gt;
        else: &lt;br /&gt;
            break&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.DialogLib.py&amp;diff=235915</id>
		<title>Danny.OOo.DialogLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.DialogLib.py&amp;diff=235915"/>
		<updated>2015-02-17T19:59:54Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A class to build a dialog box from the com.sun.star.awt.* services. This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, this just makes it much easier. &lt;br /&gt;
&lt;br /&gt;
You can change the dialog box size, position, title, etc. You can add controls, and listeners for those controls to the dialog box. This class can be used by subclassing it, or without subclassing it. &lt;br /&gt;
&lt;br /&gt;
This module depends upon Danny.OOo.Listeners.ListenerProcAdapters.py found elsewhere in this thread. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.DialogLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-05-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
# Danny&amp;#039;s libraries &lt;br /&gt;
from Danny.OOo.OOoLib import createUnoService, createUnoStruct &lt;br /&gt;
from Danny.OOo.Listeners.ListenerProcAdapters import * &lt;br /&gt;
#from Danny.OOo.Listeners.TopWindowListener import TopWindowListener &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The global Awt Toolkit. &lt;br /&gt;
# This is initialized the first time it is needed. &lt;br /&gt;
#goAwtToolkit = createUnoService( &amp;quot;com.sun.star.awt.Toolkit&amp;quot; ) &lt;br /&gt;
goAwtToolkit = None &lt;br /&gt;
# &lt;br /&gt;
def getAwtToolkit(): &lt;br /&gt;
    global goAwtToolkit &lt;br /&gt;
    if goAwtToolkit == None: &lt;br /&gt;
        goAwtToolkit = createUnoService( &amp;quot;com.sun.star.awt.Toolkit&amp;quot; ) &lt;br /&gt;
    return goAwtToolkit &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This class builds dialog boxes. &lt;br /&gt;
# This can be used in two different ways... &lt;br /&gt;
# 1. by subclassing it (elegant) &lt;br /&gt;
# 2. without subclassing it (less elegant) &lt;br /&gt;
class DBModalDialog: &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Class to build a dialog box from the com.sun.star.awt.* services. &lt;br /&gt;
    This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, &lt;br /&gt;
     this just makes it much easier. &lt;br /&gt;
    You can change the dialog box size, position, title, etc. &lt;br /&gt;
    You can add controls, and listeners for those controls to the dialog box. &lt;br /&gt;
    This class can be used by subclassing it, or without subclassing it. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    def __init__( self, nPositionX=None, nPositionY=None, nWidth=None, nHeight=None, cTitle=None ): &lt;br /&gt;
        self.oDialogModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlDialogModel&amp;quot; ) &lt;br /&gt;
        if nPositionX != None:  self.oDialogModel.PositionX = nPositionX &lt;br /&gt;
        if nPositionY != None:  self.oDialogModel.PositionY = nPositionY &lt;br /&gt;
        if nWidth     != None:  self.oDialogModel.Width     = nWidth &lt;br /&gt;
        if nHeight    != None:  self.oDialogModel.Height    = nHeight &lt;br /&gt;
        if cTitle     != None:  self.oDialogModel.Title     = cTitle &lt;br /&gt;
        self.oDialogControl = createUnoService( &amp;quot;com.sun.star.awt.UnoControlDialog&amp;quot; ) &lt;br /&gt;
        self.oDialogControl.setModel( self.oDialogModel ) &lt;br /&gt;
&lt;br /&gt;
    def release( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Release resources. &lt;br /&gt;
        After calling this, you can no longer use this object. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.oDialogControl.dispose() &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Dialog box adjustments &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    &lt;br /&gt;
    def setDialogPosition( self, nX, nY ): &lt;br /&gt;
        self.oDialogModel.PositionX = nX &lt;br /&gt;
        self.oDialogModel.PositionY = nY &lt;br /&gt;
&lt;br /&gt;
    def setDialogSize( self, nWidth, nHeight ): &lt;br /&gt;
        self.oDialogModel.Width = nWidth &lt;br /&gt;
        self.oDialogModel.Height = nHeight &lt;br /&gt;
&lt;br /&gt;
    def setDialogTitle( self, cCaption ): &lt;br /&gt;
        self.oDialogModel.Title = cCaption &lt;br /&gt;
&lt;br /&gt;
    def setVisible( self, bVisible ): &lt;br /&gt;
        self.oDialogControl.setVisible( bVisible ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlButton &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # After you add a Button control, you can call self.setControlModelProperty() &lt;br /&gt;
    #  passing any of the properties for a... &lt;br /&gt;
    #       com.sun.star.awt.UnoControlButtonModel &lt;br /&gt;
    #       com.sun.star.awt.UnoControlDialogElement &lt;br /&gt;
    #       com.sun.star.awt.UnoControlModel &lt;br /&gt;
    def addButton( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                       cLabel=None, &lt;br /&gt;
                       actionListenerProc=None, &lt;br /&gt;
                       nTabIndex=None ): &lt;br /&gt;
        self.addControl( &amp;quot;com.sun.star.awt.UnoControlButtonModel&amp;quot;, &lt;br /&gt;
                         cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                         cLabel=cLabel, &lt;br /&gt;
                         nTabIndex=nTabIndex ) &lt;br /&gt;
        if actionListenerProc != None: &lt;br /&gt;
            self.addActionListenerProc( cCtrlName, actionListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def setButtonLabel( self, cCtrlName, cLabel ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the label of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setLabel( cLabel ) &lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlCheckBox &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # After you add a CheckBox control, you can call self.setControlModelProperty() &lt;br /&gt;
    #  passing any of the properties for a... &lt;br /&gt;
    #       com.sun.star.awt.UnoControlCheckBoxModel &lt;br /&gt;
    #       com.sun.star.awt.UnoControlDialogElement &lt;br /&gt;
    #       com.sun.star.awt.UnoControlModel &lt;br /&gt;
    def addCheckBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                       cLabel=None, &lt;br /&gt;
                       itemListenerProc=None, &lt;br /&gt;
                       nTabIndex=None ): &lt;br /&gt;
        self.addControl( &amp;quot;com.sun.star.awt.UnoControlCheckBoxModel&amp;quot;, &lt;br /&gt;
                         cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                         cLabel=cLabel, &lt;br /&gt;
                         nTabIndex=nTabIndex ) &lt;br /&gt;
        if itemListenerProc != None: &lt;br /&gt;
            self.addItemListenerProc( cCtrlName, itemListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def setCheckBoxLabel( self, cCtrlName, cLabel ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the label of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setLabel( cLabel ) &lt;br /&gt;
&lt;br /&gt;
    def getCheckBoxState( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the state of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getState(); &lt;br /&gt;
&lt;br /&gt;
    def setCheckBoxState( self, cCtrlName, nState ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the state of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setState( nState ) &lt;br /&gt;
&lt;br /&gt;
    def enableCheckBoxTriState( self, cCtrlName, bTriStateEnable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Enable or disable the tri state mode of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.enableTriState( bTriStateEnable ) &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlFixedText &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addFixedText( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cLabel=None ): &lt;br /&gt;
        self.addControl( &amp;quot;com.sun.star.awt.UnoControlFixedTextModel&amp;quot;, &lt;br /&gt;
                         cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                         cLabel=cLabel ) &lt;br /&gt;
            &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Add Controls to dialog &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addControl( self, cCtrlServiceName, &lt;br /&gt;
                        cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cLabel=None, &lt;br /&gt;
                        nTabIndex=None ): &lt;br /&gt;
        oControlModel = self.oDialogModel.createInstance( cCtrlServiceName ) &lt;br /&gt;
        self.oDialogModel.insertByName( cCtrlName, oControlModel ) &lt;br /&gt;
&lt;br /&gt;
        # if negative coordinates are given for X or Y position, &lt;br /&gt;
        #  then make that coordinate be relative to the right/bottom &lt;br /&gt;
        #  edge of the dialog box instead of to the left/top. &lt;br /&gt;
        if nPositionX &amp;lt; 0: nPositionX = self.oDialogModel.Width  + nPositionX - nWidth &lt;br /&gt;
        if nPositionY &amp;lt; 0: nPositionY = self.oDialogModel.Height + nPositionY - nHeight &lt;br /&gt;
        oControlModel.PositionX = nPositionX &lt;br /&gt;
        oControlModel.PositionY = nPositionY &lt;br /&gt;
        oControlModel.Width = nWidth &lt;br /&gt;
        oControlModel.Height = nHeight &lt;br /&gt;
        oControlModel.Name = cCtrlName &lt;br /&gt;
        &lt;br /&gt;
        if cLabel != None: &lt;br /&gt;
            oControlModel.Label = cLabel &lt;br /&gt;
&lt;br /&gt;
        if nTabIndex != None: &lt;br /&gt;
            oControlModel.TabIndex = nTabIndex &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Access controls and control models &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def getControl( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the control (not its model) for a particular control name. &lt;br /&gt;
        The control returned includes the service com.sun.star.awt.UnoControl, &lt;br /&gt;
         and another control-specific service which inherits from it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.oDialogControl.getControl( cCtrlName ) &lt;br /&gt;
        return oControl &lt;br /&gt;
&lt;br /&gt;
    def getControlModel( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the control model (not the control) for a particular control name. &lt;br /&gt;
        The model returned includes the service UnoControlModel, &lt;br /&gt;
         and another control-specific service which inherits from it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControlModel = oControl.getModel() &lt;br /&gt;
        return oControlModel &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Adjust properties of control models &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def setControlModelProperty( self, cCtrlName, cPropertyName, uValue ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the value of a property of a control&amp;#039;s model. &lt;br /&gt;
        This affects the control model, not the control. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = self.getControlModel( cCtrlName ) &lt;br /&gt;
        oControlModel.setPropertyValue( cPropertyName, uValue ) &lt;br /&gt;
&lt;br /&gt;
    def getControlModelProperty( self, cCtrlName, cPropertyName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the value of a property of a control&amp;#039;s model. &lt;br /&gt;
        This affects the control model, not the control. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = self.getControlModel( cCtrlName ) &lt;br /&gt;
        return oControlModel.getPropertyValue( cPropertyName ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Sugar coated property adjustments to control models. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def setEnabled( self, cCtrlName, bEnabled=True ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Enabled&amp;quot;, bEnabled ) &lt;br /&gt;
&lt;br /&gt;
    def getEnabled( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Enabled&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setState( self, cCtrlName, nState ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;State&amp;quot;, nState ) &lt;br /&gt;
&lt;br /&gt;
    def getState( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;State&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setLabel( self, cCtrlName, cLabel ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Label&amp;quot;, cLabel ) &lt;br /&gt;
&lt;br /&gt;
    def getLabel( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Label&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setHelpText( self, cCtrlName, cHelpText ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;HelpText&amp;quot;, cHelpText ) &lt;br /&gt;
&lt;br /&gt;
    def getHelpText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;HelpText&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Adjust controls (not models) &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # The following apply to all controls which are a &lt;br /&gt;
    #   com.sun.star.awt.UnoControl &lt;br /&gt;
&lt;br /&gt;
    def setDesignMode( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setDesignMode( bDesignMode ) &lt;br /&gt;
&lt;br /&gt;
    def isDesignMode( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isDesignMode() &lt;br /&gt;
  &lt;br /&gt;
    def isTransparent( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isTransparent() &lt;br /&gt;
      &lt;br /&gt;
&lt;br /&gt;
    # The following apply to all controls which are a &lt;br /&gt;
    #   com.sun.star.awt.UnoControlDialogElement &lt;br /&gt;
&lt;br /&gt;
    def setPosition( self, cCtrlName, nPositionX, nPositionY ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;PositionX&amp;quot;, nPositionX ) &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;PositionY&amp;quot;, nPositionY ) &lt;br /&gt;
    def setPositionX( self, cCtrlName, nPositionX ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;PositionX&amp;quot;, nPositionX ) &lt;br /&gt;
    def setPositionY( self, cCtrlName, nPositionY ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;PositionY&amp;quot;, nPositionY ) &lt;br /&gt;
    def getPositionX( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;PositionX&amp;quot; ) &lt;br /&gt;
    def getPositionY( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;PositionY&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setSize( self, cCtrlName, nWidth, nHeight ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Width&amp;quot;, nWidth ) &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Height&amp;quot;, nHeight ) &lt;br /&gt;
    def setWidth( self, cCtrlName, nWidth ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Width&amp;quot;, nWidth ) &lt;br /&gt;
    def setHeight( self, cCtrlName, nHeight ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Height&amp;quot;, nHeight ) &lt;br /&gt;
    def getWidth( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Width&amp;quot; ) &lt;br /&gt;
    def getHeight( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Height&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setTabIndex( self, cCtrlName, nWidth, nTabIndex ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;TabIndex&amp;quot;, nTabIndex ) &lt;br /&gt;
    def getTabIndex( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;TabIndex&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setStep( self, cCtrlName, nWidth, nStep ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Step&amp;quot;, nStep ) &lt;br /&gt;
    def getStep( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Step&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setTag( self, cCtrlName, nWidth, cTag ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Tag&amp;quot;, cTag ) &lt;br /&gt;
    def getTag( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Tag&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Add listeners to controls. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # This applies to... &lt;br /&gt;
    #   UnoControlButton &lt;br /&gt;
    def addActionListenerProc( self, cCtrlName, actionListenerProc ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create an com.sun.star.awt.XActionListener object and add it to a control. &lt;br /&gt;
        A listener object is created which will call the python procedure actionListenerProc. &lt;br /&gt;
        The actionListenerProc can be either a method or a global procedure. &lt;br /&gt;
        The following controls support XActionListener: &lt;br /&gt;
            UnoControlButton &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oActionListener = ActionListenerProcAdapter( actionListenerProc ) &lt;br /&gt;
        oControl.addActionListener( oActionListener ) &lt;br /&gt;
&lt;br /&gt;
    # This applies to... &lt;br /&gt;
    #   UnoControlCheckBox &lt;br /&gt;
    def addItemListenerProc( self, cCtrlName, itemListenerProc ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create an com.sun.star.awt.XItemListener object and add it to a control. &lt;br /&gt;
        A listener object is created which will call the python procedure itemListenerProc. &lt;br /&gt;
        The itemListenerProc can be either a method or a global procedure. &lt;br /&gt;
        The following controls support XActionListener: &lt;br /&gt;
            UnoControlCheckBox &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oActionListener = ItemListenerProcAdapter( itemListenerProc ) &lt;br /&gt;
        oControl.addItemListener( oActionListener ) &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Display the modal dialog. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def doModalDialog( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Display the dialog as a modal dialog.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.oDialogControl.setVisible( True ) &lt;br /&gt;
        self.oDialogControl.execute() &lt;br /&gt;
&lt;br /&gt;
    def endExecute( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Call this from within one of the listeners to end the modal dialog. &lt;br /&gt;
        For instance, the listener on your OK or Cancel button would call this to end the dialog. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.oDialogControl.endExecute() &lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# Example of Dialog box built by subclassing the DBModalDialog class. &lt;br /&gt;
&lt;br /&gt;
class Test1Dialog( DBModalDialog ): &lt;br /&gt;
    def __init__( self ): &lt;br /&gt;
        DBModalDialog.__init__( self ) &lt;br /&gt;
        self.setDialogPosition( 60, 50 ) &lt;br /&gt;
        self.setDialogSize( 150, 80 ) &lt;br /&gt;
        self.setDialogTitle( &amp;quot;My Test1 Dialog&amp;quot; ) &lt;br /&gt;
        self.addButton( &amp;quot;btnOK&amp;quot;, -10, -10, 30, 14, &amp;quot;OK&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnOK_clicked ) &lt;br /&gt;
        self.addButton( &amp;quot;btnCancel&amp;quot;, -50, -10, 30, 14, &amp;quot;Cancel&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnCancel_clicked ) &lt;br /&gt;
        self.nOkClicks = 0 &lt;br /&gt;
        self.nCancelClicks = 0 &lt;br /&gt;
&lt;br /&gt;
    # Called when the OK button is clicked. &lt;br /&gt;
    def btnOK_clicked( self, oActionEvent ): &lt;br /&gt;
        self.nOkClicks += 1 &lt;br /&gt;
&lt;br /&gt;
    # Called when the Cancel button is clicked. &lt;br /&gt;
    def btnCancel_clicked( self, oActionEvent ): &lt;br /&gt;
        self.nCancelClicks += 1 &lt;br /&gt;
&lt;br /&gt;
def Test1(): &lt;br /&gt;
    oTestDialog =  Test1Dialog() &lt;br /&gt;
&lt;br /&gt;
    # Display dialog box. &lt;br /&gt;
    # This does not return until the dialog box is dismissed. &lt;br /&gt;
    oTestDialog.doModalDialog() &lt;br /&gt;
    &lt;br /&gt;
    # Print out the global button click counters. &lt;br /&gt;
    print oTestDialog.nCancelClicks, oTestDialog.nOkClicks &lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# Example of modal creating a dialog box without subclassing DBModalDialog. &lt;br /&gt;
&lt;br /&gt;
# Global vars to keep track of button clicks. &lt;br /&gt;
nOkClicks = 0 &lt;br /&gt;
nCancelClicks = 0 &lt;br /&gt;
# Global procs, called as event listeners on button clicks. &lt;br /&gt;
def OKClicked( oActionEvent ): &lt;br /&gt;
    global nOkClicks &lt;br /&gt;
    nOkClicks += 1 &lt;br /&gt;
def CancelClicked( oActionEvent ): &lt;br /&gt;
    global nCancelClicks &lt;br /&gt;
    nCancelClicks += 1 &lt;br /&gt;
&lt;br /&gt;
# Create a modal dialog box without subclassing DBModalDialog. &lt;br /&gt;
def Test2(): &lt;br /&gt;
    oTestDialog = DBModalDialog( 60, 50, 150, 80, &amp;quot;My Test2 Dialog&amp;quot; ) &lt;br /&gt;
    oTestDialog.addButton( &amp;quot;btnOK&amp;quot;, -10, -10, 30, 14, &amp;quot;OK&amp;quot; ) &lt;br /&gt;
    oTestDialog.addButton( &amp;quot;btnCancel&amp;quot;, -50, -10, 30, 14, &amp;quot;Cancel&amp;quot; ) &lt;br /&gt;
    oTestDialog.addFixedText( &amp;quot;lbl01&amp;quot;, 10, 10, 30, 14, &amp;quot;Test1&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Install global event listener procs. &lt;br /&gt;
    # Use the addActionListenerProc() routine instead of supplying the event &lt;br /&gt;
    #  listener to the addButton() as in first example. &lt;br /&gt;
    oTestDialog.addActionListenerProc( &amp;quot;btnOK&amp;quot;, OKClicked ) &lt;br /&gt;
    oTestDialog.addActionListenerProc( &amp;quot;btnCancel&amp;quot;, CancelClicked ) &lt;br /&gt;
&lt;br /&gt;
    # Display dialog box. &lt;br /&gt;
    # This does not return until the dialog box is dismissed. &lt;br /&gt;
    oTestDialog.doModalDialog() &lt;br /&gt;
&lt;br /&gt;
    # Print out the global button click counters. &lt;br /&gt;
    print nCancelClicks, nOkClicks &lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# Example of Dialog box built by subclassing the DBModalDialog class. &lt;br /&gt;
&lt;br /&gt;
class ModalDoggieKittyMonkeyDialog( DBModalDialog ): &lt;br /&gt;
    def __init__( self ):        &lt;br /&gt;
        self.nNumDoggies = 0 &lt;br /&gt;
        self.nNumKitties = 0 &lt;br /&gt;
        self.nNumMonkeys = 0 &lt;br /&gt;
        self.bTails = False &lt;br /&gt;
        self.bOkay = False &lt;br /&gt;
&lt;br /&gt;
        DBModalDialog.__init__( self, 60, 50, 200, 90, &amp;quot;Doggie/Kitty/Monkey Dialog&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
        # Add an OK and a Cancel button. &lt;br /&gt;
        # Both buttons share an action listener named &amp;quot;self.btnOkOrCancel_clicked&amp;quot;. &lt;br /&gt;
        self.addButton( &amp;quot;btnOK&amp;quot;, -10, -10, 50, 14, &amp;quot;OK&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnOkOrCancel_clicked ) &lt;br /&gt;
        self.addButton( &amp;quot;btnCancel&amp;quot;, -10 - 50 - 10, -10, 50, 14, &amp;quot;Cancel&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnOkOrCancel_clicked ) &lt;br /&gt;
&lt;br /&gt;
        # Add three buttons. &lt;br /&gt;
        self.addButton( &amp;quot;btnDoggie&amp;quot;, 5, 10, 50, 14, &amp;quot;Add Doggie&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnDoggie_Clicked ) &lt;br /&gt;
        self.addButton( &amp;quot;btnKitty&amp;quot;, 5, 30, 50, 14, &amp;quot;Add Kitty&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnKitty_Clicked ) &lt;br /&gt;
        self.addButton( &amp;quot;btnMonkey&amp;quot;, 5, 50, 50, 14, &amp;quot;Add Monkey&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnMonkey_Clicked ) &lt;br /&gt;
&lt;br /&gt;
        # Add a label to the dialog. &lt;br /&gt;
        self.addFixedText( &amp;quot;lbl1&amp;quot;, 60, 10, 100, 14, &amp;quot;Add some doggies, kitties, and monkeys.&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
        # Add a checkbox to the dialog. &lt;br /&gt;
        self.addCheckBox( &amp;quot;chkTails&amp;quot;, 60, 30, 50, 14, &amp;quot;With tails&amp;quot;, &lt;br /&gt;
                          itemListenerProc = self.chkTails_changed ) &lt;br /&gt;
&lt;br /&gt;
    def btnOkOrCancel_clicked( self, oActionEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Called when the OK or Cancel button is clicked.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        if oActionEvent.Source.getModel().Name == &amp;quot;btnOK&amp;quot;: &lt;br /&gt;
            self.bOkay = True &lt;br /&gt;
        self.endExecute() &lt;br /&gt;
&lt;br /&gt;
    def btnDoggie_Clicked( self, oActionEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Called with the Doggie button is clicked.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.nNumDoggies += 1 &lt;br /&gt;
&lt;br /&gt;
    def btnKitty_Clicked( self, oActionEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Called with the Kitty button is clicked.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.nNumKitties += 1 &lt;br /&gt;
&lt;br /&gt;
    def btnMonkey_Clicked( self, oActionEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Called with the Monkey button is clicked.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.nNumMonkeys += 1 &lt;br /&gt;
&lt;br /&gt;
    def chkTails_changed( self, oItemEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Called when the Tails checkbox is clicked.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.bTails = self.getState( &amp;quot;chkTails&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def Test3(): &lt;br /&gt;
    oTestDialog = ModalDoggieKittyMonkeyDialog() &lt;br /&gt;
    oTestDialog.doModalDialog() &lt;br /&gt;
    &lt;br /&gt;
    # Print out the global button click counters. &lt;br /&gt;
    print oTestDialog.nNumDoggies, oTestDialog.nNumKitties, oTestDialog.nNumMonkeys &lt;br /&gt;
    print &amp;quot;okay:&amp;quot;,oTestDialog.bOkay,&amp;quot; tails:&amp;quot;,oTestDialog.bTails, oTestDialog.getState( &amp;quot;chkTails&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
#&amp;gt;&amp;gt;&amp;gt; import Danny.OOo.DialogLib &lt;br /&gt;
#&amp;gt;&amp;gt;&amp;gt; reload( Danny.OOo.DialogLib ); from Danny.OOo.DialogLib import * &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.ConfigLib.py&amp;diff=235914</id>
		<title>Danny.OOo.ConfigLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.ConfigLib.py&amp;diff=235914"/>
		<updated>2015-02-17T19:59:39Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Routines for working with the Configuration Manager. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.ConfigLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-20-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
# Danny&amp;#039;s libraries &lt;br /&gt;
from Danny.OOo.OOoLib import createUnoService, createUnoStruct &lt;br /&gt;
from Danny.OOo.OOoLib import makePropertyValue &lt;br /&gt;
from Danny.OOo.OOoLib import getServiceManager &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def getConfigAccess( cNodePath, bWriteAccess=False, bEnableSync=True, bLazyWrite=False ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;An easy way to obtain a configuration node from the configuration manager.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oConfigProvider = getServiceManager().createInstanceWithArguments( &lt;br /&gt;
   &amp;quot;com.sun.star.configuration.ConfigurationProvider&amp;quot;, &lt;br /&gt;
   ( makePropertyValue( &amp;quot;enablesync&amp;quot;, bEnableSync ), ) ) &lt;br /&gt;
    &lt;br /&gt;
    if bWriteAccess: &lt;br /&gt;
        cServiceName = &amp;quot;com.sun.star.configuration.ConfigurationUpdateAccess&amp;quot; &lt;br /&gt;
    else: &lt;br /&gt;
        cServiceName = &amp;quot;com.sun.star.configuration.ConfigurationAccess&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    oConfigAccess = oConfigProvider.createInstanceWithArguments( cServiceName, &lt;br /&gt;
        ( makePropertyValue( &amp;quot;nodepath&amp;quot;, cNodePath ), &lt;br /&gt;
          makePropertyValue( &amp;quot;lazywrite&amp;quot;, bLazyWrite ), ) ) &lt;br /&gt;
&lt;br /&gt;
    return oConfigAccess &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# oConfigAccess = getConfigAccess( &amp;quot;/org.openoffice.Office.Addons/AddonUI&amp;quot; ) &lt;br /&gt;
# oElement = oConfigAccess.getByName( &amp;quot;AddonMenu&amp;quot; ) &lt;br /&gt;
# tNames = oElement.getElementNames() &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.PrintToWriter.py&amp;diff=235913</id>
		<title>Danny.OOo.PrintToWriter.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.PrintToWriter.py&amp;diff=235913"/>
		<updated>2015-02-17T19:59:29Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This makes it easy and convenient to print a bunch of text into a Writer document. &lt;br /&gt;
&lt;br /&gt;
See the example routine in the module that shows how easy this module is to use, and how useful it can be. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.PrintToWriter.py &lt;br /&gt;
# &lt;br /&gt;
#   This makes it easy and convenient to print a bunch of text into &lt;br /&gt;
#    a Writer document. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-05-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
&lt;br /&gt;
# Danny&amp;#039;s libraries &lt;br /&gt;
from Danny.OOo.OOoLib import StarDesktop &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
com_sun_star_text_ControlCharacter_PARAGRAPH_BREAK  = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK&amp;quot; ) &lt;br /&gt;
com_sun_star_text_ControlCharacter_LINE_BREAK       = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.LINE_BREAK&amp;quot; ) &lt;br /&gt;
com_sun_star_text_ControlCharacter_HARD_HYPHEN      = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.HARD_HYPHEN&amp;quot; ) &lt;br /&gt;
com_sun_star_text_ControlCharacter_SOFT_HYPHEN      = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.SOFT_HYPHEN&amp;quot; ) &lt;br /&gt;
com_sun_star_text_ControlCharacter_HARD_SPACE       = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.HARD_SPACE&amp;quot; ) &lt;br /&gt;
com_sun_star_text_ControlCharacter_APPEND_PARAGRAPH = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.APPEND_PARAGRAPH&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class PrintToWriter: &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;A class which allows conveniently printing stuff into a Writer document. &lt;br /&gt;
    Very useful for debugging, general output purposes, or even for creating reports.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    def __init__( self ): &lt;br /&gt;
        self.oWriterDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, () ) &lt;br /&gt;
        self.oWriterText = self.oWriterDoc.getText() &lt;br /&gt;
        self.oWriterCursor = self.oWriterText.createTextCursor() &lt;br /&gt;
&lt;br /&gt;
    def writeLn( self, *args ): &lt;br /&gt;
        if len( args ) &amp;gt; 0: &lt;br /&gt;
            apply( self.write, args ) &lt;br /&gt;
        self.writeParagraphBreak() &lt;br /&gt;
&lt;br /&gt;
    def write( self, arg1, *argsRest ): &lt;br /&gt;
        self.writeOne( arg1 ) &lt;br /&gt;
        for arg in argsRest: &lt;br /&gt;
            self.writeTab() &lt;br /&gt;
            self.writeOne( arg ) &lt;br /&gt;
&lt;br /&gt;
    def writeOne( self, arg, bAbsorb=False ): &lt;br /&gt;
        self.writeString( str( arg ), bAbsorb ) &lt;br /&gt;
&lt;br /&gt;
    def writeTab( self, bAbsorb=False ): &lt;br /&gt;
        self.writeString( &amp;quot;\t&amp;quot;, bAbsorb ) &lt;br /&gt;
&lt;br /&gt;
    def writeParagraphBreak( self, bAbsorb=False ): &lt;br /&gt;
        self.writeControlCharacter( com_sun_star_text_ControlCharacter_PARAGRAPH_BREAK, bAbsorb ) &lt;br /&gt;
&lt;br /&gt;
    def writeString( self, cString, bAbsorb=False ): &lt;br /&gt;
        self.oWriterText.insertString( self.oWriterCursor, cString, bAbsorb ) &lt;br /&gt;
&lt;br /&gt;
    def writeControlCharacter( self, nCtrlChar, bAbsorb=False ): &lt;br /&gt;
        self.oWriterText.insertControlCharacter( self.oWriterCursor, nCtrlChar, bAbsorb ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def example_PrintToWriter(): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;An example of how to use the PrintToWriter class to trivially create &lt;br /&gt;
    a new Writer document, and write out text into it.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oOutput = PrintToWriter() &lt;br /&gt;
    oOutput.writeLn( &amp;quot;Hello World&amp;quot; ) &lt;br /&gt;
    oOutput.write( &amp;quot;String&amp;quot;, 123, 456.23, True ) &lt;br /&gt;
    oOutput.writeLn() &lt;br /&gt;
    oOutput.writeLn() &lt;br /&gt;
&lt;br /&gt;
    oOutput.writeLn( &amp;quot;Tab delimited values...&amp;quot; ) &lt;br /&gt;
    &lt;br /&gt;
    oOutput.write( 123 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 456 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 789 ) &lt;br /&gt;
    oOutput.writeLn() &lt;br /&gt;
    &lt;br /&gt;
    oOutput.write( 465 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 522 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 835 ) &lt;br /&gt;
    oOutput.writeLn() &lt;br /&gt;
    &lt;br /&gt;
    oOutput.write( 886 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 164 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 741 ) &lt;br /&gt;
    oOutput.writeLn()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.HSBConversions.py&amp;diff=235912</id>
		<title>Danny.HSBConversions.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.HSBConversions.py&amp;diff=235912"/>
		<updated>2015-02-17T19:59:04Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;HSB to RGB color space conversion routines. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.HSBConversions.py &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2003-08-21-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#   HSB to RGB color space conversion routines. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def RGBtoHSB( nRed, nGreen, nBlue ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;RGB to HSB color space conversion routine. &lt;br /&gt;
    nRed, nGreen and nBlue are all numbers from 0 to 255. &lt;br /&gt;
    This routine returns three floating point numbers, nHue, nSaturation, nBrightness. &lt;br /&gt;
    nHue, nSaturation and nBrightness are all from 0.0 to 1.0. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    nMin = min( nRed, nGreen, nBlue ) &lt;br /&gt;
    nMax = max( nRed, nGreen, nBlue ) &lt;br /&gt;
&lt;br /&gt;
    if nMin == nMax: &lt;br /&gt;
        # Grayscale &lt;br /&gt;
        nHue = 0.0 &lt;br /&gt;
        nSaturation = 0.0 &lt;br /&gt;
        nBrightness = nMax &lt;br /&gt;
    else: &lt;br /&gt;
        if nRed == nMin: &lt;br /&gt;
            d = nGreen = nBlue &lt;br /&gt;
            h = 3.0 &lt;br /&gt;
        elif nGreen == nMin: &lt;br /&gt;
            d = nBlue - nRed &lt;br /&gt;
            h = 5.0 &lt;br /&gt;
        else: &lt;br /&gt;
            d = nRed - nGreen &lt;br /&gt;
            h = 1.0 &lt;br /&gt;
&lt;br /&gt;
        nHue = ( h - ( float( d ) / (nMax - nMin) ) ) / 6.0 &lt;br /&gt;
        nSaturation = (nMax - nMin) / float( nMax ) &lt;br /&gt;
        nBrightness = nMax / 255.0 &lt;br /&gt;
&lt;br /&gt;
    return nHue, nSaturation, nBrightness &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def HSBtoRGB( nHue, nSaturation, nBrightness ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;HSB to RGB color space conversion routine. &lt;br /&gt;
    nHue, nSaturation and nBrightness are all from 0.0 to 1.0. &lt;br /&gt;
    This routine returns three integer numbers, nRed, nGreen, nBlue. &lt;br /&gt;
    nRed, nGreen and nBlue are all numbers from 0 to 255. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    # Scale the brightness from a range of 0.0 thru 1.0 &lt;br /&gt;
    #  to a range of 0.0 thru 255.0 &lt;br /&gt;
    # Then truncate to an integer. &lt;br /&gt;
    nBrightness = int( min( nBrightness * 256.0, 255.0 ) ) &lt;br /&gt;
&lt;br /&gt;
    if nSaturation == 0.0: &lt;br /&gt;
        # Grayscale because there is no saturation &lt;br /&gt;
        nRed = nBrightness &lt;br /&gt;
        nGreen = nBrightness &lt;br /&gt;
        nBlue = nBrightness &lt;br /&gt;
    else: &lt;br /&gt;
        # Make hue angle be within a single rotation. &lt;br /&gt;
        # If the hue is &amp;gt; 1.0 or &amp;lt; 0.0, then it has &lt;br /&gt;
        #  &amp;quot;gone around the color wheel&amp;quot; too many times. &lt;br /&gt;
        #  For example, a value of 1.2 means that it has &lt;br /&gt;
        #  gone around the wheel 1.2 times, which is really &lt;br /&gt;
        #  the same ending angle as 0.2 trips around the wheel. &lt;br /&gt;
        # Scale it back to the 0.0 to 1.0 range. &lt;br /&gt;
        if nHue &amp;gt; 1.0: &lt;br /&gt;
            nHue = nHue - int( nHue ) &lt;br /&gt;
        elif nHue &amp;lt; 0.0: &lt;br /&gt;
            nHue = abs( nHue ) &lt;br /&gt;
            if nHue &amp;gt; 1.0: &lt;br /&gt;
                nHue = nHue - int( nHue ) &lt;br /&gt;
            nHue = 1.0 - nHue &lt;br /&gt;
        # Rescale hue to a range of 0.0 thru 6.0 &lt;br /&gt;
        nHue = nHue * 6.0 &lt;br /&gt;
        # Separate hue into int and fractional parts &lt;br /&gt;
        iHue = int( nHue ) &lt;br /&gt;
        fHue = nHue - iHue &lt;br /&gt;
        # Is hue even? &lt;br /&gt;
        if iHue % 2 == 0: &lt;br /&gt;
            fHue = 1.0 - fHue &lt;br /&gt;
        # &lt;br /&gt;
        m = nBrightness * (1.0 - nSaturation) &lt;br /&gt;
        n = nBrightness * (1.0 - (nSaturation * fHue)) &lt;br /&gt;
&lt;br /&gt;
        if iHue == 1: &lt;br /&gt;
            nRed = n &lt;br /&gt;
            nGreen = nBrightness &lt;br /&gt;
            nBlue = m &lt;br /&gt;
        elif iHue == 2: &lt;br /&gt;
            nRed = m &lt;br /&gt;
            nGreen = nBrightness &lt;br /&gt;
            nBlue = n &lt;br /&gt;
        elif iHue == 3: &lt;br /&gt;
            nRed = m &lt;br /&gt;
            nGreen = n &lt;br /&gt;
            nBlue = nBrightness &lt;br /&gt;
        elif iHue == 4: &lt;br /&gt;
            nRed = n &lt;br /&gt;
            nGreen = m &lt;br /&gt;
            nBlue = nBrightness &lt;br /&gt;
        elif iHue == 5: &lt;br /&gt;
            nRed = nBrightness &lt;br /&gt;
            nGreen = m &lt;br /&gt;
            nBlue = n &lt;br /&gt;
        else: &lt;br /&gt;
            nRed = nBrightness &lt;br /&gt;
            nGreen = n &lt;br /&gt;
            nBlue = m &lt;br /&gt;
    &lt;br /&gt;
    return nRed, nGreen, nBlue &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.DrawLib.py&amp;diff=235911</id>
		<title>Danny.OOo.DrawLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.DrawLib.py&amp;diff=235911"/>
		<updated>2015-02-17T19:58:46Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module has routines to make programming OOo Drawing documents easier. Much of this code was derrived from Basic code, that also appears in Danny&amp;#039;s Draw Power Tools found at OOoMacros.org. &lt;br /&gt;
&lt;br /&gt;
This module depends upon the modules... &lt;br /&gt;
* [[Danny.OOo.OOoLib.py]]&lt;br /&gt;
* [[Danny.HSBConversions.py]]&lt;br /&gt;
presented elsewhere in this thread. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.DrawLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OOo Drawings. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-05-24-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Python libraries &lt;br /&gt;
import math &lt;br /&gt;
import string &lt;br /&gt;
&lt;br /&gt;
# Danny&amp;#039;s libraries &lt;br /&gt;
from Danny import HSBConversions &lt;br /&gt;
from Danny.OOo.OOoLib import * &lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Functions for working with Draw documents. &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeDrawDocument(): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new OOo Draw document.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return loadComponentFromURL( &amp;quot;private:factory/sdraw&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
def makeImpressDocument(): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new OOo Impress document.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return loadComponentFromURL( &amp;quot;private:factory/simpress&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Notes about some properties and constants for shape objects... &lt;br /&gt;
&lt;br /&gt;
    # LineStyle can be one of... &lt;br /&gt;
    #   com.sun.star.drawing.LineStyle.NONE &lt;br /&gt;
    #   com.sun.star.drawing.LineStyle.SOLID &lt;br /&gt;
    #   com.sun.star.drawing.LineStyle.DASH &lt;br /&gt;
&lt;br /&gt;
    # CircleKind can be one of... &lt;br /&gt;
    #   com.sun.star.drawing.CircleKind.FULL &lt;br /&gt;
    #   com.sun.star.drawing.CircleKind.SECTION   &amp;#039; a circle with a cut connected by two lines &lt;br /&gt;
    #   com.sun.star.drawing.CircleKind.CUT &amp;#039; a circle with a cut connected by a line &lt;br /&gt;
    #   com.sun.star.drawing.CircleKind.ARC &amp;#039; a circle with an open cut &lt;br /&gt;
    &lt;br /&gt;
    # FillStyle can be one of... &lt;br /&gt;
    #   com.sun.star.drawing.FillStyle.NONE &lt;br /&gt;
    #   com.sun.star.drawing.FillStyle.SOLID &lt;br /&gt;
    #   com.sun.star.drawing.FillStyle.GRADIENT &lt;br /&gt;
    #   com.sun.star.drawing.FillStyle.HATCH &lt;br /&gt;
    #   com.sun.star.drawing.FillStyle.BITMAP &lt;br /&gt;
    &lt;br /&gt;
    # TextHorizontalAdjust can be one of... &lt;br /&gt;
    #   com.sun.star.drawing.TextHorizontalAdjust.LEFT &lt;br /&gt;
    #   com.sun.star.drawing.TextHorizontalAdjust.CENTER &lt;br /&gt;
    #   com.sun.star.drawing.TextHorizontalAdjust.RIGHT &lt;br /&gt;
    #   com.sun.star.drawing.TextHorizontalAdjust.BLOCK &lt;br /&gt;
    &lt;br /&gt;
    # TextVerticalAdjust can be one of... &lt;br /&gt;
    #   com.sun.star.drawing.TextVerticalAdjust.TOP &lt;br /&gt;
    #   com.sun.star.drawing.TextVerticalAdjust.CENTER &lt;br /&gt;
    #   com.sun.star.drawing.TextVerticalAdjust.BOTTOM &lt;br /&gt;
    #   com.sun.star.drawing.TextVerticalAdjust.BLOCK &lt;br /&gt;
    &lt;br /&gt;
    # TextFitToSize can be one of... &lt;br /&gt;
    #    com.sun.star.drawing.TextFitToSizeType.NONE &lt;br /&gt;
    #    com.sun.star.drawing.TextFitToSizeType.PROPORTIONAL &lt;br /&gt;
    #    com.sun.star.drawing.TextFitToSizeType.ALLLINES &lt;br /&gt;
    #    com.sun.star.drawing.TextFitToSizeType.RESIZEATTR &lt;br /&gt;
&lt;br /&gt;
# Useful code snippets... &lt;br /&gt;
&lt;br /&gt;
    # Accessing pages of a drawing document. &lt;br /&gt;
    #   oDrawPage = oDrawDoc.getDrawPages().getByIndex( 0 ) &lt;br /&gt;
    #   oDrawPage = oDrawDoc.getDrawPages().getCount() &lt;br /&gt;
    #   oDrawPage = oDrawDoc.getDrawPages().insertByIndex( 1 ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Document functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def setDrawPageOrientationLandscape( oDrawPage ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Pass in any GenericDrawPage object, and this changes it to landscape orientation, &lt;br /&gt;
     in addition to swapping the height/width as you would expect. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    # Save some settings &lt;br /&gt;
    nOldWidth = oDrawPage.Width &lt;br /&gt;
    nOldHeight = oDrawPage.Height &lt;br /&gt;
    nOldBorderTop = oDrawPage.BorderTop &lt;br /&gt;
    nOldBorderLeft = oDrawPage.BorderLeft &lt;br /&gt;
    nOldBorderRight = oDrawPage.BorderRight &lt;br /&gt;
    nOldBorderBottom = oDrawPage.BorderBottom &lt;br /&gt;
    &lt;br /&gt;
    # Change so that it will PRINT in landscape &lt;br /&gt;
    oDrawPage.Orientation = uno.getConstantByName( &amp;quot;com.sun.star.view.PaperOrientation.LANDSCAPE&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Now change some paper dimensions to match &lt;br /&gt;
    oDrawPage.Width = nOldHeight &lt;br /&gt;
    oDrawPage.Height = nOldWidth &lt;br /&gt;
    oDrawPage.BorderTop = nOldBorderRight &lt;br /&gt;
    oDrawPage.BorderLeft = nOldBorderTop &lt;br /&gt;
    oDrawPage.BorderRight = nOldBorderBottom &lt;br /&gt;
    oDrawPage.BorderBottom = nOldBorderLeft &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Shape functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeRectangleShape( oDrawDoc, oPosition=None, oSize=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new RectangleShape with an optional position and size.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oShape = makeShape( oDrawDoc, &amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;, oPosition, oSize ) &lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeEllipseShape( oDrawDoc, oPosition=None, oSize=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new EllipseShape with an optional position and size.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oShape = makeShape( oDrawDoc, &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot;, oPosition, oSize ) &lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeLineShape( oDrawDoc, oPosition=None, oSize=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new LineShape with an optional position and size.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oShape = makeShape( oDrawDoc, &amp;quot;com.sun.star.drawing.LineShape&amp;quot;, oPosition, oSize ) &lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeTextShape( oDrawDoc, oPosition=None, oSize=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new TextShape with an optional position and size.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oShape = makeShape( oDrawDoc, &amp;quot;com.sun.star.drawing.TextShape&amp;quot;, oPosition, oSize ) &lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def findShapeByName( oShapes, cShapeName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Find a named shape within an XShapes interface. &lt;br /&gt;
    oShapes can be a drawing page, which supports the XShapes interface. &lt;br /&gt;
    Thus, you can find a named shape within a draw page, or within a grouped shape, &lt;br /&gt;
     or within a selection of sseveral shapes. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    nNumShapes = oShapes.getCount() &lt;br /&gt;
    for i in range( nNumShapes ): &lt;br /&gt;
        oShape = oShapes.getByIndex( i ) &lt;br /&gt;
        cTheShapeName = oShape.getName() &lt;br /&gt;
        if cTheShapeName == cShapeName: &lt;br /&gt;
            return oShape &lt;br /&gt;
    return None &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeShape( oDrawDoc, cShapeClassName, oPosition=None, oSize=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new shape of the specified class. &lt;br /&gt;
    Position and size arguments are optional. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oShape = oDrawDoc.createInstance( cShapeClassName ) &lt;br /&gt;
&lt;br /&gt;
    if oPosition != None: &lt;br /&gt;
        oShape.Position = oPosition &lt;br /&gt;
    if oSize != None: &lt;br /&gt;
        oShape.Size = oSize &lt;br /&gt;
&lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Color manipulation &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def rgbColor( nRed, nGreen, nBlue ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return an integer which repsents a color. &lt;br /&gt;
    The color is specified in RGB notation. &lt;br /&gt;
    Each of nRed, nGreen and nBlue must be a number from 0 to 255. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return (int( nRed ) &amp;amp; 255) &amp;lt;&amp;lt; 16 | (int( nGreen ) &amp;amp; 255) &amp;lt;&amp;lt; 8 | (int( nBlue ) &amp;amp; 255) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def hsbColor( nHue, nSaturation, nBrightness ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return an integer which repsents a color. &lt;br /&gt;
    The color is specified in HSB notation. &lt;br /&gt;
    Each of nHue, nSaturation and nBrightness must be a number from 0.0 to 1.0. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    nRed, nGreen, nBlue = HSBConversions.HSBtoRGB( nHue, nSaturation, nBrightness ) &lt;br /&gt;
    return rgbColor( nRed, nGreen, nBlue ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def redColor( nColor ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return the Red component of a color as an integer from 0 to 255. &lt;br /&gt;
    nColor is an integer representing a color. &lt;br /&gt;
    This function is complimentary to the rgbColor function. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return (int( nColor ) &amp;gt;&amp;gt; 16) &amp;amp; 255 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def greenColor( nColor ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return the Green component of a color as an integer from 0 to 255. &lt;br /&gt;
    nColor is an integer representing a color. &lt;br /&gt;
    This function is complimentary to the rgbColor function. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return (int( nColor ) &amp;gt;&amp;gt; 8) &amp;amp; 255 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def blueColor( nColor ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return the Blue component of a color as an integer from 0 to 255. &lt;br /&gt;
    nColor is an integer representing a color. &lt;br /&gt;
    This function is complimentary to the rgbColor function. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return int( nColor ) &amp;amp; 255 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Drawing routines &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Multiply this number by an OOo angle in 100&amp;#039;ths of a degree &lt;br /&gt;
#  to convert to radians. &lt;br /&gt;
nRadiansPerHundredthDegree = math.pi / 18000 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def drawLine( oDrawDoc, oDrawPage, x1,y1, x2,y2, nLineColor=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Draw a line from x1,y1 to x2,y2.  Optionally specify line color. &lt;br /&gt;
    This adds the LineShape to the page. &lt;br /&gt;
    The LineShape is returned. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    # make sure size is non-zero &lt;br /&gt;
    #if x1 = x2: x2 = x1 + 1 &lt;br /&gt;
    #if y1 = y2: y2 = y1 + 1 &lt;br /&gt;
&lt;br /&gt;
    oPosition = makePoint( x1, y1 ) &lt;br /&gt;
    oSize = makeSize( x2-x1, y2-y1 ) &lt;br /&gt;
&lt;br /&gt;
    oShape = makeLineShape( oDrawDoc, oPosition, oSize ) &lt;br /&gt;
&lt;br /&gt;
    if nLineColor != None: &lt;br /&gt;
        oShape.LineColor = nLineColor &lt;br /&gt;
    #oShape.LineWidth = 0 &lt;br /&gt;
&lt;br /&gt;
    oDrawPage.add( oShape ) &lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def drawLineVector( oDrawDoc, oDrawPage, x1,y1, nAngle,nDistance, nLineColor=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Draw a line from x1,y1 in the direction of nAngle, for a distance of nDistance. &lt;br /&gt;
    nAngle is measured in radians, clockwise from the 3 O&amp;#039;Clock (east) direction. &lt;br /&gt;
    nDistance is in 1000ths of a centimeter. &lt;br /&gt;
    This adds the LineShape to the page. &lt;br /&gt;
    The LineShape is returned. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    nDX = math.cos( nAngle ) * nDistance &lt;br /&gt;
    nDY = math.sin( nAngle ) * nDistance &lt;br /&gt;
&lt;br /&gt;
    return drawLine( oDrawDoc, oDrawPage, x1,y1, x1+nDX,y1+nDY, nLineColor ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def drawAutoSizingText( oDrawDoc, oDrawPage, &lt;br /&gt;
                        cText, nHeight, nExtraWidthPercent=40 ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a TextShape that will automatically resize its characters &lt;br /&gt;
     to its shape bounding rectangle. &lt;br /&gt;
    The TextShape is created with a specified height. &lt;br /&gt;
    The width is determined based on the natural character width of the &lt;br /&gt;
     text. &lt;br /&gt;
    The initial position of the text is -10000,-10000, so that the text is not visible. &lt;br /&gt;
    This returns the TextShape, which has already been added to the drawing page, &lt;br /&gt;
     at coordinates which make it invisible. &lt;br /&gt;
    You must set the object&amp;#039;s Position property to make the text visible. &lt;br /&gt;
    (Hint: You may look at the Size property to help you determine where &lt;br /&gt;
     you want to place the text, for instance if you are trying to center &lt;br /&gt;
     it, or place it relative to some other shape object.) &lt;br /&gt;
    If you don&amp;#039;t supply nExtraWidthPercent, then a default fudge factor is used. &lt;br /&gt;
    This is the percentage of the average character width, which is added to the shape&amp;#039;s &lt;br /&gt;
     total width. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    # Create TextShape &lt;br /&gt;
    oShape = makeTextShape( oDrawDoc, makePoint( -10000, -10000 ), makeSize( 1, 1 ) ) &lt;br /&gt;
&lt;br /&gt;
    # Add it to the page. &lt;br /&gt;
    oDrawPage.add( oShape ) &lt;br /&gt;
&lt;br /&gt;
    # Make text stick to upper left corner of the shape rather than centered within the shape. &lt;br /&gt;
    oShape.TextHorizontalAdjust = uno.getConstantByName( &amp;quot;com.sun.star.drawing.TextHorizontalAdjust.LEFT&amp;quot; ) &lt;br /&gt;
    oShape.TextVerticalAdjust = uno.getConstantByName( &amp;quot;com.sun.star.drawing.TextVerticalAdjust.TOP&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Make the shape auto-grow in size, based on the text. &lt;br /&gt;
    # Once we set the text, in the next step, the shape will grow to some &lt;br /&gt;
    #  unknown size, based on the current font in use. &lt;br /&gt;
    #oShape.TextAutoGrowHeight = True &lt;br /&gt;
    oShape.TextAutoGrowWidth = True &lt;br /&gt;
&lt;br /&gt;
    # Set the text of the TextShape. &lt;br /&gt;
    # Because of the TextAutoGrowWidth, the shape now occupies some unknown size. &lt;br /&gt;
    oShape.setString( cText ) &lt;br /&gt;
&lt;br /&gt;
    # Get the shape&amp;#039;s current size. &lt;br /&gt;
    nSaveHeight = oShape.Size.Height &lt;br /&gt;
    nSaveWidth = oShape.Size.Width &lt;br /&gt;
&lt;br /&gt;
    # Make the shape NOT auto-grow in size, based on the text. &lt;br /&gt;
    #oShape.TextAutoGrowHeight = False &lt;br /&gt;
    oShape.TextAutoGrowWidth = False &lt;br /&gt;
&lt;br /&gt;
    # This next setting causes the TextShape to automatically resize its characters &lt;br /&gt;
    #  to fit the size of the text shape. &lt;br /&gt;
    oShape.TextFitToSize = uno.getConstantByName( &amp;quot;com.sun.star.drawing.TextFitToSizeType.PROPORTIONAL&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Calculate the new width, based on the desired height, &lt;br /&gt;
    #  and saved width/height ratio for the current font in use. &lt;br /&gt;
    nWidth = nSaveWidth * (float(nHeight) / nSaveHeight) &lt;br /&gt;
&lt;br /&gt;
    nAverageCharacterWidth = nWidth / len( cText ) &lt;br /&gt;
&lt;br /&gt;
    nExtraWidth = nAverageCharacterWidth * (nExtraWidthPercent / 100.0) &lt;br /&gt;
&lt;br /&gt;
    oShape.TextLeftDistance = nExtraWidth &lt;br /&gt;
    oShape.TextRightDistance = nExtraWidth &lt;br /&gt;
    nWidth = nWidth + 2 * nExtraWidth &lt;br /&gt;
&lt;br /&gt;
    # Now resize the TextShape. &lt;br /&gt;
    oShape.Size.Width = nWidth &lt;br /&gt;
    oShape.Size.Height = nHeight &lt;br /&gt;
&lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def drawArcPath( oDrawDoc, oDrawPage, &lt;br /&gt;
                 nStartX, nStartY, nStartAngle, &lt;br /&gt;
                 nArcAngle, nArcRadius, bTurnLeft ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Draw an arc of a circle from a starting position and direction. &lt;br /&gt;
    The arc has a certian radius and arc angle, &lt;br /&gt;
     and turns either to the left or to the right. &lt;br /&gt;
    Parameters: &lt;br /&gt;
    nStartX and nStartY are the starting position of the &amp;quot;turtle&amp;quot;. &lt;br /&gt;
    nStartAngle is the angle direction that the turtle is pointing, &lt;br /&gt;
     in 100&amp;#039;ths of a degree. &lt;br /&gt;
    An arc is drawn by moving the turtle forward and turning either left or right as it moves. &lt;br /&gt;
    nArcAngle is the angle of the arc describing the turtle&amp;#039;s path, &lt;br /&gt;
     in 100&amp;#039;ths of a degree. &lt;br /&gt;
    nArcRadius is the radius of the arc describing the turtle&amp;#039;s path. &lt;br /&gt;
    bTurnLeft is True if the turtle turns to the left, or False to turn to the right. &lt;br /&gt;
    Four values are returned. &lt;br /&gt;
    (1) the circle shape, (2) the new X position, (3) new Y position, and (4) new angle. &lt;br /&gt;
    Use the last three return values as initial values to draw another arc &lt;br /&gt;
     which is connected to the ending position of the arc just drawn. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # Figure out how big of a circle that the arc is a part of. &lt;br /&gt;
    nCircleDiameter = nArcRadius + nArcRadius &lt;br /&gt;
    oCircleSize = makeSize( nCircleDiameter, nCircleDiameter ) &lt;br /&gt;
&lt;br /&gt;
    # Figure out the position of the circle (ellipse) shape object. &lt;br /&gt;
    # &lt;br /&gt;
    # Determine the angle of the center point from the starting position. &lt;br /&gt;
    if bTurnLeft: &lt;br /&gt;
        nCenterPointAngle = nStartAngle + 9000 &lt;br /&gt;
    else: &lt;br /&gt;
        nCenterPointAngle = nStartAngle - 9000 &lt;br /&gt;
    # Convert to radians. &lt;br /&gt;
    nCenterPointAngle = nCenterPointAngle * nRadiansPerHundredthDegree &lt;br /&gt;
    # Determine where the center of the circle shape should be. &lt;br /&gt;
    nCenterX = nStartX + (nArcRadius * math.cos( nCenterPointAngle )) &lt;br /&gt;
    nCenterY = nStartY - (nArcRadius * math.sin( nCenterPointAngle )) &lt;br /&gt;
    oCirclePosition = makePoint( nCenterX - nArcRadius, nCenterY - nArcRadius ) &lt;br /&gt;
&lt;br /&gt;
    # Figure out what arc portion of the circle needs to be drawn. &lt;br /&gt;
    # Angles measures in 100&amp;#039;ths of a degree. &lt;br /&gt;
    if bTurnLeft: &lt;br /&gt;
        nCircleStartAngle = nStartAngle - 9000 &lt;br /&gt;
        nCircleEndAngle = nCircleStartAngle + nArcAngle &lt;br /&gt;
    else: &lt;br /&gt;
        nCircleEndAngle = nStartAngle + 9000 &lt;br /&gt;
        nCircleStartAngle = nCircleEndAngle - nArcAngle &lt;br /&gt;
  &lt;br /&gt;
    # Make the circle shape. &lt;br /&gt;
    oCircle = makeEllipseShape( oDrawDoc, oCirclePosition, oCircleSize ) &lt;br /&gt;
    # Fill in its properties &lt;br /&gt;
    oCircle.FillStyle = uno.getConstantByName( &amp;quot;com.sun.star.drawing.FillStyle.NONE&amp;quot; ) &lt;br /&gt;
    oCircle.CircleKind = uno.getConstantByName( &amp;quot;com.sun.star.drawing.CircleKind.ARC&amp;quot; ) &lt;br /&gt;
    oCircle.CircleStartAngle = nCircleStartAngle &lt;br /&gt;
    oCircle.CircleEndAngle = nCircleEndAngle &lt;br /&gt;
    # Put it on the drawing &lt;br /&gt;
    oDrawPage.add( oCircle ) &lt;br /&gt;
&lt;br /&gt;
    # Figure out the ending turtle location and direction. &lt;br /&gt;
    if bTurnLeft: &lt;br /&gt;
        nEndAngle = nStartAngle - 9000 + nArcAngle &lt;br /&gt;
    else: &lt;br /&gt;
        nEndAngle = nStartAngle + 9000 - nArcAngle &lt;br /&gt;
    # Convert to radians &lt;br /&gt;
    nEndAngleRad = nEndAngle * nRadiansPerHundredthDegree &lt;br /&gt;
    # Ending Position &lt;br /&gt;
    nEndX = nCenterX + (nArcRadius * math.cos( nEndAngleRad )) &lt;br /&gt;
    nEndY = nCenterY - (nArcRadius * math.sin( nEndAngleRad )) &lt;br /&gt;
    # Ending angle &lt;br /&gt;
    if bTurnLeft: &lt;br /&gt;
        nEndAngle = normalizeOOoAngle( nEndAngle + 9000 ) &lt;br /&gt;
    else: &lt;br /&gt;
        nEndAngle = normalizeOOoAngle( nEndAngle - 9000 ) &lt;br /&gt;
&lt;br /&gt;
    return oCircle, nEndX, nEndY, nEndAngle &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def drawSpiralOfArcs( oDrawDoc, oDrawPage, &lt;br /&gt;
                      nStartX, nStartY, nStartAngle, &lt;br /&gt;
                      nArcAngle, nArcRadius, bTurnLeft, &lt;br /&gt;
                      nNumArcs, &lt;br /&gt;
                      nRadiusGrowthMultiplier=1.0, nRadiusGrowthAddIn=0 ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Draw a spiral starting from a certian position and direction. &lt;br /&gt;
    The spiral turns either towards the left or towards the right. &lt;br /&gt;
    Parameters: &lt;br /&gt;
    nStartX and nStartY are the starting position of the &amp;quot;turtle&amp;quot;. &lt;br /&gt;
    nStartAngle is the angle direction that the turtle is pointing, &lt;br /&gt;
     in 100&amp;#039;ths of a degree. &lt;br /&gt;
    A spiral is drawn by moving the turtle forward and turning either left or right as it moves. &lt;br /&gt;
    nArcAngle is the angle of the first arc of the spiral, &lt;br /&gt;
     in 100&amp;#039;ths of a degree. &lt;br /&gt;
    nArcRadius is the radius of the first arc of the spiral. &lt;br /&gt;
    bTurnLeft is True if the turtle turns to the left, or False to turn to the right. &lt;br /&gt;
    nNumArcs is the number of arcs which are drawn. &lt;br /&gt;
    nRadiusGrowthMultiplier - the radius of the arc is multiplied by this after each arc is drawn. &lt;br /&gt;
     Use a number such as 1.1 to cause the radius to grow geometrically as the spiral turns. &lt;br /&gt;
    nRadiusGrowthAddIn - this is added to the radius after each arc. &lt;br /&gt;
     Use a number, such as the original nArcRadius / number of arcs in a complete circle to cause the radius to grow arithmeteically as the spiral turns. &lt;br /&gt;
    Four values are returned. &lt;br /&gt;
    (1) the spiral shape, (2) the new X position, (3) new Y position, and (4) new angle. &lt;br /&gt;
    Use the last three return values as initial values to draw another arc &lt;br /&gt;
     which is connected to the ending position of the arc just drawn. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    nX = nStartX &lt;br /&gt;
    nY = nStartY &lt;br /&gt;
    nAngle = nStartAngle &lt;br /&gt;
&lt;br /&gt;
    oShapesToGroup = createUnoService( &amp;quot;com.sun.star.drawing.ShapeCollection&amp;quot; ) &lt;br /&gt;
    for i in range( nNumArcs - 1 ): &lt;br /&gt;
        oArcShape, nX, nY, nAngle = drawArcPath( oDrawDoc, oDrawPage, nX, nY, nAngle, nArcAngle, nArcRadius, bTurnLeft ) &lt;br /&gt;
        nArcRadius = nArcRadius * nRadiusGrowthMultiplier + nRadiusGrowthAddIn &lt;br /&gt;
&lt;br /&gt;
        oShapesToGroup.add( oArcShape ) &lt;br /&gt;
    oSpiralShape = oDrawPage.group( oShapesToGroup ) &lt;br /&gt;
    return oSpiralShape, nX, nY, nAngle &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Styles &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def defineGraphicsStyle( oDrawDoc, cStyleName, cParentStyleName=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Add a new style to the style catalog if it is not already present. &lt;br /&gt;
    This returns the style object so that you can alter its properties. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return defineStyle( oDrawDoc, &amp;quot;graphics&amp;quot;, cStyleName, cParentStyleName ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def getGraphicsStyle( oDrawDoc, cStyleName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Lookup and return a graphics style from the document. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return getStyle( oDrawDoc, &amp;quot;graphics&amp;quot;, cStyleName ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   General Utility functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
def normalizeOOoAngle( nAngleOOo ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Given an angle in 100&amp;#039;ths of a degree, &lt;br /&gt;
    adjust it to be from 0 to 360 degrees.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    if nAngleOOo &amp;lt; 0: &lt;br /&gt;
        nSign = -1 &lt;br /&gt;
    else: &lt;br /&gt;
        nSign = 1 &lt;br /&gt;
    nAngleOOo = nAngleOOo - (int( abs( nAngleOOo ) / 36000.0 ) * 36000 * nSign) &lt;br /&gt;
    if nAngleOOo &amp;lt; 0: &lt;br /&gt;
        nAngleOOo += 36000 &lt;br /&gt;
    return nAngleOOo &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.OOoLib.py&amp;diff=235910</id>
		<title>Danny.OOo.OOoLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.OOoLib.py&amp;diff=235910"/>
		<updated>2015-02-17T19:57:46Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module makes programming OOo in Python much more like programming OOo in Basic. It also contains some frequently used functions that I typically write in Basic, such as makePropertyValue(). &lt;br /&gt;
When I write Components in Python, the first function in this module, the getServiceManager() function is replaced by a completely different implementation. Otherwise, even in a component, the features of this module are available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.OOoLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-07-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
import string &lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Uno ServiceManager access &lt;br /&gt;
#   A different version of this routine and global variable &lt;br /&gt;
#    is needed for code running inside a component. &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The ServiceManager of the running OOo. &lt;br /&gt;
# It is cached in a global variable. &lt;br /&gt;
goServiceManager = False &lt;br /&gt;
def getServiceManager( cHost=&amp;quot;localhost&amp;quot;, cPort=&amp;quot;8100&amp;quot; ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Get the ServiceManager from the running OpenOffice.org. &lt;br /&gt;
        Then retain it in the global variable goServiceManager for future use. &lt;br /&gt;
        This is similar to the GetProcessServiceManager() in OOo Basic. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    global goServiceManager &lt;br /&gt;
    if not goServiceManager: &lt;br /&gt;
        # Get the uno component context from the PyUNO runtime &lt;br /&gt;
        oLocalContext = uno.getComponentContext() &lt;br /&gt;
        # Create the UnoUrlResolver on the Python side. &lt;br /&gt;
        oLocalResolver = oLocalContext.ServiceManager.createInstanceWithContext( &lt;br /&gt;
                                    &amp;quot;com.sun.star.bridge.UnoUrlResolver&amp;quot;, oLocalContext ) &lt;br /&gt;
        # Connect to the running OpenOffice.org and get its context. &lt;br /&gt;
        oContext = oLocalResolver.resolve( &amp;quot;uno:socket,host=&amp;quot; + cHost + &amp;quot;,port=&amp;quot; + cPort + &amp;quot;;urp;StarOffice.ComponentContext&amp;quot; ) &lt;br /&gt;
        # Get the ServiceManager object &lt;br /&gt;
        goServiceManager = oContext.ServiceManager &lt;br /&gt;
    return goServiceManager &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Uno convenience functions &lt;br /&gt;
#   The stuff in this section is just to make &lt;br /&gt;
#    python progrmaming of OOo more like using OOo Basic. &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This is the same as ServiceManager.createInstance( ... ) &lt;br /&gt;
def createUnoService( cClass ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;A handy way to create a global objects within the running OOo. &lt;br /&gt;
    Similar to the function of the same name in OOo Basic. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oServiceManager = getServiceManager() &lt;br /&gt;
    oObj = oServiceManager.createInstance( cClass ) &lt;br /&gt;
    return oObj &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The StarDesktop object.  (global like in OOo Basic) &lt;br /&gt;
# It is cached in a global variable. &lt;br /&gt;
StarDesktop = None &lt;br /&gt;
def getDesktop(): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;An easy way to obtain the Desktop object from a running OOo. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    global StarDesktop &lt;br /&gt;
    if StarDesktop == None: &lt;br /&gt;
        StarDesktop = createUnoService( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ) &lt;br /&gt;
    return StarDesktop &lt;br /&gt;
# preload the StarDesktop variable. &lt;br /&gt;
getDesktop() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The CoreReflection object. &lt;br /&gt;
# It is cached in a global variable. &lt;br /&gt;
goCoreReflection = False &lt;br /&gt;
def getCoreReflection(): &lt;br /&gt;
    global goCoreReflection &lt;br /&gt;
    if not goCoreReflection: &lt;br /&gt;
        goCoreReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; ) &lt;br /&gt;
    return goCoreReflection &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def createUnoStruct( cTypeName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a UNO struct and return it. &lt;br /&gt;
    Similar to the function of the same name in OOo Basic. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oCoreReflection = getCoreReflection() &lt;br /&gt;
    # Get the IDL class for the type name &lt;br /&gt;
    oXIdlClass = oCoreReflection.forName( cTypeName ) &lt;br /&gt;
    # Create the struct. &lt;br /&gt;
    oReturnValue, oStruct = oXIdlClass.createObject( None ) &lt;br /&gt;
    return oStruct &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#def newConnectionToOOo( cHost=&amp;quot;localhost&amp;quot;, cPort=&amp;quot;8100&amp;quot; ): &lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;Call this to establish, or re-establish a connection to OOo.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
#    global goServiceManager &lt;br /&gt;
#    global StarDesktop &lt;br /&gt;
#    global goCoreReflection &lt;br /&gt;
#    goServiceManager = False &lt;br /&gt;
#    StarDesktop = None &lt;br /&gt;
#    goCoreReflection = False &lt;br /&gt;
#    getServiceManager( cHost, cPort ) &lt;br /&gt;
#    getDesktop() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   API helpers &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
def hasUnoInterface( oObject, cInterfaceName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Similar to Basic&amp;#039;s HasUnoInterfaces() function, but singular not plural.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # Get the Introspection service. &lt;br /&gt;
    oIntrospection = createUnoService( &amp;quot;com.sun.star.beans.Introspection&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Now inspect the object to learn about it.    &lt;br /&gt;
    oObjInfo = oIntrospection.inspect( oObject ) &lt;br /&gt;
    &lt;br /&gt;
    # Obtain an array describing all methods of the object. &lt;br /&gt;
    oMethods = oObjInfo.getMethods( uno.getConstantByName( &amp;quot;com.sun.star.beans.MethodConcept.ALL&amp;quot; ) ) &lt;br /&gt;
    # Now look at every method. &lt;br /&gt;
    for oMethod in oMethods: &lt;br /&gt;
        # Check the method&amp;#039;s interface to see if &lt;br /&gt;
        #  these aren&amp;#039;t the droids you&amp;#039;re looking for. &lt;br /&gt;
        cMethodInterfaceName = oMethod.getDeclaringClass().getName() &lt;br /&gt;
        if cMethodInterfaceName == cInterfaceName: &lt;br /&gt;
            return True &lt;br /&gt;
    return False &lt;br /&gt;
&lt;br /&gt;
def hasUnoInterfaces( oObject, *cInterfaces ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Similar to the function of the same name in OOo Basic.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    for cInterface in cInterfaces: &lt;br /&gt;
        if not hasUnoInterface( oObject, cInterface ): &lt;br /&gt;
            return False &lt;br /&gt;
    return True &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   High level general purpose functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makePropertyValue( cName=None, uValue=None, nHandle=None, nState=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.beans.PropertyValue struct and return it. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oPropertyValue = createUnoStruct( &amp;quot;com.sun.star.beans.PropertyValue&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    if cName != None: &lt;br /&gt;
        oPropertyValue.Name = cName &lt;br /&gt;
    if uValue != None: &lt;br /&gt;
        oPropertyValue.Value = uValue &lt;br /&gt;
    if nHandle != None: &lt;br /&gt;
        oPropertyValue.Handle = nHandle &lt;br /&gt;
    if nState != None: &lt;br /&gt;
        oPropertyValue.State = nState &lt;br /&gt;
&lt;br /&gt;
    return oPropertyValue &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makePoint( nX, nY ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.awt.Point struct.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oPoint = createUnoStruct( &amp;quot;com.sun.star.awt.Point&amp;quot; ) &lt;br /&gt;
    oPoint.X = nX &lt;br /&gt;
    oPoint.Y = nY &lt;br /&gt;
    return oPoint &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeSize( nWidth, nHeight ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.awt.Size struct.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oSize = createUnoStruct( &amp;quot;com.sun.star.awt.Size&amp;quot; ) &lt;br /&gt;
    oSize.Width = nWidth &lt;br /&gt;
    oSize.Height = nHeight &lt;br /&gt;
    return oSize &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeRectangle( nX, nY, nWidth, nHeight ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.awt.Rectangle struct.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oRect = createUnoStruct( &amp;quot;com.sun.star.awt.Rectangle&amp;quot; ) &lt;br /&gt;
    oRect.X = nX &lt;br /&gt;
    oRect.Y = nY &lt;br /&gt;
    oRect.Width = nWidth &lt;br /&gt;
    oRect.Height = nHeight &lt;br /&gt;
    return oRect &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def Array( *args ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;This is just sugar coating so that code from OOoBasic which &lt;br /&gt;
    contains the Array() function can work perfectly in python.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    tArray = () &lt;br /&gt;
    for arg in args: &lt;br /&gt;
        tArray += (arg,) &lt;br /&gt;
    return tArray &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def loadComponentFromURL( cUrl, tProperties=() ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Open or Create a document from it&amp;#039;s URL. &lt;br /&gt;
    New documents are created from URL&amp;#039;s such as: &lt;br /&gt;
        private:factory/sdraw &lt;br /&gt;
        private:factory/swriter &lt;br /&gt;
        private:factory/scalc &lt;br /&gt;
        private:factory/simpress &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    StarDesktop = getDesktop() &lt;br /&gt;
    oDocument = StarDesktop.loadComponentFromURL( cUrl, &amp;quot;_blank&amp;quot;, 0, tProperties ) &lt;br /&gt;
    return oDocument &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#def makeWriterDocument(): &lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;Create a new OOo Writer document.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
#    return loadComponentFromURL( &amp;quot;private:factory/swriter&amp;quot; ) &lt;br /&gt;
# &lt;br /&gt;
# &lt;br /&gt;
#def makeCalcDocument(): &lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;Create a new OOo Calc document.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
#    return loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Styles &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def defineStyle( oDrawDoc, cStyleFamily, cStyleName, cParentStyleName=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Add a new style to the style catalog if it is not already present. &lt;br /&gt;
    This returns the style object so that you can alter its properties. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    oStyleFamily = oDrawDoc.getStyleFamilies().getByName( cStyleFamily ) &lt;br /&gt;
&lt;br /&gt;
    # Does the style already exist? &lt;br /&gt;
    if oStyleFamily.hasByName( cStyleName ): &lt;br /&gt;
        # then get it so we can return it. &lt;br /&gt;
        oStyle = oStyleFamily.getByName( cStyleName ) &lt;br /&gt;
    else: &lt;br /&gt;
        # Create new style object. &lt;br /&gt;
        oStyle = oDrawDoc.createInstance( &amp;quot;com.sun.star.style.Style&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
        # Set its parent style &lt;br /&gt;
        if cParentStyleName != None: &lt;br /&gt;
            oStyle.setParentStyle( cParentStyleName ) &lt;br /&gt;
&lt;br /&gt;
        # Add the new style to the style family. &lt;br /&gt;
        oStyleFamily.insertByName( cStyleName, oStyle ) &lt;br /&gt;
&lt;br /&gt;
    return oStyle &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def getStyle( oDrawDoc, cStyleFamily, cStyleName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Lookup and return a style from the document. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return oDrawDoc.getStyleFamilies().getByName( cStyleFamily ).getByName( cStyleName ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   General Utility functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def convertToURL( cPathname ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Convert a Windows or Linux pathname into an OOo URL.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    if len( cPathname ) &amp;gt; 1: &lt;br /&gt;
        if cPathname[1:2] == &amp;quot;:&amp;quot;: &lt;br /&gt;
            cPathname = &amp;quot;/&amp;quot; + cPathname[0] + &amp;quot;|&amp;quot; + cPathname[2:] &lt;br /&gt;
    cPathname = string.replace( cPathname, &amp;quot;\\&amp;quot;, &amp;quot;/&amp;quot; ) &lt;br /&gt;
    cPathname = &amp;quot;file://&amp;quot; + cPathname &lt;br /&gt;
    return cPathname &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.HeapSort&amp;diff=235909</id>
		<title>Danny.HeapSort</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.HeapSort&amp;diff=235909"/>
		<updated>2015-02-17T19:53:32Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is my HeapSort module. This is NOT an OOo related module, but I am posting it because someone asked..... &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.HeapSort.py &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2005 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2005-03-29 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def SwapItems( items, nIndex1, nIndex2 ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Swap two items in the sequence.  Return a new sequence with the swap. &lt;br /&gt;
    nIndex1 and nIndex2 are zero based.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    item1 = items[nIndex1] &lt;br /&gt;
    item2 = items[nIndex2] &lt;br /&gt;
    items[nIndex1] = item2 &lt;br /&gt;
    items[nIndex2] = item1 &lt;br /&gt;
    return items &lt;br /&gt;
&lt;br /&gt;
def ItemsCompareGreater( items, nIndex1, nIndex2 ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return True if the item at nIndex1 is greater than the item at nIndex2. &lt;br /&gt;
    nIndex1 and nIndex2 are zero based.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return items[nIndex1] &amp;gt; items[nIndex2] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def HeapSort( items, &lt;br /&gt;
                      compareGreaterProc=ItemsCompareGreater, &lt;br /&gt;
                      swapProc=SwapItems ): &lt;br /&gt;
    MakeHeap( items, compareGreaterProc, swapProc ) &lt;br /&gt;
    nNumItems = len( items ) &lt;br /&gt;
    for i in range( nNumItems-1, -1, -1 ): &lt;br /&gt;
        swapProc( items, 0, i ) &lt;br /&gt;
        SiftHeap( items, i, 0, compareGreaterProc, swapProc ) &lt;br /&gt;
    return items &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def MakeHeap( items, &lt;br /&gt;
                      compareGreaterProc=ItemsCompareGreater, &lt;br /&gt;
                      swapProc=SwapItems ): &lt;br /&gt;
    nNumItems = len( items ) &lt;br /&gt;
    for i in range( nNumItems-1, -1, -1 ): &lt;br /&gt;
        SiftHeap( items, nNumItems, i, compareGreaterProc, swapProc ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def SiftHeap( items, nHeapSize, nTheNode, &lt;br /&gt;
                      compareGreaterProc=ItemsCompareGreater, &lt;br /&gt;
                      swapProc=SwapItems ): &lt;br /&gt;
    nLargestNode = nTheNode &lt;br /&gt;
    while True: &lt;br /&gt;
        bNeedSwap = False &lt;br /&gt;
        nParentNode = nLargestNode &lt;br /&gt;
&lt;br /&gt;
        nChildNode = nParentNode+nParentNode+1 # left child &lt;br /&gt;
        if( nChildNode &amp;lt; nHeapSize and compareGreaterProc( items, nChildNode, nLargestNode ) ): &lt;br /&gt;
            nLargestNode = nChildNode &lt;br /&gt;
            bNeedSwap = True &lt;br /&gt;
&lt;br /&gt;
        nChildNode = nChildNode + 1 # right child &lt;br /&gt;
        if( nChildNode &amp;lt; nHeapSize and compareGreaterProc( items, nChildNode, nLargestNode ) ): &lt;br /&gt;
            nLargestNode = nChildNode &lt;br /&gt;
            bNeedSwap = True &lt;br /&gt;
&lt;br /&gt;
        if bNeedSwap: &lt;br /&gt;
            swapProc( items, nParentNode, nLargestNode ) &lt;br /&gt;
        else: &lt;br /&gt;
            break&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.WindowLib.py&amp;diff=235908</id>
		<title>Danny.OOo.WindowLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.WindowLib.py&amp;diff=235908"/>
		<updated>2015-02-17T19:51:03Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A class to build a modeless window from the com.sun.star.awt.* services. This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, this just makes it much easier. &lt;br /&gt;
&lt;br /&gt;
This class IS NOT the actual OOo window, but you can get the OOo window or frame by calling getWindow() or getFrame() on this class. &lt;br /&gt;
&lt;br /&gt;
You can change the window size, position, title, etc. You can add controls, and listeners for those controls to the window. This class can be used by subclassing it, or without subclassing it. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.WindowLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-05-02 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
# Danny&amp;#039;s libraries &lt;br /&gt;
from Danny.OOo.OOoLib import createUnoService, createUnoStruct &lt;br /&gt;
from Danny.OOo.OOoLib import makeRectangle, StarDesktop &lt;br /&gt;
# &lt;br /&gt;
from Danny.OOo.Listeners.ListenerProcAdapters import * &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#---------- &lt;br /&gt;
#   com.sun.star.awt.WindowAttribute &lt;br /&gt;
# &lt;br /&gt;
# specifies that the window is initially visible. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_SHOW        = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.SHOW&amp;quot; ) &lt;br /&gt;
# specifies that the window fills the complete desktop area. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_FULLSIZE    = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.FULLSIZE&amp;quot; ) &lt;br /&gt;
com_sun_star_awt_WindowAttribute_OPTIMUMSIZE = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.OPTIMUMSIZE&amp;quot; ) &lt;br /&gt;
com_sun_star_awt_WindowAttribute_MINSIZE     = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.MINSIZE&amp;quot; ) &lt;br /&gt;
# specifies that the window has visible borders. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_BORDER      = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.BORDER&amp;quot; ) &lt;br /&gt;
# specifies that the size of the window can be changed by the user. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_SIZEABLE    = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.SIZEABLE&amp;quot; ) &lt;br /&gt;
# specifies that the window can be moved by the user. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_MOVEABLE    = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.MOVEABLE&amp;quot; ) &lt;br /&gt;
# specifies that the window can be closed by the user. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_CLOSEABLE   = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.CLOSEABLE&amp;quot; ) &lt;br /&gt;
#[ DEPRECATED ] specifies that the window should support the XSystemDependentWindowPeer interface. &lt;br /&gt;
com_sun_star_awt_WindowAttribute_SYSTEMDEPENDENT = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowAttribute.SYSTEMDEPENDENT&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Default window attributes. &lt;br /&gt;
# The DBWindow class (and subclasses) use this as the default window attributes &lt;br /&gt;
#  when you don&amp;#039;t specify any window attributes on the constructor. &lt;br /&gt;
gnDefaultWindowAttributes = \ &lt;br /&gt;
        com_sun_star_awt_WindowAttribute_SHOW + \ &lt;br /&gt;
        com_sun_star_awt_WindowAttribute_BORDER + \ &lt;br /&gt;
        com_sun_star_awt_WindowAttribute_MOVEABLE + \ &lt;br /&gt;
        com_sun_star_awt_WindowAttribute_CLOSEABLE &lt;br /&gt;
        # we could have addedd... &lt;br /&gt;
        #com_sun_star_awt_WindowAttribute_SIZEABLE &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The global Awt Toolkit. &lt;br /&gt;
# This is initialized the first time it is needed. &lt;br /&gt;
#goAwtToolkit = createUnoService( &amp;quot;com.sun.star.awt.Toolkit&amp;quot; ) &lt;br /&gt;
goAwtToolkit = None &lt;br /&gt;
# &lt;br /&gt;
def getAwtToolkit(): &lt;br /&gt;
    global goAwtToolkit &lt;br /&gt;
    if goAwtToolkit == None: &lt;br /&gt;
        goAwtToolkit = createUnoService( &amp;quot;com.sun.star.awt.Toolkit&amp;quot; ) &lt;br /&gt;
    return goAwtToolkit &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This class is a sugar coated abstraction for OOo&amp;#039;s Awt Window. &lt;br /&gt;
# This can be used in two different ways... &lt;br /&gt;
# 1. by subclassing it (elegant) &lt;br /&gt;
# 2. without subclassing it (less elegant) &lt;br /&gt;
class DBWindow: &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Class to build a modeless window from the com.sun.star.awt.* services. &lt;br /&gt;
    This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, &lt;br /&gt;
     this just makes it much easier. &lt;br /&gt;
    This class IS NOT the actual OOo window, but you can get the OOo window or frame by calling getWindow() or getFrame() on this class. &lt;br /&gt;
    You can change the window size, position, title, etc. &lt;br /&gt;
    You can add controls, and listeners for those controls to the window. &lt;br /&gt;
    This class can be used by subclassing it, or without subclassing it. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    def __init__( self, cTitle=None, tBoundsRect=None, nWindowAttributes=None ): &lt;br /&gt;
        oAwtToolkit = getAwtToolkit() &lt;br /&gt;
        oWindowDesc = self.createMyWindowDescriptor( tBoundsRect, nWindowAttributes ) &lt;br /&gt;
        self.oWindow = oAwtToolkit.createWindow( oWindowDesc ) &lt;br /&gt;
        &lt;br /&gt;
        # At this point, if you stop the program, you will have a &lt;br /&gt;
        #  new OOo window on the screen, but you cannot do anything &lt;br /&gt;
        #  with it.  You cannot even close it! &lt;br /&gt;
        # In fact, you have to kill the OOo process, as even OOo &lt;br /&gt;
        #  cannot close this window since it has no Frame and &lt;br /&gt;
        #  therefore is not integrated into the desktop environment. &lt;br /&gt;
        # So we need to create a Frame for our window.... &lt;br /&gt;
&lt;br /&gt;
        # Create a new frame. &lt;br /&gt;
        self.oFrame = createUnoService( &amp;quot;com.sun.star.frame.Frame&amp;quot; ) &lt;br /&gt;
        # Initialize this frame with our new window. &lt;br /&gt;
        self.oFrame.initialize( self.oWindow ) &lt;br /&gt;
        # Tell the frame that its parent is the Desktop. &lt;br /&gt;
        self.oFrame.setCreator( StarDesktop ) &lt;br /&gt;
&lt;br /&gt;
        if cTitle != None: &lt;br /&gt;
            self.setWindowTitle( cTitle ) &lt;br /&gt;
&lt;br /&gt;
        # A collection of controls on this window.  (NOT control models, but controls.) &lt;br /&gt;
        self.controls = {} &lt;br /&gt;
&lt;br /&gt;
    def createMyWindowDescriptor( self, tBoundsRect=None, nWindowAttributes=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;This returns the com.sun.star.awt.WindowDescriptor that will be used to create this window. &lt;br /&gt;
        Your subclass can override this method to provide a modified window descriptor.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        if tBoundsRect == None: &lt;br /&gt;
            tBoundsRect = makeRectangle( 100, 200, 300, 400 ) &lt;br /&gt;
        if nWindowAttributes == None: &lt;br /&gt;
            nWindowAttributes = gnDefaultWindowAttributes &lt;br /&gt;
        oAwtToolkit = getAwtToolkit() &lt;br /&gt;
        &lt;br /&gt;
        oWindowDesc = createUnoStruct( &amp;quot;com.sun.star.awt.WindowDescriptor&amp;quot; ) &lt;br /&gt;
        &lt;br /&gt;
        # specifies a top level window on the desktop. It is also a container. &lt;br /&gt;
        oWindowDesc.Type = uno.getConstantByName( &amp;quot;com.sun.star.awt.WindowClass.TOP&amp;quot; ) &lt;br /&gt;
        &lt;br /&gt;
        # specifies the name of the component service. &lt;br /&gt;
        # A zero length name means that the vcl creates a blank top, &lt;br /&gt;
        #  a container, or a simple window. &lt;br /&gt;
        oWindowDesc.WindowServiceName = &amp;quot;&amp;quot; &lt;br /&gt;
        &lt;br /&gt;
        # specifies the parent of the component. &lt;br /&gt;
        # If Parent == 0 &amp;amp;&amp;amp; ParentIndex == -1 , then the window is on the desktop. &lt;br /&gt;
        oWindowDesc.Parent = oAwtToolkit.getDesktopWindow() &lt;br /&gt;
        # specifies the index of the parent window, if available. &lt;br /&gt;
        # If Parent == 0 and this struct is a member of an array, &lt;br /&gt;
        #  then this is the offset from the beginning of the array to the parent. &lt;br /&gt;
        #  A value of -1 means desktop. &lt;br /&gt;
        oWindowDesc.ParentIndex = -1 &lt;br /&gt;
        &lt;br /&gt;
        # specifies the position and size of the window. &lt;br /&gt;
        # This member is ignored if the window attribute has &lt;br /&gt;
        #  WindowAttribute::FULLSIZE . &lt;br /&gt;
        oWindowDesc.Bounds = tBoundsRect &lt;br /&gt;
        &lt;br /&gt;
        # specifies the window attributes. &lt;br /&gt;
        oWindowDesc.WindowAttributes = nWindowAttributes &lt;br /&gt;
&lt;br /&gt;
        return oWindowDesc &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   The following two methods &lt;br /&gt;
    #   getWindow() and getFrame() &lt;br /&gt;
    #   return the two objects that this class manages. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def getWindow( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return the OOo Awt Window that this object represents. &lt;br /&gt;
        The window object returned has the following interfaces... &lt;br /&gt;
            com.sun.star.awt.XTopWindow &lt;br /&gt;
            com.sun.star.awt.XWindow &lt;br /&gt;
            com.sun.star.awt.XWindowPeer &lt;br /&gt;
            com.sun.star.awt.XVclContainer      [deprecated] &lt;br /&gt;
            com.sun.star.awt.XVclContainerPeer  [deprecated] &lt;br /&gt;
            com.sun.star.awt.XVclWindowPeer     [deprecated] &lt;br /&gt;
            com.sun.star.awt.XLayoutConstraints &lt;br /&gt;
            com.sun.star.awt.XView &lt;br /&gt;
            com.sun.star.awt.XDevice &lt;br /&gt;
            com.sun.star.lang.XEventListener &lt;br /&gt;
            com.sun.star.lang.XComponent &lt;br /&gt;
            com.sun.star.lang.XTypeProvider &lt;br /&gt;
            com.sun.star.accessibility.XAccessible &lt;br /&gt;
        Properties... &lt;br /&gt;
            &amp;lt;object&amp;gt;    MenuBar &lt;br /&gt;
            &amp;lt;array&amp;gt;     Windows &lt;br /&gt;
            &amp;lt;array&amp;gt;     Group &lt;br /&gt;
            &amp;lt;object&amp;gt;    PosSize &lt;br /&gt;
            Boolean     Visible &lt;br /&gt;
            Boolean     Enable &lt;br /&gt;
            &amp;lt;object&amp;gt;    Toolkit &lt;br /&gt;
            &amp;lt;object&amp;gt;    Pointer &lt;br /&gt;
            Long        Background &lt;br /&gt;
            Boolean     DesignMode &lt;br /&gt;
            Long        Foreground &lt;br /&gt;
            &amp;lt;object&amp;gt;    ControlFont &lt;br /&gt;
            &amp;lt;object&amp;gt;    MinimumSize &lt;br /&gt;
            &amp;lt;object&amp;gt;    PreferredSize &lt;br /&gt;
            &amp;lt;object&amp;gt;    AccessibleContext &lt;br /&gt;
            &amp;lt;object&amp;gt;    Graphics &lt;br /&gt;
            &amp;lt;object&amp;gt;    Size &lt;br /&gt;
            &amp;lt;object&amp;gt;    Info &lt;br /&gt;
            &amp;lt;array&amp;gt;     FontDescriptors &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.oWindow &lt;br /&gt;
    &lt;br /&gt;
    def getFrame( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return the Frame for the OOo Awt Window that this object represents.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.oFrame &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   The following methods represent part of the sugar coating &lt;br /&gt;
    #    that this class provides to manage the window. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def windowClose( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Close the window frame.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getFrame().close( True ) &lt;br /&gt;
        self.oFrame = None &lt;br /&gt;
        self.oWindow = None &lt;br /&gt;
&lt;br /&gt;
    def windowToFront( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;places this window at the top of the stacking order and shows it in front of any other windows.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        # By looking at the following line of code, &lt;br /&gt;
        #  and by looking at the list of interfaces from the comment in the getWindow() method, &lt;br /&gt;
        #  you should be able to figure out how to do lots of other things to this window. &lt;br /&gt;
        self.getWindow().toFront() &lt;br /&gt;
&lt;br /&gt;
    def windowToBack( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; places this window at the bottom of the stacking order and makes the corresponding adjustment to other visible windows.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().toBack() &lt;br /&gt;
&lt;br /&gt;
    def setWindowTitle( self, cTitle ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the title of the window that this object represents.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        # By looking at the following line of code, &lt;br /&gt;
        #  and by looking at the com.sun.star.frame.Frame service, &lt;br /&gt;
        #  you should be able to figure out how to do lots of other things to this window. &lt;br /&gt;
        self.getFrame().Title = cTitle &lt;br /&gt;
&lt;br /&gt;
    def getWindowTitle( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the title of the window that this object represents&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getFrame().Title &lt;br /&gt;
&lt;br /&gt;
    def setWindowBackground( self, nColor ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the background color of the window that this object represents.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setBackground( nColor ) &lt;br /&gt;
&lt;br /&gt;
    def getWindowGraphics( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns a com.sun.star.awt.XGraphics for the window that this object represents. &lt;br /&gt;
        You can then call methods on the XGraphics to draw things into this window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getWindow().getGraphics() &lt;br /&gt;
&lt;br /&gt;
    def setWindowPosSize( self, nX, nY, nWidth, nHeight ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position and size of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setPosSize( nX, nY, nWidth, nHeight, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.POSSIZE&amp;quot; ) ) &lt;br /&gt;
    def setWindowPosition( self, nX, nY ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setPosSize( nX, nY, 0, 0, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.POS&amp;quot; ) ) &lt;br /&gt;
    def setWindowSize( self, nWidth, nHeight ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position and size of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setPosSize( 0, 0, nWidth, nHeight, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.SIZE&amp;quot; ) ) &lt;br /&gt;
    def getWindowPosSize( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns a com.sun.star.awt.Rectangle that contains the position and size of this window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getWindow().getPosSize() &lt;br /&gt;
&lt;br /&gt;
    def setWindowVisible( self, bVisible ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Make this window (in)visible.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setVisible( bVisible ) &lt;br /&gt;
    def setWindowEnable( self, bEnable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Make this window (dis)enabled.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setEnable( bEnable ) &lt;br /&gt;
&lt;br /&gt;
    def setWindowFocus( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the focus to this window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().setFocus() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlButton &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addButton( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cLabel=None, &lt;br /&gt;
                        actionListenerProc=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a Button control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlButtonModel&amp;quot; ) &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if cLabel != None: &lt;br /&gt;
            oControlModel.Label = cLabel &lt;br /&gt;
&lt;br /&gt;
        if actionListenerProc != None: &lt;br /&gt;
            self.addActionListenerProc( cCtrlName, actionListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def setButtonLabel( self, cCtrlName, cLabel ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the label of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setLabel( cLabel ) &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlCheckBox &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addCheckBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cLabel=None, &lt;br /&gt;
                        itemListenerProc=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a CheckBox control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlCheckBoxModel&amp;quot; ) &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if cLabel != None: &lt;br /&gt;
            oControlModel.Label = cLabel &lt;br /&gt;
&lt;br /&gt;
        if itemListenerProc != None: &lt;br /&gt;
            self.addItemListenerProc( cCtrlName, itemListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def setCheckBoxLabel( self, cCtrlName, cLabel ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the label of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setLabel( cLabel ) &lt;br /&gt;
&lt;br /&gt;
    def getCheckBoxState( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the state of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getState(); &lt;br /&gt;
&lt;br /&gt;
    def setCheckBoxState( self, cCtrlName, nState ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the state of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setState( nState ) &lt;br /&gt;
&lt;br /&gt;
    def enableCheckBoxTriState( self, cCtrlName, bTriStateEnable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Enable or disable the tri state mode of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.enableTriState( bTriStateEnable ) &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlComboBox &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addComboBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        bDropdown=True, &lt;br /&gt;
                        itemListenerProc=None, &lt;br /&gt;
                        actionListenerProc=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a ComboBox control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlComboBoxModel&amp;quot; ) &lt;br /&gt;
        oControlModel.Dropdown = bDropdown &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if itemListenerProc != None: &lt;br /&gt;
            self.addItemListenerProc( cCtrlName, itemListenerProc ) &lt;br /&gt;
        if actionListenerProc != None: &lt;br /&gt;
            self.addActionListenerProc( cCtrlName, actionListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def addComboBoxItem( self, cCtrlName, cItemText, nPosition=-1 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add an item to the ComboBox at specified position.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        if nPosition == -1: nPosition = self.getComboBoxItemCount( cCtrlName ) &lt;br /&gt;
        oControl.addItem( cItemText, nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def addComboBoxItems( self, cCtrlName, tcItemTexts, nPosition=0 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a tupple of items to the ComboBox at specified position.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.addItems( tcItemTexts, nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def removeComboBoxItems( self, cCtrlName, nPosition, nCount=1 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Remove items from a ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.removeItems( nPosition, nCount ) &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxItemCount( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the number of items in a ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItemCount() &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxItem( self, cCtrlName, nPosition ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return the item at specified position within the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItem( nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxItems( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return a tupple of all items in the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItems() &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxDropDownLineCount( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns the number of visible lines in the drop down mode.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getDropDownLineCount() &lt;br /&gt;
&lt;br /&gt;
    def setComboBoxDropDownLineCount( self, cCtrlName, nNumLines ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Sets the number of visible lines in the drop down mode.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setDropDownLineCount( nNumLines ) &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the text of the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getText(); &lt;br /&gt;
&lt;br /&gt;
    def setComboBoxText( self, cCtrlName, cText ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the text of the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setText( cText ) &lt;br /&gt;
&lt;br /&gt;
    def insertComboBoxText( self, cCtrlName, cText, nMinSelection, nMaxSelection ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Insert text at specified position in the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        tSelection = Selection() &lt;br /&gt;
        tSelection.Min = nMinSelection &lt;br /&gt;
        tSelection.Max = nMaxSelection &lt;br /&gt;
        oControl.insertText( tSelection, cText ) &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxSelectedText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the selected text of the ComboBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedText(); &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxSelection( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the selection of the ComboBox. &lt;br /&gt;
        This is a com.sun.star.awt.Selection struct with members Min and Max.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelection() &lt;br /&gt;
&lt;br /&gt;
    def isComboBoxEditable( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Indicate whether the text in the ComboBox is editable by the user.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isEditable() &lt;br /&gt;
&lt;br /&gt;
    def setComboBoxEditable( self, cCtrlName, bEditable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set whether the text in the ComboBox is editable by the user.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setEditable( bEditable ) &lt;br /&gt;
&lt;br /&gt;
    def setComboBoxMaxTextLen( self, cCtrlName, nMaxLen ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the maximum text length the ComboBox can have.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setMaxTextLen( nMaxLen ) &lt;br /&gt;
&lt;br /&gt;
    def getComboBoxMaxTextLen( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the maximum text length the ComboBox can have.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.getMaxTextLen() &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlEdit &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addEdit( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cText=None, &lt;br /&gt;
                        textListenerProc=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a Edit control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlEditModel&amp;quot; ) &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if cText != None: &lt;br /&gt;
            self.setEditText( cCtrlName, cText ) &lt;br /&gt;
        if textListenerProc != None: &lt;br /&gt;
            self.addTextListenerProc( cCtrlName, textListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def getEditText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the text of the edit box.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getText(); &lt;br /&gt;
&lt;br /&gt;
    def setEditText( self, cCtrlName, cText ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the text of the edit box.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setText( cText ) &lt;br /&gt;
&lt;br /&gt;
    def insertEditText( self, cCtrlName, cText, nMinSelection, nMaxSelection ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Insert text at specified position in the edit box.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        tSelection = Selection() &lt;br /&gt;
        tSelection.Min = nMinSelection &lt;br /&gt;
        tSelection.Max = nMaxSelection &lt;br /&gt;
        oControl.insertText( tSelection, cText ) &lt;br /&gt;
&lt;br /&gt;
    def getEditSelectedText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the selected text of the edit box.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedText(); &lt;br /&gt;
&lt;br /&gt;
    def getEditSelection( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the selection of the edit box. &lt;br /&gt;
        This is a com.sun.star.awt.Selection struct with members Min and Max.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelection() &lt;br /&gt;
&lt;br /&gt;
    def isEditEditable( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Indicate whether the text in the edit box is editable by the user.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isEditable() &lt;br /&gt;
&lt;br /&gt;
    def setEditEditable( self, cCtrlName, bEditable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set whether the text in the edit box is editable by the user.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setEditable( bEditable ) &lt;br /&gt;
&lt;br /&gt;
    def setEditMaxTextLen( self, cCtrlName, nMaxLen ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the maximum text length the edit box can have.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setMaxTextLen( nMaxLen ) &lt;br /&gt;
&lt;br /&gt;
    def getEditMaxTextLen( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the maximum text length the edit box can have.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.getMaxTextLen() &lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlFixedText &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addFixedText( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cLabel=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a FixedText control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlFixedTextModel&amp;quot; ) &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if cLabel != None: &lt;br /&gt;
            oControlModel.Label = cLabel &lt;br /&gt;
&lt;br /&gt;
    def getFixedTextText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the text of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getText(); &lt;br /&gt;
&lt;br /&gt;
    def setFixedTextText( self, cCtrlName, cText ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the text of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setText( cText ) &lt;br /&gt;
&lt;br /&gt;
    def getFixedTextAlignment( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the alignment of the control.  0:left, 1:center, 2:right&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getAlignment(); &lt;br /&gt;
&lt;br /&gt;
    def setFixedTextAlignment( self, cCtrlName, nAlignment ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the alignment of the control.  0:left, 1:center, 2:right&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setAlignment( nAlignment ) &lt;br /&gt;
&lt;br /&gt;
        &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlImageControl &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addImageControl( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                         nBorder=1 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add an ImageControl control to the window. &lt;br /&gt;
        nBorder = 0:none, 1:3D border, 2:simple border&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlImageControlModel&amp;quot; ) &lt;br /&gt;
        oControlModel.Border = nBorder &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
    def getImageControlImageURL( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the ImageURL of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getControlModelProperty( cCtrlName, &amp;quot;ImageURL&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setImageControlImageURL( self, cCtrlName, cImageURL ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the ImageURL of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;ImageURL&amp;quot;, cImageURL ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlListBox &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addListBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        bDropdown=False, &lt;br /&gt;
                        itemListenerProc=None, &lt;br /&gt;
                        actionListenerProc=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a ComboBox control to the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlListBoxModel&amp;quot; ) &lt;br /&gt;
        oControlModel.Dropdown = bDropdown &lt;br /&gt;
        oControl      = createUnoService( oControlModel.DefaultControl ) # Create a control and its model. &lt;br /&gt;
        oControl.setModel( oControlModel )                              # Introduce the model to the control. &lt;br /&gt;
        oControl.createPeer( getAwtToolkit(), self.getWindow() )        # Make the control create its window peer. &lt;br /&gt;
        # Keep a dictionary of controls we are managing in the window. &lt;br /&gt;
        self.controls[ cCtrlName ] = oControl &lt;br /&gt;
        # Set position and size &lt;br /&gt;
        self.setPosSize( cCtrlName, nPositionX, nPositionY, nWidth, nHeight ) &lt;br /&gt;
&lt;br /&gt;
        if itemListenerProc != None: &lt;br /&gt;
            self.addItemListenerProc( cCtrlName, itemListenerProc ) &lt;br /&gt;
        if actionListenerProc != None: &lt;br /&gt;
            self.addActionListenerProc( cCtrlName, actionListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def addListBoxItem( self, cCtrlName, cItemText, nPosition=-1 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add an item to the ListBox at specified position.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        if nPosition == -1: nPosition = self.getComboBoxItemCount( cCtrlName ) &lt;br /&gt;
        oControl.addItem( cItemText, nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def addListBoxItems( self, cCtrlName, tcItemTexts, nPosition=0 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Add a tupple of items to the ListBox at specified position.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.addItems( tcItemTexts, nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def removeListBoxItems( self, cCtrlName, nPosition, nCount=1 ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Remove items from a ListBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.removeItems( nPosition, nCount ) &lt;br /&gt;
&lt;br /&gt;
    def getListBoxItemCount( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the number of items in a ListBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItemCount() &lt;br /&gt;
&lt;br /&gt;
    def getListBoxItem( self, cCtrlName, nPosition ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return the item at specified position within the ListBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItem( nPosition ) &lt;br /&gt;
&lt;br /&gt;
    def getListBoxItems( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Return a tupple of all items in the ListBox.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getItems() &lt;br /&gt;
&lt;br /&gt;
    def getListBoxSelectedItemPos( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns the position of the currently selected item.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedItemPos() &lt;br /&gt;
&lt;br /&gt;
    def getListBoxSelectedItemsPos( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns the positions of all currently selected items.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedItemsPos() &lt;br /&gt;
&lt;br /&gt;
    def getListBoxSelectedItem( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns the currently selected item.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedItem() &lt;br /&gt;
&lt;br /&gt;
    def getListBoxSelectedItems( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns all currently selected items.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getSelectedItems() &lt;br /&gt;
&lt;br /&gt;
    def selectListBoxItemPos( self, cCtrlName, nItemPos, bSelect=True ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Select/Deselect the item at the specified position.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.selectItemPos( nItemPos, bSelect ) &lt;br /&gt;
&lt;br /&gt;
    def selectListBoxItemsPos( self, cCtrlName, tnItemPos, bSelect=True ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Selects/Deselects the items at the specified positions.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.selectItemsPos( tnItemPos, bSelect ) &lt;br /&gt;
&lt;br /&gt;
    def selectListBoxItem( self, cCtrlName, cItemText, bSelect=True ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Selects/Deselects the ispecified item.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.selectItem( cItemText, bSelect ) &lt;br /&gt;
&lt;br /&gt;
    def isListBoxMultipleMode( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Selects/Deselects the ispecified item.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isMutipleMode() &lt;br /&gt;
&lt;br /&gt;
    def setListBoxMultipleMode( self, cCtrlName, bMultipleMode ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Selects/Deselects the ispecified item.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.setMutipleMode( bMultipleMode ) &lt;br /&gt;
&lt;br /&gt;
    def getListBoxDropDownLineCount( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns the number of visible lines in the drop down mode.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getDropDownLineCount() &lt;br /&gt;
&lt;br /&gt;
    def setListBoxDropDownLineCount( self, cCtrlName, nNumLines ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Sets the number of visible lines in the drop down mode.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setDropDownLineCount( nNumLines ) &lt;br /&gt;
&lt;br /&gt;
    def makeListBoxItemVisible( self, nItemPos ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Makes the item at the specified position visible by scrolling the list box.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.makeVisible( nItemPos ) &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Access controls and control models &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def getControl( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the control (not its model) for a particular control name. &lt;br /&gt;
        The control returned includes the service com.sun.star.awt.UnoControl, &lt;br /&gt;
         and another control-specific service which inherits from it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.controls[ cCtrlName ] &lt;br /&gt;
        return oControl &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    def getControlModel( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the control model (not the control) for a particular control name. &lt;br /&gt;
        The model returned includes the service UnoControlModel, &lt;br /&gt;
         and another control-specific service which inherits from it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControlModel = oControl.getModel() &lt;br /&gt;
        return oControlModel &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Adjust properties of control models &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def setControlModelProperty( self, cCtrlName, cPropertyName, uValue ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the value of a property of a control&amp;#039;s model. &lt;br /&gt;
        This affects the control model, not the control. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = self.getControlModel( cCtrlName ) &lt;br /&gt;
        oControlModel.setPropertyValue( cPropertyName, uValue ) &lt;br /&gt;
&lt;br /&gt;
    def getControlModelProperty( self, cCtrlName, cPropertyName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the value of a property of a control&amp;#039;s model. &lt;br /&gt;
        This affects the control model, not the control. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = self.getControlModel( cCtrlName ) &lt;br /&gt;
        return oControlModel.getPropertyValue( cPropertyName ) &lt;br /&gt;
      &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Adjust controls (not models) &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # The following apply to all controls which are a &lt;br /&gt;
    #   com.sun.star.awt.UnoControl &lt;br /&gt;
    # (which means all controls) &lt;br /&gt;
&lt;br /&gt;
    def setDesignMode( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setDesignMode( bDesignMode ) &lt;br /&gt;
&lt;br /&gt;
    def isDesignMode( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isDesignMode() &lt;br /&gt;
  &lt;br /&gt;
    def isTransparent( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isTransparent() &lt;br /&gt;
&lt;br /&gt;
    def setPosSize( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position and size of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        # if negative coordinates are given for X or Y position, &lt;br /&gt;
        #  then make that coordinate be relative to the right/bottom &lt;br /&gt;
        #  edge of the window instead of to the left/top. &lt;br /&gt;
        if nPositionX &amp;lt; 0  or  nPositionY &amp;lt; 0: &lt;br /&gt;
            oWindowPosSizeRect = self.getWindowPosSize() &lt;br /&gt;
            if nPositionX &amp;lt; 0: nPositionX = oWindowPosSizeRect.Width  + nPositionX - nWidth &lt;br /&gt;
            if nPositionY &amp;lt; 0: nPositionY = oWindowPosSizeRect.Height + nPositionY - nHeight &lt;br /&gt;
        oControl.setPosSize( nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.POSSIZE&amp;quot; ) ) &lt;br /&gt;
    def setPosition( self, cCtrlName, nPositionX, nPositionY ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        # if negative coordinates are given for X or Y position, &lt;br /&gt;
        #  then make that coordinate be relative to the right/bottom &lt;br /&gt;
        #  edge of the window instead of to the left/top. &lt;br /&gt;
        if nPositionX &amp;lt; 0  or  nPositionY &amp;lt; 0: &lt;br /&gt;
            oCtrlPosSizeRect = oControl.getPosSize() &lt;br /&gt;
            oWindowPosSizeRect = self.getWindowPosSize() &lt;br /&gt;
            if nPositionX &amp;lt; 0: nPositionX = oWindowPosSizeRect.Width  + nPositionX - oCtrlPosSizeRect.Width &lt;br /&gt;
            if nPositionY &amp;lt; 0: nPositionY = oWindowPosSizeRect.Height + nPositionY - oCtrlPosSizeRect.Height &lt;br /&gt;
        oControl.setPosSize( nPositionX, nPositionY, 0, 0, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.POS&amp;quot; ) ) &lt;br /&gt;
    def setSize( self, cCtrlName, nWidth, nHeight ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the position and size of the window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setPosSize( 0, 0, nWidth, nHeight, &lt;br /&gt;
                                     uno.getConstantByName( &amp;quot;com.sun.star.awt.PosSize.SIZE&amp;quot; ) ) &lt;br /&gt;
    def getPosSize( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Returns a com.sun.star.awt.Rectangle that contains the position and size of this window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getPosSize() &lt;br /&gt;
&lt;br /&gt;
    def setVisible( self, cCtrlName, bVisible ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Show or hide the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setVisible( bVisible ) &lt;br /&gt;
&lt;br /&gt;
    def setEnable( self, cCtrlName, bEnable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Enable or disable the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setEnable( bEnable ) &lt;br /&gt;
&lt;br /&gt;
    def setFocus( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set focus to the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setFocus() &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Add listeners to controls. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # This applies to... &lt;br /&gt;
    #   UnoControlButton &lt;br /&gt;
    #   UnoControlComboBox &lt;br /&gt;
    def addActionListenerProc( self, cCtrlName, actionListenerProc ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create an com.sun.star.awt.XActionListener object and add it to a control. &lt;br /&gt;
        A listener object is created which will call the python procedure actionListenerProc. &lt;br /&gt;
        The actionListenerProc can be either a method or a global procedure. &lt;br /&gt;
        The following controls support XActionListener: &lt;br /&gt;
            UnoControlButton &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oActionListener = ActionListenerProcAdapter( actionListenerProc ) &lt;br /&gt;
        oControl.addActionListener( oActionListener ) &lt;br /&gt;
&lt;br /&gt;
    # This applies to... &lt;br /&gt;
    #   UnoControlCheckBox &lt;br /&gt;
    #   UnoControlComboBox &lt;br /&gt;
    def addItemListenerProc( self, cCtrlName, itemListenerProc ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create an com.sun.star.awt.XItemListener object and add it to a control. &lt;br /&gt;
        A listener object is created which will call the python procedure itemListenerProc. &lt;br /&gt;
        The itemListenerProc can be either a method or a global procedure. &lt;br /&gt;
        The following controls support XActionListener: &lt;br /&gt;
            UnoControlCheckBox &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oActionListener = ItemListenerProcAdapter( itemListenerProc ) &lt;br /&gt;
        oControl.addItemListener( oActionListener ) &lt;br /&gt;
&lt;br /&gt;
    # This applies to... &lt;br /&gt;
    #   UnoControlEdit &lt;br /&gt;
    def addTextListenerProc( self, cCtrlName, textListenerProc ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create an com.sun.star.awt.XTextListener object and add it to a control. &lt;br /&gt;
        A listener object is created which will call the python procedure textListenerProc. &lt;br /&gt;
        The textListenerProc can be either a method or a global procedure. &lt;br /&gt;
        The following controls support XTextListener: &lt;br /&gt;
            UnoControlEdit &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oTextListener = TextListenerProcAdapter( textListenerProc ) &lt;br /&gt;
        oControl.addTextListener( oTextListener ) &lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
from com.sun.star.awt import XTopWindowListener &lt;br /&gt;
from com.sun.star.awt import XWindowListener &lt;br /&gt;
from com.sun.star.awt import XFocusListener &lt;br /&gt;
from com.sun.star.awt import XKeyListener &lt;br /&gt;
from com.sun.star.awt import XMouseListener &lt;br /&gt;
from com.sun.star.awt import XPaintListener &lt;br /&gt;
from com.sun.star.lang import XEventListener &lt;br /&gt;
class DBListenerWindow( DBWindow, unohelper.Base, &lt;br /&gt;
                            XKeyListener, XMouseListener, XPaintListener, &lt;br /&gt;
                            XFocusListener, XWindowListener, XTopWindowListener, &lt;br /&gt;
                            XEventListener ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;This is like a DBWindow, but has useful listener methods implemented directly in this class. &lt;br /&gt;
    You can easily subclass this class, and override the various listener methods from the interfaces implemented by this class. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    def __init__( self, cTitle=None, tBoundsRect=None, nWindowAttributes=None ): &lt;br /&gt;
        DBWindow.__init__( self, &lt;br /&gt;
                    cTitle=cTitle, &lt;br /&gt;
                    tBoundsRect=tBoundsRect, &lt;br /&gt;
                    nWindowAttributes=nWindowAttributes ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XTopWindowListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addTopWindowListener( self ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XWindowListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addWindowListener( self ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XFocusListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addFocusListener( self ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XKeyListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addKeyListener( self ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XMouseListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addMouseListener( self ) &lt;br /&gt;
&lt;br /&gt;
        # Since this class implements the XPaintListener interface, &lt;br /&gt;
        #  add ourself as a listener to our own window. &lt;br /&gt;
        self.oWindow.addPaintListener( self ) &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XTopWindowListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.lang.EventObject has the following members: &lt;br /&gt;
    #       Source  which is a  com.sun.star.uno.XInterface &lt;br /&gt;
    #           refers to the object that fired the event. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowOpened( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowOpened( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window has been opened.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowClosing( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowClosing( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is in the process of being closed. &lt;br /&gt;
        The close operation can be overridden at this point.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.getWindow().dispose() &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowClosed( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowClosed( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window has been closed.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowMinimized( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowMinimized( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is iconified.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowNormalized( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowNormalized( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is de-iconified.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowActivated( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowActivated( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is activated.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowDeactivated( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowDeactivated( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is de-activated.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XWindowListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.awt.WindowEvent has the following members: &lt;br /&gt;
    #       long X      long Y &lt;br /&gt;
    #       long Width  long Height &lt;br /&gt;
    #       long LeftInset  long TopInset   long RightInset     long BottomInset &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # windowResized( [in] WindowEvent tEvent ); &lt;br /&gt;
    def windowResized( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the window has been resized.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # windowMoved( [in] WindowEvent tEvent ); &lt;br /&gt;
    def windowMoved( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the window has been moved.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # windowShown( [in] EventObject tEvent ); &lt;br /&gt;
    def windowShown( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the window has been shown.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        # please note the type of parameter is described &lt;br /&gt;
        #  above in the comment for XTopWindowListener. &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # windowHidden( [in] EventObject tEvent ); &lt;br /&gt;
    def windowHidden( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the window has been hidden.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        # please note the type of parameter is described &lt;br /&gt;
        #  above in the comment for XTopWindowListener. &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XFocusListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.awt.FocusEvent has the following members: &lt;br /&gt;
    #       short FocusFlags &lt;br /&gt;
    #       com.sun.star.uno.XInterface NextFocus &lt;br /&gt;
    #       boolean Temporary &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # focusGained( [in] FocusEvent tEvent ); &lt;br /&gt;
    def focusGained( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; is invoked when a window gains the keyboard focus.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # focusLost( [in] FocusEvent tEvent ); &lt;br /&gt;
    def focusLost( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; is invoked when a window loses the keyboard focus.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XKeyListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.awt.KeyEvent has the following members: &lt;br /&gt;
    #       short KeyCode   (constant from com.sun.star.awt.Key) &lt;br /&gt;
    #       char  KeyChar &lt;br /&gt;
    #       short KeyFunc   (constant from com.sun.star.awt.KeyFunction) &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # keyPressed( [in] com.sun.star.awt.KeyEvent tEvent ); &lt;br /&gt;
    def keyPressed( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; is invoked when a key has been pressed.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # keyReleased( [in] com.sun.star.awt.KeyEvent tEvent ); &lt;br /&gt;
    def keyReleased( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; is invoked when a key has been released.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XMouseListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.awt.MouseEvent has the following members: &lt;br /&gt;
    #       short Buttons       (constant from com.sun.star.awt.MouseButton) &lt;br /&gt;
    #       short X     short Y &lt;br /&gt;
    #       long ClickCount &lt;br /&gt;
    #       boolean PupupTrigger &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # mousePressed( [in] com.sun.star.awt.MouseEvent tEvent ); &lt;br /&gt;
    def mousePressed( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a mouse button has been pressed on a window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # mouseReleased( [in] com.sun.star.awt.MouseEvent tEvent ); &lt;br /&gt;
    def mouseReleased( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a mouse button has been released on a window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # mouseEntered( [in] com.sun.star.awt.MouseEvent tEvent ); &lt;br /&gt;
    def mouseEntered( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the mouse enters a window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # mouseExited( [in] com.sun.star.awt.MouseEvent tEvent ); &lt;br /&gt;
    def mouseExited( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when the mouse exits a window.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XPaintListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.awt.PaintEvent has the following members: &lt;br /&gt;
    #       com.sun.star.awt.Rectangle UpdateRect &lt;br /&gt;
    #       short Count &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowPaint( [in] PaintEvent tEvent ); &lt;br /&gt;
    def windowPaint( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; is invoked when a region of the window became invalid, e.g. when another window has been moved away.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Interface:  XEventListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.lang.EventObject has the following members: &lt;br /&gt;
    #       Source  which is a  com.sun.star.uno.XInterface &lt;br /&gt;
    #           refers to the object that fired the event. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # disposing( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def disposing( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;gets called when the broadcaster is about to be disposed.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# import Danny.OOo.WindowLib &lt;br /&gt;
# reload( Danny.OOo.WindowLib ); from Danny.OOo.WindowLib import * &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.Listeners.TopWindowListener.py&amp;diff=235907</id>
		<title>Danny.OOo.Listeners.TopWindowListener.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.Listeners.TopWindowListener.py&amp;diff=235907"/>
		<updated>2015-02-17T19:48:11Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is similar in purpose to the Danny.OOo.Listeners.ListenerProcAdapters.py module. &lt;br /&gt;
&lt;br /&gt;
This one is NOT an adapter however. It is a class that you subclass. Your subclass does not need to implement every possible listener method, because you inherit the empty implementations from this class. So when you need to add a window listener to a TopWindow, this class comes in very handy. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.Listeners.TopWindowListener.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-05-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
from com.sun.star.awt import XTopWindowListener &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class TopWindowListener( XTopWindowListener ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;An empty implementation of com.sun.star.awt.XTopWindowListener. &lt;br /&gt;
    It is useful for you to be able to subclass from this. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    # NOTE: &lt;br /&gt;
    # If you subclass from this, you must either: &lt;br /&gt;
    #  1. also subclass from unohelper.Base. &lt;br /&gt;
    #  2. or otherwise implement com.sun.star.lang.XTypeProvider. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface:  XTopWindowListener &lt;br /&gt;
    # &lt;br /&gt;
    #   This interface is implemented so that your subclass &lt;br /&gt;
    #    can conveniently override these methods! &lt;br /&gt;
    # &lt;br /&gt;
    #   Note that com.sun.star.lang.EventObject has the following members: &lt;br /&gt;
    #       Source  which is a  com.sun.star.uno.XInterface &lt;br /&gt;
    #           refers to the object that fired the event. &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowOpened( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowOpened( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window has been opened.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowClosing( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowClosing( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is in the process of being closed. &lt;br /&gt;
        The close operation can be overridden at this point.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowClosed( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowClosed( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window has been closed.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowMinimized( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowMinimized( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is iconified.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowNormalized( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowNormalized( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is de-iconified.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowActivated( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowActivated( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is activated.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&lt;br /&gt;
    # [oneway] void &lt;br /&gt;
    # windowDeactivated( [in] com.sun.star.lang.EventObject tEvent ); &lt;br /&gt;
    def windowDeactivated( self, tEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;is invoked when a window is de-activated.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        pass &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.Listeners.ListenerProcAdapters.py&amp;diff=235906</id>
		<title>Danny.OOo.Listeners.ListenerProcAdapters.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.Listeners.ListenerProcAdapters.py&amp;diff=235906"/>
		<updated>2015-02-17T19:46:07Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module has various helpers that make it extremely easy to create listeners on the fly, and make them call an arbitrary python procedure. &lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.Listeners.ListenerProcAdapters.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-05-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# An ActionListener adapter. &lt;br /&gt;
# This object implements com.sun.star.awt.XActionListener. &lt;br /&gt;
# When actionPerformed is called, this will call an arbitrary &lt;br /&gt;
#  python procedure, passing it... &lt;br /&gt;
#   1. the oActionEvent &lt;br /&gt;
#   2. any other parameters you specified to this object&amp;#039;s constructor (as a tuple). &lt;br /&gt;
from com.sun.star.awt import XActionListener &lt;br /&gt;
class ActionListenerProcAdapter( unohelper.Base, XActionListener ): &lt;br /&gt;
    def __init__( self, oProcToCall, tParams=() ): &lt;br /&gt;
        self.oProcToCall = oProcToCall # a python procedure &lt;br /&gt;
        self.tParams = tParams # a tuple &lt;br /&gt;
&lt;br /&gt;
    # oActionEvent is a com.sun.star.awt.ActionEvent struct. &lt;br /&gt;
    def actionPerformed( self, oActionEvent ): &lt;br /&gt;
        if callable( self.oProcToCall ): &lt;br /&gt;
            apply( self.oProcToCall, (oActionEvent,) + self.tParams ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# An ItemListener adapter. &lt;br /&gt;
# This object implements com.sun.star.awt.XItemListener. &lt;br /&gt;
# When itemStateChanged is called, this will call an arbitrary &lt;br /&gt;
#  python procedure, passing it... &lt;br /&gt;
#   1. the oItemEvent &lt;br /&gt;
#   2. any other parameters you specified to this object&amp;#039;s constructor (as a tuple). &lt;br /&gt;
from com.sun.star.awt import XItemListener &lt;br /&gt;
class ItemListenerProcAdapter( unohelper.Base, XItemListener ): &lt;br /&gt;
    def __init__( self, oProcToCall, tParams=() ): &lt;br /&gt;
        self.oProcToCall = oProcToCall # a python procedure &lt;br /&gt;
        self.tParams = tParams # a tuple &lt;br /&gt;
&lt;br /&gt;
    # oItemEvent is a com.sun.star.awt.ItemEvent struct. &lt;br /&gt;
    def itemStateChanged( self, oItemEvent ): &lt;br /&gt;
        if callable( self.oProcToCall ): &lt;br /&gt;
            apply( self.oProcToCall, (oItemEvent,) + self.tParams ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# An TextListener adapter. &lt;br /&gt;
# This object implements com.sun.star.awt.XTextistener. &lt;br /&gt;
# When textChanged is called, this will call an arbitrary &lt;br /&gt;
#  python procedure, passing it... &lt;br /&gt;
#   1. the oTextEvent &lt;br /&gt;
#   2. any other parameters you specified to this object&amp;#039;s constructor (as a tuple). &lt;br /&gt;
from com.sun.star.awt import XTextListener &lt;br /&gt;
class TextListenerProcAdapter( unohelper.Base, XTextListener ): &lt;br /&gt;
    def __init__( self, oProcToCall, tParams=() ): &lt;br /&gt;
        self.oProcToCall = oProcToCall # a python procedure &lt;br /&gt;
        self.tParams = tParams # a tuple &lt;br /&gt;
&lt;br /&gt;
    # oTextEvent is a com.sun.star.awt.TextEvent struct. &lt;br /&gt;
    def textChanged( self, oTextEvent ): &lt;br /&gt;
        if callable( self.oProcToCall ): &lt;br /&gt;
            apply( self.oProcToCall, (oTextEvent,) + self.tParams ) &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.DialogLib.py&amp;diff=235905</id>
		<title>Danny.OOo.DialogLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.DialogLib.py&amp;diff=235905"/>
		<updated>2015-02-17T19:44:16Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A class to build a dialog box from the com.sun.star.awt.* services. This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, this just makes it much easier. &lt;br /&gt;
&lt;br /&gt;
You can change the dialog box size, position, title, etc. You can add controls, and listeners for those controls to the dialog box. This class can be used by subclassing it, or without subclassing it. &lt;br /&gt;
&lt;br /&gt;
This module depends upon Danny.OOo.Listeners.ListenerProcAdapters.py found elsewhere in this thread. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.DialogLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-05-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
# Danny&amp;#039;s libraries &lt;br /&gt;
from Danny.OOo.OOoLib import createUnoService, createUnoStruct &lt;br /&gt;
from Danny.OOo.Listeners.ListenerProcAdapters import * &lt;br /&gt;
#from Danny.OOo.Listeners.TopWindowListener import TopWindowListener &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The global Awt Toolkit. &lt;br /&gt;
# This is initialized the first time it is needed. &lt;br /&gt;
#goAwtToolkit = createUnoService( &amp;quot;com.sun.star.awt.Toolkit&amp;quot; ) &lt;br /&gt;
goAwtToolkit = None &lt;br /&gt;
# &lt;br /&gt;
def getAwtToolkit(): &lt;br /&gt;
    global goAwtToolkit &lt;br /&gt;
    if goAwtToolkit == None: &lt;br /&gt;
        goAwtToolkit = createUnoService( &amp;quot;com.sun.star.awt.Toolkit&amp;quot; ) &lt;br /&gt;
    return goAwtToolkit &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This class builds dialog boxes. &lt;br /&gt;
# This can be used in two different ways... &lt;br /&gt;
# 1. by subclassing it (elegant) &lt;br /&gt;
# 2. without subclassing it (less elegant) &lt;br /&gt;
class DBModalDialog: &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Class to build a dialog box from the com.sun.star.awt.* services. &lt;br /&gt;
    This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, &lt;br /&gt;
     this just makes it much easier. &lt;br /&gt;
    You can change the dialog box size, position, title, etc. &lt;br /&gt;
    You can add controls, and listeners for those controls to the dialog box. &lt;br /&gt;
    This class can be used by subclassing it, or without subclassing it. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    def __init__( self, nPositionX=None, nPositionY=None, nWidth=None, nHeight=None, cTitle=None ): &lt;br /&gt;
        self.oDialogModel = createUnoService( &amp;quot;com.sun.star.awt.UnoControlDialogModel&amp;quot; ) &lt;br /&gt;
        if nPositionX != None:  self.oDialogModel.PositionX = nPositionX &lt;br /&gt;
        if nPositionY != None:  self.oDialogModel.PositionY = nPositionY &lt;br /&gt;
        if nWidth     != None:  self.oDialogModel.Width     = nWidth &lt;br /&gt;
        if nHeight    != None:  self.oDialogModel.Height    = nHeight &lt;br /&gt;
        if cTitle     != None:  self.oDialogModel.Title     = cTitle &lt;br /&gt;
        self.oDialogControl = createUnoService( &amp;quot;com.sun.star.awt.UnoControlDialog&amp;quot; ) &lt;br /&gt;
        self.oDialogControl.setModel( self.oDialogModel ) &lt;br /&gt;
&lt;br /&gt;
    def release( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Release resources. &lt;br /&gt;
        After calling this, you can no longer use this object. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.oDialogControl.dispose() &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Dialog box adjustments &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    &lt;br /&gt;
    def setDialogPosition( self, nX, nY ): &lt;br /&gt;
        self.oDialogModel.PositionX = nX &lt;br /&gt;
        self.oDialogModel.PositionY = nY &lt;br /&gt;
&lt;br /&gt;
    def setDialogSize( self, nWidth, nHeight ): &lt;br /&gt;
        self.oDialogModel.Width = nWidth &lt;br /&gt;
        self.oDialogModel.Height = nHeight &lt;br /&gt;
&lt;br /&gt;
    def setDialogTitle( self, cCaption ): &lt;br /&gt;
        self.oDialogModel.Title = cCaption &lt;br /&gt;
&lt;br /&gt;
    def setVisible( self, bVisible ): &lt;br /&gt;
        self.oDialogControl.setVisible( bVisible ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlButton &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # After you add a Button control, you can call self.setControlModelProperty() &lt;br /&gt;
    #  passing any of the properties for a... &lt;br /&gt;
    #       com.sun.star.awt.UnoControlButtonModel &lt;br /&gt;
    #       com.sun.star.awt.UnoControlDialogElement &lt;br /&gt;
    #       com.sun.star.awt.UnoControlModel &lt;br /&gt;
    def addButton( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                       cLabel=None, &lt;br /&gt;
                       actionListenerProc=None, &lt;br /&gt;
                       nTabIndex=None ): &lt;br /&gt;
        self.addControl( &amp;quot;com.sun.star.awt.UnoControlButtonModel&amp;quot;, &lt;br /&gt;
                         cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                         cLabel=cLabel, &lt;br /&gt;
                         nTabIndex=nTabIndex ) &lt;br /&gt;
        if actionListenerProc != None: &lt;br /&gt;
            self.addActionListenerProc( cCtrlName, actionListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def setButtonLabel( self, cCtrlName, cLabel ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the label of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setLabel( cLabel ) &lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlCheckBox &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # After you add a CheckBox control, you can call self.setControlModelProperty() &lt;br /&gt;
    #  passing any of the properties for a... &lt;br /&gt;
    #       com.sun.star.awt.UnoControlCheckBoxModel &lt;br /&gt;
    #       com.sun.star.awt.UnoControlDialogElement &lt;br /&gt;
    #       com.sun.star.awt.UnoControlModel &lt;br /&gt;
    def addCheckBox( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                       cLabel=None, &lt;br /&gt;
                       itemListenerProc=None, &lt;br /&gt;
                       nTabIndex=None ): &lt;br /&gt;
        self.addControl( &amp;quot;com.sun.star.awt.UnoControlCheckBoxModel&amp;quot;, &lt;br /&gt;
                         cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                         cLabel=cLabel, &lt;br /&gt;
                         nTabIndex=nTabIndex ) &lt;br /&gt;
        if itemListenerProc != None: &lt;br /&gt;
            self.addItemListenerProc( cCtrlName, itemListenerProc ) &lt;br /&gt;
&lt;br /&gt;
    def setCheckBoxLabel( self, cCtrlName, cLabel ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the label of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setLabel( cLabel ) &lt;br /&gt;
&lt;br /&gt;
    def getCheckBoxState( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the state of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.getState(); &lt;br /&gt;
&lt;br /&gt;
    def setCheckBoxState( self, cCtrlName, nState ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the state of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setState( nState ) &lt;br /&gt;
&lt;br /&gt;
    def enableCheckBoxTriState( self, cCtrlName, bTriStateEnable ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Enable or disable the tri state mode of the control.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.enableTriState( bTriStateEnable ) &lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   com.sun.star.awt.UnoControlFixedText &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addFixedText( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cLabel=None ): &lt;br /&gt;
        self.addControl( &amp;quot;com.sun.star.awt.UnoControlFixedTextModel&amp;quot;, &lt;br /&gt;
                         cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                         cLabel=cLabel ) &lt;br /&gt;
            &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Add Controls to dialog &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def addControl( self, cCtrlServiceName, &lt;br /&gt;
                        cCtrlName, nPositionX, nPositionY, nWidth, nHeight, &lt;br /&gt;
                        cLabel=None, &lt;br /&gt;
                        nTabIndex=None ): &lt;br /&gt;
        oControlModel = self.oDialogModel.createInstance( cCtrlServiceName ) &lt;br /&gt;
        self.oDialogModel.insertByName( cCtrlName, oControlModel ) &lt;br /&gt;
&lt;br /&gt;
        # if negative coordinates are given for X or Y position, &lt;br /&gt;
        #  then make that coordinate be relative to the right/bottom &lt;br /&gt;
        #  edge of the dialog box instead of to the left/top. &lt;br /&gt;
        if nPositionX &amp;lt; 0: nPositionX = self.oDialogModel.Width  + nPositionX - nWidth &lt;br /&gt;
        if nPositionY &amp;lt; 0: nPositionY = self.oDialogModel.Height + nPositionY - nHeight &lt;br /&gt;
        oControlModel.PositionX = nPositionX &lt;br /&gt;
        oControlModel.PositionY = nPositionY &lt;br /&gt;
        oControlModel.Width = nWidth &lt;br /&gt;
        oControlModel.Height = nHeight &lt;br /&gt;
        oControlModel.Name = cCtrlName &lt;br /&gt;
        &lt;br /&gt;
        if cLabel != None: &lt;br /&gt;
            oControlModel.Label = cLabel &lt;br /&gt;
&lt;br /&gt;
        if nTabIndex != None: &lt;br /&gt;
            oControlModel.TabIndex = nTabIndex &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Access controls and control models &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def getControl( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the control (not its model) for a particular control name. &lt;br /&gt;
        The control returned includes the service com.sun.star.awt.UnoControl, &lt;br /&gt;
         and another control-specific service which inherits from it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.oDialogControl.getControl( cCtrlName ) &lt;br /&gt;
        return oControl &lt;br /&gt;
&lt;br /&gt;
    def getControlModel( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the control model (not the control) for a particular control name. &lt;br /&gt;
        The model returned includes the service UnoControlModel, &lt;br /&gt;
         and another control-specific service which inherits from it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControlModel = oControl.getModel() &lt;br /&gt;
        return oControlModel &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Adjust properties of control models &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def setControlModelProperty( self, cCtrlName, cPropertyName, uValue ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Set the value of a property of a control&amp;#039;s model. &lt;br /&gt;
        This affects the control model, not the control. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = self.getControlModel( cCtrlName ) &lt;br /&gt;
        oControlModel.setPropertyValue( cPropertyName, uValue ) &lt;br /&gt;
&lt;br /&gt;
    def getControlModelProperty( self, cCtrlName, cPropertyName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the value of a property of a control&amp;#039;s model. &lt;br /&gt;
        This affects the control model, not the control. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControlModel = self.getControlModel( cCtrlName ) &lt;br /&gt;
        return oControlModel.getPropertyValue( cPropertyName ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Sugar coated property adjustments to control models. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def setEnabled( self, cCtrlName, bEnabled=True ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Enabled&amp;quot;, bEnabled ) &lt;br /&gt;
&lt;br /&gt;
    def getEnabled( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Enabled&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setState( self, cCtrlName, nState ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;State&amp;quot;, nState ) &lt;br /&gt;
&lt;br /&gt;
    def getState( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;State&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setLabel( self, cCtrlName, cLabel ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Label&amp;quot;, cLabel ) &lt;br /&gt;
&lt;br /&gt;
    def getLabel( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Label&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setHelpText( self, cCtrlName, cHelpText ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;HelpText&amp;quot;, cHelpText ) &lt;br /&gt;
&lt;br /&gt;
    def getHelpText( self, cCtrlName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Supported controls... &lt;br /&gt;
            UnoControlButtonModel &lt;br /&gt;
            UnoControlCheckBoxModel &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;HelpText&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Adjust controls (not models) &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # The following apply to all controls which are a &lt;br /&gt;
    #   com.sun.star.awt.UnoControl &lt;br /&gt;
&lt;br /&gt;
    def setDesignMode( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oControl.setDesignMode( bDesignMode ) &lt;br /&gt;
&lt;br /&gt;
    def isDesignMode( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isDesignMode() &lt;br /&gt;
  &lt;br /&gt;
    def isTransparent( self, cCtrlName, bDesignMode=True ): &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        return oControl.isTransparent() &lt;br /&gt;
      &lt;br /&gt;
&lt;br /&gt;
    # The following apply to all controls which are a &lt;br /&gt;
    #   com.sun.star.awt.UnoControlDialogElement &lt;br /&gt;
&lt;br /&gt;
    def setPosition( self, cCtrlName, nPositionX, nPositionY ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;PositionX&amp;quot;, nPositionX ) &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;PositionY&amp;quot;, nPositionY ) &lt;br /&gt;
    def setPositionX( self, cCtrlName, nPositionX ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;PositionX&amp;quot;, nPositionX ) &lt;br /&gt;
    def setPositionY( self, cCtrlName, nPositionY ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;PositionY&amp;quot;, nPositionY ) &lt;br /&gt;
    def getPositionX( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;PositionX&amp;quot; ) &lt;br /&gt;
    def getPositionY( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;PositionY&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setSize( self, cCtrlName, nWidth, nHeight ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Width&amp;quot;, nWidth ) &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Height&amp;quot;, nHeight ) &lt;br /&gt;
    def setWidth( self, cCtrlName, nWidth ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Width&amp;quot;, nWidth ) &lt;br /&gt;
    def setHeight( self, cCtrlName, nHeight ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Height&amp;quot;, nHeight ) &lt;br /&gt;
    def getWidth( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Width&amp;quot; ) &lt;br /&gt;
    def getHeight( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Height&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setTabIndex( self, cCtrlName, nWidth, nTabIndex ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;TabIndex&amp;quot;, nTabIndex ) &lt;br /&gt;
    def getTabIndex( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;TabIndex&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setStep( self, cCtrlName, nWidth, nStep ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Step&amp;quot;, nStep ) &lt;br /&gt;
    def getStep( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Step&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    def setTag( self, cCtrlName, nWidth, cTag ): &lt;br /&gt;
        self.setControlModelProperty( cCtrlName, &amp;quot;Tag&amp;quot;, cTag ) &lt;br /&gt;
    def getTag( self, cCtrlName ): &lt;br /&gt;
        return self.getControlModelProperty( cCtrlName, &amp;quot;Tag&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Add listeners to controls. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # This applies to... &lt;br /&gt;
    #   UnoControlButton &lt;br /&gt;
    def addActionListenerProc( self, cCtrlName, actionListenerProc ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create an com.sun.star.awt.XActionListener object and add it to a control. &lt;br /&gt;
        A listener object is created which will call the python procedure actionListenerProc. &lt;br /&gt;
        The actionListenerProc can be either a method or a global procedure. &lt;br /&gt;
        The following controls support XActionListener: &lt;br /&gt;
            UnoControlButton &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oActionListener = ActionListenerProcAdapter( actionListenerProc ) &lt;br /&gt;
        oControl.addActionListener( oActionListener ) &lt;br /&gt;
&lt;br /&gt;
    # This applies to... &lt;br /&gt;
    #   UnoControlCheckBox &lt;br /&gt;
    def addItemListenerProc( self, cCtrlName, itemListenerProc ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create an com.sun.star.awt.XItemListener object and add it to a control. &lt;br /&gt;
        A listener object is created which will call the python procedure itemListenerProc. &lt;br /&gt;
        The itemListenerProc can be either a method or a global procedure. &lt;br /&gt;
        The following controls support XActionListener: &lt;br /&gt;
            UnoControlCheckBox &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oControl = self.getControl( cCtrlName ) &lt;br /&gt;
        oActionListener = ItemListenerProcAdapter( itemListenerProc ) &lt;br /&gt;
        oControl.addItemListener( oActionListener ) &lt;br /&gt;
&lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
    #   Display the modal dialog. &lt;br /&gt;
    #-------------------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def doModalDialog( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Display the dialog as a modal dialog.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.oDialogControl.setVisible( True ) &lt;br /&gt;
        self.oDialogControl.execute() &lt;br /&gt;
&lt;br /&gt;
    def endExecute( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Call this from within one of the listeners to end the modal dialog. &lt;br /&gt;
        For instance, the listener on your OK or Cancel button would call this to end the dialog. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.oDialogControl.endExecute() &lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# Example of Dialog box built by subclassing the DBModalDialog class. &lt;br /&gt;
&lt;br /&gt;
class Test1Dialog( DBModalDialog ): &lt;br /&gt;
    def __init__( self ): &lt;br /&gt;
        DBModalDialog.__init__( self ) &lt;br /&gt;
        self.setDialogPosition( 60, 50 ) &lt;br /&gt;
        self.setDialogSize( 150, 80 ) &lt;br /&gt;
        self.setDialogTitle( &amp;quot;My Test1 Dialog&amp;quot; ) &lt;br /&gt;
        self.addButton( &amp;quot;btnOK&amp;quot;, -10, -10, 30, 14, &amp;quot;OK&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnOK_clicked ) &lt;br /&gt;
        self.addButton( &amp;quot;btnCancel&amp;quot;, -50, -10, 30, 14, &amp;quot;Cancel&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnCancel_clicked ) &lt;br /&gt;
        self.nOkClicks = 0 &lt;br /&gt;
        self.nCancelClicks = 0 &lt;br /&gt;
&lt;br /&gt;
    # Called when the OK button is clicked. &lt;br /&gt;
    def btnOK_clicked( self, oActionEvent ): &lt;br /&gt;
        self.nOkClicks += 1 &lt;br /&gt;
&lt;br /&gt;
    # Called when the Cancel button is clicked. &lt;br /&gt;
    def btnCancel_clicked( self, oActionEvent ): &lt;br /&gt;
        self.nCancelClicks += 1 &lt;br /&gt;
&lt;br /&gt;
def Test1(): &lt;br /&gt;
    oTestDialog =  Test1Dialog() &lt;br /&gt;
&lt;br /&gt;
    # Display dialog box. &lt;br /&gt;
    # This does not return until the dialog box is dismissed. &lt;br /&gt;
    oTestDialog.doModalDialog() &lt;br /&gt;
    &lt;br /&gt;
    # Print out the global button click counters. &lt;br /&gt;
    print oTestDialog.nCancelClicks, oTestDialog.nOkClicks &lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# Example of modal creating a dialog box without subclassing DBModalDialog. &lt;br /&gt;
&lt;br /&gt;
# Global vars to keep track of button clicks. &lt;br /&gt;
nOkClicks = 0 &lt;br /&gt;
nCancelClicks = 0 &lt;br /&gt;
# Global procs, called as event listeners on button clicks. &lt;br /&gt;
def OKClicked( oActionEvent ): &lt;br /&gt;
    global nOkClicks &lt;br /&gt;
    nOkClicks += 1 &lt;br /&gt;
def CancelClicked( oActionEvent ): &lt;br /&gt;
    global nCancelClicks &lt;br /&gt;
    nCancelClicks += 1 &lt;br /&gt;
&lt;br /&gt;
# Create a modal dialog box without subclassing DBModalDialog. &lt;br /&gt;
def Test2(): &lt;br /&gt;
    oTestDialog = DBModalDialog( 60, 50, 150, 80, &amp;quot;My Test2 Dialog&amp;quot; ) &lt;br /&gt;
    oTestDialog.addButton( &amp;quot;btnOK&amp;quot;, -10, -10, 30, 14, &amp;quot;OK&amp;quot; ) &lt;br /&gt;
    oTestDialog.addButton( &amp;quot;btnCancel&amp;quot;, -50, -10, 30, 14, &amp;quot;Cancel&amp;quot; ) &lt;br /&gt;
    oTestDialog.addFixedText( &amp;quot;lbl01&amp;quot;, 10, 10, 30, 14, &amp;quot;Test1&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Install global event listener procs. &lt;br /&gt;
    # Use the addActionListenerProc() routine instead of supplying the event &lt;br /&gt;
    #  listener to the addButton() as in first example. &lt;br /&gt;
    oTestDialog.addActionListenerProc( &amp;quot;btnOK&amp;quot;, OKClicked ) &lt;br /&gt;
    oTestDialog.addActionListenerProc( &amp;quot;btnCancel&amp;quot;, CancelClicked ) &lt;br /&gt;
&lt;br /&gt;
    # Display dialog box. &lt;br /&gt;
    # This does not return until the dialog box is dismissed. &lt;br /&gt;
    oTestDialog.doModalDialog() &lt;br /&gt;
&lt;br /&gt;
    # Print out the global button click counters. &lt;br /&gt;
    print nCancelClicks, nOkClicks &lt;br /&gt;
&lt;br /&gt;
#-------------------------------------------------- &lt;br /&gt;
# Example of Dialog box built by subclassing the DBModalDialog class. &lt;br /&gt;
&lt;br /&gt;
class ModalDoggieKittyMonkeyDialog( DBModalDialog ): &lt;br /&gt;
    def __init__( self ):        &lt;br /&gt;
        self.nNumDoggies = 0 &lt;br /&gt;
        self.nNumKitties = 0 &lt;br /&gt;
        self.nNumMonkeys = 0 &lt;br /&gt;
        self.bTails = False &lt;br /&gt;
        self.bOkay = False &lt;br /&gt;
&lt;br /&gt;
        DBModalDialog.__init__( self, 60, 50, 200, 90, &amp;quot;Doggie/Kitty/Monkey Dialog&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
        # Add an OK and a Cancel button. &lt;br /&gt;
        # Both buttons share an action listener named &amp;quot;self.btnOkOrCancel_clicked&amp;quot;. &lt;br /&gt;
        self.addButton( &amp;quot;btnOK&amp;quot;, -10, -10, 50, 14, &amp;quot;OK&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnOkOrCancel_clicked ) &lt;br /&gt;
        self.addButton( &amp;quot;btnCancel&amp;quot;, -10 - 50 - 10, -10, 50, 14, &amp;quot;Cancel&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnOkOrCancel_clicked ) &lt;br /&gt;
&lt;br /&gt;
        # Add three buttons. &lt;br /&gt;
        self.addButton( &amp;quot;btnDoggie&amp;quot;, 5, 10, 50, 14, &amp;quot;Add Doggie&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnDoggie_Clicked ) &lt;br /&gt;
        self.addButton( &amp;quot;btnKitty&amp;quot;, 5, 30, 50, 14, &amp;quot;Add Kitty&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnKitty_Clicked ) &lt;br /&gt;
        self.addButton( &amp;quot;btnMonkey&amp;quot;, 5, 50, 50, 14, &amp;quot;Add Monkey&amp;quot;, &lt;br /&gt;
                        actionListenerProc = self.btnMonkey_Clicked ) &lt;br /&gt;
&lt;br /&gt;
        # Add a label to the dialog. &lt;br /&gt;
        self.addFixedText( &amp;quot;lbl1&amp;quot;, 60, 10, 100, 14, &amp;quot;Add some doggies, kitties, and monkeys.&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
        # Add a checkbox to the dialog. &lt;br /&gt;
        self.addCheckBox( &amp;quot;chkTails&amp;quot;, 60, 30, 50, 14, &amp;quot;With tails&amp;quot;, &lt;br /&gt;
                          itemListenerProc = self.chkTails_changed ) &lt;br /&gt;
&lt;br /&gt;
    def btnOkOrCancel_clicked( self, oActionEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Called when the OK or Cancel button is clicked.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        if oActionEvent.Source.getModel().Name == &amp;quot;btnOK&amp;quot;: &lt;br /&gt;
            self.bOkay = True &lt;br /&gt;
        self.endExecute() &lt;br /&gt;
&lt;br /&gt;
    def btnDoggie_Clicked( self, oActionEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Called with the Doggie button is clicked.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.nNumDoggies += 1 &lt;br /&gt;
&lt;br /&gt;
    def btnKitty_Clicked( self, oActionEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Called with the Kitty button is clicked.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.nNumKitties += 1 &lt;br /&gt;
&lt;br /&gt;
    def btnMonkey_Clicked( self, oActionEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Called with the Monkey button is clicked.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.nNumMonkeys += 1 &lt;br /&gt;
&lt;br /&gt;
    def chkTails_changed( self, oItemEvent ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Called when the Tails checkbox is clicked.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        self.bTails = self.getState( &amp;quot;chkTails&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def Test3(): &lt;br /&gt;
    oTestDialog = ModalDoggieKittyMonkeyDialog() &lt;br /&gt;
    oTestDialog.doModalDialog() &lt;br /&gt;
    &lt;br /&gt;
    # Print out the global button click counters. &lt;br /&gt;
    print oTestDialog.nNumDoggies, oTestDialog.nNumKitties, oTestDialog.nNumMonkeys &lt;br /&gt;
    print &amp;quot;okay:&amp;quot;,oTestDialog.bOkay,&amp;quot; tails:&amp;quot;,oTestDialog.bTails, oTestDialog.getState( &amp;quot;chkTails&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
#&amp;gt;&amp;gt;&amp;gt; import Danny.OOo.DialogLib &lt;br /&gt;
#&amp;gt;&amp;gt;&amp;gt; reload( Danny.OOo.DialogLib ); from Danny.OOo.DialogLib import * &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.ConfigLib.py&amp;diff=235904</id>
		<title>Danny.OOo.ConfigLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.ConfigLib.py&amp;diff=235904"/>
		<updated>2015-02-17T19:42:05Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Routines for working with the Configuration Manager. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.ConfigLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-20-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
# Danny&amp;#039;s libraries &lt;br /&gt;
from Danny.OOo.OOoLib import createUnoService, createUnoStruct &lt;br /&gt;
from Danny.OOo.OOoLib import makePropertyValue &lt;br /&gt;
from Danny.OOo.OOoLib import getServiceManager &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def getConfigAccess( cNodePath, bWriteAccess=False, bEnableSync=True, bLazyWrite=False ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;An easy way to obtain a configuration node from the configuration manager.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oConfigProvider = getServiceManager().createInstanceWithArguments( &lt;br /&gt;
   &amp;quot;com.sun.star.configuration.ConfigurationProvider&amp;quot;, &lt;br /&gt;
   ( makePropertyValue( &amp;quot;enablesync&amp;quot;, bEnableSync ), ) ) &lt;br /&gt;
    &lt;br /&gt;
    if bWriteAccess: &lt;br /&gt;
        cServiceName = &amp;quot;com.sun.star.configuration.ConfigurationUpdateAccess&amp;quot; &lt;br /&gt;
    else: &lt;br /&gt;
        cServiceName = &amp;quot;com.sun.star.configuration.ConfigurationAccess&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    oConfigAccess = oConfigProvider.createInstanceWithArguments( cServiceName, &lt;br /&gt;
        ( makePropertyValue( &amp;quot;nodepath&amp;quot;, cNodePath ), &lt;br /&gt;
          makePropertyValue( &amp;quot;lazywrite&amp;quot;, bLazyWrite ), ) ) &lt;br /&gt;
&lt;br /&gt;
    return oConfigAccess &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# oConfigAccess = getConfigAccess( &amp;quot;/org.openoffice.Office.Addons/AddonUI&amp;quot; ) &lt;br /&gt;
# oElement = oConfigAccess.getByName( &amp;quot;AddonMenu&amp;quot; ) &lt;br /&gt;
# tNames = oElement.getElementNames() &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.PrintToWriter.py&amp;diff=235903</id>
		<title>Danny.OOo.PrintToWriter.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.PrintToWriter.py&amp;diff=235903"/>
		<updated>2015-02-17T19:40:15Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This makes it easy and convenient to print a bunch of text into a Writer document. &lt;br /&gt;
&lt;br /&gt;
See the example routine in the module that shows how easy this module is to use, and how useful it can be. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.PrintToWriter.py &lt;br /&gt;
# &lt;br /&gt;
#   This makes it easy and convenient to print a bunch of text into &lt;br /&gt;
#    a Writer document. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-05-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
&lt;br /&gt;
# Danny&amp;#039;s libraries &lt;br /&gt;
from Danny.OOo.OOoLib import StarDesktop &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
com_sun_star_text_ControlCharacter_PARAGRAPH_BREAK  = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK&amp;quot; ) &lt;br /&gt;
com_sun_star_text_ControlCharacter_LINE_BREAK       = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.LINE_BREAK&amp;quot; ) &lt;br /&gt;
com_sun_star_text_ControlCharacter_HARD_HYPHEN      = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.HARD_HYPHEN&amp;quot; ) &lt;br /&gt;
com_sun_star_text_ControlCharacter_SOFT_HYPHEN      = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.SOFT_HYPHEN&amp;quot; ) &lt;br /&gt;
com_sun_star_text_ControlCharacter_HARD_SPACE       = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.HARD_SPACE&amp;quot; ) &lt;br /&gt;
com_sun_star_text_ControlCharacter_APPEND_PARAGRAPH = uno.getConstantByName( &amp;quot;com.sun.star.text.ControlCharacter.APPEND_PARAGRAPH&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class PrintToWriter: &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;A class which allows conveniently printing stuff into a Writer document. &lt;br /&gt;
    Very useful for debugging, general output purposes, or even for creating reports.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    def __init__( self ): &lt;br /&gt;
        self.oWriterDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/swriter&amp;quot;, &amp;quot;_blank&amp;quot;, 0, () ) &lt;br /&gt;
        self.oWriterText = self.oWriterDoc.getText() &lt;br /&gt;
        self.oWriterCursor = self.oWriterText.createTextCursor() &lt;br /&gt;
&lt;br /&gt;
    def writeLn( self, *args ): &lt;br /&gt;
        if len( args ) &amp;gt; 0: &lt;br /&gt;
            apply( self.write, args ) &lt;br /&gt;
        self.writeParagraphBreak() &lt;br /&gt;
&lt;br /&gt;
    def write( self, arg1, *argsRest ): &lt;br /&gt;
        self.writeOne( arg1 ) &lt;br /&gt;
        for arg in argsRest: &lt;br /&gt;
            self.writeTab() &lt;br /&gt;
            self.writeOne( arg ) &lt;br /&gt;
&lt;br /&gt;
    def writeOne( self, arg, bAbsorb=False ): &lt;br /&gt;
        self.writeString( str( arg ), bAbsorb ) &lt;br /&gt;
&lt;br /&gt;
    def writeTab( self, bAbsorb=False ): &lt;br /&gt;
        self.writeString( &amp;quot;\t&amp;quot;, bAbsorb ) &lt;br /&gt;
&lt;br /&gt;
    def writeParagraphBreak( self, bAbsorb=False ): &lt;br /&gt;
        self.writeControlCharacter( com_sun_star_text_ControlCharacter_PARAGRAPH_BREAK, bAbsorb ) &lt;br /&gt;
&lt;br /&gt;
    def writeString( self, cString, bAbsorb=False ): &lt;br /&gt;
        self.oWriterText.insertString( self.oWriterCursor, cString, bAbsorb ) &lt;br /&gt;
&lt;br /&gt;
    def writeControlCharacter( self, nCtrlChar, bAbsorb=False ): &lt;br /&gt;
        self.oWriterText.insertControlCharacter( self.oWriterCursor, nCtrlChar, bAbsorb ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def example_PrintToWriter(): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;An example of how to use the PrintToWriter class to trivially create &lt;br /&gt;
    a new Writer document, and write out text into it.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oOutput = PrintToWriter() &lt;br /&gt;
    oOutput.writeLn( &amp;quot;Hello World&amp;quot; ) &lt;br /&gt;
    oOutput.write( &amp;quot;String&amp;quot;, 123, 456.23, True ) &lt;br /&gt;
    oOutput.writeLn() &lt;br /&gt;
    oOutput.writeLn() &lt;br /&gt;
&lt;br /&gt;
    oOutput.writeLn( &amp;quot;Tab delimited values...&amp;quot; ) &lt;br /&gt;
    &lt;br /&gt;
    oOutput.write( 123 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 456 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 789 ) &lt;br /&gt;
    oOutput.writeLn() &lt;br /&gt;
    &lt;br /&gt;
    oOutput.write( 465 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 522 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 835 ) &lt;br /&gt;
    oOutput.writeLn() &lt;br /&gt;
    &lt;br /&gt;
    oOutput.write( 886 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 164 ) &lt;br /&gt;
    oOutput.writeTab() &lt;br /&gt;
    oOutput.write( 741 ) &lt;br /&gt;
    oOutput.writeLn()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.HSBConversions.py&amp;diff=235902</id>
		<title>Danny.HSBConversions.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.HSBConversions.py&amp;diff=235902"/>
		<updated>2015-02-17T19:36:27Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;HSB to RGB color space conversion routines. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.HSBConversions.py &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2003-08-21-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#   HSB to RGB color space conversion routines. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def RGBtoHSB( nRed, nGreen, nBlue ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;RGB to HSB color space conversion routine. &lt;br /&gt;
    nRed, nGreen and nBlue are all numbers from 0 to 255. &lt;br /&gt;
    This routine returns three floating point numbers, nHue, nSaturation, nBrightness. &lt;br /&gt;
    nHue, nSaturation and nBrightness are all from 0.0 to 1.0. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    nMin = min( nRed, nGreen, nBlue ) &lt;br /&gt;
    nMax = max( nRed, nGreen, nBlue ) &lt;br /&gt;
&lt;br /&gt;
    if nMin == nMax: &lt;br /&gt;
        # Grayscale &lt;br /&gt;
        nHue = 0.0 &lt;br /&gt;
        nSaturation = 0.0 &lt;br /&gt;
        nBrightness = nMax &lt;br /&gt;
    else: &lt;br /&gt;
        if nRed == nMin: &lt;br /&gt;
            d = nGreen = nBlue &lt;br /&gt;
            h = 3.0 &lt;br /&gt;
        elif nGreen == nMin: &lt;br /&gt;
            d = nBlue - nRed &lt;br /&gt;
            h = 5.0 &lt;br /&gt;
        else: &lt;br /&gt;
            d = nRed - nGreen &lt;br /&gt;
            h = 1.0 &lt;br /&gt;
&lt;br /&gt;
        nHue = ( h - ( float( d ) / (nMax - nMin) ) ) / 6.0 &lt;br /&gt;
        nSaturation = (nMax - nMin) / float( nMax ) &lt;br /&gt;
        nBrightness = nMax / 255.0 &lt;br /&gt;
&lt;br /&gt;
    return nHue, nSaturation, nBrightness &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def HSBtoRGB( nHue, nSaturation, nBrightness ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;HSB to RGB color space conversion routine. &lt;br /&gt;
    nHue, nSaturation and nBrightness are all from 0.0 to 1.0. &lt;br /&gt;
    This routine returns three integer numbers, nRed, nGreen, nBlue. &lt;br /&gt;
    nRed, nGreen and nBlue are all numbers from 0 to 255. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    # Scale the brightness from a range of 0.0 thru 1.0 &lt;br /&gt;
    #  to a range of 0.0 thru 255.0 &lt;br /&gt;
    # Then truncate to an integer. &lt;br /&gt;
    nBrightness = int( min( nBrightness * 256.0, 255.0 ) ) &lt;br /&gt;
&lt;br /&gt;
    if nSaturation == 0.0: &lt;br /&gt;
        # Grayscale because there is no saturation &lt;br /&gt;
        nRed = nBrightness &lt;br /&gt;
        nGreen = nBrightness &lt;br /&gt;
        nBlue = nBrightness &lt;br /&gt;
    else: &lt;br /&gt;
        # Make hue angle be within a single rotation. &lt;br /&gt;
        # If the hue is &amp;gt; 1.0 or &amp;lt; 0.0, then it has &lt;br /&gt;
        #  &amp;quot;gone around the color wheel&amp;quot; too many times. &lt;br /&gt;
        #  For example, a value of 1.2 means that it has &lt;br /&gt;
        #  gone around the wheel 1.2 times, which is really &lt;br /&gt;
        #  the same ending angle as 0.2 trips around the wheel. &lt;br /&gt;
        # Scale it back to the 0.0 to 1.0 range. &lt;br /&gt;
        if nHue &amp;gt; 1.0: &lt;br /&gt;
            nHue = nHue - int( nHue ) &lt;br /&gt;
        elif nHue &amp;lt; 0.0: &lt;br /&gt;
            nHue = abs( nHue ) &lt;br /&gt;
            if nHue &amp;gt; 1.0: &lt;br /&gt;
                nHue = nHue - int( nHue ) &lt;br /&gt;
            nHue = 1.0 - nHue &lt;br /&gt;
        # Rescale hue to a range of 0.0 thru 6.0 &lt;br /&gt;
        nHue = nHue * 6.0 &lt;br /&gt;
        # Separate hue into int and fractional parts &lt;br /&gt;
        iHue = int( nHue ) &lt;br /&gt;
        fHue = nHue - iHue &lt;br /&gt;
        # Is hue even? &lt;br /&gt;
        if iHue % 2 == 0: &lt;br /&gt;
            fHue = 1.0 - fHue &lt;br /&gt;
        # &lt;br /&gt;
        m = nBrightness * (1.0 - nSaturation) &lt;br /&gt;
        n = nBrightness * (1.0 - (nSaturation * fHue)) &lt;br /&gt;
&lt;br /&gt;
        if iHue == 1: &lt;br /&gt;
            nRed = n &lt;br /&gt;
            nGreen = nBrightness &lt;br /&gt;
            nBlue = m &lt;br /&gt;
        elif iHue == 2: &lt;br /&gt;
            nRed = m &lt;br /&gt;
            nGreen = nBrightness &lt;br /&gt;
            nBlue = n &lt;br /&gt;
        elif iHue == 3: &lt;br /&gt;
            nRed = m &lt;br /&gt;
            nGreen = n &lt;br /&gt;
            nBlue = nBrightness &lt;br /&gt;
        elif iHue == 4: &lt;br /&gt;
            nRed = n &lt;br /&gt;
            nGreen = m &lt;br /&gt;
            nBlue = nBrightness &lt;br /&gt;
        elif iHue == 5: &lt;br /&gt;
            nRed = nBrightness &lt;br /&gt;
            nGreen = m &lt;br /&gt;
            nBlue = n &lt;br /&gt;
        else: &lt;br /&gt;
            nRed = nBrightness &lt;br /&gt;
            nGreen = n &lt;br /&gt;
            nBlue = m &lt;br /&gt;
    &lt;br /&gt;
    return nRed, nGreen, nBlue &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.DrawLib.py&amp;diff=235901</id>
		<title>Danny.OOo.DrawLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.DrawLib.py&amp;diff=235901"/>
		<updated>2015-02-17T19:34:36Z</updated>

		<summary type="html">&lt;p&gt;JZA: Source from oooforum&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module has routines to make programming OOo Drawing documents easier. Much of this code was derrived from Basic code, that also appears in Danny&amp;#039;s Draw Power Tools found at OOoMacros.org. &lt;br /&gt;
&lt;br /&gt;
This module depends upon the modules... &lt;br /&gt;
* [[Danny.OOo.OOoLib.py]]&lt;br /&gt;
* [[Danny.HSBConversions.py]]&lt;br /&gt;
presented elsewhere in this thread. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.DrawLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OOo Drawings. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-05-24-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Python libraries &lt;br /&gt;
import math &lt;br /&gt;
import string &lt;br /&gt;
&lt;br /&gt;
# Danny&amp;#039;s libraries &lt;br /&gt;
from Danny import HSBConversions &lt;br /&gt;
from Danny.OOo.OOoLib import * &lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Functions for working with Draw documents. &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeDrawDocument(): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new OOo Draw document.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return loadComponentFromURL( &amp;quot;private:factory/sdraw&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
def makeImpressDocument(): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new OOo Impress document.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return loadComponentFromURL( &amp;quot;private:factory/simpress&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Notes about some properties and constants for shape objects... &lt;br /&gt;
&lt;br /&gt;
    # LineStyle can be one of... &lt;br /&gt;
    #   com.sun.star.drawing.LineStyle.NONE &lt;br /&gt;
    #   com.sun.star.drawing.LineStyle.SOLID &lt;br /&gt;
    #   com.sun.star.drawing.LineStyle.DASH &lt;br /&gt;
&lt;br /&gt;
    # CircleKind can be one of... &lt;br /&gt;
    #   com.sun.star.drawing.CircleKind.FULL &lt;br /&gt;
    #   com.sun.star.drawing.CircleKind.SECTION   &amp;#039; a circle with a cut connected by two lines &lt;br /&gt;
    #   com.sun.star.drawing.CircleKind.CUT &amp;#039; a circle with a cut connected by a line &lt;br /&gt;
    #   com.sun.star.drawing.CircleKind.ARC &amp;#039; a circle with an open cut &lt;br /&gt;
    &lt;br /&gt;
    # FillStyle can be one of... &lt;br /&gt;
    #   com.sun.star.drawing.FillStyle.NONE &lt;br /&gt;
    #   com.sun.star.drawing.FillStyle.SOLID &lt;br /&gt;
    #   com.sun.star.drawing.FillStyle.GRADIENT &lt;br /&gt;
    #   com.sun.star.drawing.FillStyle.HATCH &lt;br /&gt;
    #   com.sun.star.drawing.FillStyle.BITMAP &lt;br /&gt;
    &lt;br /&gt;
    # TextHorizontalAdjust can be one of... &lt;br /&gt;
    #   com.sun.star.drawing.TextHorizontalAdjust.LEFT &lt;br /&gt;
    #   com.sun.star.drawing.TextHorizontalAdjust.CENTER &lt;br /&gt;
    #   com.sun.star.drawing.TextHorizontalAdjust.RIGHT &lt;br /&gt;
    #   com.sun.star.drawing.TextHorizontalAdjust.BLOCK &lt;br /&gt;
    &lt;br /&gt;
    # TextVerticalAdjust can be one of... &lt;br /&gt;
    #   com.sun.star.drawing.TextVerticalAdjust.TOP &lt;br /&gt;
    #   com.sun.star.drawing.TextVerticalAdjust.CENTER &lt;br /&gt;
    #   com.sun.star.drawing.TextVerticalAdjust.BOTTOM &lt;br /&gt;
    #   com.sun.star.drawing.TextVerticalAdjust.BLOCK &lt;br /&gt;
    &lt;br /&gt;
    # TextFitToSize can be one of... &lt;br /&gt;
    #    com.sun.star.drawing.TextFitToSizeType.NONE &lt;br /&gt;
    #    com.sun.star.drawing.TextFitToSizeType.PROPORTIONAL &lt;br /&gt;
    #    com.sun.star.drawing.TextFitToSizeType.ALLLINES &lt;br /&gt;
    #    com.sun.star.drawing.TextFitToSizeType.RESIZEATTR &lt;br /&gt;
&lt;br /&gt;
# Useful code snippets... &lt;br /&gt;
&lt;br /&gt;
    # Accessing pages of a drawing document. &lt;br /&gt;
    #   oDrawPage = oDrawDoc.getDrawPages().getByIndex( 0 ) &lt;br /&gt;
    #   oDrawPage = oDrawDoc.getDrawPages().getCount() &lt;br /&gt;
    #   oDrawPage = oDrawDoc.getDrawPages().insertByIndex( 1 ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Document functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def setDrawPageOrientationLandscape( oDrawPage ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Pass in any GenericDrawPage object, and this changes it to landscape orientation, &lt;br /&gt;
     in addition to swapping the height/width as you would expect. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    # Save some settings &lt;br /&gt;
    nOldWidth = oDrawPage.Width &lt;br /&gt;
    nOldHeight = oDrawPage.Height &lt;br /&gt;
    nOldBorderTop = oDrawPage.BorderTop &lt;br /&gt;
    nOldBorderLeft = oDrawPage.BorderLeft &lt;br /&gt;
    nOldBorderRight = oDrawPage.BorderRight &lt;br /&gt;
    nOldBorderBottom = oDrawPage.BorderBottom &lt;br /&gt;
    &lt;br /&gt;
    # Change so that it will PRINT in landscape &lt;br /&gt;
    oDrawPage.Orientation = uno.getConstantByName( &amp;quot;com.sun.star.view.PaperOrientation.LANDSCAPE&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Now change some paper dimensions to match &lt;br /&gt;
    oDrawPage.Width = nOldHeight &lt;br /&gt;
    oDrawPage.Height = nOldWidth &lt;br /&gt;
    oDrawPage.BorderTop = nOldBorderRight &lt;br /&gt;
    oDrawPage.BorderLeft = nOldBorderTop &lt;br /&gt;
    oDrawPage.BorderRight = nOldBorderBottom &lt;br /&gt;
    oDrawPage.BorderBottom = nOldBorderLeft &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Shape functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeRectangleShape( oDrawDoc, oPosition=None, oSize=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new RectangleShape with an optional position and size.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oShape = makeShape( oDrawDoc, &amp;quot;com.sun.star.drawing.RectangleShape&amp;quot;, oPosition, oSize ) &lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeEllipseShape( oDrawDoc, oPosition=None, oSize=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new EllipseShape with an optional position and size.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oShape = makeShape( oDrawDoc, &amp;quot;com.sun.star.drawing.EllipseShape&amp;quot;, oPosition, oSize ) &lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeLineShape( oDrawDoc, oPosition=None, oSize=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new LineShape with an optional position and size.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oShape = makeShape( oDrawDoc, &amp;quot;com.sun.star.drawing.LineShape&amp;quot;, oPosition, oSize ) &lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeTextShape( oDrawDoc, oPosition=None, oSize=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new TextShape with an optional position and size.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oShape = makeShape( oDrawDoc, &amp;quot;com.sun.star.drawing.TextShape&amp;quot;, oPosition, oSize ) &lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def findShapeByName( oShapes, cShapeName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Find a named shape within an XShapes interface. &lt;br /&gt;
    oShapes can be a drawing page, which supports the XShapes interface. &lt;br /&gt;
    Thus, you can find a named shape within a draw page, or within a grouped shape, &lt;br /&gt;
     or within a selection of sseveral shapes. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    nNumShapes = oShapes.getCount() &lt;br /&gt;
    for i in range( nNumShapes ): &lt;br /&gt;
        oShape = oShapes.getByIndex( i ) &lt;br /&gt;
        cTheShapeName = oShape.getName() &lt;br /&gt;
        if cTheShapeName == cShapeName: &lt;br /&gt;
            return oShape &lt;br /&gt;
    return None &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeShape( oDrawDoc, cShapeClassName, oPosition=None, oSize=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a new shape of the specified class. &lt;br /&gt;
    Position and size arguments are optional. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oShape = oDrawDoc.createInstance( cShapeClassName ) &lt;br /&gt;
&lt;br /&gt;
    if oPosition != None: &lt;br /&gt;
        oShape.Position = oPosition &lt;br /&gt;
    if oSize != None: &lt;br /&gt;
        oShape.Size = oSize &lt;br /&gt;
&lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Color manipulation &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def rgbColor( nRed, nGreen, nBlue ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return an integer which repsents a color. &lt;br /&gt;
    The color is specified in RGB notation. &lt;br /&gt;
    Each of nRed, nGreen and nBlue must be a number from 0 to 255. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return (int( nRed ) &amp;amp; 255) &amp;lt;&amp;lt; 16 | (int( nGreen ) &amp;amp; 255) &amp;lt;&amp;lt; 8 | (int( nBlue ) &amp;amp; 255) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def hsbColor( nHue, nSaturation, nBrightness ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return an integer which repsents a color. &lt;br /&gt;
    The color is specified in HSB notation. &lt;br /&gt;
    Each of nHue, nSaturation and nBrightness must be a number from 0.0 to 1.0. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    nRed, nGreen, nBlue = HSBConversions.HSBtoRGB( nHue, nSaturation, nBrightness ) &lt;br /&gt;
    return rgbColor( nRed, nGreen, nBlue ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def redColor( nColor ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return the Red component of a color as an integer from 0 to 255. &lt;br /&gt;
    nColor is an integer representing a color. &lt;br /&gt;
    This function is complimentary to the rgbColor function. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return (int( nColor ) &amp;gt;&amp;gt; 16) &amp;amp; 255 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def greenColor( nColor ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return the Green component of a color as an integer from 0 to 255. &lt;br /&gt;
    nColor is an integer representing a color. &lt;br /&gt;
    This function is complimentary to the rgbColor function. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return (int( nColor ) &amp;gt;&amp;gt; 8) &amp;amp; 255 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def blueColor( nColor ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Return the Blue component of a color as an integer from 0 to 255. &lt;br /&gt;
    nColor is an integer representing a color. &lt;br /&gt;
    This function is complimentary to the rgbColor function. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return int( nColor ) &amp;amp; 255 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Drawing routines &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Multiply this number by an OOo angle in 100&amp;#039;ths of a degree &lt;br /&gt;
#  to convert to radians. &lt;br /&gt;
nRadiansPerHundredthDegree = math.pi / 18000 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def drawLine( oDrawDoc, oDrawPage, x1,y1, x2,y2, nLineColor=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Draw a line from x1,y1 to x2,y2.  Optionally specify line color. &lt;br /&gt;
    This adds the LineShape to the page. &lt;br /&gt;
    The LineShape is returned. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    # make sure size is non-zero &lt;br /&gt;
    #if x1 = x2: x2 = x1 + 1 &lt;br /&gt;
    #if y1 = y2: y2 = y1 + 1 &lt;br /&gt;
&lt;br /&gt;
    oPosition = makePoint( x1, y1 ) &lt;br /&gt;
    oSize = makeSize( x2-x1, y2-y1 ) &lt;br /&gt;
&lt;br /&gt;
    oShape = makeLineShape( oDrawDoc, oPosition, oSize ) &lt;br /&gt;
&lt;br /&gt;
    if nLineColor != None: &lt;br /&gt;
        oShape.LineColor = nLineColor &lt;br /&gt;
    #oShape.LineWidth = 0 &lt;br /&gt;
&lt;br /&gt;
    oDrawPage.add( oShape ) &lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def drawLineVector( oDrawDoc, oDrawPage, x1,y1, nAngle,nDistance, nLineColor=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Draw a line from x1,y1 in the direction of nAngle, for a distance of nDistance. &lt;br /&gt;
    nAngle is measured in radians, clockwise from the 3 O&amp;#039;Clock (east) direction. &lt;br /&gt;
    nDistance is in 1000ths of a centimeter. &lt;br /&gt;
    This adds the LineShape to the page. &lt;br /&gt;
    The LineShape is returned. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    nDX = math.cos( nAngle ) * nDistance &lt;br /&gt;
    nDY = math.sin( nAngle ) * nDistance &lt;br /&gt;
&lt;br /&gt;
    return drawLine( oDrawDoc, oDrawPage, x1,y1, x1+nDX,y1+nDY, nLineColor ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def drawAutoSizingText( oDrawDoc, oDrawPage, &lt;br /&gt;
                        cText, nHeight, nExtraWidthPercent=40 ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a TextShape that will automatically resize its characters &lt;br /&gt;
     to its shape bounding rectangle. &lt;br /&gt;
    The TextShape is created with a specified height. &lt;br /&gt;
    The width is determined based on the natural character width of the &lt;br /&gt;
     text. &lt;br /&gt;
    The initial position of the text is -10000,-10000, so that the text is not visible. &lt;br /&gt;
    This returns the TextShape, which has already been added to the drawing page, &lt;br /&gt;
     at coordinates which make it invisible. &lt;br /&gt;
    You must set the object&amp;#039;s Position property to make the text visible. &lt;br /&gt;
    (Hint: You may look at the Size property to help you determine where &lt;br /&gt;
     you want to place the text, for instance if you are trying to center &lt;br /&gt;
     it, or place it relative to some other shape object.) &lt;br /&gt;
    If you don&amp;#039;t supply nExtraWidthPercent, then a default fudge factor is used. &lt;br /&gt;
    This is the percentage of the average character width, which is added to the shape&amp;#039;s &lt;br /&gt;
     total width. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    # Create TextShape &lt;br /&gt;
    oShape = makeTextShape( oDrawDoc, makePoint( -10000, -10000 ), makeSize( 1, 1 ) ) &lt;br /&gt;
&lt;br /&gt;
    # Add it to the page. &lt;br /&gt;
    oDrawPage.add( oShape ) &lt;br /&gt;
&lt;br /&gt;
    # Make text stick to upper left corner of the shape rather than centered within the shape. &lt;br /&gt;
    oShape.TextHorizontalAdjust = uno.getConstantByName( &amp;quot;com.sun.star.drawing.TextHorizontalAdjust.LEFT&amp;quot; ) &lt;br /&gt;
    oShape.TextVerticalAdjust = uno.getConstantByName( &amp;quot;com.sun.star.drawing.TextVerticalAdjust.TOP&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Make the shape auto-grow in size, based on the text. &lt;br /&gt;
    # Once we set the text, in the next step, the shape will grow to some &lt;br /&gt;
    #  unknown size, based on the current font in use. &lt;br /&gt;
    #oShape.TextAutoGrowHeight = True &lt;br /&gt;
    oShape.TextAutoGrowWidth = True &lt;br /&gt;
&lt;br /&gt;
    # Set the text of the TextShape. &lt;br /&gt;
    # Because of the TextAutoGrowWidth, the shape now occupies some unknown size. &lt;br /&gt;
    oShape.setString( cText ) &lt;br /&gt;
&lt;br /&gt;
    # Get the shape&amp;#039;s current size. &lt;br /&gt;
    nSaveHeight = oShape.Size.Height &lt;br /&gt;
    nSaveWidth = oShape.Size.Width &lt;br /&gt;
&lt;br /&gt;
    # Make the shape NOT auto-grow in size, based on the text. &lt;br /&gt;
    #oShape.TextAutoGrowHeight = False &lt;br /&gt;
    oShape.TextAutoGrowWidth = False &lt;br /&gt;
&lt;br /&gt;
    # This next setting causes the TextShape to automatically resize its characters &lt;br /&gt;
    #  to fit the size of the text shape. &lt;br /&gt;
    oShape.TextFitToSize = uno.getConstantByName( &amp;quot;com.sun.star.drawing.TextFitToSizeType.PROPORTIONAL&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Calculate the new width, based on the desired height, &lt;br /&gt;
    #  and saved width/height ratio for the current font in use. &lt;br /&gt;
    nWidth = nSaveWidth * (float(nHeight) / nSaveHeight) &lt;br /&gt;
&lt;br /&gt;
    nAverageCharacterWidth = nWidth / len( cText ) &lt;br /&gt;
&lt;br /&gt;
    nExtraWidth = nAverageCharacterWidth * (nExtraWidthPercent / 100.0) &lt;br /&gt;
&lt;br /&gt;
    oShape.TextLeftDistance = nExtraWidth &lt;br /&gt;
    oShape.TextRightDistance = nExtraWidth &lt;br /&gt;
    nWidth = nWidth + 2 * nExtraWidth &lt;br /&gt;
&lt;br /&gt;
    # Now resize the TextShape. &lt;br /&gt;
    oShape.Size.Width = nWidth &lt;br /&gt;
    oShape.Size.Height = nHeight &lt;br /&gt;
&lt;br /&gt;
    return oShape &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def drawArcPath( oDrawDoc, oDrawPage, &lt;br /&gt;
                 nStartX, nStartY, nStartAngle, &lt;br /&gt;
                 nArcAngle, nArcRadius, bTurnLeft ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Draw an arc of a circle from a starting position and direction. &lt;br /&gt;
    The arc has a certian radius and arc angle, &lt;br /&gt;
     and turns either to the left or to the right. &lt;br /&gt;
    Parameters: &lt;br /&gt;
    nStartX and nStartY are the starting position of the &amp;quot;turtle&amp;quot;. &lt;br /&gt;
    nStartAngle is the angle direction that the turtle is pointing, &lt;br /&gt;
     in 100&amp;#039;ths of a degree. &lt;br /&gt;
    An arc is drawn by moving the turtle forward and turning either left or right as it moves. &lt;br /&gt;
    nArcAngle is the angle of the arc describing the turtle&amp;#039;s path, &lt;br /&gt;
     in 100&amp;#039;ths of a degree. &lt;br /&gt;
    nArcRadius is the radius of the arc describing the turtle&amp;#039;s path. &lt;br /&gt;
    bTurnLeft is True if the turtle turns to the left, or False to turn to the right. &lt;br /&gt;
    Four values are returned. &lt;br /&gt;
    (1) the circle shape, (2) the new X position, (3) new Y position, and (4) new angle. &lt;br /&gt;
    Use the last three return values as initial values to draw another arc &lt;br /&gt;
     which is connected to the ending position of the arc just drawn. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # Figure out how big of a circle that the arc is a part of. &lt;br /&gt;
    nCircleDiameter = nArcRadius + nArcRadius &lt;br /&gt;
    oCircleSize = makeSize( nCircleDiameter, nCircleDiameter ) &lt;br /&gt;
&lt;br /&gt;
    # Figure out the position of the circle (ellipse) shape object. &lt;br /&gt;
    # &lt;br /&gt;
    # Determine the angle of the center point from the starting position. &lt;br /&gt;
    if bTurnLeft: &lt;br /&gt;
        nCenterPointAngle = nStartAngle + 9000 &lt;br /&gt;
    else: &lt;br /&gt;
        nCenterPointAngle = nStartAngle - 9000 &lt;br /&gt;
    # Convert to radians. &lt;br /&gt;
    nCenterPointAngle = nCenterPointAngle * nRadiansPerHundredthDegree &lt;br /&gt;
    # Determine where the center of the circle shape should be. &lt;br /&gt;
    nCenterX = nStartX + (nArcRadius * math.cos( nCenterPointAngle )) &lt;br /&gt;
    nCenterY = nStartY - (nArcRadius * math.sin( nCenterPointAngle )) &lt;br /&gt;
    oCirclePosition = makePoint( nCenterX - nArcRadius, nCenterY - nArcRadius ) &lt;br /&gt;
&lt;br /&gt;
    # Figure out what arc portion of the circle needs to be drawn. &lt;br /&gt;
    # Angles measures in 100&amp;#039;ths of a degree. &lt;br /&gt;
    if bTurnLeft: &lt;br /&gt;
        nCircleStartAngle = nStartAngle - 9000 &lt;br /&gt;
        nCircleEndAngle = nCircleStartAngle + nArcAngle &lt;br /&gt;
    else: &lt;br /&gt;
        nCircleEndAngle = nStartAngle + 9000 &lt;br /&gt;
        nCircleStartAngle = nCircleEndAngle - nArcAngle &lt;br /&gt;
  &lt;br /&gt;
    # Make the circle shape. &lt;br /&gt;
    oCircle = makeEllipseShape( oDrawDoc, oCirclePosition, oCircleSize ) &lt;br /&gt;
    # Fill in its properties &lt;br /&gt;
    oCircle.FillStyle = uno.getConstantByName( &amp;quot;com.sun.star.drawing.FillStyle.NONE&amp;quot; ) &lt;br /&gt;
    oCircle.CircleKind = uno.getConstantByName( &amp;quot;com.sun.star.drawing.CircleKind.ARC&amp;quot; ) &lt;br /&gt;
    oCircle.CircleStartAngle = nCircleStartAngle &lt;br /&gt;
    oCircle.CircleEndAngle = nCircleEndAngle &lt;br /&gt;
    # Put it on the drawing &lt;br /&gt;
    oDrawPage.add( oCircle ) &lt;br /&gt;
&lt;br /&gt;
    # Figure out the ending turtle location and direction. &lt;br /&gt;
    if bTurnLeft: &lt;br /&gt;
        nEndAngle = nStartAngle - 9000 + nArcAngle &lt;br /&gt;
    else: &lt;br /&gt;
        nEndAngle = nStartAngle + 9000 - nArcAngle &lt;br /&gt;
    # Convert to radians &lt;br /&gt;
    nEndAngleRad = nEndAngle * nRadiansPerHundredthDegree &lt;br /&gt;
    # Ending Position &lt;br /&gt;
    nEndX = nCenterX + (nArcRadius * math.cos( nEndAngleRad )) &lt;br /&gt;
    nEndY = nCenterY - (nArcRadius * math.sin( nEndAngleRad )) &lt;br /&gt;
    # Ending angle &lt;br /&gt;
    if bTurnLeft: &lt;br /&gt;
        nEndAngle = normalizeOOoAngle( nEndAngle + 9000 ) &lt;br /&gt;
    else: &lt;br /&gt;
        nEndAngle = normalizeOOoAngle( nEndAngle - 9000 ) &lt;br /&gt;
&lt;br /&gt;
    return oCircle, nEndX, nEndY, nEndAngle &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def drawSpiralOfArcs( oDrawDoc, oDrawPage, &lt;br /&gt;
                      nStartX, nStartY, nStartAngle, &lt;br /&gt;
                      nArcAngle, nArcRadius, bTurnLeft, &lt;br /&gt;
                      nNumArcs, &lt;br /&gt;
                      nRadiusGrowthMultiplier=1.0, nRadiusGrowthAddIn=0 ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Draw a spiral starting from a certian position and direction. &lt;br /&gt;
    The spiral turns either towards the left or towards the right. &lt;br /&gt;
    Parameters: &lt;br /&gt;
    nStartX and nStartY are the starting position of the &amp;quot;turtle&amp;quot;. &lt;br /&gt;
    nStartAngle is the angle direction that the turtle is pointing, &lt;br /&gt;
     in 100&amp;#039;ths of a degree. &lt;br /&gt;
    A spiral is drawn by moving the turtle forward and turning either left or right as it moves. &lt;br /&gt;
    nArcAngle is the angle of the first arc of the spiral, &lt;br /&gt;
     in 100&amp;#039;ths of a degree. &lt;br /&gt;
    nArcRadius is the radius of the first arc of the spiral. &lt;br /&gt;
    bTurnLeft is True if the turtle turns to the left, or False to turn to the right. &lt;br /&gt;
    nNumArcs is the number of arcs which are drawn. &lt;br /&gt;
    nRadiusGrowthMultiplier - the radius of the arc is multiplied by this after each arc is drawn. &lt;br /&gt;
     Use a number such as 1.1 to cause the radius to grow geometrically as the spiral turns. &lt;br /&gt;
    nRadiusGrowthAddIn - this is added to the radius after each arc. &lt;br /&gt;
     Use a number, such as the original nArcRadius / number of arcs in a complete circle to cause the radius to grow arithmeteically as the spiral turns. &lt;br /&gt;
    Four values are returned. &lt;br /&gt;
    (1) the spiral shape, (2) the new X position, (3) new Y position, and (4) new angle. &lt;br /&gt;
    Use the last three return values as initial values to draw another arc &lt;br /&gt;
     which is connected to the ending position of the arc just drawn. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    nX = nStartX &lt;br /&gt;
    nY = nStartY &lt;br /&gt;
    nAngle = nStartAngle &lt;br /&gt;
&lt;br /&gt;
    oShapesToGroup = createUnoService( &amp;quot;com.sun.star.drawing.ShapeCollection&amp;quot; ) &lt;br /&gt;
    for i in range( nNumArcs - 1 ): &lt;br /&gt;
        oArcShape, nX, nY, nAngle = drawArcPath( oDrawDoc, oDrawPage, nX, nY, nAngle, nArcAngle, nArcRadius, bTurnLeft ) &lt;br /&gt;
        nArcRadius = nArcRadius * nRadiusGrowthMultiplier + nRadiusGrowthAddIn &lt;br /&gt;
&lt;br /&gt;
        oShapesToGroup.add( oArcShape ) &lt;br /&gt;
    oSpiralShape = oDrawPage.group( oShapesToGroup ) &lt;br /&gt;
    return oSpiralShape, nX, nY, nAngle &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Styles &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def defineGraphicsStyle( oDrawDoc, cStyleName, cParentStyleName=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Add a new style to the style catalog if it is not already present. &lt;br /&gt;
    This returns the style object so that you can alter its properties. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return defineStyle( oDrawDoc, &amp;quot;graphics&amp;quot;, cStyleName, cParentStyleName ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def getGraphicsStyle( oDrawDoc, cStyleName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Lookup and return a graphics style from the document. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return getStyle( oDrawDoc, &amp;quot;graphics&amp;quot;, cStyleName ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   General Utility functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
def normalizeOOoAngle( nAngleOOo ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Given an angle in 100&amp;#039;ths of a degree, &lt;br /&gt;
    adjust it to be from 0 to 360 degrees.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    if nAngleOOo &amp;lt; 0: &lt;br /&gt;
        nSign = -1 &lt;br /&gt;
    else: &lt;br /&gt;
        nSign = 1 &lt;br /&gt;
    nAngleOOo = nAngleOOo - (int( abs( nAngleOOo ) / 36000.0 ) * 36000 * nSign) &lt;br /&gt;
    if nAngleOOo &amp;lt; 0: &lt;br /&gt;
        nAngleOOo += 36000 &lt;br /&gt;
    return nAngleOOo &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny.OOo.OOoLib.py&amp;diff=235900</id>
		<title>Danny.OOo.OOoLib.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny.OOo.OOoLib.py&amp;diff=235900"/>
		<updated>2015-02-17T19:27:44Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module makes programming OOo in Python much more like programming OOo in Basic. It also contains some frequently used functions that I typically write in Basic, such as makePropertyValue(). &lt;br /&gt;
When I write Components in Python, the first function in this module, the getServiceManager() function is replaced by a completely different implementation. Otherwise, even in a component, the features of this module are available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#********************************************************************** &lt;br /&gt;
# &lt;br /&gt;
#   Danny.OOo.OOoLib.py &lt;br /&gt;
# &lt;br /&gt;
#   A module to easily work with OpenOffice.org. &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   Copyright (c) 2003-2004 Danny Brewer &lt;br /&gt;
#   d29583@groovegarden.com &lt;br /&gt;
# &lt;br /&gt;
#   This library is free software; you can redistribute it and/or &lt;br /&gt;
#   modify it under the terms of the GNU Lesser General Public &lt;br /&gt;
#   License as published by the Free Software Foundation; either &lt;br /&gt;
#   version 2.1 of the License, or (at your option) any later version. &lt;br /&gt;
# &lt;br /&gt;
#   This library is distributed in the hope that it will be useful, &lt;br /&gt;
#   but WITHOUT ANY WARRANTY; without even the implied warranty of &lt;br /&gt;
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU &lt;br /&gt;
#   Lesser General Public License for more details. &lt;br /&gt;
# &lt;br /&gt;
#   You should have received a copy of the GNU Lesser General Public &lt;br /&gt;
#   License along with this library; if not, write to the Free Software &lt;br /&gt;
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA &lt;br /&gt;
# &lt;br /&gt;
#   See:  http://www.gnu.org/licenses/lgpl.html &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
#   If you make changes, please append to the change log below. &lt;br /&gt;
# &lt;br /&gt;
#   Change Log &lt;br /&gt;
#   Danny Brewer         Revised 2004-06-07-01 &lt;br /&gt;
# &lt;br /&gt;
#********************************************************************** &lt;br /&gt;
&lt;br /&gt;
import string &lt;br /&gt;
&lt;br /&gt;
# OOo&amp;#039;s libraries &lt;br /&gt;
import uno &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Uno ServiceManager access &lt;br /&gt;
#   A different version of this routine and global variable &lt;br /&gt;
#    is needed for code running inside a component. &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The ServiceManager of the running OOo. &lt;br /&gt;
# It is cached in a global variable. &lt;br /&gt;
goServiceManager = False &lt;br /&gt;
def getServiceManager( cHost=&amp;quot;localhost&amp;quot;, cPort=&amp;quot;8100&amp;quot; ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Get the ServiceManager from the running OpenOffice.org. &lt;br /&gt;
        Then retain it in the global variable goServiceManager for future use. &lt;br /&gt;
        This is similar to the GetProcessServiceManager() in OOo Basic. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    global goServiceManager &lt;br /&gt;
    if not goServiceManager: &lt;br /&gt;
        # Get the uno component context from the PyUNO runtime &lt;br /&gt;
        oLocalContext = uno.getComponentContext() &lt;br /&gt;
        # Create the UnoUrlResolver on the Python side. &lt;br /&gt;
        oLocalResolver = oLocalContext.ServiceManager.createInstanceWithContext( &lt;br /&gt;
                                    &amp;quot;com.sun.star.bridge.UnoUrlResolver&amp;quot;, oLocalContext ) &lt;br /&gt;
        # Connect to the running OpenOffice.org and get its context. &lt;br /&gt;
        oContext = oLocalResolver.resolve( &amp;quot;uno:socket,host=&amp;quot; + cHost + &amp;quot;,port=&amp;quot; + cPort + &amp;quot;;urp;StarOffice.ComponentContext&amp;quot; ) &lt;br /&gt;
        # Get the ServiceManager object &lt;br /&gt;
        goServiceManager = oContext.ServiceManager &lt;br /&gt;
    return goServiceManager &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Uno convenience functions &lt;br /&gt;
#   The stuff in this section is just to make &lt;br /&gt;
#    python progrmaming of OOo more like using OOo Basic. &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# This is the same as ServiceManager.createInstance( ... ) &lt;br /&gt;
def createUnoService( cClass ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;A handy way to create a global objects within the running OOo. &lt;br /&gt;
    Similar to the function of the same name in OOo Basic. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oServiceManager = getServiceManager() &lt;br /&gt;
    oObj = oServiceManager.createInstance( cClass ) &lt;br /&gt;
    return oObj &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The StarDesktop object.  (global like in OOo Basic) &lt;br /&gt;
# It is cached in a global variable. &lt;br /&gt;
StarDesktop = None &lt;br /&gt;
def getDesktop(): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;An easy way to obtain the Desktop object from a running OOo. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    global StarDesktop &lt;br /&gt;
    if StarDesktop == None: &lt;br /&gt;
        StarDesktop = createUnoService( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ) &lt;br /&gt;
    return StarDesktop &lt;br /&gt;
# preload the StarDesktop variable. &lt;br /&gt;
getDesktop() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# The CoreReflection object. &lt;br /&gt;
# It is cached in a global variable. &lt;br /&gt;
goCoreReflection = False &lt;br /&gt;
def getCoreReflection(): &lt;br /&gt;
    global goCoreReflection &lt;br /&gt;
    if not goCoreReflection: &lt;br /&gt;
        goCoreReflection = createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; ) &lt;br /&gt;
    return goCoreReflection &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def createUnoStruct( cTypeName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a UNO struct and return it. &lt;br /&gt;
    Similar to the function of the same name in OOo Basic. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oCoreReflection = getCoreReflection() &lt;br /&gt;
    # Get the IDL class for the type name &lt;br /&gt;
    oXIdlClass = oCoreReflection.forName( cTypeName ) &lt;br /&gt;
    # Create the struct. &lt;br /&gt;
    oReturnValue, oStruct = oXIdlClass.createObject( None ) &lt;br /&gt;
    return oStruct &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#def newConnectionToOOo( cHost=&amp;quot;localhost&amp;quot;, cPort=&amp;quot;8100&amp;quot; ): &lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;Call this to establish, or re-establish a connection to OOo.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
#    global goServiceManager &lt;br /&gt;
#    global StarDesktop &lt;br /&gt;
#    global goCoreReflection &lt;br /&gt;
#    goServiceManager = False &lt;br /&gt;
#    StarDesktop = None &lt;br /&gt;
#    goCoreReflection = False &lt;br /&gt;
#    getServiceManager( cHost, cPort ) &lt;br /&gt;
#    getDesktop() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   API helpers &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
def hasUnoInterface( oObject, cInterfaceName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Similar to Basic&amp;#039;s HasUnoInterfaces() function, but singular not plural.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # Get the Introspection service. &lt;br /&gt;
    oIntrospection = createUnoService( &amp;quot;com.sun.star.beans.Introspection&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    # Now inspect the object to learn about it.    &lt;br /&gt;
    oObjInfo = oIntrospection.inspect( oObject ) &lt;br /&gt;
    &lt;br /&gt;
    # Obtain an array describing all methods of the object. &lt;br /&gt;
    oMethods = oObjInfo.getMethods( uno.getConstantByName( &amp;quot;com.sun.star.beans.MethodConcept.ALL&amp;quot; ) ) &lt;br /&gt;
    # Now look at every method. &lt;br /&gt;
    for oMethod in oMethods: &lt;br /&gt;
        # Check the method&amp;#039;s interface to see if &lt;br /&gt;
        #  these aren&amp;#039;t the droids you&amp;#039;re looking for. &lt;br /&gt;
        cMethodInterfaceName = oMethod.getDeclaringClass().getName() &lt;br /&gt;
        if cMethodInterfaceName == cInterfaceName: &lt;br /&gt;
            return True &lt;br /&gt;
    return False &lt;br /&gt;
&lt;br /&gt;
def hasUnoInterfaces( oObject, *cInterfaces ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Similar to the function of the same name in OOo Basic.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    for cInterface in cInterfaces: &lt;br /&gt;
        if not hasUnoInterface( oObject, cInterface ): &lt;br /&gt;
            return False &lt;br /&gt;
    return True &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   High level general purpose functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makePropertyValue( cName=None, uValue=None, nHandle=None, nState=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.beans.PropertyValue struct and return it. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oPropertyValue = createUnoStruct( &amp;quot;com.sun.star.beans.PropertyValue&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    if cName != None: &lt;br /&gt;
        oPropertyValue.Name = cName &lt;br /&gt;
    if uValue != None: &lt;br /&gt;
        oPropertyValue.Value = uValue &lt;br /&gt;
    if nHandle != None: &lt;br /&gt;
        oPropertyValue.Handle = nHandle &lt;br /&gt;
    if nState != None: &lt;br /&gt;
        oPropertyValue.State = nState &lt;br /&gt;
&lt;br /&gt;
    return oPropertyValue &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makePoint( nX, nY ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.awt.Point struct.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oPoint = createUnoStruct( &amp;quot;com.sun.star.awt.Point&amp;quot; ) &lt;br /&gt;
    oPoint.X = nX &lt;br /&gt;
    oPoint.Y = nY &lt;br /&gt;
    return oPoint &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeSize( nWidth, nHeight ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.awt.Size struct.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oSize = createUnoStruct( &amp;quot;com.sun.star.awt.Size&amp;quot; ) &lt;br /&gt;
    oSize.Width = nWidth &lt;br /&gt;
    oSize.Height = nHeight &lt;br /&gt;
    return oSize &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def makeRectangle( nX, nY, nWidth, nHeight ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.awt.Rectangle struct.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    oRect = createUnoStruct( &amp;quot;com.sun.star.awt.Rectangle&amp;quot; ) &lt;br /&gt;
    oRect.X = nX &lt;br /&gt;
    oRect.Y = nY &lt;br /&gt;
    oRect.Width = nWidth &lt;br /&gt;
    oRect.Height = nHeight &lt;br /&gt;
    return oRect &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def Array( *args ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;This is just sugar coating so that code from OOoBasic which &lt;br /&gt;
    contains the Array() function can work perfectly in python.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    tArray = () &lt;br /&gt;
    for arg in args: &lt;br /&gt;
        tArray += (arg,) &lt;br /&gt;
    return tArray &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def loadComponentFromURL( cUrl, tProperties=() ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Open or Create a document from it&amp;#039;s URL. &lt;br /&gt;
    New documents are created from URL&amp;#039;s such as: &lt;br /&gt;
        private:factory/sdraw &lt;br /&gt;
        private:factory/swriter &lt;br /&gt;
        private:factory/scalc &lt;br /&gt;
        private:factory/simpress &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    StarDesktop = getDesktop() &lt;br /&gt;
    oDocument = StarDesktop.loadComponentFromURL( cUrl, &amp;quot;_blank&amp;quot;, 0, tProperties ) &lt;br /&gt;
    return oDocument &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#def makeWriterDocument(): &lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;Create a new OOo Writer document.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
#    return loadComponentFromURL( &amp;quot;private:factory/swriter&amp;quot; ) &lt;br /&gt;
# &lt;br /&gt;
# &lt;br /&gt;
#def makeCalcDocument(): &lt;br /&gt;
#    &amp;quot;&amp;quot;&amp;quot;Create a new OOo Calc document.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
#    return loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   Styles &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def defineStyle( oDrawDoc, cStyleFamily, cStyleName, cParentStyleName=None ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Add a new style to the style catalog if it is not already present. &lt;br /&gt;
    This returns the style object so that you can alter its properties. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    oStyleFamily = oDrawDoc.getStyleFamilies().getByName( cStyleFamily ) &lt;br /&gt;
&lt;br /&gt;
    # Does the style already exist? &lt;br /&gt;
    if oStyleFamily.hasByName( cStyleName ): &lt;br /&gt;
        # then get it so we can return it. &lt;br /&gt;
        oStyle = oStyleFamily.getByName( cStyleName ) &lt;br /&gt;
    else: &lt;br /&gt;
        # Create new style object. &lt;br /&gt;
        oStyle = oDrawDoc.createInstance( &amp;quot;com.sun.star.style.Style&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
        # Set its parent style &lt;br /&gt;
        if cParentStyleName != None: &lt;br /&gt;
            oStyle.setParentStyle( cParentStyleName ) &lt;br /&gt;
&lt;br /&gt;
        # Add the new style to the style family. &lt;br /&gt;
        oStyleFamily.insertByName( cStyleName, oStyle ) &lt;br /&gt;
&lt;br /&gt;
    return oStyle &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def getStyle( oDrawDoc, cStyleFamily, cStyleName ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Lookup and return a style from the document. &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    return oDrawDoc.getStyleFamilies().getByName( cStyleFamily ).getByName( cStyleName ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
#   General Utility functions &lt;br /&gt;
#------------------------------------------------------------ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def convertToURL( cPathname ): &lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Convert a Windows or Linux pathname into an OOo URL.&amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
    if len( cPathname ) &amp;gt; 1: &lt;br /&gt;
        if cPathname[1:2] == &amp;quot;:&amp;quot;: &lt;br /&gt;
            cPathname = &amp;quot;/&amp;quot; + cPathname[0] + &amp;quot;|&amp;quot; + cPathname[2:] &lt;br /&gt;
    cPathname = string.replace( cPathname, &amp;quot;\\&amp;quot;, &amp;quot;/&amp;quot; ) &lt;br /&gt;
    cPathname = &amp;quot;file://&amp;quot; + cPathname &lt;br /&gt;
    return cPathname &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Danny%27s_Python_Modules&amp;diff=235899</id>
		<title>Danny&#039;s Python Modules</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Danny%27s_Python_Modules&amp;diff=235899"/>
		<updated>2015-02-17T19:26:27Z</updated>

		<summary type="html">&lt;p&gt;JZA: Add links to the source of the Danny Modules&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this thread I am going to post some various Python modules from my growing library. The following links take you directly to the message where a particular class is posted. &lt;br /&gt;
&lt;br /&gt;
[http://www.oooforum.org/forum/viewtopic.phtml?t=14409 Click here to see original posting]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.OOoLib.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This module makes programming OOo in Python much more like programming OOo in Basic. It also contains some frequently used functions that I typically write in Basic, such as &amp;#039;&amp;#039;&amp;#039;makePropertyValue()&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.DrawLib.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This module has routines to make programming OOo Drawing documents easier. Much of this code was derrived from Basic code, that also appears in Danny&amp;#039;s Draw Power Tools found at OOoMacros.org. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.HSBConversions.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
HSB to RGB color space conversion routines. This module is a prerequisite for the module Danny.OOo.DrawLib.py. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.PrintToWriter.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
This makes it easy and convenient to print a bunch of text into a Writer document. See the example routine in the module that shows how easy this module is to use, and how useful it can be. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.ConfigLib.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Routines for working with the Configuration Manager. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.DialogLib.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
A class to build a dialog box from the com.sun.star.awt.* services. This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, this just makes it much easier. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.WindowLib.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
A class to build a modeless window from the com.sun.star.awt.* services. This doesn&amp;#039;t do anything you couldn&amp;#039;t already do using OOo&amp;#039;s UNO API, this just makes it much easier. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.Listeners.ListenerProcAdapters.py]]&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
This module has various helpers that make it extremely easy to create listeners on the fly, and make them call an arbitrary python procedure. See quick example that appears with the code. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.OOo.Listeners.TopWindowListener.py]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
When you need to add a window listener to a top window, this class makes is easy to create such a listener. You can use this class, or your own subclass of it. If you create a subclass, you don&amp;#039;t need to bother to implement every one of the methods, because you can inherit the empty implementations of methods from this class for the methods you are not interested in. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[Danny.HeapSort]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
A simple implementation of HeapSort. Yet, it allows a customizable notion of &amp;quot;comparison&amp;quot; and &amp;quot;swapping&amp;quot; by passing in your own compareGreaterProc, and swapProc. &lt;br /&gt;
This is NOT an OOo specific module. It can be used for any type of Python code.&lt;br /&gt;
&lt;br /&gt;
[[Category:Python]][[Category:External Project]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=PythonContainers&amp;diff=235898</id>
		<title>PythonContainers</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=PythonContainers&amp;diff=235898"/>
		<updated>2015-02-17T19:22:07Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Originally posted by DannyB on oooForum, read the original post [http://www.oooforum.org/forum/viewtopic.phtml?p=33986 here]. &lt;br /&gt;
As a first experiment, here is a single python component program which implements two services. &lt;br /&gt;
&lt;br /&gt;
The two new services are.... &lt;br /&gt;
&lt;br /&gt;
name.dannyBrewer.util.IndexContainer &lt;br /&gt;
name.dannyBrewer.util.NameContainer &lt;br /&gt;
&lt;br /&gt;
Here is how you install the new component. &lt;br /&gt;
# Copy the text of the following python source code. &lt;br /&gt;
# Put it into a file named &amp;quot;DannyComponentTest2004052217.py&amp;quot; &lt;br /&gt;
# Put the file DannyComponentTest2004052217.py into the uno_components folder of your &amp;quot;user&amp;quot; folder. &lt;br /&gt;
&lt;br /&gt;
The user folder on Windows is probably the folder named &amp;quot;user&amp;quot; under your OOo installation. &lt;br /&gt;
The user folder on Linux is contained within a folder in your home directory with a name like OpenOffice.org1.1.1. &lt;br /&gt;
(Note on Linux, be sure that when you copy the python program that it has no carriage returns, but instead has unix linefeeds. Otherwise the component will not install properly!) &lt;br /&gt;
&lt;br /&gt;
(New edit 2005-03-28: It may in fact be important now on ALL platforms to make sure that the &amp;quot;.py&amp;quot; file of python source has its line endings separated by linefeeds only with NO carriage returns!) &lt;br /&gt;
&lt;br /&gt;
* Be sure that OOo is NOT running. &lt;br /&gt;
* Run the command &amp;quot;pkgchk&amp;quot; in your OOo\programs folder. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
import uno &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
g_ImplementationHelper = unohelper.ImplementationHelper() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
################################################################## &lt;br /&gt;
class DannysUnoBaseClass: &lt;br /&gt;
    cServiceName = &amp;quot;&amp;quot; &lt;br /&gt;
    tServiceNames = ( cServiceName, ) &lt;br /&gt;
    # stuff to support the XTypeProvider interface. &lt;br /&gt;
    tInterfaceTypes = ( &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.lang.XServiceName&amp;quot; ), &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.lang.XServiceInfo&amp;quot; ), &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.lang.XTypeProvider&amp;quot; ), &lt;br /&gt;
                    ) &lt;br /&gt;
    uuid = uno.generateUuid() &lt;br /&gt;
    &lt;br /&gt;
    # The component must have a ctor with the component context as argument. &lt;br /&gt;
    def __init__( self, oContext ): &lt;br /&gt;
        self.DannysUnoBaseClass_init( oContext ) &lt;br /&gt;
&lt;br /&gt;
    def DannysUnoBaseClass_init( self, oContext ): &lt;br /&gt;
        self.oContext = oContext &lt;br /&gt;
&lt;br /&gt;
        self.oCoreReflection = None &lt;br /&gt;
        self.StarDesktop = None &lt;br /&gt;
        self.getDesktop() &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Danny&amp;#039;s stuff to make programming less convenient. &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def getServiceManager( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the ServiceManager from the running OpenOffice.org. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.oContext.ServiceManager &lt;br /&gt;
    &lt;br /&gt;
    def createUnoService( self, cClass ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;A handy way to create a global objects within the running OOo. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oServiceManager = self.getServiceManager() &lt;br /&gt;
        oObj = oServiceManager.createInstance( cClass ) &lt;br /&gt;
        return oObj &lt;br /&gt;
    &lt;br /&gt;
    def getDesktop( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;An easy way to obtain the Desktop object from a running OOo. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        if self.StarDesktop == None: &lt;br /&gt;
            self.StarDesktop = self.createUnoService( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ) &lt;br /&gt;
        return self.StarDesktop &lt;br /&gt;
&lt;br /&gt;
    def getCoreReflection( self ): &lt;br /&gt;
        if self.oCoreReflection == None: &lt;br /&gt;
            self.oCoreReflection = self.createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; ) &lt;br /&gt;
        return oCoreReflection &lt;br /&gt;
    &lt;br /&gt;
    def createUnoStruct( self, cTypeName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create a UNO struct and return it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oCoreReflection = self.getCoreReflection() &lt;br /&gt;
&lt;br /&gt;
        # Get the IDL class for the type name &lt;br /&gt;
        oXIdlClass = oCoreReflection.forName( cTypeName ) &lt;br /&gt;
&lt;br /&gt;
        # Create the struct. &lt;br /&gt;
        oReturnValue, oStruct = oXIdlClass.createObject( None ) &lt;br /&gt;
&lt;br /&gt;
        return oStruct &lt;br /&gt;
&lt;br /&gt;
    def makePropertyValue( self, cName=None, uValue=None, nHandle=None, nState=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.beans.PropertyValue struct and return it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oPropertyValue = self.createUnoStruct( &amp;quot;com.sun.star.beans.PropertyValue&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
        if cName != None: &lt;br /&gt;
            oPropertyValue.Name = cName &lt;br /&gt;
        if uValue != None: &lt;br /&gt;
            oPropertyValue.Value = uValue &lt;br /&gt;
        if nHandle != None: &lt;br /&gt;
            oPropertyValue.Handle = nHandle &lt;br /&gt;
        if nState != None: &lt;br /&gt;
            oPropertyValue.State = nState &lt;br /&gt;
&lt;br /&gt;
        return oPropertyValue &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XServiceName &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getServiceName(); &lt;br /&gt;
    def getServiceName( self ): &lt;br /&gt;
        return self.cServiceName &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XServiceInfo &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getImplementationName(); &lt;br /&gt;
    def getImplementationName( self ): &lt;br /&gt;
        return self.cServiceName &lt;br /&gt;
&lt;br /&gt;
    # boolean &lt;br /&gt;
    # supportsService( [in] string ServiceName ); &lt;br /&gt;
    def supportsService( self, cServiceName ): &lt;br /&gt;
        return cServiceName in self.getSupportedServiceNames() &lt;br /&gt;
&lt;br /&gt;
    # sequence&amp;lt; string &amp;gt; &lt;br /&gt;
    # getSupportedServiceNames(); &lt;br /&gt;
    def getSupportedServiceNames( self ): &lt;br /&gt;
        return self.tServiceNames &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XTypeProvider &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # sequence&amp;lt; type &amp;gt; &lt;br /&gt;
    # getTypes(); &lt;br /&gt;
    def getTypes( self ): &lt;br /&gt;
        #if self.tInterfaceTypes == None: &lt;br /&gt;
        #    self.tInterfaceTypes = () &lt;br /&gt;
        #    for cTypeName in self.tInterfaces: &lt;br /&gt;
        #        self.tInterfaceTypes += ( uno.getTypeByName( cTypeName ), ) &lt;br /&gt;
        return self.tInterfaceTypes &lt;br /&gt;
&lt;br /&gt;
    # sequence&amp;lt; byte &amp;gt; &lt;br /&gt;
    # getImplementationId(); &lt;br /&gt;
    def getImplementationId( self ): &lt;br /&gt;
        return self.uuid &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
################################################################## &lt;br /&gt;
from com.sun.star.lang import IndexOutOfBoundsException &lt;br /&gt;
&lt;br /&gt;
class IndexContainer( DannysUnoBaseClass ): &lt;br /&gt;
    cServiceName = &amp;quot;name.dannyBrewer.util.IndexContainer&amp;quot; &lt;br /&gt;
    tServiceNames = ( cServiceName, ) &lt;br /&gt;
    tInterfaceTypes = DannysUnoBaseClass.tInterfaceTypes + ( &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.container.XIndexContainer&amp;quot; ), &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.container.XIndexReplace&amp;quot; ), &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.container.XIndexAccess&amp;quot; ), &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.container.XElementAccess&amp;quot; ), &lt;br /&gt;
                    ) &lt;br /&gt;
    &lt;br /&gt;
    # The component must have a ctor with the component context as argument. &lt;br /&gt;
    def __init__( self, oContext ): &lt;br /&gt;
        # Initialize the base class! &lt;br /&gt;
        self.DannysUnoBaseClass_init( oContext ) &lt;br /&gt;
        # This is the list of items in the IndexContainer. &lt;br /&gt;
        self.items = [] &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: com.sun.star.container.XIndexContainer &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # insertByIndex( [in] long nIndex, &lt;br /&gt;
    #                [in] any uElement ); &lt;br /&gt;
    def insertByIndex( self, nIndex, uElement ): &lt;br /&gt;
        if nIndex &amp;lt; 0: &lt;br /&gt;
            raise IndexOutOfBoundsException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an index that was less than zero. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        nItems = len( self.items ) &lt;br /&gt;
        if nIndex &amp;gt; nItems: &lt;br /&gt;
            raise IndexOutOfBoundsException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an index that was greater than the last item in the container. &lt;br /&gt;
                Since there are &amp;quot;&amp;quot;&amp;quot; + str( nItems ) + &amp;quot;&amp;quot;&amp;quot; items in the container, you must specify an &lt;br /&gt;
                insert index that is from zero to &amp;quot;&amp;quot;&amp;quot; + str( nItems ) + &amp;quot;&amp;quot;&amp;quot;. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        if nIndex == nItems: &lt;br /&gt;
            self.items += [uElement] &lt;br /&gt;
            return &lt;br /&gt;
        self.items = self.items[0:nIndex] + [uElement] + self.items[nIndex:] &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # removeByIndex( [in] long nIndex ); &lt;br /&gt;
    def removeByIndex( self, nIndex ): &lt;br /&gt;
        if nIndex &amp;lt; 0: &lt;br /&gt;
            raise IndexOutOfBoundsException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an index that was less than zero. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        nItems = len( self.items ) &lt;br /&gt;
        if nIndex &amp;gt; nItems: &lt;br /&gt;
            raise IndexOutOfBoundsException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an index that was greater than or equal to the last item in the container. &lt;br /&gt;
                Since there are &amp;quot;&amp;quot;&amp;quot; + str( nItems ) + &amp;quot;&amp;quot;&amp;quot; items in the container, you must specify an &lt;br /&gt;
                insert index that is from zero to &amp;quot;&amp;quot;&amp;quot; + str( nItems-1 ) + &amp;quot;&amp;quot;&amp;quot;. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        self.items = self.items[0:nIndex] + self.items[nIndex+1:] &lt;br /&gt;
        &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: com.sun.star.container.XIndexReplace &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # replaceByIndex( [in] long nIndes, &lt;br /&gt;
    #                 [in] any uElement ); &lt;br /&gt;
    def replaceByIndex( self, nIndex, uElement ): &lt;br /&gt;
        if nIndex &amp;lt; 0: &lt;br /&gt;
            raise IndexOutOfBoundsException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an index that was less than zero. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        nItems = len( self.items ) &lt;br /&gt;
        if nIndex &amp;gt; nItems: &lt;br /&gt;
            raise IndexOutOfBoundsException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an index that was greater than or equal to the last item in the container. &lt;br /&gt;
                Since there are &amp;quot;&amp;quot;&amp;quot; + str( nItems ) + &amp;quot;&amp;quot;&amp;quot; items in the container, you must specify an &lt;br /&gt;
                insert index that is from zero to &amp;quot;&amp;quot;&amp;quot; + str( nItems-1 ) + &amp;quot;&amp;quot;&amp;quot;. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        self.items = self.items[0:nIndex] + [uElement] + self.items[nIndex+1:] &lt;br /&gt;
    &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: com.sun.star.container.XIndexAccess &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # long &lt;br /&gt;
    # getCount(); &lt;br /&gt;
    def getCount( self ): &lt;br /&gt;
        return len( self.items ) &lt;br /&gt;
&lt;br /&gt;
    # any &lt;br /&gt;
    # getByIndex( [in] long nIndex ); &lt;br /&gt;
    def getByIndex( self, nIndex ): &lt;br /&gt;
        if nIndex &amp;lt; 0: &lt;br /&gt;
            raise IndexOutOfBoundsException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an index that was less than zero. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        nItems = len( self.items ) &lt;br /&gt;
        if nIndex &amp;gt; nItems: &lt;br /&gt;
            raise IndexOutOfBoundsException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an index that was greater than or equal to the last item in the container. &lt;br /&gt;
                Since there are &amp;quot;&amp;quot;&amp;quot; + str( nItems ) + &amp;quot;&amp;quot;&amp;quot; items in the container, you must specify an &lt;br /&gt;
                insert index that is from zero to &amp;quot;&amp;quot;&amp;quot; + str( nItems-1 ) + &amp;quot;&amp;quot;&amp;quot;. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        return self.items[ nIndex ] &lt;br /&gt;
    &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: com.sun.star.container.XElementAccess &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # type &lt;br /&gt;
    # getElementType(); &lt;br /&gt;
    def getElementType( self ): &lt;br /&gt;
        return None &lt;br /&gt;
&lt;br /&gt;
    # boolean &lt;br /&gt;
    # hasElements(); &lt;br /&gt;
    def hasElements( self ): &lt;br /&gt;
        return len( self.items ) &amp;gt; 0 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Add the class to the implementation container, &lt;br /&gt;
#  which the loader uses to register/instantiate the component. &lt;br /&gt;
g_ImplementationHelper.addImplementation( &lt;br /&gt;
        # The class &lt;br /&gt;
   IndexContainer, &lt;br /&gt;
        # The implementation name. &lt;br /&gt;
        # Change this name for your own service. &lt;br /&gt;
        IndexContainer.cServiceName, &lt;br /&gt;
        # A list of services that that are implemented. &lt;br /&gt;
   IndexContainer.tServiceNames, &lt;br /&gt;
        ) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
################################################################## &lt;br /&gt;
from com.sun.star.lang import IndexOutOfBoundsException &lt;br /&gt;
from com.sun.star.container import ElementExistException &lt;br /&gt;
from com.sun.star.container import NoSuchElementException &lt;br /&gt;
&lt;br /&gt;
class NameContainer( DannysUnoBaseClass ): &lt;br /&gt;
    cServiceName = &amp;quot;name.dannyBrewer.util.NameContainer&amp;quot; &lt;br /&gt;
    tServiceNames = ( cServiceName, ) &lt;br /&gt;
    tInterfaceTypes = DannysUnoBaseClass.tInterfaceTypes + ( &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.container.XNameContainer&amp;quot; ), &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.container.XNameReplace&amp;quot; ), &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.container.XNameAccess&amp;quot; ), &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.container.XIndexAccess&amp;quot; ), &lt;br /&gt;
                    uno.getTypeByName( &amp;quot;com.sun.star.container.XElementAccess&amp;quot; ), &lt;br /&gt;
                    ) &lt;br /&gt;
    &lt;br /&gt;
    # The component must have a ctor with the component context as argument. &lt;br /&gt;
    def __init__( self, oContext ): &lt;br /&gt;
        # Initialize the base class! &lt;br /&gt;
        self.DannysUnoBaseClass_init( oContext ) &lt;br /&gt;
        # This is the dictionary of items in the NameContainer. &lt;br /&gt;
        self.items = {} &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: com.sun.star.container.XNameContainer &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # insertByName( [in] string cName, &lt;br /&gt;
    #               [in] any uElement ); &lt;br /&gt;
    def insertByName( self, cName, uElement ): &lt;br /&gt;
        if self.items.has_key( cName ): &lt;br /&gt;
            raise ElementExistException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an element name of \&amp;quot;&amp;quot;&amp;quot;&amp;quot; + cName + &amp;quot;&amp;quot;&amp;quot;\&amp;quot; &lt;br /&gt;
                which is already present in the container. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        self.items[ cName ] = uElement &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # removeByName( [in] string cName ); &lt;br /&gt;
    def removeByName( self, cName ): &lt;br /&gt;
        if not self.items.has_key( cName ): &lt;br /&gt;
            raise NoSuchElementException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an element name of \&amp;quot;&amp;quot;&amp;quot;&amp;quot; + cName + &amp;quot;&amp;quot;&amp;quot;\&amp;quot; &lt;br /&gt;
                which does not exist in the container. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        del self.items[ cName ] &lt;br /&gt;
        &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: com.sun.star.container.XNameReplace &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # replaceByName( [in] string cName, &lt;br /&gt;
    #                [in] any uElement ); &lt;br /&gt;
    def replaceByName( self, cName, uElement ): &lt;br /&gt;
        if not self.items.has_key( cName ): &lt;br /&gt;
            raise NoSuchElementException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an element name of \&amp;quot;&amp;quot;&amp;quot;&amp;quot; + cName + &amp;quot;&amp;quot;&amp;quot;\&amp;quot; &lt;br /&gt;
                which does not exist in the container. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        self.items[ cName ] = uElement &lt;br /&gt;
    &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: com.sun.star.container.XNameAccess &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # any &lt;br /&gt;
    # getByName( [in] string cName ); &lt;br /&gt;
    def getByName( self, cName ): &lt;br /&gt;
        if not self.items.has_key( cName ): &lt;br /&gt;
            raise NoSuchElementException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an element name of \&amp;quot;&amp;quot;&amp;quot;&amp;quot; + cName + &amp;quot;&amp;quot;&amp;quot;\&amp;quot; &lt;br /&gt;
                which does not exist in the container. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        return self.items[ cName ] &lt;br /&gt;
    &lt;br /&gt;
    # boolean &lt;br /&gt;
    # hasByName( [in] string cName ); &lt;br /&gt;
    def hasByName( self, cName ): &lt;br /&gt;
        return self.items.has_key( cName ) &lt;br /&gt;
&lt;br /&gt;
    # sequence&amp;lt; string &amp;gt; &lt;br /&gt;
    # getElementNames(); &lt;br /&gt;
    def getElementNames( self ): &lt;br /&gt;
        ret = () &lt;br /&gt;
        for item in self.items.keys(): &lt;br /&gt;
            ret += ( item, ) &lt;br /&gt;
        return ret &lt;br /&gt;
    &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: com.sun.star.container.XIndexAccess &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # long &lt;br /&gt;
    # getCount(); &lt;br /&gt;
    def getCount( self ): &lt;br /&gt;
        return len( self.items ) &lt;br /&gt;
&lt;br /&gt;
    # any &lt;br /&gt;
    # getByIndex( [in] long nIndex ); &lt;br /&gt;
    def getByIndex( self, nIndex ): &lt;br /&gt;
        if nIndex &amp;lt; 0: &lt;br /&gt;
            raise IndexOutOfBoundsException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an index that was less than zero. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        nItems = len( self.items ) &lt;br /&gt;
        if nIndex &amp;gt; nItems: &lt;br /&gt;
            raise IndexOutOfBoundsException( &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;You specified an index that was greater than or equal to the last item in the container. &lt;br /&gt;
                Since there are &amp;quot;&amp;quot;&amp;quot; + str( nItems ) + &amp;quot;&amp;quot;&amp;quot; items in the container, you must specify an &lt;br /&gt;
                insert index that is from zero to &amp;quot;&amp;quot;&amp;quot; + str( nItems-1 ) + &amp;quot;&amp;quot;&amp;quot;. &lt;br /&gt;
                &amp;quot;&amp;quot;&amp;quot;, self ) &lt;br /&gt;
        return self.items.values()[ nIndex ] &lt;br /&gt;
    &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: com.sun.star.container.XElementAccess &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # type &lt;br /&gt;
    # getElementType(); &lt;br /&gt;
    def getElementType( self ): &lt;br /&gt;
        return None &lt;br /&gt;
&lt;br /&gt;
    # boolean &lt;br /&gt;
    # hasElements(); &lt;br /&gt;
    def hasElements( self ): &lt;br /&gt;
        return len( self.items ) &amp;gt; 0 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Add the class to the implementation container, &lt;br /&gt;
#  which the loader uses to register/instantiate the component. &lt;br /&gt;
g_ImplementationHelper.addImplementation( &lt;br /&gt;
        # The class &lt;br /&gt;
   NameContainer, &lt;br /&gt;
        # The implementation name. &lt;br /&gt;
        # Change this name for your own service. &lt;br /&gt;
        NameContainer.cServiceName, &lt;br /&gt;
        # A list of services that that are implemented. &lt;br /&gt;
   NameContainer.tServiceNames, &lt;br /&gt;
        ) &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235897</id>
		<title>Python-Calc</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235897"/>
		<updated>2015-02-17T16:39:11Z</updated>

		<summary type="html">&lt;p&gt;JZA: /* Underline each Nth row of cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This code was originally written on the oooforum, you can reach it [http://www.oooforum.org/forum/viewtopic.phtml?p=55393#55393 here]. The code was somewhat broken down into different areas so the reader can understand each step.&lt;br /&gt;
&lt;br /&gt;
The intend of the code is to:&lt;br /&gt;
# Create a new spreadsheet&lt;br /&gt;
# Open an existing spreadsheet&lt;br /&gt;
# Insert strings inito a cell&lt;br /&gt;
# Insert formulas into a cell&lt;br /&gt;
# Insert graphs to a range&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
from Danny.OOo.OOoLib import * &lt;br /&gt;
&lt;br /&gt;
def CalcExample(): &lt;br /&gt;
    # create a new Calc spreadsheet. &lt;br /&gt;
    oDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    #----- &lt;br /&gt;
    # Use this instead to open an EXISTING calc document, &lt;br /&gt;
    #  and assign it to variable oDoc. &lt;br /&gt;
    #  cFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc&amp;quot; # Windows &lt;br /&gt;
    #  cFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; # Linux &lt;br /&gt;
    #  cURL = convertToURL( cFile + &amp;quot;.sxc&amp;quot; ) &lt;br /&gt;
    #  oDoc = StarDesktop.loadComponentFromURL( cURL, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    # Here are two ways to get access to one of the various sheets &lt;br /&gt;
    #  in the spreadsheet document. &lt;br /&gt;
    # Note that these don&amp;#039;t make the sheet *vislble*, they merely give &lt;br /&gt;
    #  access to the sheet&amp;#039;s content within the program. &lt;br /&gt;
    oSheet = oDoc.getSheets().getByIndex( 0 ) # get the zero&amp;#039;th sheet &lt;br /&gt;
    #oSheet = oDoc.getSheets().getByName( &amp;quot;Sheet3&amp;quot; ) # get by name &lt;br /&gt;
    &lt;br /&gt;
    #----- &lt;br /&gt;
    # Put some sales figures onto the sheet. &lt;br /&gt;
    oSheet.getCellByPosition( 0, 0 ).setString( &amp;quot;Month&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 0 ).setString( &amp;quot;Sales&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 0 ).setString( &amp;quot;End Date&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 0, 1 ).setString( &amp;quot;Jan&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 2 ).setString( &amp;quot;Feb&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 3 ).setString( &amp;quot;Mar&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 4 ).setString( &amp;quot;Apr&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 5 ).setString( &amp;quot;May&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 6 ).setString( &amp;quot;Jun&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 7 ).setString( &amp;quot;Jul&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 8 ).setString( &amp;quot;Aug&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 9 ).setString( &amp;quot;Sep&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 10 ).setString( &amp;quot;Oct&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 11 ).setString( &amp;quot;Nov&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 12 ).setString( &amp;quot;Dec&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 1, 1 ).setValue( 3826.37 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 2 ).setValue( 3504.21 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 3 ).setValue( 2961.45 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 4 ).setValue( 2504.12 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 5 ).setValue( 2713.98 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 6 ).setValue( 2248.17 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 7 ).setValue( 1802.13 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 8 ).setValue( 2003.22 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 9 ).setValue( 1502.54 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 10 ).setValue( 1207.68 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 11 ).setValue( 1319.71 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 12 ).setValue( 786.03 ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 2, 1 ).setFormula( &amp;quot;=DATE(2004;01;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 2 ).setFormula( &amp;quot;=DATE(2004;02;29)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 3 ).setFormula( &amp;quot;=DATE(2004;03;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 4 ).setFormula( &amp;quot;=DATE(2004;04;30)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 5 ).setFormula( &amp;quot;=DATE(2004;05;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 6 ).setFormula( &amp;quot;=DATE(2004;06;30)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 7 ).setFormula( &amp;quot;=DATE(2004;07;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 8 ).setFormula( &amp;quot;=DATE(2004;08;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 9 ).setFormula( &amp;quot;=DATE(2004;09;30)&amp;quot; ) &lt;br /&gt;
    # Note that these last three dates are not set as DATE() function calls. &lt;br /&gt;
    oSheet.getCellByPosition( 2, 10 ).setFormula( &amp;quot;10/31/2004&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 11 ).setFormula( &amp;quot;11/30/2004&amp;quot; ) &lt;br /&gt;
    oSheet.getCellRangeByName( &amp;quot;C13&amp;quot; ).setFormula( &amp;quot;12/31/2004&amp;quot; ) &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    #----- &lt;br /&gt;
    # Format the date cells as dates. &lt;br /&gt;
    com_sun_star_util_NumberFormat_DATE = uno.getConstantByName( &amp;quot;com.sun.star.util.NumberFormat.DATE&amp;quot; ) &lt;br /&gt;
    oFormats = oDoc.getNumberFormats() &lt;br /&gt;
    oLocale = createUnoStruct( &amp;quot;com.sun.star.lang.Locale&amp;quot; ) &lt;br /&gt;
    nDateKey = oFormats.getStandardFormat( com_sun_star_util_NumberFormat_DATE, oLocale ) &lt;br /&gt;
    oCell = oSheet.getCellRangeByName( &amp;quot;C2:C13&amp;quot; ) &lt;br /&gt;
    oCell.NumberFormat = nDateKey &lt;br /&gt;
    #----- &lt;br /&gt;
    &lt;br /&gt;
    #----- &lt;br /&gt;
    # Now add a chart to the spreadsheet. &lt;br /&gt;
&lt;br /&gt;
    oCellRangeAddress = oSheet.getCellRangeByName( &amp;quot;A1:B13&amp;quot; ).getRangeAddress() &lt;br /&gt;
    # oCellRangeAddress = MakeCellRangeAddress( 0, 0, 1, 1, 12 ) &lt;br /&gt;
    # Get the collection of charts from the sheet. &lt;br /&gt;
    oCharts = oSheet.getCharts() &lt;br /&gt;
    # Add a new chart with a specific name, &lt;br /&gt;
    #  in a specific rectangle on the drawing page, &lt;br /&gt;
    #  and connected to specific cells of the spreadsheet. &lt;br /&gt;
    oCharts.addNewByName( &amp;quot;Sales&amp;quot;, &lt;br /&gt;
               makeRectangle( 8000, 1000, 16000, 10000 ), &lt;br /&gt;
               Array( oCellRangeAddress ), &lt;br /&gt;
               True, True ) &lt;br /&gt;
    # From the collection of charts, get the new chart we just created. &lt;br /&gt;
    oChart = oCharts.getByName( &amp;quot;Sales&amp;quot; ) &lt;br /&gt;
    # Get the chart document model. &lt;br /&gt;
    oChartDoc = oChart.getEmbeddedObject() &lt;br /&gt;
&lt;br /&gt;
    # Get the drawing text shape of the title of the chart. &lt;br /&gt;
    oTitleTextShape = oChartDoc.getTitle() &lt;br /&gt;
    # Change the title. &lt;br /&gt;
    oTitleTextShape.String = &amp;quot;Sales Chart&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # Create a diagram. &lt;br /&gt;
    oDiagram = oChartDoc.createInstance( &amp;quot;com.sun.star.chart.BarDiagram&amp;quot; ) &lt;br /&gt;
    # Set its parameters. &lt;br /&gt;
    oDiagram.Vertical = True &lt;br /&gt;
    # Make the chart use this diagram. &lt;br /&gt;
    oChartDoc.setDiagram( oDiagram ) &lt;br /&gt;
&lt;br /&gt;
    # Ask the chart what diagram it is using. &lt;br /&gt;
    # (Unnecessary, since variable oDiagram already contains this value.) &lt;br /&gt;
    oDiagram = oChartDoc.getDiagram() &lt;br /&gt;
    # Make more changes to the diagram. &lt;br /&gt;
    oDiagram.DataCaption = uno.getConstantByName( &amp;quot;com.sun.star.chart.ChartDataCaption.VALUE&amp;quot; ) &lt;br /&gt;
    oDiagram.DataRowSource = uno.getConstantByName( &amp;quot;com.sun.star.chart.ChartDataRowSource.COLUMNS&amp;quot; ) &lt;br /&gt;
    # &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #----- &lt;br /&gt;
    # Now demonstrate how to manipulate the sheets. &lt;br /&gt;
&lt;br /&gt;
    # Insert six more sheets into the document. &lt;br /&gt;
    nNumSheetsCurrently = oDoc.getSheets().getCount() &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Fred&amp;quot;, nNumSheetsCurrently+1 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Joe&amp;quot;, nNumSheetsCurrently+2 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Bill&amp;quot;, nNumSheetsCurrently+3 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Sam&amp;quot;, nNumSheetsCurrently+4 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Tom&amp;quot;, nNumSheetsCurrently+5 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;David&amp;quot;, nNumSheetsCurrently+6 ) &lt;br /&gt;
    # Now find a sheet named &amp;quot;Sheet2&amp;quot; and get rid of it. &lt;br /&gt;
    oDoc.getSheets().removeByName( &amp;quot;Sheet2&amp;quot; ) &lt;br /&gt;
    # Now find the sheet named &amp;quot;Sam&amp;quot; and change its name to &amp;quot;Sheet 37&amp;quot; &lt;br /&gt;
    oDoc.getSheets().getByName( &amp;quot;Sam&amp;quot; ).Name = &amp;quot;Sheet 37&amp;quot; &lt;br /&gt;
    # &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now print the document -- three different ways. &lt;br /&gt;
&lt;br /&gt;
    # Technique 1. &lt;br /&gt;
    # Now print the document. &lt;br /&gt;
    # Print two copies. &lt;br /&gt;
    # Print pages 1 thru 4, and also page 10. &lt;br /&gt;
    # &lt;br /&gt;
    # NOTE: we would do it like this, except the word &amp;quot;print&amp;quot; &lt;br /&gt;
    #       has a special meaning in python, and cannot be invoked &lt;br /&gt;
    #       as a method. &lt;br /&gt;
    #oDoc.print( &lt;br /&gt;
    #    Array( &lt;br /&gt;
    #        makePropertyValue( &amp;quot;CopyCount&amp;quot;, 2 ), &lt;br /&gt;
    #        makePropertyValue( &amp;quot;Pages&amp;quot;, &amp;quot;1-4;10&amp;quot; ) ) ) &lt;br /&gt;
    uno.invoke( oDoc, &amp;quot;print&amp;quot;, ( Array( &lt;br /&gt;
            makePropertyValue( &amp;quot;CopyCount&amp;quot;, 2 ), &lt;br /&gt;
            makePropertyValue( &amp;quot;Pages&amp;quot;, &amp;quot;1-4;10&amp;quot; ) ), ) ) &lt;br /&gt;
&lt;br /&gt;
    # Technique 2. &lt;br /&gt;
    # Print the document already, without any arguments. &lt;br /&gt;
    uno.invoke( oDoc, &amp;quot;print&amp;quot;, ( Array(), ) ) &lt;br /&gt;
    #oDoc.print( Array() ) &lt;br /&gt;
&lt;br /&gt;
    # Using technique 1 or 2, be sure not to close the document &lt;br /&gt;
    #  until printing is completed. &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?p=23144#23144 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    # Technique 3. &lt;br /&gt;
    # Print the document by bringing up the Print Job dialog box &lt;br /&gt;
    #  for the user to interact with. &lt;br /&gt;
    oDocFrame = oDoc.getCurrentController().getFrame() &lt;br /&gt;
    oDispatchHelper = createUnoService( &amp;quot;com.sun.star.frame.DispatchHelper&amp;quot; ) &lt;br /&gt;
    oDispatchHelper.executeDispatch( oDocFrame, &amp;quot;.uno:Print&amp;quot;, &amp;quot;&amp;quot;, 0, Array() ) &lt;br /&gt;
    # To learn some more about the dispatcher, see these articles... &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=5058 &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=5057 &lt;br /&gt;
&lt;br /&gt;
    # &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now save the document &lt;br /&gt;
&lt;br /&gt;
    # Prepare the filename to save. &lt;br /&gt;
    # We&amp;#039;re going to save the file in several different formats, &lt;br /&gt;
    #  but all based on the same filename. &lt;br /&gt;
    cFile = &amp;quot;C:\Documents and Settings\dbrewer\Desktop\MyCalc&amp;quot; # Windows &lt;br /&gt;
    #cFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; # Linux &lt;br /&gt;
&lt;br /&gt;
    # Now save the spreadsheet in native OOo Calc format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.sxc&amp;quot; ) &lt;br /&gt;
    oDoc.storeAsURL( cURL, Array() ) &lt;br /&gt;
&lt;br /&gt;
    # Note the above used storeAsUrl, &lt;br /&gt;
    #  the following use storeToUrl. &lt;br /&gt;
&lt;br /&gt;
    # Now save it in Excel format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.xls&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;MS Excel 97&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save a PDF. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.pdf&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;calc_pdf_Export&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in CSV format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.csv&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;Text - txt - csv (StarCalc)&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in DIF format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.dif&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;DIF&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in SYLK format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.sylk&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;SYLK&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save as HTML. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.html&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;HTML (StarCalc)&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # A list of some filter names you can use for both loading &lt;br /&gt;
    #  and saving a document can be found here... &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=3549 &lt;br /&gt;
&lt;br /&gt;
    # &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now close the document &lt;br /&gt;
    oDoc.close( True ) &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# import Danny.OOo.Examples.CalcExamples &lt;br /&gt;
# reload( Danny.OOo.Examples.CalcExamples ); from Danny.OOo.Examples.CalcExamples import * &lt;br /&gt;
&lt;br /&gt;
# CalcExample() &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code can be greatly enhanced, if you want to provide a better version of the code, please edit it and notify me for feedback. [[User:JZA|JZA]] ([[User talk:JZA|talk]])&lt;br /&gt;
&lt;br /&gt;
== Set the font size of text in a spreadsheet ==&lt;br /&gt;
Here is an example of how to set the font size of text in a spreadsheet cell. &lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Get this spreadsheet document &lt;br /&gt;
   oDoc = ThisComponent &lt;br /&gt;
   &amp;#039; Get the first sheet. &lt;br /&gt;
   oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
   &amp;#039; Get cell A1 &lt;br /&gt;
   oCell = oSheet.getCellByPosition( 0, 0 ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Put some text into the cell. &lt;br /&gt;
   oCell.setString( &amp;quot;This is a test&amp;quot; ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the cell&amp;#039;s Text. &lt;br /&gt;
   &amp;#039; You can do many things with this text, like you can do with Writer text. &lt;br /&gt;
   oText = oCell.getText() &lt;br /&gt;
   &amp;#039; Get a cursor on the text. &lt;br /&gt;
   oCursor = oText.createTextCursor() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Select ALL of the text. &lt;br /&gt;
   oCursor.gotoStart( False ) &amp;#039; goto start of text &lt;br /&gt;
   oCursor.gotoEnd( True ) &amp;#039; goto end of text while holding down SHIFT key &lt;br /&gt;
   &amp;#039; Change selected char&amp;#039;s height &lt;br /&gt;
   oCursor.CharHeight = 34 &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Select the first four characters &lt;br /&gt;
   oCursor.gotoStart( False ) &amp;#039; goto start of text &lt;br /&gt;
   oCursor.goRight( 4, True ) &amp;#039; go right 4 chars, holding down SHIFT key &lt;br /&gt;
   &amp;#039; Change selected char&amp;#039;s height &lt;br /&gt;
   oCursor.CharHeight = 27 &lt;br /&gt;
End Sub &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all of the text is of uniform size, and you want to increase the size of the entire text cell, then simply do.... &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Get this spreadsheet document &lt;br /&gt;
   oDoc = ThisComponent &lt;br /&gt;
   &amp;#039; Get the first sheet. &lt;br /&gt;
   oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
   &amp;#039; Get cell A1 &lt;br /&gt;
   oCell = oSheet.getCellByPosition( 0, 0 ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the cell&amp;#039;s Text. &lt;br /&gt;
   &amp;#039; You can do many things with this text, like you can do with Writer text. &lt;br /&gt;
   oText = oCell.getText() &lt;br /&gt;
   &amp;#039; Get a cursor on the text. &lt;br /&gt;
   oCursor = oText.createTextCursor() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Select ALL of the text. &lt;br /&gt;
   oCursor.gotoStart( False ) &amp;#039; goto start of text &lt;br /&gt;
   oCursor.gotoEnd( True ) &amp;#039; goto end of text while holding down SHIFT key &lt;br /&gt;
   &amp;#039; Change selected char&amp;#039;s height &lt;br /&gt;
   oCursor.CharHeight = oCursor.CharHeight + 1 &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
== Underline each Nth row of cells ==&lt;br /&gt;
Underline a row of cells, every Nth row, by setting the cell border bottom  and Adjust the column widths of a certain range of columns. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Create a new document. &lt;br /&gt;
   oDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
   &amp;#039; Alternative: Use document that this macro is embedded into. &lt;br /&gt;
   &amp;#039;oDoc = ThisComponent &lt;br /&gt;
   &amp;#039; Alternative: Load document from disk &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039;cFile = &amp;quot;C:\Documents and Settings\dbrewer\Desktop\Something.sxc&amp;quot; &amp;#039; for Windows &lt;br /&gt;
   &amp;#039;cFile = &amp;quot;/home/danny/Desktop/Something.sxc&amp;quot; &amp;#039; for Linux &lt;br /&gt;
   &amp;#039;cUrl = ConvertToUrl( cFile ) &lt;br /&gt;
   &amp;#039;oDoc = StarDesktop.loadComponentFromURL( cUrl, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
&lt;br /&gt;
   &amp;#039; Get first sheet of the document -- the zero&amp;#039;th sheet. &lt;br /&gt;
   oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
    &lt;br /&gt;
   UnderlineRows( oSheet ) &lt;br /&gt;
   AdjustColumnWidths( oSheet ) &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039; Pass in a single sheet of a spreadsheet document. &lt;br /&gt;
&amp;#039; This will create borders that underline certain cells. &lt;br /&gt;
Sub UnderlineRows( oSheet ) &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; You could turn these local variables into parameters. &lt;br /&gt;
   nUnderlineFirstRow = 9 &lt;br /&gt;
   nUnderlineSkipRows = 4 &lt;br /&gt;
   nUnderlineLastRow = 50 &lt;br /&gt;
   cUnderlineFirstColumn = &amp;quot;A&amp;quot; &lt;br /&gt;
   cUnderlineLastColumn = &amp;quot;I&amp;quot; &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039;nBorderColor = RGB( 0, 0, 0 ) &amp;#039; Black &lt;br /&gt;
   nBorderColor = RGB( 255, 200, 200 ) &amp;#039; Pink &lt;br /&gt;
    &lt;br /&gt;
   nInnerBorderWidth = 0 &amp;#039; in 1000&amp;#039;th of cm &lt;br /&gt;
   &amp;#039;nOuterBorderWidth = 75 &amp;#039; in 1000&amp;#039;th of cm, means 0.075 cm width &lt;br /&gt;
   nOuterBorderWidth = 1/32 * 2540 &amp;#039; 1/32 inch (2.54 cm = 1 inch) &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
    &lt;br /&gt;
   nRow = nUnderlineFirstRow &lt;br /&gt;
   Do While nRow &amp;lt;= nUnderlineLastRow &lt;br /&gt;
      &amp;#039; Form a string such as...  &amp;quot;A19:I19&amp;quot; &lt;br /&gt;
      cCellRangeName = cUnderlineFirstColumn + CSTR( nRow ) _ &lt;br /&gt;
                  + &amp;quot;:&amp;quot; + cUnderlineLastColumn + CSTR( nRow ) &lt;br /&gt;
       &lt;br /&gt;
      &amp;#039; Get the range of cells whose border is to be adjusted. &lt;br /&gt;
      oCellRange = oSheet.getCellRangeByName( cCellRangeName ) &lt;br /&gt;
       &lt;br /&gt;
      &amp;#039;oCellRange.LeftBorder   = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
      &amp;#039;oCellRange.RightBorder  = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
      &amp;#039;oCellRange.TopBorder    = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
      oCellRange.BottomBorder = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
       &lt;br /&gt;
      nRow = nRow + nUnderlineSkipRows &lt;br /&gt;
   Loop &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039; Pass in a single sheet of a spreadsheet document. &lt;br /&gt;
&amp;#039; This will set the column widths of certain cells. &lt;br /&gt;
Sub AdjustColumnWidths( oSheet ) &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; You could turn these local variables into parameters. &lt;br /&gt;
   cFirstColumn = &amp;quot;A&amp;quot; &lt;br /&gt;
   cLastColumn = &amp;quot;I&amp;quot; &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Turn the column names into column numbers. &lt;br /&gt;
   nFirstColumn = CalcColumnNameToNumber( oSheet, cFirstColumn ) &lt;br /&gt;
   nLastColumn = CalcColumnNameToNumber( oSheet, cLastColumn ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the collection of all columns on the sheet. &lt;br /&gt;
   oColumns = oSheet.getColumns() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Loop over each column... &lt;br /&gt;
   For nCol = nFirstColumn To nLastColumn &lt;br /&gt;
      &amp;#039; Get a single column &lt;br /&gt;
      oColumn = oColumns.getByIndex( nCol ) &lt;br /&gt;
       &lt;br /&gt;
      &amp;#039; Change column width &lt;br /&gt;
      oColumn.Width = 2.5 * 2540 &amp;#039; 2.5 inches * 2.54 cm / inch. &lt;br /&gt;
   Next &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function MakeCellBorderLine( nColor, nInnerLineWidth, nOuterLineWidth, nLineDistance ) _ &lt;br /&gt;
         As com.sun.star.table.BorderLine &lt;br /&gt;
   oBorderLine = createUnoStruct( &amp;quot;com.sun.star.table.BorderLine&amp;quot; ) &lt;br /&gt;
   With oBorderLine &lt;br /&gt;
      .Color = nColor &lt;br /&gt;
&lt;br /&gt;
      .InnerLineWidth = nInnerLineWidth &lt;br /&gt;
      .OuterLineWidth = nOuterLineWidth &lt;br /&gt;
      .LineDistance = nLineDistance &lt;br /&gt;
   End With &lt;br /&gt;
   MakeCellBorderLine = oBorderLine &lt;br /&gt;
End Function &lt;br /&gt;
&lt;br /&gt;
Function CalcColumnNameToNumber( oSheet As com.sun.star.sheet.Spreadsheet,_ &lt;br /&gt;
                     cColumnName As String ) As Long &lt;br /&gt;
   oColumns = oSheet.getColumns() &lt;br /&gt;
   oColumn = oColumns.getByName( cColumnName ) &lt;br /&gt;
   oRangeAddress = oColumn.getRangeAddress() &lt;br /&gt;
   nColumn = oRangeAddress.StartColumn &lt;br /&gt;
   CalcColumnNameToNumber() = nColumn &lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Take data from a Writer&amp;#039;s table and insert in Calc ==&lt;br /&gt;
This code tries to do as mentioned, extract a table data from Writer and insert it in a Calc document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Work with the writer document that this macro is embedded into. &lt;br /&gt;
   oWriterDoc = ThisComponent &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the collection of tables from the Writer doc. &lt;br /&gt;
   oWriterTables = oWriterDoc.getTextTables() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the table named FooBar. &lt;br /&gt;
   &amp;#039; Each table has a name.  We want the table named FooBar. &lt;br /&gt;
   &amp;#039; To see or change the name of a table, first click in the table, &lt;br /&gt;
   &amp;#039;  then Format--&amp;gt;Table, pick the Table tab, and adjust the Name. &lt;br /&gt;
   oWriterTable = oWriterTables.getByName( &amp;quot;FooBar&amp;quot; ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Find out how many Rows and Columns the table has. &lt;br /&gt;
   nRows = oWriterTable.getRows().getCount() &lt;br /&gt;
   nCols = oWriterTable.getColumns().getCount() &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Create a new Calc spreadsheet. &lt;br /&gt;
   oCalcDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the first sheet of the document. &lt;br /&gt;
   oSheet = oCalcDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
&amp;#039;   oSheet = oCalcDoc.getSheets().getByName( &amp;quot;Sheet1&amp;quot; ) &amp;#039; an alternate way to get by name &lt;br /&gt;
&lt;br /&gt;
   &amp;#039; Determine where we are going to insert the data from the Writer table. &lt;br /&gt;
   nFirstRow = 6 &lt;br /&gt;
   nFirstCol = 2 &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Copy the data, row by row, column by column &lt;br /&gt;
   For nRow = 0 To nRows-1 &lt;br /&gt;
      For nCol = 0 To nCols-1 &lt;br /&gt;
         oWriterCell = oWriterTable.getCellByPosition( nCol, nRow ) &lt;br /&gt;
         oCalcCell = oSheet.getCellByPosition( nCol+nFirstCol, nRow+nFirstRow ) &lt;br /&gt;
          &lt;br /&gt;
         &amp;#039; If the cell has a formula, then copy that... &lt;br /&gt;
         If oWriterCell.getFormula() &amp;lt;&amp;gt; &amp;quot;&amp;quot; Then &lt;br /&gt;
            oCalcCell.setFormula( oWriterCell.getFormula() ) &lt;br /&gt;
          &lt;br /&gt;
         &amp;#039; If the cell has a non-zero numeric value, then copy that... &lt;br /&gt;
         ElseIf oWriterCell.getValue() &amp;lt;&amp;gt; 0 Then &lt;br /&gt;
            oCalcCell.setValue( oWriterCell.getValue() ) &lt;br /&gt;
            &amp;#039; Question... what if the cell is numeric, but zero? &lt;br /&gt;
         ElseIf oWriterCell.getString() = &amp;quot;0&amp;quot; Then &lt;br /&gt;
            oCalcCell.setValue( oWriterCell.getValue() ) &lt;br /&gt;
          &lt;br /&gt;
         Else &lt;br /&gt;
            oCalcCell.setString( oWriterCell.getString() ) &lt;br /&gt;
         EndIf &lt;br /&gt;
      Next &lt;br /&gt;
   Next &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235896</id>
		<title>Python-Calc</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235896"/>
		<updated>2015-02-17T16:35:41Z</updated>

		<summary type="html">&lt;p&gt;JZA: /* Underline each Nth row of cells */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This code was originally written on the oooforum, you can reach it [http://www.oooforum.org/forum/viewtopic.phtml?p=55393#55393 here]. The code was somewhat broken down into different areas so the reader can understand each step.&lt;br /&gt;
&lt;br /&gt;
The intend of the code is to:&lt;br /&gt;
# Create a new spreadsheet&lt;br /&gt;
# Open an existing spreadsheet&lt;br /&gt;
# Insert strings inito a cell&lt;br /&gt;
# Insert formulas into a cell&lt;br /&gt;
# Insert graphs to a range&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
from Danny.OOo.OOoLib import * &lt;br /&gt;
&lt;br /&gt;
def CalcExample(): &lt;br /&gt;
    # create a new Calc spreadsheet. &lt;br /&gt;
    oDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    #----- &lt;br /&gt;
    # Use this instead to open an EXISTING calc document, &lt;br /&gt;
    #  and assign it to variable oDoc. &lt;br /&gt;
    #  cFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc&amp;quot; # Windows &lt;br /&gt;
    #  cFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; # Linux &lt;br /&gt;
    #  cURL = convertToURL( cFile + &amp;quot;.sxc&amp;quot; ) &lt;br /&gt;
    #  oDoc = StarDesktop.loadComponentFromURL( cURL, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    # Here are two ways to get access to one of the various sheets &lt;br /&gt;
    #  in the spreadsheet document. &lt;br /&gt;
    # Note that these don&amp;#039;t make the sheet *vislble*, they merely give &lt;br /&gt;
    #  access to the sheet&amp;#039;s content within the program. &lt;br /&gt;
    oSheet = oDoc.getSheets().getByIndex( 0 ) # get the zero&amp;#039;th sheet &lt;br /&gt;
    #oSheet = oDoc.getSheets().getByName( &amp;quot;Sheet3&amp;quot; ) # get by name &lt;br /&gt;
    &lt;br /&gt;
    #----- &lt;br /&gt;
    # Put some sales figures onto the sheet. &lt;br /&gt;
    oSheet.getCellByPosition( 0, 0 ).setString( &amp;quot;Month&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 0 ).setString( &amp;quot;Sales&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 0 ).setString( &amp;quot;End Date&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 0, 1 ).setString( &amp;quot;Jan&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 2 ).setString( &amp;quot;Feb&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 3 ).setString( &amp;quot;Mar&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 4 ).setString( &amp;quot;Apr&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 5 ).setString( &amp;quot;May&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 6 ).setString( &amp;quot;Jun&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 7 ).setString( &amp;quot;Jul&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 8 ).setString( &amp;quot;Aug&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 9 ).setString( &amp;quot;Sep&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 10 ).setString( &amp;quot;Oct&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 11 ).setString( &amp;quot;Nov&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 12 ).setString( &amp;quot;Dec&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 1, 1 ).setValue( 3826.37 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 2 ).setValue( 3504.21 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 3 ).setValue( 2961.45 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 4 ).setValue( 2504.12 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 5 ).setValue( 2713.98 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 6 ).setValue( 2248.17 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 7 ).setValue( 1802.13 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 8 ).setValue( 2003.22 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 9 ).setValue( 1502.54 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 10 ).setValue( 1207.68 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 11 ).setValue( 1319.71 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 12 ).setValue( 786.03 ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 2, 1 ).setFormula( &amp;quot;=DATE(2004;01;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 2 ).setFormula( &amp;quot;=DATE(2004;02;29)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 3 ).setFormula( &amp;quot;=DATE(2004;03;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 4 ).setFormula( &amp;quot;=DATE(2004;04;30)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 5 ).setFormula( &amp;quot;=DATE(2004;05;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 6 ).setFormula( &amp;quot;=DATE(2004;06;30)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 7 ).setFormula( &amp;quot;=DATE(2004;07;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 8 ).setFormula( &amp;quot;=DATE(2004;08;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 9 ).setFormula( &amp;quot;=DATE(2004;09;30)&amp;quot; ) &lt;br /&gt;
    # Note that these last three dates are not set as DATE() function calls. &lt;br /&gt;
    oSheet.getCellByPosition( 2, 10 ).setFormula( &amp;quot;10/31/2004&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 11 ).setFormula( &amp;quot;11/30/2004&amp;quot; ) &lt;br /&gt;
    oSheet.getCellRangeByName( &amp;quot;C13&amp;quot; ).setFormula( &amp;quot;12/31/2004&amp;quot; ) &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    #----- &lt;br /&gt;
    # Format the date cells as dates. &lt;br /&gt;
    com_sun_star_util_NumberFormat_DATE = uno.getConstantByName( &amp;quot;com.sun.star.util.NumberFormat.DATE&amp;quot; ) &lt;br /&gt;
    oFormats = oDoc.getNumberFormats() &lt;br /&gt;
    oLocale = createUnoStruct( &amp;quot;com.sun.star.lang.Locale&amp;quot; ) &lt;br /&gt;
    nDateKey = oFormats.getStandardFormat( com_sun_star_util_NumberFormat_DATE, oLocale ) &lt;br /&gt;
    oCell = oSheet.getCellRangeByName( &amp;quot;C2:C13&amp;quot; ) &lt;br /&gt;
    oCell.NumberFormat = nDateKey &lt;br /&gt;
    #----- &lt;br /&gt;
    &lt;br /&gt;
    #----- &lt;br /&gt;
    # Now add a chart to the spreadsheet. &lt;br /&gt;
&lt;br /&gt;
    oCellRangeAddress = oSheet.getCellRangeByName( &amp;quot;A1:B13&amp;quot; ).getRangeAddress() &lt;br /&gt;
    # oCellRangeAddress = MakeCellRangeAddress( 0, 0, 1, 1, 12 ) &lt;br /&gt;
    # Get the collection of charts from the sheet. &lt;br /&gt;
    oCharts = oSheet.getCharts() &lt;br /&gt;
    # Add a new chart with a specific name, &lt;br /&gt;
    #  in a specific rectangle on the drawing page, &lt;br /&gt;
    #  and connected to specific cells of the spreadsheet. &lt;br /&gt;
    oCharts.addNewByName( &amp;quot;Sales&amp;quot;, &lt;br /&gt;
               makeRectangle( 8000, 1000, 16000, 10000 ), &lt;br /&gt;
               Array( oCellRangeAddress ), &lt;br /&gt;
               True, True ) &lt;br /&gt;
    # From the collection of charts, get the new chart we just created. &lt;br /&gt;
    oChart = oCharts.getByName( &amp;quot;Sales&amp;quot; ) &lt;br /&gt;
    # Get the chart document model. &lt;br /&gt;
    oChartDoc = oChart.getEmbeddedObject() &lt;br /&gt;
&lt;br /&gt;
    # Get the drawing text shape of the title of the chart. &lt;br /&gt;
    oTitleTextShape = oChartDoc.getTitle() &lt;br /&gt;
    # Change the title. &lt;br /&gt;
    oTitleTextShape.String = &amp;quot;Sales Chart&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # Create a diagram. &lt;br /&gt;
    oDiagram = oChartDoc.createInstance( &amp;quot;com.sun.star.chart.BarDiagram&amp;quot; ) &lt;br /&gt;
    # Set its parameters. &lt;br /&gt;
    oDiagram.Vertical = True &lt;br /&gt;
    # Make the chart use this diagram. &lt;br /&gt;
    oChartDoc.setDiagram( oDiagram ) &lt;br /&gt;
&lt;br /&gt;
    # Ask the chart what diagram it is using. &lt;br /&gt;
    # (Unnecessary, since variable oDiagram already contains this value.) &lt;br /&gt;
    oDiagram = oChartDoc.getDiagram() &lt;br /&gt;
    # Make more changes to the diagram. &lt;br /&gt;
    oDiagram.DataCaption = uno.getConstantByName( &amp;quot;com.sun.star.chart.ChartDataCaption.VALUE&amp;quot; ) &lt;br /&gt;
    oDiagram.DataRowSource = uno.getConstantByName( &amp;quot;com.sun.star.chart.ChartDataRowSource.COLUMNS&amp;quot; ) &lt;br /&gt;
    # &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #----- &lt;br /&gt;
    # Now demonstrate how to manipulate the sheets. &lt;br /&gt;
&lt;br /&gt;
    # Insert six more sheets into the document. &lt;br /&gt;
    nNumSheetsCurrently = oDoc.getSheets().getCount() &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Fred&amp;quot;, nNumSheetsCurrently+1 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Joe&amp;quot;, nNumSheetsCurrently+2 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Bill&amp;quot;, nNumSheetsCurrently+3 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Sam&amp;quot;, nNumSheetsCurrently+4 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Tom&amp;quot;, nNumSheetsCurrently+5 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;David&amp;quot;, nNumSheetsCurrently+6 ) &lt;br /&gt;
    # Now find a sheet named &amp;quot;Sheet2&amp;quot; and get rid of it. &lt;br /&gt;
    oDoc.getSheets().removeByName( &amp;quot;Sheet2&amp;quot; ) &lt;br /&gt;
    # Now find the sheet named &amp;quot;Sam&amp;quot; and change its name to &amp;quot;Sheet 37&amp;quot; &lt;br /&gt;
    oDoc.getSheets().getByName( &amp;quot;Sam&amp;quot; ).Name = &amp;quot;Sheet 37&amp;quot; &lt;br /&gt;
    # &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now print the document -- three different ways. &lt;br /&gt;
&lt;br /&gt;
    # Technique 1. &lt;br /&gt;
    # Now print the document. &lt;br /&gt;
    # Print two copies. &lt;br /&gt;
    # Print pages 1 thru 4, and also page 10. &lt;br /&gt;
    # &lt;br /&gt;
    # NOTE: we would do it like this, except the word &amp;quot;print&amp;quot; &lt;br /&gt;
    #       has a special meaning in python, and cannot be invoked &lt;br /&gt;
    #       as a method. &lt;br /&gt;
    #oDoc.print( &lt;br /&gt;
    #    Array( &lt;br /&gt;
    #        makePropertyValue( &amp;quot;CopyCount&amp;quot;, 2 ), &lt;br /&gt;
    #        makePropertyValue( &amp;quot;Pages&amp;quot;, &amp;quot;1-4;10&amp;quot; ) ) ) &lt;br /&gt;
    uno.invoke( oDoc, &amp;quot;print&amp;quot;, ( Array( &lt;br /&gt;
            makePropertyValue( &amp;quot;CopyCount&amp;quot;, 2 ), &lt;br /&gt;
            makePropertyValue( &amp;quot;Pages&amp;quot;, &amp;quot;1-4;10&amp;quot; ) ), ) ) &lt;br /&gt;
&lt;br /&gt;
    # Technique 2. &lt;br /&gt;
    # Print the document already, without any arguments. &lt;br /&gt;
    uno.invoke( oDoc, &amp;quot;print&amp;quot;, ( Array(), ) ) &lt;br /&gt;
    #oDoc.print( Array() ) &lt;br /&gt;
&lt;br /&gt;
    # Using technique 1 or 2, be sure not to close the document &lt;br /&gt;
    #  until printing is completed. &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?p=23144#23144 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    # Technique 3. &lt;br /&gt;
    # Print the document by bringing up the Print Job dialog box &lt;br /&gt;
    #  for the user to interact with. &lt;br /&gt;
    oDocFrame = oDoc.getCurrentController().getFrame() &lt;br /&gt;
    oDispatchHelper = createUnoService( &amp;quot;com.sun.star.frame.DispatchHelper&amp;quot; ) &lt;br /&gt;
    oDispatchHelper.executeDispatch( oDocFrame, &amp;quot;.uno:Print&amp;quot;, &amp;quot;&amp;quot;, 0, Array() ) &lt;br /&gt;
    # To learn some more about the dispatcher, see these articles... &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=5058 &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=5057 &lt;br /&gt;
&lt;br /&gt;
    # &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now save the document &lt;br /&gt;
&lt;br /&gt;
    # Prepare the filename to save. &lt;br /&gt;
    # We&amp;#039;re going to save the file in several different formats, &lt;br /&gt;
    #  but all based on the same filename. &lt;br /&gt;
    cFile = &amp;quot;C:\Documents and Settings\dbrewer\Desktop\MyCalc&amp;quot; # Windows &lt;br /&gt;
    #cFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; # Linux &lt;br /&gt;
&lt;br /&gt;
    # Now save the spreadsheet in native OOo Calc format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.sxc&amp;quot; ) &lt;br /&gt;
    oDoc.storeAsURL( cURL, Array() ) &lt;br /&gt;
&lt;br /&gt;
    # Note the above used storeAsUrl, &lt;br /&gt;
    #  the following use storeToUrl. &lt;br /&gt;
&lt;br /&gt;
    # Now save it in Excel format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.xls&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;MS Excel 97&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save a PDF. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.pdf&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;calc_pdf_Export&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in CSV format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.csv&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;Text - txt - csv (StarCalc)&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in DIF format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.dif&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;DIF&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in SYLK format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.sylk&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;SYLK&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save as HTML. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.html&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;HTML (StarCalc)&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # A list of some filter names you can use for both loading &lt;br /&gt;
    #  and saving a document can be found here... &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=3549 &lt;br /&gt;
&lt;br /&gt;
    # &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now close the document &lt;br /&gt;
    oDoc.close( True ) &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# import Danny.OOo.Examples.CalcExamples &lt;br /&gt;
# reload( Danny.OOo.Examples.CalcExamples ); from Danny.OOo.Examples.CalcExamples import * &lt;br /&gt;
&lt;br /&gt;
# CalcExample() &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code can be greatly enhanced, if you want to provide a better version of the code, please edit it and notify me for feedback. [[User:JZA|JZA]] ([[User talk:JZA|talk]])&lt;br /&gt;
&lt;br /&gt;
== Set the font size of text in a spreadsheet ==&lt;br /&gt;
Here is an example of how to set the font size of text in a spreadsheet cell. &lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Get this spreadsheet document &lt;br /&gt;
   oDoc = ThisComponent &lt;br /&gt;
   &amp;#039; Get the first sheet. &lt;br /&gt;
   oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
   &amp;#039; Get cell A1 &lt;br /&gt;
   oCell = oSheet.getCellByPosition( 0, 0 ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Put some text into the cell. &lt;br /&gt;
   oCell.setString( &amp;quot;This is a test&amp;quot; ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the cell&amp;#039;s Text. &lt;br /&gt;
   &amp;#039; You can do many things with this text, like you can do with Writer text. &lt;br /&gt;
   oText = oCell.getText() &lt;br /&gt;
   &amp;#039; Get a cursor on the text. &lt;br /&gt;
   oCursor = oText.createTextCursor() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Select ALL of the text. &lt;br /&gt;
   oCursor.gotoStart( False ) &amp;#039; goto start of text &lt;br /&gt;
   oCursor.gotoEnd( True ) &amp;#039; goto end of text while holding down SHIFT key &lt;br /&gt;
   &amp;#039; Change selected char&amp;#039;s height &lt;br /&gt;
   oCursor.CharHeight = 34 &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Select the first four characters &lt;br /&gt;
   oCursor.gotoStart( False ) &amp;#039; goto start of text &lt;br /&gt;
   oCursor.goRight( 4, True ) &amp;#039; go right 4 chars, holding down SHIFT key &lt;br /&gt;
   &amp;#039; Change selected char&amp;#039;s height &lt;br /&gt;
   oCursor.CharHeight = 27 &lt;br /&gt;
End Sub &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all of the text is of uniform size, and you want to increase the size of the entire text cell, then simply do.... &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Get this spreadsheet document &lt;br /&gt;
   oDoc = ThisComponent &lt;br /&gt;
   &amp;#039; Get the first sheet. &lt;br /&gt;
   oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
   &amp;#039; Get cell A1 &lt;br /&gt;
   oCell = oSheet.getCellByPosition( 0, 0 ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the cell&amp;#039;s Text. &lt;br /&gt;
   &amp;#039; You can do many things with this text, like you can do with Writer text. &lt;br /&gt;
   oText = oCell.getText() &lt;br /&gt;
   &amp;#039; Get a cursor on the text. &lt;br /&gt;
   oCursor = oText.createTextCursor() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Select ALL of the text. &lt;br /&gt;
   oCursor.gotoStart( False ) &amp;#039; goto start of text &lt;br /&gt;
   oCursor.gotoEnd( True ) &amp;#039; goto end of text while holding down SHIFT key &lt;br /&gt;
   &amp;#039; Change selected char&amp;#039;s height &lt;br /&gt;
   oCursor.CharHeight = oCursor.CharHeight + 1 &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
== Underline each Nth row of cells ==&lt;br /&gt;
Underline a row of cells, every Nth row, by setting the cell border bottom  and Adjust the column widths of a certain range of columns. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=basic&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Create a new document. &lt;br /&gt;
   oDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
   &amp;#039; Alternative: Use document that this macro is embedded into. &lt;br /&gt;
   &amp;#039;oDoc = ThisComponent &lt;br /&gt;
   &amp;#039; Alternative: Load document from disk &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039;cFile = &amp;quot;C:\Documents and Settings\dbrewer\Desktop\Something.sxc&amp;quot; &amp;#039; for Windows &lt;br /&gt;
   &amp;#039;cFile = &amp;quot;/home/danny/Desktop/Something.sxc&amp;quot; &amp;#039; for Linux &lt;br /&gt;
   &amp;#039;cUrl = ConvertToUrl( cFile ) &lt;br /&gt;
   &amp;#039;oDoc = StarDesktop.loadComponentFromURL( cUrl, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
&lt;br /&gt;
   &amp;#039; Get first sheet of the document -- the zero&amp;#039;th sheet. &lt;br /&gt;
   oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
    &lt;br /&gt;
   UnderlineRows( oSheet ) &lt;br /&gt;
   AdjustColumnWidths( oSheet ) &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039; Pass in a single sheet of a spreadsheet document. &lt;br /&gt;
&amp;#039; This will create borders that underline certain cells. &lt;br /&gt;
Sub UnderlineRows( oSheet ) &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; You could turn these local variables into parameters. &lt;br /&gt;
   nUnderlineFirstRow = 9 &lt;br /&gt;
   nUnderlineSkipRows = 4 &lt;br /&gt;
   nUnderlineLastRow = 50 &lt;br /&gt;
   cUnderlineFirstColumn = &amp;quot;A&amp;quot; &lt;br /&gt;
   cUnderlineLastColumn = &amp;quot;I&amp;quot; &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039;nBorderColor = RGB( 0, 0, 0 ) &amp;#039; Black &lt;br /&gt;
   nBorderColor = RGB( 255, 200, 200 ) &amp;#039; Pink &lt;br /&gt;
    &lt;br /&gt;
   nInnerBorderWidth = 0 &amp;#039; in 1000&amp;#039;th of cm &lt;br /&gt;
   &amp;#039;nOuterBorderWidth = 75 &amp;#039; in 1000&amp;#039;th of cm, means 0.075 cm width &lt;br /&gt;
   nOuterBorderWidth = 1/32 * 2540 &amp;#039; 1/32 inch (2.54 cm = 1 inch) &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
    &lt;br /&gt;
   nRow = nUnderlineFirstRow &lt;br /&gt;
   Do While nRow &amp;lt;= nUnderlineLastRow &lt;br /&gt;
      &amp;#039; Form a string such as...  &amp;quot;A19:I19&amp;quot; &lt;br /&gt;
      cCellRangeName = cUnderlineFirstColumn + CSTR( nRow ) _ &lt;br /&gt;
                  + &amp;quot;:&amp;quot; + cUnderlineLastColumn + CSTR( nRow ) &lt;br /&gt;
       &lt;br /&gt;
      &amp;#039; Get the range of cells whose border is to be adjusted. &lt;br /&gt;
      oCellRange = oSheet.getCellRangeByName( cCellRangeName ) &lt;br /&gt;
       &lt;br /&gt;
      &amp;#039;oCellRange.LeftBorder   = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
      &amp;#039;oCellRange.RightBorder  = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
      &amp;#039;oCellRange.TopBorder    = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
      oCellRange.BottomBorder = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
       &lt;br /&gt;
      nRow = nRow + nUnderlineSkipRows &lt;br /&gt;
   Loop &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039; Pass in a single sheet of a spreadsheet document. &lt;br /&gt;
&amp;#039; This will set the column widths of certain cells. &lt;br /&gt;
Sub AdjustColumnWidths( oSheet ) &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; You could turn these local variables into parameters. &lt;br /&gt;
   cFirstColumn = &amp;quot;A&amp;quot; &lt;br /&gt;
   cLastColumn = &amp;quot;I&amp;quot; &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Turn the column names into column numbers. &lt;br /&gt;
   nFirstColumn = CalcColumnNameToNumber( oSheet, cFirstColumn ) &lt;br /&gt;
   nLastColumn = CalcColumnNameToNumber( oSheet, cLastColumn ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the collection of all columns on the sheet. &lt;br /&gt;
   oColumns = oSheet.getColumns() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Loop over each column... &lt;br /&gt;
   For nCol = nFirstColumn To nLastColumn &lt;br /&gt;
      &amp;#039; Get a single column &lt;br /&gt;
      oColumn = oColumns.getByIndex( nCol ) &lt;br /&gt;
       &lt;br /&gt;
      &amp;#039; Change column width &lt;br /&gt;
      oColumn.Width = 2.5 * 2540 &amp;#039; 2.5 inches * 2.54 cm / inch. &lt;br /&gt;
   Next &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function MakeCellBorderLine( nColor, nInnerLineWidth, nOuterLineWidth, nLineDistance ) _ &lt;br /&gt;
         As com.sun.star.table.BorderLine &lt;br /&gt;
   oBorderLine = createUnoStruct( &amp;quot;com.sun.star.table.BorderLine&amp;quot; ) &lt;br /&gt;
   With oBorderLine &lt;br /&gt;
      .Color = nColor &lt;br /&gt;
&lt;br /&gt;
      .InnerLineWidth = nInnerLineWidth &lt;br /&gt;
      .OuterLineWidth = nOuterLineWidth &lt;br /&gt;
      .LineDistance = nLineDistance &lt;br /&gt;
   End With &lt;br /&gt;
   MakeCellBorderLine = oBorderLine &lt;br /&gt;
End Function &lt;br /&gt;
&lt;br /&gt;
Function CalcColumnNameToNumber( oSheet As com.sun.star.sheet.Spreadsheet,_ &lt;br /&gt;
                     cColumnName As String ) As Long &lt;br /&gt;
   oColumns = oSheet.getColumns() &lt;br /&gt;
   oColumn = oColumns.getByName( cColumnName ) &lt;br /&gt;
   oRangeAddress = oColumn.getRangeAddress() &lt;br /&gt;
   nColumn = oRangeAddress.StartColumn &lt;br /&gt;
   CalcColumnNameToNumber() = nColumn &lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Take data from a Writer&amp;#039;s table and insert in Calc ==&lt;br /&gt;
This code tries to do as mentioned, extract a table data from Writer and insert it in a Calc document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Work with the writer document that this macro is embedded into. &lt;br /&gt;
   oWriterDoc = ThisComponent &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the collection of tables from the Writer doc. &lt;br /&gt;
   oWriterTables = oWriterDoc.getTextTables() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the table named FooBar. &lt;br /&gt;
   &amp;#039; Each table has a name.  We want the table named FooBar. &lt;br /&gt;
   &amp;#039; To see or change the name of a table, first click in the table, &lt;br /&gt;
   &amp;#039;  then Format--&amp;gt;Table, pick the Table tab, and adjust the Name. &lt;br /&gt;
   oWriterTable = oWriterTables.getByName( &amp;quot;FooBar&amp;quot; ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Find out how many Rows and Columns the table has. &lt;br /&gt;
   nRows = oWriterTable.getRows().getCount() &lt;br /&gt;
   nCols = oWriterTable.getColumns().getCount() &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Create a new Calc spreadsheet. &lt;br /&gt;
   oCalcDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the first sheet of the document. &lt;br /&gt;
   oSheet = oCalcDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
&amp;#039;   oSheet = oCalcDoc.getSheets().getByName( &amp;quot;Sheet1&amp;quot; ) &amp;#039; an alternate way to get by name &lt;br /&gt;
&lt;br /&gt;
   &amp;#039; Determine where we are going to insert the data from the Writer table. &lt;br /&gt;
   nFirstRow = 6 &lt;br /&gt;
   nFirstCol = 2 &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Copy the data, row by row, column by column &lt;br /&gt;
   For nRow = 0 To nRows-1 &lt;br /&gt;
      For nCol = 0 To nCols-1 &lt;br /&gt;
         oWriterCell = oWriterTable.getCellByPosition( nCol, nRow ) &lt;br /&gt;
         oCalcCell = oSheet.getCellByPosition( nCol+nFirstCol, nRow+nFirstRow ) &lt;br /&gt;
          &lt;br /&gt;
         &amp;#039; If the cell has a formula, then copy that... &lt;br /&gt;
         If oWriterCell.getFormula() &amp;lt;&amp;gt; &amp;quot;&amp;quot; Then &lt;br /&gt;
            oCalcCell.setFormula( oWriterCell.getFormula() ) &lt;br /&gt;
          &lt;br /&gt;
         &amp;#039; If the cell has a non-zero numeric value, then copy that... &lt;br /&gt;
         ElseIf oWriterCell.getValue() &amp;lt;&amp;gt; 0 Then &lt;br /&gt;
            oCalcCell.setValue( oWriterCell.getValue() ) &lt;br /&gt;
            &amp;#039; Question... what if the cell is numeric, but zero? &lt;br /&gt;
         ElseIf oWriterCell.getString() = &amp;quot;0&amp;quot; Then &lt;br /&gt;
            oCalcCell.setValue( oWriterCell.getValue() ) &lt;br /&gt;
          &lt;br /&gt;
         Else &lt;br /&gt;
            oCalcCell.setString( oWriterCell.getString() ) &lt;br /&gt;
         EndIf &lt;br /&gt;
      Next &lt;br /&gt;
   Next &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235895</id>
		<title>Python-Calc</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235895"/>
		<updated>2015-02-17T16:34:52Z</updated>

		<summary type="html">&lt;p&gt;JZA: Adding more code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This code was originally written on the oooforum, you can reach it [http://www.oooforum.org/forum/viewtopic.phtml?p=55393#55393 here]. The code was somewhat broken down into different areas so the reader can understand each step.&lt;br /&gt;
&lt;br /&gt;
The intend of the code is to:&lt;br /&gt;
# Create a new spreadsheet&lt;br /&gt;
# Open an existing spreadsheet&lt;br /&gt;
# Insert strings inito a cell&lt;br /&gt;
# Insert formulas into a cell&lt;br /&gt;
# Insert graphs to a range&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
from Danny.OOo.OOoLib import * &lt;br /&gt;
&lt;br /&gt;
def CalcExample(): &lt;br /&gt;
    # create a new Calc spreadsheet. &lt;br /&gt;
    oDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    #----- &lt;br /&gt;
    # Use this instead to open an EXISTING calc document, &lt;br /&gt;
    #  and assign it to variable oDoc. &lt;br /&gt;
    #  cFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc&amp;quot; # Windows &lt;br /&gt;
    #  cFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; # Linux &lt;br /&gt;
    #  cURL = convertToURL( cFile + &amp;quot;.sxc&amp;quot; ) &lt;br /&gt;
    #  oDoc = StarDesktop.loadComponentFromURL( cURL, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    # Here are two ways to get access to one of the various sheets &lt;br /&gt;
    #  in the spreadsheet document. &lt;br /&gt;
    # Note that these don&amp;#039;t make the sheet *vislble*, they merely give &lt;br /&gt;
    #  access to the sheet&amp;#039;s content within the program. &lt;br /&gt;
    oSheet = oDoc.getSheets().getByIndex( 0 ) # get the zero&amp;#039;th sheet &lt;br /&gt;
    #oSheet = oDoc.getSheets().getByName( &amp;quot;Sheet3&amp;quot; ) # get by name &lt;br /&gt;
    &lt;br /&gt;
    #----- &lt;br /&gt;
    # Put some sales figures onto the sheet. &lt;br /&gt;
    oSheet.getCellByPosition( 0, 0 ).setString( &amp;quot;Month&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 0 ).setString( &amp;quot;Sales&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 0 ).setString( &amp;quot;End Date&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 0, 1 ).setString( &amp;quot;Jan&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 2 ).setString( &amp;quot;Feb&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 3 ).setString( &amp;quot;Mar&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 4 ).setString( &amp;quot;Apr&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 5 ).setString( &amp;quot;May&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 6 ).setString( &amp;quot;Jun&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 7 ).setString( &amp;quot;Jul&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 8 ).setString( &amp;quot;Aug&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 9 ).setString( &amp;quot;Sep&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 10 ).setString( &amp;quot;Oct&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 11 ).setString( &amp;quot;Nov&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 12 ).setString( &amp;quot;Dec&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 1, 1 ).setValue( 3826.37 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 2 ).setValue( 3504.21 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 3 ).setValue( 2961.45 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 4 ).setValue( 2504.12 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 5 ).setValue( 2713.98 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 6 ).setValue( 2248.17 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 7 ).setValue( 1802.13 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 8 ).setValue( 2003.22 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 9 ).setValue( 1502.54 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 10 ).setValue( 1207.68 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 11 ).setValue( 1319.71 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 12 ).setValue( 786.03 ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 2, 1 ).setFormula( &amp;quot;=DATE(2004;01;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 2 ).setFormula( &amp;quot;=DATE(2004;02;29)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 3 ).setFormula( &amp;quot;=DATE(2004;03;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 4 ).setFormula( &amp;quot;=DATE(2004;04;30)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 5 ).setFormula( &amp;quot;=DATE(2004;05;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 6 ).setFormula( &amp;quot;=DATE(2004;06;30)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 7 ).setFormula( &amp;quot;=DATE(2004;07;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 8 ).setFormula( &amp;quot;=DATE(2004;08;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 9 ).setFormula( &amp;quot;=DATE(2004;09;30)&amp;quot; ) &lt;br /&gt;
    # Note that these last three dates are not set as DATE() function calls. &lt;br /&gt;
    oSheet.getCellByPosition( 2, 10 ).setFormula( &amp;quot;10/31/2004&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 11 ).setFormula( &amp;quot;11/30/2004&amp;quot; ) &lt;br /&gt;
    oSheet.getCellRangeByName( &amp;quot;C13&amp;quot; ).setFormula( &amp;quot;12/31/2004&amp;quot; ) &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    #----- &lt;br /&gt;
    # Format the date cells as dates. &lt;br /&gt;
    com_sun_star_util_NumberFormat_DATE = uno.getConstantByName( &amp;quot;com.sun.star.util.NumberFormat.DATE&amp;quot; ) &lt;br /&gt;
    oFormats = oDoc.getNumberFormats() &lt;br /&gt;
    oLocale = createUnoStruct( &amp;quot;com.sun.star.lang.Locale&amp;quot; ) &lt;br /&gt;
    nDateKey = oFormats.getStandardFormat( com_sun_star_util_NumberFormat_DATE, oLocale ) &lt;br /&gt;
    oCell = oSheet.getCellRangeByName( &amp;quot;C2:C13&amp;quot; ) &lt;br /&gt;
    oCell.NumberFormat = nDateKey &lt;br /&gt;
    #----- &lt;br /&gt;
    &lt;br /&gt;
    #----- &lt;br /&gt;
    # Now add a chart to the spreadsheet. &lt;br /&gt;
&lt;br /&gt;
    oCellRangeAddress = oSheet.getCellRangeByName( &amp;quot;A1:B13&amp;quot; ).getRangeAddress() &lt;br /&gt;
    # oCellRangeAddress = MakeCellRangeAddress( 0, 0, 1, 1, 12 ) &lt;br /&gt;
    # Get the collection of charts from the sheet. &lt;br /&gt;
    oCharts = oSheet.getCharts() &lt;br /&gt;
    # Add a new chart with a specific name, &lt;br /&gt;
    #  in a specific rectangle on the drawing page, &lt;br /&gt;
    #  and connected to specific cells of the spreadsheet. &lt;br /&gt;
    oCharts.addNewByName( &amp;quot;Sales&amp;quot;, &lt;br /&gt;
               makeRectangle( 8000, 1000, 16000, 10000 ), &lt;br /&gt;
               Array( oCellRangeAddress ), &lt;br /&gt;
               True, True ) &lt;br /&gt;
    # From the collection of charts, get the new chart we just created. &lt;br /&gt;
    oChart = oCharts.getByName( &amp;quot;Sales&amp;quot; ) &lt;br /&gt;
    # Get the chart document model. &lt;br /&gt;
    oChartDoc = oChart.getEmbeddedObject() &lt;br /&gt;
&lt;br /&gt;
    # Get the drawing text shape of the title of the chart. &lt;br /&gt;
    oTitleTextShape = oChartDoc.getTitle() &lt;br /&gt;
    # Change the title. &lt;br /&gt;
    oTitleTextShape.String = &amp;quot;Sales Chart&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # Create a diagram. &lt;br /&gt;
    oDiagram = oChartDoc.createInstance( &amp;quot;com.sun.star.chart.BarDiagram&amp;quot; ) &lt;br /&gt;
    # Set its parameters. &lt;br /&gt;
    oDiagram.Vertical = True &lt;br /&gt;
    # Make the chart use this diagram. &lt;br /&gt;
    oChartDoc.setDiagram( oDiagram ) &lt;br /&gt;
&lt;br /&gt;
    # Ask the chart what diagram it is using. &lt;br /&gt;
    # (Unnecessary, since variable oDiagram already contains this value.) &lt;br /&gt;
    oDiagram = oChartDoc.getDiagram() &lt;br /&gt;
    # Make more changes to the diagram. &lt;br /&gt;
    oDiagram.DataCaption = uno.getConstantByName( &amp;quot;com.sun.star.chart.ChartDataCaption.VALUE&amp;quot; ) &lt;br /&gt;
    oDiagram.DataRowSource = uno.getConstantByName( &amp;quot;com.sun.star.chart.ChartDataRowSource.COLUMNS&amp;quot; ) &lt;br /&gt;
    # &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #----- &lt;br /&gt;
    # Now demonstrate how to manipulate the sheets. &lt;br /&gt;
&lt;br /&gt;
    # Insert six more sheets into the document. &lt;br /&gt;
    nNumSheetsCurrently = oDoc.getSheets().getCount() &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Fred&amp;quot;, nNumSheetsCurrently+1 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Joe&amp;quot;, nNumSheetsCurrently+2 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Bill&amp;quot;, nNumSheetsCurrently+3 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Sam&amp;quot;, nNumSheetsCurrently+4 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Tom&amp;quot;, nNumSheetsCurrently+5 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;David&amp;quot;, nNumSheetsCurrently+6 ) &lt;br /&gt;
    # Now find a sheet named &amp;quot;Sheet2&amp;quot; and get rid of it. &lt;br /&gt;
    oDoc.getSheets().removeByName( &amp;quot;Sheet2&amp;quot; ) &lt;br /&gt;
    # Now find the sheet named &amp;quot;Sam&amp;quot; and change its name to &amp;quot;Sheet 37&amp;quot; &lt;br /&gt;
    oDoc.getSheets().getByName( &amp;quot;Sam&amp;quot; ).Name = &amp;quot;Sheet 37&amp;quot; &lt;br /&gt;
    # &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now print the document -- three different ways. &lt;br /&gt;
&lt;br /&gt;
    # Technique 1. &lt;br /&gt;
    # Now print the document. &lt;br /&gt;
    # Print two copies. &lt;br /&gt;
    # Print pages 1 thru 4, and also page 10. &lt;br /&gt;
    # &lt;br /&gt;
    # NOTE: we would do it like this, except the word &amp;quot;print&amp;quot; &lt;br /&gt;
    #       has a special meaning in python, and cannot be invoked &lt;br /&gt;
    #       as a method. &lt;br /&gt;
    #oDoc.print( &lt;br /&gt;
    #    Array( &lt;br /&gt;
    #        makePropertyValue( &amp;quot;CopyCount&amp;quot;, 2 ), &lt;br /&gt;
    #        makePropertyValue( &amp;quot;Pages&amp;quot;, &amp;quot;1-4;10&amp;quot; ) ) ) &lt;br /&gt;
    uno.invoke( oDoc, &amp;quot;print&amp;quot;, ( Array( &lt;br /&gt;
            makePropertyValue( &amp;quot;CopyCount&amp;quot;, 2 ), &lt;br /&gt;
            makePropertyValue( &amp;quot;Pages&amp;quot;, &amp;quot;1-4;10&amp;quot; ) ), ) ) &lt;br /&gt;
&lt;br /&gt;
    # Technique 2. &lt;br /&gt;
    # Print the document already, without any arguments. &lt;br /&gt;
    uno.invoke( oDoc, &amp;quot;print&amp;quot;, ( Array(), ) ) &lt;br /&gt;
    #oDoc.print( Array() ) &lt;br /&gt;
&lt;br /&gt;
    # Using technique 1 or 2, be sure not to close the document &lt;br /&gt;
    #  until printing is completed. &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?p=23144#23144 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    # Technique 3. &lt;br /&gt;
    # Print the document by bringing up the Print Job dialog box &lt;br /&gt;
    #  for the user to interact with. &lt;br /&gt;
    oDocFrame = oDoc.getCurrentController().getFrame() &lt;br /&gt;
    oDispatchHelper = createUnoService( &amp;quot;com.sun.star.frame.DispatchHelper&amp;quot; ) &lt;br /&gt;
    oDispatchHelper.executeDispatch( oDocFrame, &amp;quot;.uno:Print&amp;quot;, &amp;quot;&amp;quot;, 0, Array() ) &lt;br /&gt;
    # To learn some more about the dispatcher, see these articles... &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=5058 &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=5057 &lt;br /&gt;
&lt;br /&gt;
    # &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now save the document &lt;br /&gt;
&lt;br /&gt;
    # Prepare the filename to save. &lt;br /&gt;
    # We&amp;#039;re going to save the file in several different formats, &lt;br /&gt;
    #  but all based on the same filename. &lt;br /&gt;
    cFile = &amp;quot;C:\Documents and Settings\dbrewer\Desktop\MyCalc&amp;quot; # Windows &lt;br /&gt;
    #cFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; # Linux &lt;br /&gt;
&lt;br /&gt;
    # Now save the spreadsheet in native OOo Calc format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.sxc&amp;quot; ) &lt;br /&gt;
    oDoc.storeAsURL( cURL, Array() ) &lt;br /&gt;
&lt;br /&gt;
    # Note the above used storeAsUrl, &lt;br /&gt;
    #  the following use storeToUrl. &lt;br /&gt;
&lt;br /&gt;
    # Now save it in Excel format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.xls&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;MS Excel 97&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save a PDF. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.pdf&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;calc_pdf_Export&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in CSV format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.csv&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;Text - txt - csv (StarCalc)&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in DIF format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.dif&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;DIF&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in SYLK format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.sylk&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;SYLK&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save as HTML. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.html&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;HTML (StarCalc)&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # A list of some filter names you can use for both loading &lt;br /&gt;
    #  and saving a document can be found here... &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=3549 &lt;br /&gt;
&lt;br /&gt;
    # &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now close the document &lt;br /&gt;
    oDoc.close( True ) &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# import Danny.OOo.Examples.CalcExamples &lt;br /&gt;
# reload( Danny.OOo.Examples.CalcExamples ); from Danny.OOo.Examples.CalcExamples import * &lt;br /&gt;
&lt;br /&gt;
# CalcExample() &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code can be greatly enhanced, if you want to provide a better version of the code, please edit it and notify me for feedback. [[User:JZA|JZA]] ([[User talk:JZA|talk]])&lt;br /&gt;
&lt;br /&gt;
== Set the font size of text in a spreadsheet ==&lt;br /&gt;
Here is an example of how to set the font size of text in a spreadsheet cell. &lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Get this spreadsheet document &lt;br /&gt;
   oDoc = ThisComponent &lt;br /&gt;
   &amp;#039; Get the first sheet. &lt;br /&gt;
   oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
   &amp;#039; Get cell A1 &lt;br /&gt;
   oCell = oSheet.getCellByPosition( 0, 0 ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Put some text into the cell. &lt;br /&gt;
   oCell.setString( &amp;quot;This is a test&amp;quot; ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the cell&amp;#039;s Text. &lt;br /&gt;
   &amp;#039; You can do many things with this text, like you can do with Writer text. &lt;br /&gt;
   oText = oCell.getText() &lt;br /&gt;
   &amp;#039; Get a cursor on the text. &lt;br /&gt;
   oCursor = oText.createTextCursor() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Select ALL of the text. &lt;br /&gt;
   oCursor.gotoStart( False ) &amp;#039; goto start of text &lt;br /&gt;
   oCursor.gotoEnd( True ) &amp;#039; goto end of text while holding down SHIFT key &lt;br /&gt;
   &amp;#039; Change selected char&amp;#039;s height &lt;br /&gt;
   oCursor.CharHeight = 34 &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Select the first four characters &lt;br /&gt;
   oCursor.gotoStart( False ) &amp;#039; goto start of text &lt;br /&gt;
   oCursor.goRight( 4, True ) &amp;#039; go right 4 chars, holding down SHIFT key &lt;br /&gt;
   &amp;#039; Change selected char&amp;#039;s height &lt;br /&gt;
   oCursor.CharHeight = 27 &lt;br /&gt;
End Sub &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
If all of the text is of uniform size, and you want to increase the size of the entire text cell, then simply do.... &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Get this spreadsheet document &lt;br /&gt;
   oDoc = ThisComponent &lt;br /&gt;
   &amp;#039; Get the first sheet. &lt;br /&gt;
   oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
   &amp;#039; Get cell A1 &lt;br /&gt;
   oCell = oSheet.getCellByPosition( 0, 0 ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the cell&amp;#039;s Text. &lt;br /&gt;
   &amp;#039; You can do many things with this text, like you can do with Writer text. &lt;br /&gt;
   oText = oCell.getText() &lt;br /&gt;
   &amp;#039; Get a cursor on the text. &lt;br /&gt;
   oCursor = oText.createTextCursor() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Select ALL of the text. &lt;br /&gt;
   oCursor.gotoStart( False ) &amp;#039; goto start of text &lt;br /&gt;
   oCursor.gotoEnd( True ) &amp;#039; goto end of text while holding down SHIFT key &lt;br /&gt;
   &amp;#039; Change selected char&amp;#039;s height &lt;br /&gt;
   oCursor.CharHeight = oCursor.CharHeight + 1 &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
== Underline each Nth row of cells ==&lt;br /&gt;
Underline a row of cells, every Nth row, by setting the cell border bottom  and Adjust the column widths of a certain range of columns. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Create a new document. &lt;br /&gt;
   oDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
   &amp;#039; Alternative: Use document that this macro is embedded into. &lt;br /&gt;
   &amp;#039;oDoc = ThisComponent &lt;br /&gt;
   &amp;#039; Alternative: Load document from disk &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039;cFile = &amp;quot;C:\Documents and Settings\dbrewer\Desktop\Something.sxc&amp;quot; &amp;#039; for Windows &lt;br /&gt;
   &amp;#039;cFile = &amp;quot;/home/danny/Desktop/Something.sxc&amp;quot; &amp;#039; for Linux &lt;br /&gt;
   &amp;#039;cUrl = ConvertToUrl( cFile ) &lt;br /&gt;
   &amp;#039;oDoc = StarDesktop.loadComponentFromURL( cUrl, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
&lt;br /&gt;
   &amp;#039; Get first sheet of the document -- the zero&amp;#039;th sheet. &lt;br /&gt;
   oSheet = oDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
    &lt;br /&gt;
   UnderlineRows( oSheet ) &lt;br /&gt;
   AdjustColumnWidths( oSheet ) &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039; Pass in a single sheet of a spreadsheet document. &lt;br /&gt;
&amp;#039; This will create borders that underline certain cells. &lt;br /&gt;
Sub UnderlineRows( oSheet ) &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; You could turn these local variables into parameters. &lt;br /&gt;
   nUnderlineFirstRow = 9 &lt;br /&gt;
   nUnderlineSkipRows = 4 &lt;br /&gt;
   nUnderlineLastRow = 50 &lt;br /&gt;
   cUnderlineFirstColumn = &amp;quot;A&amp;quot; &lt;br /&gt;
   cUnderlineLastColumn = &amp;quot;I&amp;quot; &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039;nBorderColor = RGB( 0, 0, 0 ) &amp;#039; Black &lt;br /&gt;
   nBorderColor = RGB( 255, 200, 200 ) &amp;#039; Pink &lt;br /&gt;
    &lt;br /&gt;
   nInnerBorderWidth = 0 &amp;#039; in 1000&amp;#039;th of cm &lt;br /&gt;
   &amp;#039;nOuterBorderWidth = 75 &amp;#039; in 1000&amp;#039;th of cm, means 0.075 cm width &lt;br /&gt;
   nOuterBorderWidth = 1/32 * 2540 &amp;#039; 1/32 inch (2.54 cm = 1 inch) &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
    &lt;br /&gt;
   nRow = nUnderlineFirstRow &lt;br /&gt;
   Do While nRow &amp;lt;= nUnderlineLastRow &lt;br /&gt;
      &amp;#039; Form a string such as...  &amp;quot;A19:I19&amp;quot; &lt;br /&gt;
      cCellRangeName = cUnderlineFirstColumn + CSTR( nRow ) _ &lt;br /&gt;
                  + &amp;quot;:&amp;quot; + cUnderlineLastColumn + CSTR( nRow ) &lt;br /&gt;
       &lt;br /&gt;
      &amp;#039; Get the range of cells whose border is to be adjusted. &lt;br /&gt;
      oCellRange = oSheet.getCellRangeByName( cCellRangeName ) &lt;br /&gt;
       &lt;br /&gt;
      &amp;#039;oCellRange.LeftBorder   = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
      &amp;#039;oCellRange.RightBorder  = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
      &amp;#039;oCellRange.TopBorder    = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
      oCellRange.BottomBorder = MakeCellBorderLine( nBorderColor, nInnerBorderWidth, nOuterBorderWidth, 0 ) &lt;br /&gt;
       &lt;br /&gt;
      nRow = nRow + nUnderlineSkipRows &lt;br /&gt;
   Loop &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039; Pass in a single sheet of a spreadsheet document. &lt;br /&gt;
&amp;#039; This will set the column widths of certain cells. &lt;br /&gt;
Sub AdjustColumnWidths( oSheet ) &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; CHANGE ME &lt;br /&gt;
   &amp;#039; You could turn these local variables into parameters. &lt;br /&gt;
   cFirstColumn = &amp;quot;A&amp;quot; &lt;br /&gt;
   cLastColumn = &amp;quot;I&amp;quot; &lt;br /&gt;
   &amp;#039;----- &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Turn the column names into column numbers. &lt;br /&gt;
   nFirstColumn = CalcColumnNameToNumber( oSheet, cFirstColumn ) &lt;br /&gt;
   nLastColumn = CalcColumnNameToNumber( oSheet, cLastColumn ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the collection of all columns on the sheet. &lt;br /&gt;
   oColumns = oSheet.getColumns() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Loop over each column... &lt;br /&gt;
   For nCol = nFirstColumn To nLastColumn &lt;br /&gt;
      &amp;#039; Get a single column &lt;br /&gt;
      oColumn = oColumns.getByIndex( nCol ) &lt;br /&gt;
       &lt;br /&gt;
      &amp;#039; Change column width &lt;br /&gt;
      oColumn.Width = 2.5 * 2540 &amp;#039; 2.5 inches * 2.54 cm / inch. &lt;br /&gt;
   Next &lt;br /&gt;
End Sub &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Function MakeCellBorderLine( nColor, nInnerLineWidth, nOuterLineWidth, nLineDistance ) _ &lt;br /&gt;
         As com.sun.star.table.BorderLine &lt;br /&gt;
   oBorderLine = createUnoStruct( &amp;quot;com.sun.star.table.BorderLine&amp;quot; ) &lt;br /&gt;
   With oBorderLine &lt;br /&gt;
      .Color = nColor &lt;br /&gt;
&lt;br /&gt;
      .InnerLineWidth = nInnerLineWidth &lt;br /&gt;
      .OuterLineWidth = nOuterLineWidth &lt;br /&gt;
      .LineDistance = nLineDistance &lt;br /&gt;
   End With &lt;br /&gt;
   MakeCellBorderLine = oBorderLine &lt;br /&gt;
End Function &lt;br /&gt;
&lt;br /&gt;
Function CalcColumnNameToNumber( oSheet As com.sun.star.sheet.Spreadsheet,_ &lt;br /&gt;
                     cColumnName As String ) As Long &lt;br /&gt;
   oColumns = oSheet.getColumns() &lt;br /&gt;
   oColumn = oColumns.getByName( cColumnName ) &lt;br /&gt;
   oRangeAddress = oColumn.getRangeAddress() &lt;br /&gt;
   nColumn = oRangeAddress.StartColumn &lt;br /&gt;
   CalcColumnNameToNumber() = nColumn &lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Take data from a Writer&amp;#039;s table and insert in Calc ==&lt;br /&gt;
This code tries to do as mentioned, extract a table data from Writer and insert it in a Calc document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Work with the writer document that this macro is embedded into. &lt;br /&gt;
   oWriterDoc = ThisComponent &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the collection of tables from the Writer doc. &lt;br /&gt;
   oWriterTables = oWriterDoc.getTextTables() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the table named FooBar. &lt;br /&gt;
   &amp;#039; Each table has a name.  We want the table named FooBar. &lt;br /&gt;
   &amp;#039; To see or change the name of a table, first click in the table, &lt;br /&gt;
   &amp;#039;  then Format--&amp;gt;Table, pick the Table tab, and adjust the Name. &lt;br /&gt;
   oWriterTable = oWriterTables.getByName( &amp;quot;FooBar&amp;quot; ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Find out how many Rows and Columns the table has. &lt;br /&gt;
   nRows = oWriterTable.getRows().getCount() &lt;br /&gt;
   nCols = oWriterTable.getColumns().getCount() &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Create a new Calc spreadsheet. &lt;br /&gt;
   oCalcDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the first sheet of the document. &lt;br /&gt;
   oSheet = oCalcDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
&amp;#039;   oSheet = oCalcDoc.getSheets().getByName( &amp;quot;Sheet1&amp;quot; ) &amp;#039; an alternate way to get by name &lt;br /&gt;
&lt;br /&gt;
   &amp;#039; Determine where we are going to insert the data from the Writer table. &lt;br /&gt;
   nFirstRow = 6 &lt;br /&gt;
   nFirstCol = 2 &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Copy the data, row by row, column by column &lt;br /&gt;
   For nRow = 0 To nRows-1 &lt;br /&gt;
      For nCol = 0 To nCols-1 &lt;br /&gt;
         oWriterCell = oWriterTable.getCellByPosition( nCol, nRow ) &lt;br /&gt;
         oCalcCell = oSheet.getCellByPosition( nCol+nFirstCol, nRow+nFirstRow ) &lt;br /&gt;
          &lt;br /&gt;
         &amp;#039; If the cell has a formula, then copy that... &lt;br /&gt;
         If oWriterCell.getFormula() &amp;lt;&amp;gt; &amp;quot;&amp;quot; Then &lt;br /&gt;
            oCalcCell.setFormula( oWriterCell.getFormula() ) &lt;br /&gt;
          &lt;br /&gt;
         &amp;#039; If the cell has a non-zero numeric value, then copy that... &lt;br /&gt;
         ElseIf oWriterCell.getValue() &amp;lt;&amp;gt; 0 Then &lt;br /&gt;
            oCalcCell.setValue( oWriterCell.getValue() ) &lt;br /&gt;
            &amp;#039; Question... what if the cell is numeric, but zero? &lt;br /&gt;
         ElseIf oWriterCell.getString() = &amp;quot;0&amp;quot; Then &lt;br /&gt;
            oCalcCell.setValue( oWriterCell.getValue() ) &lt;br /&gt;
          &lt;br /&gt;
         Else &lt;br /&gt;
            oCalcCell.setString( oWriterCell.getString() ) &lt;br /&gt;
         EndIf &lt;br /&gt;
      Next &lt;br /&gt;
   Next &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235894</id>
		<title>Python-Calc</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235894"/>
		<updated>2015-02-17T16:28:53Z</updated>

		<summary type="html">&lt;p&gt;JZA: Other code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This code was originally written on the oooforum, you can reach it [http://www.oooforum.org/forum/viewtopic.phtml?p=55393#55393 here]. The code was somewhat broken down into different areas so the reader can understand each step.&lt;br /&gt;
&lt;br /&gt;
The intend of the code is to:&lt;br /&gt;
# Create a new spreadsheet&lt;br /&gt;
# Open an existing spreadsheet&lt;br /&gt;
# Insert strings inito a cell&lt;br /&gt;
# Insert formulas into a cell&lt;br /&gt;
# Insert graphs to a range&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
from Danny.OOo.OOoLib import * &lt;br /&gt;
&lt;br /&gt;
def CalcExample(): &lt;br /&gt;
    # create a new Calc spreadsheet. &lt;br /&gt;
    oDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    #----- &lt;br /&gt;
    # Use this instead to open an EXISTING calc document, &lt;br /&gt;
    #  and assign it to variable oDoc. &lt;br /&gt;
    #  cFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc&amp;quot; # Windows &lt;br /&gt;
    #  cFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; # Linux &lt;br /&gt;
    #  cURL = convertToURL( cFile + &amp;quot;.sxc&amp;quot; ) &lt;br /&gt;
    #  oDoc = StarDesktop.loadComponentFromURL( cURL, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    # Here are two ways to get access to one of the various sheets &lt;br /&gt;
    #  in the spreadsheet document. &lt;br /&gt;
    # Note that these don&amp;#039;t make the sheet *vislble*, they merely give &lt;br /&gt;
    #  access to the sheet&amp;#039;s content within the program. &lt;br /&gt;
    oSheet = oDoc.getSheets().getByIndex( 0 ) # get the zero&amp;#039;th sheet &lt;br /&gt;
    #oSheet = oDoc.getSheets().getByName( &amp;quot;Sheet3&amp;quot; ) # get by name &lt;br /&gt;
    &lt;br /&gt;
    #----- &lt;br /&gt;
    # Put some sales figures onto the sheet. &lt;br /&gt;
    oSheet.getCellByPosition( 0, 0 ).setString( &amp;quot;Month&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 0 ).setString( &amp;quot;Sales&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 0 ).setString( &amp;quot;End Date&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 0, 1 ).setString( &amp;quot;Jan&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 2 ).setString( &amp;quot;Feb&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 3 ).setString( &amp;quot;Mar&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 4 ).setString( &amp;quot;Apr&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 5 ).setString( &amp;quot;May&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 6 ).setString( &amp;quot;Jun&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 7 ).setString( &amp;quot;Jul&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 8 ).setString( &amp;quot;Aug&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 9 ).setString( &amp;quot;Sep&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 10 ).setString( &amp;quot;Oct&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 11 ).setString( &amp;quot;Nov&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 12 ).setString( &amp;quot;Dec&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 1, 1 ).setValue( 3826.37 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 2 ).setValue( 3504.21 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 3 ).setValue( 2961.45 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 4 ).setValue( 2504.12 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 5 ).setValue( 2713.98 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 6 ).setValue( 2248.17 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 7 ).setValue( 1802.13 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 8 ).setValue( 2003.22 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 9 ).setValue( 1502.54 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 10 ).setValue( 1207.68 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 11 ).setValue( 1319.71 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 12 ).setValue( 786.03 ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 2, 1 ).setFormula( &amp;quot;=DATE(2004;01;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 2 ).setFormula( &amp;quot;=DATE(2004;02;29)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 3 ).setFormula( &amp;quot;=DATE(2004;03;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 4 ).setFormula( &amp;quot;=DATE(2004;04;30)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 5 ).setFormula( &amp;quot;=DATE(2004;05;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 6 ).setFormula( &amp;quot;=DATE(2004;06;30)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 7 ).setFormula( &amp;quot;=DATE(2004;07;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 8 ).setFormula( &amp;quot;=DATE(2004;08;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 9 ).setFormula( &amp;quot;=DATE(2004;09;30)&amp;quot; ) &lt;br /&gt;
    # Note that these last three dates are not set as DATE() function calls. &lt;br /&gt;
    oSheet.getCellByPosition( 2, 10 ).setFormula( &amp;quot;10/31/2004&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 11 ).setFormula( &amp;quot;11/30/2004&amp;quot; ) &lt;br /&gt;
    oSheet.getCellRangeByName( &amp;quot;C13&amp;quot; ).setFormula( &amp;quot;12/31/2004&amp;quot; ) &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    #----- &lt;br /&gt;
    # Format the date cells as dates. &lt;br /&gt;
    com_sun_star_util_NumberFormat_DATE = uno.getConstantByName( &amp;quot;com.sun.star.util.NumberFormat.DATE&amp;quot; ) &lt;br /&gt;
    oFormats = oDoc.getNumberFormats() &lt;br /&gt;
    oLocale = createUnoStruct( &amp;quot;com.sun.star.lang.Locale&amp;quot; ) &lt;br /&gt;
    nDateKey = oFormats.getStandardFormat( com_sun_star_util_NumberFormat_DATE, oLocale ) &lt;br /&gt;
    oCell = oSheet.getCellRangeByName( &amp;quot;C2:C13&amp;quot; ) &lt;br /&gt;
    oCell.NumberFormat = nDateKey &lt;br /&gt;
    #----- &lt;br /&gt;
    &lt;br /&gt;
    #----- &lt;br /&gt;
    # Now add a chart to the spreadsheet. &lt;br /&gt;
&lt;br /&gt;
    oCellRangeAddress = oSheet.getCellRangeByName( &amp;quot;A1:B13&amp;quot; ).getRangeAddress() &lt;br /&gt;
    # oCellRangeAddress = MakeCellRangeAddress( 0, 0, 1, 1, 12 ) &lt;br /&gt;
    # Get the collection of charts from the sheet. &lt;br /&gt;
    oCharts = oSheet.getCharts() &lt;br /&gt;
    # Add a new chart with a specific name, &lt;br /&gt;
    #  in a specific rectangle on the drawing page, &lt;br /&gt;
    #  and connected to specific cells of the spreadsheet. &lt;br /&gt;
    oCharts.addNewByName( &amp;quot;Sales&amp;quot;, &lt;br /&gt;
               makeRectangle( 8000, 1000, 16000, 10000 ), &lt;br /&gt;
               Array( oCellRangeAddress ), &lt;br /&gt;
               True, True ) &lt;br /&gt;
    # From the collection of charts, get the new chart we just created. &lt;br /&gt;
    oChart = oCharts.getByName( &amp;quot;Sales&amp;quot; ) &lt;br /&gt;
    # Get the chart document model. &lt;br /&gt;
    oChartDoc = oChart.getEmbeddedObject() &lt;br /&gt;
&lt;br /&gt;
    # Get the drawing text shape of the title of the chart. &lt;br /&gt;
    oTitleTextShape = oChartDoc.getTitle() &lt;br /&gt;
    # Change the title. &lt;br /&gt;
    oTitleTextShape.String = &amp;quot;Sales Chart&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # Create a diagram. &lt;br /&gt;
    oDiagram = oChartDoc.createInstance( &amp;quot;com.sun.star.chart.BarDiagram&amp;quot; ) &lt;br /&gt;
    # Set its parameters. &lt;br /&gt;
    oDiagram.Vertical = True &lt;br /&gt;
    # Make the chart use this diagram. &lt;br /&gt;
    oChartDoc.setDiagram( oDiagram ) &lt;br /&gt;
&lt;br /&gt;
    # Ask the chart what diagram it is using. &lt;br /&gt;
    # (Unnecessary, since variable oDiagram already contains this value.) &lt;br /&gt;
    oDiagram = oChartDoc.getDiagram() &lt;br /&gt;
    # Make more changes to the diagram. &lt;br /&gt;
    oDiagram.DataCaption = uno.getConstantByName( &amp;quot;com.sun.star.chart.ChartDataCaption.VALUE&amp;quot; ) &lt;br /&gt;
    oDiagram.DataRowSource = uno.getConstantByName( &amp;quot;com.sun.star.chart.ChartDataRowSource.COLUMNS&amp;quot; ) &lt;br /&gt;
    # &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #----- &lt;br /&gt;
    # Now demonstrate how to manipulate the sheets. &lt;br /&gt;
&lt;br /&gt;
    # Insert six more sheets into the document. &lt;br /&gt;
    nNumSheetsCurrently = oDoc.getSheets().getCount() &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Fred&amp;quot;, nNumSheetsCurrently+1 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Joe&amp;quot;, nNumSheetsCurrently+2 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Bill&amp;quot;, nNumSheetsCurrently+3 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Sam&amp;quot;, nNumSheetsCurrently+4 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Tom&amp;quot;, nNumSheetsCurrently+5 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;David&amp;quot;, nNumSheetsCurrently+6 ) &lt;br /&gt;
    # Now find a sheet named &amp;quot;Sheet2&amp;quot; and get rid of it. &lt;br /&gt;
    oDoc.getSheets().removeByName( &amp;quot;Sheet2&amp;quot; ) &lt;br /&gt;
    # Now find the sheet named &amp;quot;Sam&amp;quot; and change its name to &amp;quot;Sheet 37&amp;quot; &lt;br /&gt;
    oDoc.getSheets().getByName( &amp;quot;Sam&amp;quot; ).Name = &amp;quot;Sheet 37&amp;quot; &lt;br /&gt;
    # &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now print the document -- three different ways. &lt;br /&gt;
&lt;br /&gt;
    # Technique 1. &lt;br /&gt;
    # Now print the document. &lt;br /&gt;
    # Print two copies. &lt;br /&gt;
    # Print pages 1 thru 4, and also page 10. &lt;br /&gt;
    # &lt;br /&gt;
    # NOTE: we would do it like this, except the word &amp;quot;print&amp;quot; &lt;br /&gt;
    #       has a special meaning in python, and cannot be invoked &lt;br /&gt;
    #       as a method. &lt;br /&gt;
    #oDoc.print( &lt;br /&gt;
    #    Array( &lt;br /&gt;
    #        makePropertyValue( &amp;quot;CopyCount&amp;quot;, 2 ), &lt;br /&gt;
    #        makePropertyValue( &amp;quot;Pages&amp;quot;, &amp;quot;1-4;10&amp;quot; ) ) ) &lt;br /&gt;
    uno.invoke( oDoc, &amp;quot;print&amp;quot;, ( Array( &lt;br /&gt;
            makePropertyValue( &amp;quot;CopyCount&amp;quot;, 2 ), &lt;br /&gt;
            makePropertyValue( &amp;quot;Pages&amp;quot;, &amp;quot;1-4;10&amp;quot; ) ), ) ) &lt;br /&gt;
&lt;br /&gt;
    # Technique 2. &lt;br /&gt;
    # Print the document already, without any arguments. &lt;br /&gt;
    uno.invoke( oDoc, &amp;quot;print&amp;quot;, ( Array(), ) ) &lt;br /&gt;
    #oDoc.print( Array() ) &lt;br /&gt;
&lt;br /&gt;
    # Using technique 1 or 2, be sure not to close the document &lt;br /&gt;
    #  until printing is completed. &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?p=23144#23144 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    # Technique 3. &lt;br /&gt;
    # Print the document by bringing up the Print Job dialog box &lt;br /&gt;
    #  for the user to interact with. &lt;br /&gt;
    oDocFrame = oDoc.getCurrentController().getFrame() &lt;br /&gt;
    oDispatchHelper = createUnoService( &amp;quot;com.sun.star.frame.DispatchHelper&amp;quot; ) &lt;br /&gt;
    oDispatchHelper.executeDispatch( oDocFrame, &amp;quot;.uno:Print&amp;quot;, &amp;quot;&amp;quot;, 0, Array() ) &lt;br /&gt;
    # To learn some more about the dispatcher, see these articles... &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=5058 &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=5057 &lt;br /&gt;
&lt;br /&gt;
    # &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now save the document &lt;br /&gt;
&lt;br /&gt;
    # Prepare the filename to save. &lt;br /&gt;
    # We&amp;#039;re going to save the file in several different formats, &lt;br /&gt;
    #  but all based on the same filename. &lt;br /&gt;
    cFile = &amp;quot;C:\Documents and Settings\dbrewer\Desktop\MyCalc&amp;quot; # Windows &lt;br /&gt;
    #cFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; # Linux &lt;br /&gt;
&lt;br /&gt;
    # Now save the spreadsheet in native OOo Calc format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.sxc&amp;quot; ) &lt;br /&gt;
    oDoc.storeAsURL( cURL, Array() ) &lt;br /&gt;
&lt;br /&gt;
    # Note the above used storeAsUrl, &lt;br /&gt;
    #  the following use storeToUrl. &lt;br /&gt;
&lt;br /&gt;
    # Now save it in Excel format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.xls&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;MS Excel 97&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save a PDF. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.pdf&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;calc_pdf_Export&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in CSV format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.csv&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;Text - txt - csv (StarCalc)&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in DIF format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.dif&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;DIF&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in SYLK format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.sylk&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;SYLK&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save as HTML. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.html&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;HTML (StarCalc)&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # A list of some filter names you can use for both loading &lt;br /&gt;
    #  and saving a document can be found here... &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=3549 &lt;br /&gt;
&lt;br /&gt;
    # &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now close the document &lt;br /&gt;
    oDoc.close( True ) &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# import Danny.OOo.Examples.CalcExamples &lt;br /&gt;
# reload( Danny.OOo.Examples.CalcExamples ); from Danny.OOo.Examples.CalcExamples import * &lt;br /&gt;
&lt;br /&gt;
# CalcExample() &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code can be greatly enhanced, if you want to provide a better version of the code, please edit it and notify me for feedback. [[User:JZA|JZA]] ([[User talk:JZA|talk]])&lt;br /&gt;
&lt;br /&gt;
== Take data from a Writer&amp;#039;s table and insert in Calc ==&lt;br /&gt;
This code tries to do as mentioned, extract a table data from Writer and insert it in a Calc document.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Work with the writer document that this macro is embedded into. &lt;br /&gt;
   oWriterDoc = ThisComponent &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the collection of tables from the Writer doc. &lt;br /&gt;
   oWriterTables = oWriterDoc.getTextTables() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the table named FooBar. &lt;br /&gt;
   &amp;#039; Each table has a name.  We want the table named FooBar. &lt;br /&gt;
   &amp;#039; To see or change the name of a table, first click in the table, &lt;br /&gt;
   &amp;#039;  then Format--&amp;gt;Table, pick the Table tab, and adjust the Name. &lt;br /&gt;
   oWriterTable = oWriterTables.getByName( &amp;quot;FooBar&amp;quot; ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Find out how many Rows and Columns the table has. &lt;br /&gt;
   nRows = oWriterTable.getRows().getCount() &lt;br /&gt;
   nCols = oWriterTable.getColumns().getCount() &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Create a new Calc spreadsheet. &lt;br /&gt;
   oCalcDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the first sheet of the document. &lt;br /&gt;
   oSheet = oCalcDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
&amp;#039;   oSheet = oCalcDoc.getSheets().getByName( &amp;quot;Sheet1&amp;quot; ) &amp;#039; an alternate way to get by name &lt;br /&gt;
&lt;br /&gt;
   &amp;#039; Determine where we are going to insert the data from the Writer table. &lt;br /&gt;
   nFirstRow = 6 &lt;br /&gt;
   nFirstCol = 2 &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Copy the data, row by row, column by column &lt;br /&gt;
   For nRow = 0 To nRows-1 &lt;br /&gt;
      For nCol = 0 To nCols-1 &lt;br /&gt;
         oWriterCell = oWriterTable.getCellByPosition( nCol, nRow ) &lt;br /&gt;
         oCalcCell = oSheet.getCellByPosition( nCol+nFirstCol, nRow+nFirstRow ) &lt;br /&gt;
          &lt;br /&gt;
         &amp;#039; If the cell has a formula, then copy that... &lt;br /&gt;
         If oWriterCell.getFormula() &amp;lt;&amp;gt; &amp;quot;&amp;quot; Then &lt;br /&gt;
            oCalcCell.setFormula( oWriterCell.getFormula() ) &lt;br /&gt;
          &lt;br /&gt;
         &amp;#039; If the cell has a non-zero numeric value, then copy that... &lt;br /&gt;
         ElseIf oWriterCell.getValue() &amp;lt;&amp;gt; 0 Then &lt;br /&gt;
            oCalcCell.setValue( oWriterCell.getValue() ) &lt;br /&gt;
            &amp;#039; Question... what if the cell is numeric, but zero? &lt;br /&gt;
         ElseIf oWriterCell.getString() = &amp;quot;0&amp;quot; Then &lt;br /&gt;
            oCalcCell.setValue( oWriterCell.getValue() ) &lt;br /&gt;
          &lt;br /&gt;
         Else &lt;br /&gt;
            oCalcCell.setString( oWriterCell.getString() ) &lt;br /&gt;
         EndIf &lt;br /&gt;
      Next &lt;br /&gt;
   Next &lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235893</id>
		<title>Python-Calc</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235893"/>
		<updated>2015-02-17T16:24:22Z</updated>

		<summary type="html">&lt;p&gt;JZA: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This code was originally written on the oooforum, you can reach it [http://www.oooforum.org/forum/viewtopic.phtml?p=55393#55393 here]. The code was somewhat broken down into different areas so the reader can understand each step.&lt;br /&gt;
&lt;br /&gt;
The intend of the code is to:&lt;br /&gt;
# Create a new spreadsheet&lt;br /&gt;
# Open an existing spreadsheet&lt;br /&gt;
# Insert strings inito a cell&lt;br /&gt;
# Insert formulas into a cell&lt;br /&gt;
# Insert graphs to a range&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
&lt;br /&gt;
from Danny.OOo.OOoLib import * &lt;br /&gt;
&lt;br /&gt;
def CalcExample(): &lt;br /&gt;
    # create a new Calc spreadsheet. &lt;br /&gt;
    oDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    #----- &lt;br /&gt;
    # Use this instead to open an EXISTING calc document, &lt;br /&gt;
    #  and assign it to variable oDoc. &lt;br /&gt;
    #  cFile = &amp;quot;C:\Documents and Settings\danny\Desktop\MyCalc&amp;quot; # Windows &lt;br /&gt;
    #  cFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; # Linux &lt;br /&gt;
    #  cURL = convertToURL( cFile + &amp;quot;.sxc&amp;quot; ) &lt;br /&gt;
    #  oDoc = StarDesktop.loadComponentFromURL( cURL, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    # Here are two ways to get access to one of the various sheets &lt;br /&gt;
    #  in the spreadsheet document. &lt;br /&gt;
    # Note that these don&amp;#039;t make the sheet *vislble*, they merely give &lt;br /&gt;
    #  access to the sheet&amp;#039;s content within the program. &lt;br /&gt;
    oSheet = oDoc.getSheets().getByIndex( 0 ) # get the zero&amp;#039;th sheet &lt;br /&gt;
    #oSheet = oDoc.getSheets().getByName( &amp;quot;Sheet3&amp;quot; ) # get by name &lt;br /&gt;
    &lt;br /&gt;
    #----- &lt;br /&gt;
    # Put some sales figures onto the sheet. &lt;br /&gt;
    oSheet.getCellByPosition( 0, 0 ).setString( &amp;quot;Month&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 0 ).setString( &amp;quot;Sales&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 0 ).setString( &amp;quot;End Date&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 0, 1 ).setString( &amp;quot;Jan&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 2 ).setString( &amp;quot;Feb&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 3 ).setString( &amp;quot;Mar&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 4 ).setString( &amp;quot;Apr&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 5 ).setString( &amp;quot;May&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 6 ).setString( &amp;quot;Jun&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 7 ).setString( &amp;quot;Jul&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 8 ).setString( &amp;quot;Aug&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 9 ).setString( &amp;quot;Sep&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 10 ).setString( &amp;quot;Oct&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 11 ).setString( &amp;quot;Nov&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 0, 12 ).setString( &amp;quot;Dec&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 1, 1 ).setValue( 3826.37 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 2 ).setValue( 3504.21 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 3 ).setValue( 2961.45 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 4 ).setValue( 2504.12 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 5 ).setValue( 2713.98 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 6 ).setValue( 2248.17 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 7 ).setValue( 1802.13 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 8 ).setValue( 2003.22 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 9 ).setValue( 1502.54 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 10 ).setValue( 1207.68 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 11 ).setValue( 1319.71 ) &lt;br /&gt;
    oSheet.getCellByPosition( 1, 12 ).setValue( 786.03 ) &lt;br /&gt;
&lt;br /&gt;
    oSheet.getCellByPosition( 2, 1 ).setFormula( &amp;quot;=DATE(2004;01;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 2 ).setFormula( &amp;quot;=DATE(2004;02;29)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 3 ).setFormula( &amp;quot;=DATE(2004;03;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 4 ).setFormula( &amp;quot;=DATE(2004;04;30)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 5 ).setFormula( &amp;quot;=DATE(2004;05;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 6 ).setFormula( &amp;quot;=DATE(2004;06;30)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 7 ).setFormula( &amp;quot;=DATE(2004;07;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 8 ).setFormula( &amp;quot;=DATE(2004;08;31)&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 9 ).setFormula( &amp;quot;=DATE(2004;09;30)&amp;quot; ) &lt;br /&gt;
    # Note that these last three dates are not set as DATE() function calls. &lt;br /&gt;
    oSheet.getCellByPosition( 2, 10 ).setFormula( &amp;quot;10/31/2004&amp;quot; ) &lt;br /&gt;
    oSheet.getCellByPosition( 2, 11 ).setFormula( &amp;quot;11/30/2004&amp;quot; ) &lt;br /&gt;
    oSheet.getCellRangeByName( &amp;quot;C13&amp;quot; ).setFormula( &amp;quot;12/31/2004&amp;quot; ) &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    #----- &lt;br /&gt;
    # Format the date cells as dates. &lt;br /&gt;
    com_sun_star_util_NumberFormat_DATE = uno.getConstantByName( &amp;quot;com.sun.star.util.NumberFormat.DATE&amp;quot; ) &lt;br /&gt;
    oFormats = oDoc.getNumberFormats() &lt;br /&gt;
    oLocale = createUnoStruct( &amp;quot;com.sun.star.lang.Locale&amp;quot; ) &lt;br /&gt;
    nDateKey = oFormats.getStandardFormat( com_sun_star_util_NumberFormat_DATE, oLocale ) &lt;br /&gt;
    oCell = oSheet.getCellRangeByName( &amp;quot;C2:C13&amp;quot; ) &lt;br /&gt;
    oCell.NumberFormat = nDateKey &lt;br /&gt;
    #----- &lt;br /&gt;
    &lt;br /&gt;
    #----- &lt;br /&gt;
    # Now add a chart to the spreadsheet. &lt;br /&gt;
&lt;br /&gt;
    oCellRangeAddress = oSheet.getCellRangeByName( &amp;quot;A1:B13&amp;quot; ).getRangeAddress() &lt;br /&gt;
    # oCellRangeAddress = MakeCellRangeAddress( 0, 0, 1, 1, 12 ) &lt;br /&gt;
    # Get the collection of charts from the sheet. &lt;br /&gt;
    oCharts = oSheet.getCharts() &lt;br /&gt;
    # Add a new chart with a specific name, &lt;br /&gt;
    #  in a specific rectangle on the drawing page, &lt;br /&gt;
    #  and connected to specific cells of the spreadsheet. &lt;br /&gt;
    oCharts.addNewByName( &amp;quot;Sales&amp;quot;, &lt;br /&gt;
               makeRectangle( 8000, 1000, 16000, 10000 ), &lt;br /&gt;
               Array( oCellRangeAddress ), &lt;br /&gt;
               True, True ) &lt;br /&gt;
    # From the collection of charts, get the new chart we just created. &lt;br /&gt;
    oChart = oCharts.getByName( &amp;quot;Sales&amp;quot; ) &lt;br /&gt;
    # Get the chart document model. &lt;br /&gt;
    oChartDoc = oChart.getEmbeddedObject() &lt;br /&gt;
&lt;br /&gt;
    # Get the drawing text shape of the title of the chart. &lt;br /&gt;
    oTitleTextShape = oChartDoc.getTitle() &lt;br /&gt;
    # Change the title. &lt;br /&gt;
    oTitleTextShape.String = &amp;quot;Sales Chart&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # Create a diagram. &lt;br /&gt;
    oDiagram = oChartDoc.createInstance( &amp;quot;com.sun.star.chart.BarDiagram&amp;quot; ) &lt;br /&gt;
    # Set its parameters. &lt;br /&gt;
    oDiagram.Vertical = True &lt;br /&gt;
    # Make the chart use this diagram. &lt;br /&gt;
    oChartDoc.setDiagram( oDiagram ) &lt;br /&gt;
&lt;br /&gt;
    # Ask the chart what diagram it is using. &lt;br /&gt;
    # (Unnecessary, since variable oDiagram already contains this value.) &lt;br /&gt;
    oDiagram = oChartDoc.getDiagram() &lt;br /&gt;
    # Make more changes to the diagram. &lt;br /&gt;
    oDiagram.DataCaption = uno.getConstantByName( &amp;quot;com.sun.star.chart.ChartDataCaption.VALUE&amp;quot; ) &lt;br /&gt;
    oDiagram.DataRowSource = uno.getConstantByName( &amp;quot;com.sun.star.chart.ChartDataRowSource.COLUMNS&amp;quot; ) &lt;br /&gt;
    # &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #----- &lt;br /&gt;
    # Now demonstrate how to manipulate the sheets. &lt;br /&gt;
&lt;br /&gt;
    # Insert six more sheets into the document. &lt;br /&gt;
    nNumSheetsCurrently = oDoc.getSheets().getCount() &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Fred&amp;quot;, nNumSheetsCurrently+1 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Joe&amp;quot;, nNumSheetsCurrently+2 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Bill&amp;quot;, nNumSheetsCurrently+3 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Sam&amp;quot;, nNumSheetsCurrently+4 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;Tom&amp;quot;, nNumSheetsCurrently+5 ) &lt;br /&gt;
    oDoc.getSheets().insertNewByName( &amp;quot;David&amp;quot;, nNumSheetsCurrently+6 ) &lt;br /&gt;
    # Now find a sheet named &amp;quot;Sheet2&amp;quot; and get rid of it. &lt;br /&gt;
    oDoc.getSheets().removeByName( &amp;quot;Sheet2&amp;quot; ) &lt;br /&gt;
    # Now find the sheet named &amp;quot;Sam&amp;quot; and change its name to &amp;quot;Sheet 37&amp;quot; &lt;br /&gt;
    oDoc.getSheets().getByName( &amp;quot;Sam&amp;quot; ).Name = &amp;quot;Sheet 37&amp;quot; &lt;br /&gt;
    # &lt;br /&gt;
    #----- &lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now print the document -- three different ways. &lt;br /&gt;
&lt;br /&gt;
    # Technique 1. &lt;br /&gt;
    # Now print the document. &lt;br /&gt;
    # Print two copies. &lt;br /&gt;
    # Print pages 1 thru 4, and also page 10. &lt;br /&gt;
    # &lt;br /&gt;
    # NOTE: we would do it like this, except the word &amp;quot;print&amp;quot; &lt;br /&gt;
    #       has a special meaning in python, and cannot be invoked &lt;br /&gt;
    #       as a method. &lt;br /&gt;
    #oDoc.print( &lt;br /&gt;
    #    Array( &lt;br /&gt;
    #        makePropertyValue( &amp;quot;CopyCount&amp;quot;, 2 ), &lt;br /&gt;
    #        makePropertyValue( &amp;quot;Pages&amp;quot;, &amp;quot;1-4;10&amp;quot; ) ) ) &lt;br /&gt;
    uno.invoke( oDoc, &amp;quot;print&amp;quot;, ( Array( &lt;br /&gt;
            makePropertyValue( &amp;quot;CopyCount&amp;quot;, 2 ), &lt;br /&gt;
            makePropertyValue( &amp;quot;Pages&amp;quot;, &amp;quot;1-4;10&amp;quot; ) ), ) ) &lt;br /&gt;
&lt;br /&gt;
    # Technique 2. &lt;br /&gt;
    # Print the document already, without any arguments. &lt;br /&gt;
    uno.invoke( oDoc, &amp;quot;print&amp;quot;, ( Array(), ) ) &lt;br /&gt;
    #oDoc.print( Array() ) &lt;br /&gt;
&lt;br /&gt;
    # Using technique 1 or 2, be sure not to close the document &lt;br /&gt;
    #  until printing is completed. &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?p=23144#23144 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    # Technique 3. &lt;br /&gt;
    # Print the document by bringing up the Print Job dialog box &lt;br /&gt;
    #  for the user to interact with. &lt;br /&gt;
    oDocFrame = oDoc.getCurrentController().getFrame() &lt;br /&gt;
    oDispatchHelper = createUnoService( &amp;quot;com.sun.star.frame.DispatchHelper&amp;quot; ) &lt;br /&gt;
    oDispatchHelper.executeDispatch( oDocFrame, &amp;quot;.uno:Print&amp;quot;, &amp;quot;&amp;quot;, 0, Array() ) &lt;br /&gt;
    # To learn some more about the dispatcher, see these articles... &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=5058 &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=5057 &lt;br /&gt;
&lt;br /&gt;
    # &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now save the document &lt;br /&gt;
&lt;br /&gt;
    # Prepare the filename to save. &lt;br /&gt;
    # We&amp;#039;re going to save the file in several different formats, &lt;br /&gt;
    #  but all based on the same filename. &lt;br /&gt;
    cFile = &amp;quot;C:\Documents and Settings\dbrewer\Desktop\MyCalc&amp;quot; # Windows &lt;br /&gt;
    #cFile = &amp;quot;/home/danny/Desktop/MyCalc.sxc&amp;quot; # Linux &lt;br /&gt;
&lt;br /&gt;
    # Now save the spreadsheet in native OOo Calc format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.sxc&amp;quot; ) &lt;br /&gt;
    oDoc.storeAsURL( cURL, Array() ) &lt;br /&gt;
&lt;br /&gt;
    # Note the above used storeAsUrl, &lt;br /&gt;
    #  the following use storeToUrl. &lt;br /&gt;
&lt;br /&gt;
    # Now save it in Excel format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.xls&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;MS Excel 97&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save a PDF. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.pdf&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;calc_pdf_Export&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in CSV format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.csv&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;Text - txt - csv (StarCalc)&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in DIF format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.dif&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;DIF&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save it in SYLK format. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.sylk&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;SYLK&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # Now save as HTML. &lt;br /&gt;
    cURL = convertToURL( cFile + &amp;quot;.html&amp;quot; ) &lt;br /&gt;
    oDoc.storeToURL( cURL, Array( makePropertyValue( &amp;quot;FilterName&amp;quot;, &amp;quot;HTML (StarCalc)&amp;quot; ) ) ) &lt;br /&gt;
&lt;br /&gt;
    # A list of some filter names you can use for both loading &lt;br /&gt;
    #  and saving a document can be found here... &lt;br /&gt;
    #    http://www.oooforum.org/forum/viewtopic.php?t=3549 &lt;br /&gt;
&lt;br /&gt;
    # &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #------- &lt;br /&gt;
    # Now close the document &lt;br /&gt;
    oDoc.close( True ) &lt;br /&gt;
    #------- &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# import Danny.OOo.Examples.CalcExamples &lt;br /&gt;
# reload( Danny.OOo.Examples.CalcExamples ); from Danny.OOo.Examples.CalcExamples import * &lt;br /&gt;
&lt;br /&gt;
# CalcExample() &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code can be greatly enhanced, if you want to provide a better version of the code, please edit it and notify me for feedback. [[User:JZA|JZA]] ([[User talk:JZA|talk]])&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235892</id>
		<title>Python-Calc</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Python-Calc&amp;diff=235892"/>
		<updated>2015-02-17T16:22:14Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This code was originally written on the oooforum, you can reach it [http://www.oooforum.org/forum/viewtopic.phtml?p=55393#55393 here]. The code was somewhat broken down into different areas so the reader can understand each step.&lt;br /&gt;
&lt;br /&gt;
The intend of the code is to:&lt;br /&gt;
# Create a new spreadsheet&lt;br /&gt;
# Open an existing spreadsheet&lt;br /&gt;
# Insert strings inito a cell&lt;br /&gt;
# Insert formulas into a cell&lt;br /&gt;
# Insert graphs to a range&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
Sub Main &lt;br /&gt;
   &amp;#039; Work with the writer document that this macro is embedded into. &lt;br /&gt;
   oWriterDoc = ThisComponent &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the collection of tables from the Writer doc. &lt;br /&gt;
   oWriterTables = oWriterDoc.getTextTables() &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the table named FooBar. &lt;br /&gt;
   &amp;#039; Each table has a name.  We want the table named FooBar. &lt;br /&gt;
   &amp;#039; To see or change the name of a table, first click in the table, &lt;br /&gt;
   &amp;#039;  then Format--&amp;gt;Table, pick the Table tab, and adjust the Name. &lt;br /&gt;
   oWriterTable = oWriterTables.getByName( &amp;quot;FooBar&amp;quot; ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Find out how many Rows and Columns the table has. &lt;br /&gt;
   nRows = oWriterTable.getRows().getCount() &lt;br /&gt;
   nCols = oWriterTable.getColumns().getCount() &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Create a new Calc spreadsheet. &lt;br /&gt;
   oCalcDoc = StarDesktop.loadComponentFromURL( &amp;quot;private:factory/scalc&amp;quot;, &amp;quot;_blank&amp;quot;, 0, Array() ) &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Get the first sheet of the document. &lt;br /&gt;
   oSheet = oCalcDoc.getSheets().getByIndex( 0 ) &lt;br /&gt;
&amp;#039;   oSheet = oCalcDoc.getSheets().getByName( &amp;quot;Sheet1&amp;quot; ) &amp;#039; an alternate way to get by name &lt;br /&gt;
&lt;br /&gt;
   &amp;#039; Determine where we are going to insert the data from the Writer table. &lt;br /&gt;
   nFirstRow = 6 &lt;br /&gt;
   nFirstCol = 2 &lt;br /&gt;
    &lt;br /&gt;
   &amp;#039; Copy the data, row by row, column by column &lt;br /&gt;
   For nRow = 0 To nRows-1 &lt;br /&gt;
      For nCol = 0 To nCols-1 &lt;br /&gt;
         oWriterCell = oWriterTable.getCellByPosition( nCol, nRow ) &lt;br /&gt;
         oCalcCell = oSheet.getCellByPosition( nCol+nFirstCol, nRow+nFirstRow ) &lt;br /&gt;
          &lt;br /&gt;
         &amp;#039; If the cell has a formula, then copy that... &lt;br /&gt;
         If oWriterCell.getFormula() &amp;lt;&amp;gt; &amp;quot;&amp;quot; Then &lt;br /&gt;
            oCalcCell.setFormula( oWriterCell.getFormula() ) &lt;br /&gt;
          &lt;br /&gt;
         &amp;#039; If the cell has a non-zero numeric value, then copy that... &lt;br /&gt;
         ElseIf oWriterCell.getValue() &amp;lt;&amp;gt; 0 Then &lt;br /&gt;
            oCalcCell.setValue( oWriterCell.getValue() ) &lt;br /&gt;
            &amp;#039; Question... what if the cell is numeric, but zero? &lt;br /&gt;
         ElseIf oWriterCell.getString() = &amp;quot;0&amp;quot; Then &lt;br /&gt;
            oCalcCell.setValue( oWriterCell.getValue() ) &lt;br /&gt;
          &lt;br /&gt;
         Else  &lt;br /&gt;
            oCalcCell.setString( oWriterCell.getString() ) &lt;br /&gt;
         EndIf &lt;br /&gt;
      Next &lt;br /&gt;
   Next &lt;br /&gt;
End Sub &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This code can be greatly enhanced, if you want to provide a better version of the code, please edit it and notify me for feedback. [[User:JZA|JZA]] ([[User talk:JZA|talk]])&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Python&amp;diff=235891</id>
		<title>Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Python&amp;diff=235891"/>
		<updated>2015-02-17T16:16:35Z</updated>

		<summary type="html">&lt;p&gt;JZA: Link typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Extensions}}&lt;br /&gt;
[[image:Py-uno_128.png|PyUNO Logo]] [[image:Pyuno_logo_a.jpg]] &lt;br /&gt;
&lt;br /&gt;
=== Python and OpenOffice ===&lt;br /&gt;
Apache OpenOffice 4 ships with the Python scripting language, version 2.7. OpenOffice.org 3.1 and above shipped with Python version 2.6.1 and older OpenOffice.org releases shipped with Python version 2.3.4. This Python distribution via OpenOffice comes with the [[Uno]] module, which connects the [[API|UNO API]] to the python scripting language.  To run this version of Python on Linux, you can go directly to the OpenOffice PATH.  And as one would expect with any distribution of Python, AOO-Python can be run from the command line as well.&lt;br /&gt;
&lt;br /&gt;
If you already have a separate Python installation, you can import the uno module (the Python-UNO bridge) to it using [http://forum.openoffice.org/en/forum/viewtopic.php?f=45&amp;amp;t=36370&amp;amp;p=166783 these instructions].&lt;br /&gt;
&lt;br /&gt;
If you already have a different version of Python installed on Windows, you can also access the [[API|UNO API]] using the [http://forum.openoffice.org//en/forum/viewtopic.php?f=45&amp;amp;t=36608&amp;amp;p=167909 COM bridge] instead of the Python bridge. Requires the [http://sourceforge.net/projects/pywin32/ add-on pywin32] module so Python can talk to COM. Note that while the UNO API is uniform, the implementation by the two bridges is slightly different, so the syntax required by each is also sometimes different.&lt;br /&gt;
&lt;br /&gt;
==== Where is the IDE ? ====&lt;br /&gt;
OpenOffice&amp;#039;s IDE doesn&amp;#039;t support Python, so development has to be done from another editor that does.  Any volunteer for a binding is welcomed. Here is a nice [http://pythonconquerstheuniverse.wordpress.com/category/the-python-debugger/ blog post] about using [http://www.vim.org VIM] a common Unix/Linux text editor configured in a way that acts like an IDE. Windows users can use [http://www.vim.org/download.php#pc Gvim] and [http://macvim.org/ MacVim] for OSX users.&lt;br /&gt;
&lt;br /&gt;
==== Tips &amp;amp; Tricks ====&lt;br /&gt;
&lt;br /&gt;
Here is some useful information about using python in AOO.&lt;br /&gt;
&lt;br /&gt;
===== Debug output =====&lt;br /&gt;
&lt;br /&gt;
If you launch a python script, any error will silently break the execution, making your extension hard to debug.  To change this behaviour, one can change the&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;LogLevel&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
Have a look in &lt;br /&gt;
&amp;#039;&amp;#039;/path/to/aoo/program/&amp;#039;&amp;#039;&amp;#039;pythonscript.py&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
and replace &lt;br /&gt;
&amp;#039;&amp;#039;LogLevel.use = LogLevel.&amp;#039;&amp;#039;&amp;#039;NONE&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
with&lt;br /&gt;
&amp;#039;&amp;#039;LogLevel.use = LogLevel.&amp;#039;&amp;#039;&amp;#039;DEBUG&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
There are also currently-undocumented environment variables that tell the pyUno bridge to log every call.  Set the environment variable&lt;br /&gt;
&amp;#039;&amp;#039;export PYUNO_LOGLEVEL=ARGS&amp;#039;&amp;#039;&lt;br /&gt;
.  The output may be a little hard to read, but helpful nonetheless.&lt;br /&gt;
&lt;br /&gt;
Note that his applies only to Linux.  For Windows, you need some more switches, and the output gets written to files (there is no stdout on windows :-( ).&lt;br /&gt;
&lt;br /&gt;
There are still some error messages that won&amp;#039;t appear in these logs; this will improve in the near future (cws pyunofixes4).  Once the cws is integrated, I will document these switches on the official pyuno site. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Thanks to Joerg Budischewski&amp;#039;&amp;#039;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
=== Python specific information for Extension creation ===&lt;br /&gt;
To create extensions for python, it is important that you have enough familiarity with the UNO components, as well as with packaging your code for easy distribution through the &amp;#039;&amp;#039;OpenOffice package manager&amp;#039;&amp;#039;.  Please check the tutorials to learn how to component-ize your code, and how to deploy remote scripting through a service implementation.&lt;br /&gt;
&lt;br /&gt;
To learn to run Python on Windows, visit [[Using Python on Windows| this link]] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot; style=&amp;quot;border: 0px solid rgb(134, 194, 230);&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| style=&amp;quot;width: 35%; padding-right: 15px;&amp;quot; | &amp;lt;div style=&amp;quot;border-style: solid solid none; border-color: rgb(134, 194, 230) rgb(134, 194, 230) -moz-use-text-color; border-width: 1px 1px medium; padding: 5px; font-size: 120%; font-weight: bold; background-color: rgb(203, 222, 250);&amp;quot;&amp;gt;Getting Started&amp;lt;/div&amp;gt; &amp;lt;div style=&amp;quot;border: 1px solid rgb(155, 192, 245); padding: 5px 5px 10px;&amp;quot;&amp;gt;&lt;br /&gt;
*[[Python/Python_Language_Binding|Python Language Binding]]&lt;br /&gt;
*[[Python/Python_Loader|Python Loader]]&lt;br /&gt;
*[[Using Python on Windows]] - New to Python? Learn how to use python on Windows&lt;br /&gt;
*[[Using Python on Linux]] - A must read for an overview on Python and AOO relations&lt;br /&gt;
* [[pyUNO bridge]] - Official page of the PyUNO bridge at the [http://udk.openoffice.org/ UDK site] - ([http://www.fatcow.com/edu/mathtex-be/ &amp;#039;&amp;#039;Belorussian translation&amp;#039;&amp;#039;])&lt;br /&gt;
* [[Python as a macro language]] in OpenOffice.org 2.x - How to use the Python scripting framework&lt;br /&gt;
* [[Python/Transfer_from_Basic_to_Python|Transfer from Basic to Python]]&lt;br /&gt;
* [http://lucasmanual.com/mywiki/OpenOffice PyUNO Manual] Lukasz created a pyUNO manual. &amp;#039;&amp;#039;&amp;#039;new&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* [[SQLAlquemyPyUNO|SQLAlchemy and PyUNO]] connecting OpenOffice to any database&lt;br /&gt;
* [http://www.linuxjournal.com/content/starting-stopping-and-connecting-openoffice-python Starting/Stopping and connecting using Python] From Linux Journal&lt;br /&gt;
* Introduction on testing pyUNO programs with [[doctests]]&lt;br /&gt;
* Create a [[PythonDialogBox|dialog box]] in PyUNO.&lt;br /&gt;
* [http://codesnippets.services.openoffice.org/Office/Office.ConnectViaPipe.snip Connect to Openoffice] from PyUNO&lt;br /&gt;
* [[PyUNO samples]] currently shipping with OpenOffice.org and the explanation.&lt;br /&gt;
* Enhanced [http://www.oooforum.org/forum/viewtopic.phtml?p=257496#257496 Capitalized.py] script by &amp;#039;&amp;#039;The gray Cardinal&amp;#039;&amp;#039; at the OpenOffice forum.&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;width: 35%; padding-right: 15px;&amp;quot; | &amp;lt;div style=&amp;quot;border-style: solid solid none; border-color: rgb(134, 194, 230) rgb(134, 194, 230) -moz-use-text-color; border-width: 1px 1px medium; padding: 5px; font-size: 120%; font-weight: bold; background-color: rgb(203, 222, 250);&amp;quot;&amp;gt;PYUNO Modules&amp;lt;/div&amp;gt; &amp;lt;div style=&amp;quot;border: 1px solid rgb(155, 192, 245); padding: 5px 5px 10px;&amp;quot;&amp;gt;&lt;br /&gt;
*[[Danny&amp;#039;s Python Modules]] - Collection guide from DannyB&amp;#039;s modules.&lt;br /&gt;
*[[PrinttoWriter.py]] - This makes it easy and convenient to print a bunch of text into a Writer document.&lt;br /&gt;
*[[CalcFunctions]] - Learn how Python can be used to develop Calc functions in Python&lt;br /&gt;
*[[Python-Calc]] - Various scripts to deal with Calc&lt;br /&gt;
*[[PythonContainers]] - Python container components&lt;br /&gt;
*[[PyUNOServer]] - The PyUNOServer is a script that works as an XML server for OpenOffice.org Calc&lt;br /&gt;
*[[calcParser]] - calcParser is a small parser using the native SAX utilities within the OpenOffice.org python&lt;br /&gt;
*[[OoConfig]] - OoConfig is a Python extension that seeks to provide a configuration editing facility similar to Mozilla&amp;#039;s about:config&lt;br /&gt;
*[[Bibliographic/Hints and Tips/OOoRISExport.py|OOoRISExport.py]] - Exports the bibliographic database in RIS format. Also [http://bibliographic.openoffice.org/files/documents/124/3078/RISImport.py RISImport.py]&lt;br /&gt;
*[[Zotero_Plugin |Zotero Plugin]] - The Zotero plugin provides citation and bibliographic table insertion and editing functions for Writer documents.&lt;br /&gt;
*[http://oosheet.hacklab.com.br/ OOSheet] - High level python library to develop spreadsheet macros without the complexity of Uno. Focuses on spreadsheets, but may be useful for other documents.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Hacking Around ===&lt;br /&gt;
*[[UNO component packaging]] - How to create UNO components as well as the basics of script componentizing&lt;br /&gt;
*[http://www.oooforum.org/forum/viewtopic.phtml?p=38234#38234 Python component to parse XML] - Python is great to parse XML, PyUNO is also excellent when working with XML&lt;br /&gt;
*[[Example of Service in Python]] - Learn how to run Python as a service, this is useful for remote scripting.&lt;br /&gt;
*[http://www.oooforum.org/forum/viewtopic.phtml?p=76972#76972 Modify spreadsheet] - Example of storing and retrieving a custom attribute on a spreadsheet cell.&lt;br /&gt;
*A simple [[daemon in Python]] - Learn how to run Python as a daemon&lt;br /&gt;
*[[Loook.py]] - a simple Python tool that searches for text strings in OpenOffice.org.&lt;br /&gt;
*[[odt2txt.py]] - convert ODF to plain text using python (and convert the txt to html).&lt;br /&gt;
&lt;br /&gt;
=== Python rules OpenOffice (by B. Bois) ===&lt;br /&gt;
[[image:python_power_for_OOo.png|Python rules OpenOffice :-)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=CalcFunctions&amp;diff=235890</id>
		<title>CalcFunctions</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=CalcFunctions&amp;diff=235890"/>
		<updated>2015-02-17T16:15:15Z</updated>

		<summary type="html">&lt;p&gt;JZA: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Originally posted in oooForum [http://www.oooforum.org/forum/viewtopic.phtml?t=8456 here].  This code tries to introduce native Calc functions coded in Python. This article is related to the [[Python]] series page tutorials.&lt;br /&gt;
&lt;br /&gt;
This code deals with:&lt;br /&gt;
# Develop a trivial Calc function add on in Python. &lt;br /&gt;
# To be followed by more sophisticated functions. &lt;br /&gt;
# To be followed by eventually running a Poll on OOoForum asking what kind of functions shoudl be developed. (PLEASE don&amp;#039;t post any answers to this question AT THIS TIME. This post is a ROADMAP, NOT A REQUEST for ideas.) &lt;br /&gt;
# Build a canned example, posted to OOoForum that is specifically designed for easy cloning and creation of new Calc functions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has several issues, please read the forum topic for more detail issues on this code, also remember this code was never really debugged and is pretty old. So you are on your own. If you have a more update version or discover workarounds, please update the wiki.&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
import sys &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
from com.sun.star.sheet import XAddIn &lt;br /&gt;
from com.sun.star.sheet import XCompatibilityNames &lt;br /&gt;
&lt;br /&gt;
from com.sun.star.lang import XServiceName &lt;br /&gt;
from com.sun.star.lang import XLocalizable &lt;br /&gt;
&lt;br /&gt;
g_ImplementationHelper = unohelper.ImplementationHelper() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class DannysCalcFunctions1( unohelper.Base, XAddIn, XLocalizable, XCompatibilityNames, XServiceName ): &lt;br /&gt;
    # The component must have a ctor with the component context as argument. &lt;br /&gt;
    def __init__( self, oContext ): &lt;br /&gt;
        self.oContext = oContext &lt;br /&gt;
        self.oCoreReflection = None &lt;br /&gt;
        self.StarDesktop = None &lt;br /&gt;
        self.getDesktop() &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Danny&amp;#039;s stuff to make programming less convenient. &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def getServiceManager( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the ServiceManager from the running OpenOffice.org. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.oContext.ServiceManager &lt;br /&gt;
    &lt;br /&gt;
    def createUnoService( self, cClass ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;A handy way to create a global objects within the running OOo. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oServiceManager = self.getServiceManager() &lt;br /&gt;
        oObj = oServiceManager.createInstance( cClass ) &lt;br /&gt;
        return oObj &lt;br /&gt;
    &lt;br /&gt;
    def getDesktop( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;An easy way to obtain the Desktop object from a running OOo. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        if self.StarDesktop == None: &lt;br /&gt;
            self.StarDesktop = self.createUnoService( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ) &lt;br /&gt;
        return self.StarDesktop &lt;br /&gt;
&lt;br /&gt;
    def getCoreReflection( self ): &lt;br /&gt;
        if self.oCoreReflection == None: &lt;br /&gt;
            self.oCoreReflection = self.createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; ) &lt;br /&gt;
        return oCoreReflection &lt;br /&gt;
    &lt;br /&gt;
    def createUnoStruct( self, cTypeName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create a UNO struct and return it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oCoreReflection = self.getCoreReflection() &lt;br /&gt;
&lt;br /&gt;
        # Get the IDL class for the type name &lt;br /&gt;
        oXIdlClass = oCoreReflection.forName( cTypeName ) &lt;br /&gt;
&lt;br /&gt;
        # Create the struct. &lt;br /&gt;
        oReturnValue, oStruct = oXIdlClass.createObject( None ) &lt;br /&gt;
&lt;br /&gt;
        return oStruct &lt;br /&gt;
&lt;br /&gt;
    def makePropertyValue( self, cName=None, uValue=None, nHandle=None, nState=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.beans.PropertyValue struct and return it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oPropertyValue = self.createUnoStruct( &amp;quot;com.sun.star.beans.PropertyValue&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
        if cName != None: &lt;br /&gt;
            oPropertyValue.Name = cName &lt;br /&gt;
        if uValue != None: &lt;br /&gt;
            oPropertyValue.Value = uValue &lt;br /&gt;
        if nHandle != None: &lt;br /&gt;
            oPropertyValue.Handle = nHandle &lt;br /&gt;
        if nState != None: &lt;br /&gt;
            oPropertyValue.State = nState &lt;br /&gt;
&lt;br /&gt;
        return oPropertyValue &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Inconvenience routines for working with structs needed later &lt;br /&gt;
    # &lt;br /&gt;
&lt;br /&gt;
    def makeLocale( self, cLanguage=&amp;quot;&amp;quot;, cCountry=&amp;quot;&amp;quot;, cVariant=&amp;quot;&amp;quot; ): &lt;br /&gt;
        oLocale = self.createUnoStruct( &amp;quot;com.sun.star.lang.Locale&amp;quot; ) &lt;br /&gt;
        oLocale.Language = cLanguage &lt;br /&gt;
        oLocale.Country = cCountry &lt;br /&gt;
        oLocale.Variant = oVariant &lt;br /&gt;
        return oLocale &lt;br /&gt;
&lt;br /&gt;
    def makeLocalizedName( self, stLocale, cName ): &lt;br /&gt;
        oLocalizedName = self.createUnoStruct( &amp;quot;com.sun.star.sheet.LocalizedName&amp;quot; ) &lt;br /&gt;
        oLocalizedName.Locale = stLocale &lt;br /&gt;
        oLocalizedName.Name = cName &lt;br /&gt;
        return oLocalizedName &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XAddIn &lt;br /&gt;
    #   Inherits from...    XLocalizable &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    &lt;br /&gt;
    # string &lt;br /&gt;
    # getProgrammaticFuntionName( [in] string aDisplayName ); &lt;br /&gt;
    # Note: the method name spelling error is in the API! &lt;br /&gt;
    def getProgrammaticFuntionName( self, cDisplayFnName ): &lt;br /&gt;
        if cDisplayFnName == &amp;quot;AddFive&amp;quot;: &lt;br /&gt;
            return &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot; &lt;br /&gt;
        elif cDisplayFnName == &amp;quot;AddSix&amp;quot;: &lt;br /&gt;
            return &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
    &lt;br /&gt;
    # string &lt;br /&gt;
    # getDisplayFunctionName( [in] string aProgrammaticName ); &lt;br /&gt;
    def getDisplayFunctioName( self, cProgrammaticFnName ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            return &amp;quot;AddFive&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            return &amp;quot;AddSix&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getFunctionDescription( [in] string aProgrammaticName ); &lt;br /&gt;
    def getFunctionDescription( self, ccProgrammaticFnName ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            return &amp;quot;Adds five to the argument.&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            return &amp;quot;Add six to the argument.&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getDisplayArgumentName( [in] string aProgrammaticName &lt;br /&gt;
    #                         [in] long   nArgument ); &lt;br /&gt;
    def getDisplayArgumentName( self, ccProgrammaticFnName, nArgNum ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            if nArgNum == 0: &lt;br /&gt;
                return &amp;quot;number&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            if nArgNum == 0: &lt;br /&gt;
                return &amp;quot;number&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getArgumentDescription( [in] string aProgrammaticName &lt;br /&gt;
    #                         [in] long   nArgument ); &lt;br /&gt;
    def getArgumentDescription( self, ccProgrammaticFnName, nArgNum ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            if nArgNum == 0: &lt;br /&gt;
                return &amp;quot;A number to which five will be added.&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            if nArgNum == 0: &lt;br /&gt;
               return &amp;quot;A number to which six will be added.&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getProgrammaticCategoryName( [in] string aProgrammaticName ); &lt;br /&gt;
    def getProgrammaticCategoryName( self, ccProgrammaticFnName ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            return &amp;quot;Add-In&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            return &amp;quot;Add-In&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getDisplayCategoryName( [in] string aProgrammaticName ); &lt;br /&gt;
    def getDisplayCategoryName( self, ccProgrammaticFnName ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            return &amp;quot;Add-In&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            return &amp;quot;Add-In&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XCompatibilityNames &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # sequence&amp;lt; LocalizedName &amp;gt; &lt;br /&gt;
    # getCompatibilityNames( [in] string aProgrammaticName ); &lt;br /&gt;
    def getCompatibilityNames( self, ccProgrammaticFnName ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            return ( &lt;br /&gt;
                self.makeLocalizedName( self.makeLocale( &amp;quot;en&amp;quot;, &amp;quot;US&amp;quot;, &amp;quot;&amp;quot; ), &lt;br /&gt;
                                        &amp;quot;AddFive&amp;quot; ) &lt;br /&gt;
                ,) &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            return ( &lt;br /&gt;
                self.makeLocalizedName( self.makeLocale( &amp;quot;en&amp;quot;, &amp;quot;US&amp;quot;, &amp;quot;&amp;quot; ), &lt;br /&gt;
                                        &amp;quot;AddSix&amp;quot; ) &lt;br /&gt;
                ,) &lt;br /&gt;
        return () &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XLocalizable &lt;br /&gt;
    #   This is here because XAddIn inherits it. &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # setLocale( [in] Locale eLocale ); &lt;br /&gt;
    def setLocale( self, stLocale ): &lt;br /&gt;
        return &lt;br /&gt;
&lt;br /&gt;
    # Locale &lt;br /&gt;
    # getLocale(); &lt;br /&gt;
    def getLocale( self ): &lt;br /&gt;
        return self.makeLocale( &amp;quot;en&amp;quot;, &amp;quot;US&amp;quot;, &amp;quot;&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XServiceName &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getServiceName(); &lt;br /&gt;
    def getServiceName( self ): &lt;br /&gt;
        return &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# add the class to the implementation container, &lt;br /&gt;
# which the loader uses to register/instantiate the component. &lt;br /&gt;
g_ImplementationHelper.addImplementation( \ &lt;br /&gt;
        # The class &lt;br /&gt;
   DannysCalcFunctions1, &lt;br /&gt;
        # The implementation name. &lt;br /&gt;
        # Change this name for your own service. &lt;br /&gt;
        &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1&amp;quot;, &lt;br /&gt;
        # A list of services that that are implemented. &lt;br /&gt;
   (&amp;quot;com.sun.star.sheet.AddIn&amp;quot;,), )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final notes on the code by danny:&lt;br /&gt;
It is also worth noting that I have not figured out where to actually implement the two functions AddFive() and AddSix(). All of the above is just the infrastructure for making the two functions and their descriptions and argument lists known to Calc. &lt;br /&gt;
&lt;br /&gt;
I still have to finish reading the above linked section of the Developer&amp;#039;s Guide again. Maybe I can figure out what I&amp;#039;m missing. Or maybe there is a fully working Calc function example somewhere else (even in a different language?) that I can examine?&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=CalcFunctions&amp;diff=235889</id>
		<title>CalcFunctions</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=CalcFunctions&amp;diff=235889"/>
		<updated>2015-02-17T16:14:02Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added code from oooforum.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Originally posted in oooForum [http://www.oooforum.org/forum/viewtopic.phtml?t=8456 here].&lt;br /&gt;
&lt;br /&gt;
This code deals with:&lt;br /&gt;
# Develop a trivial Calc function add on in Python. &lt;br /&gt;
# To be followed by more sophisticated functions. &lt;br /&gt;
# To be followed by eventually running a Poll on OOoForum asking what kind of functions shoudl be developed. (PLEASE don&amp;#039;t post any answers to this question AT THIS TIME. This post is a ROADMAP, NOT A REQUEST for ideas.) &lt;br /&gt;
# Build a canned example, posted to OOoForum that is specifically designed for easy cloning and creation of new Calc functions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code has several issues, please read the forum topic for more detail issues on this code, also remember this code was never really debugged and is pretty old. So you are on your own. If you have a more update version or discover workarounds, please update the wiki.&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
import sys &lt;br /&gt;
import unohelper &lt;br /&gt;
&lt;br /&gt;
from com.sun.star.sheet import XAddIn &lt;br /&gt;
from com.sun.star.sheet import XCompatibilityNames &lt;br /&gt;
&lt;br /&gt;
from com.sun.star.lang import XServiceName &lt;br /&gt;
from com.sun.star.lang import XLocalizable &lt;br /&gt;
&lt;br /&gt;
g_ImplementationHelper = unohelper.ImplementationHelper() &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class DannysCalcFunctions1( unohelper.Base, XAddIn, XLocalizable, XCompatibilityNames, XServiceName ): &lt;br /&gt;
    # The component must have a ctor with the component context as argument. &lt;br /&gt;
    def __init__( self, oContext ): &lt;br /&gt;
        self.oContext = oContext &lt;br /&gt;
        self.oCoreReflection = None &lt;br /&gt;
        self.StarDesktop = None &lt;br /&gt;
        self.getDesktop() &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Danny&amp;#039;s stuff to make programming less convenient. &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    def getServiceManager( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Get the ServiceManager from the running OpenOffice.org. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        return self.oContext.ServiceManager &lt;br /&gt;
    &lt;br /&gt;
    def createUnoService( self, cClass ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;A handy way to create a global objects within the running OOo. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oServiceManager = self.getServiceManager() &lt;br /&gt;
        oObj = oServiceManager.createInstance( cClass ) &lt;br /&gt;
        return oObj &lt;br /&gt;
    &lt;br /&gt;
    def getDesktop( self ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;An easy way to obtain the Desktop object from a running OOo. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        if self.StarDesktop == None: &lt;br /&gt;
            self.StarDesktop = self.createUnoService( &amp;quot;com.sun.star.frame.Desktop&amp;quot; ) &lt;br /&gt;
        return self.StarDesktop &lt;br /&gt;
&lt;br /&gt;
    def getCoreReflection( self ): &lt;br /&gt;
        if self.oCoreReflection == None: &lt;br /&gt;
            self.oCoreReflection = self.createUnoService( &amp;quot;com.sun.star.reflection.CoreReflection&amp;quot; ) &lt;br /&gt;
        return oCoreReflection &lt;br /&gt;
    &lt;br /&gt;
    def createUnoStruct( self, cTypeName ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create a UNO struct and return it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oCoreReflection = self.getCoreReflection() &lt;br /&gt;
&lt;br /&gt;
        # Get the IDL class for the type name &lt;br /&gt;
        oXIdlClass = oCoreReflection.forName( cTypeName ) &lt;br /&gt;
&lt;br /&gt;
        # Create the struct. &lt;br /&gt;
        oReturnValue, oStruct = oXIdlClass.createObject( None ) &lt;br /&gt;
&lt;br /&gt;
        return oStruct &lt;br /&gt;
&lt;br /&gt;
    def makePropertyValue( self, cName=None, uValue=None, nHandle=None, nState=None ): &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot;Create a com.sun.star.beans.PropertyValue struct and return it. &lt;br /&gt;
        &amp;quot;&amp;quot;&amp;quot; &lt;br /&gt;
        oPropertyValue = self.createUnoStruct( &amp;quot;com.sun.star.beans.PropertyValue&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
        if cName != None: &lt;br /&gt;
            oPropertyValue.Name = cName &lt;br /&gt;
        if uValue != None: &lt;br /&gt;
            oPropertyValue.Value = uValue &lt;br /&gt;
        if nHandle != None: &lt;br /&gt;
            oPropertyValue.Handle = nHandle &lt;br /&gt;
        if nState != None: &lt;br /&gt;
            oPropertyValue.State = nState &lt;br /&gt;
&lt;br /&gt;
        return oPropertyValue &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Inconvenience routines for working with structs needed later &lt;br /&gt;
    # &lt;br /&gt;
&lt;br /&gt;
    def makeLocale( self, cLanguage=&amp;quot;&amp;quot;, cCountry=&amp;quot;&amp;quot;, cVariant=&amp;quot;&amp;quot; ): &lt;br /&gt;
        oLocale = self.createUnoStruct( &amp;quot;com.sun.star.lang.Locale&amp;quot; ) &lt;br /&gt;
        oLocale.Language = cLanguage &lt;br /&gt;
        oLocale.Country = cCountry &lt;br /&gt;
        oLocale.Variant = oVariant &lt;br /&gt;
        return oLocale &lt;br /&gt;
&lt;br /&gt;
    def makeLocalizedName( self, stLocale, cName ): &lt;br /&gt;
        oLocalizedName = self.createUnoStruct( &amp;quot;com.sun.star.sheet.LocalizedName&amp;quot; ) &lt;br /&gt;
        oLocalizedName.Locale = stLocale &lt;br /&gt;
        oLocalizedName.Name = cName &lt;br /&gt;
        return oLocalizedName &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XAddIn &lt;br /&gt;
    #   Inherits from...    XLocalizable &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    &lt;br /&gt;
    # string &lt;br /&gt;
    # getProgrammaticFuntionName( [in] string aDisplayName ); &lt;br /&gt;
    # Note: the method name spelling error is in the API! &lt;br /&gt;
    def getProgrammaticFuntionName( self, cDisplayFnName ): &lt;br /&gt;
        if cDisplayFnName == &amp;quot;AddFive&amp;quot;: &lt;br /&gt;
            return &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot; &lt;br /&gt;
        elif cDisplayFnName == &amp;quot;AddSix&amp;quot;: &lt;br /&gt;
            return &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
    &lt;br /&gt;
    # string &lt;br /&gt;
    # getDisplayFunctionName( [in] string aProgrammaticName ); &lt;br /&gt;
    def getDisplayFunctioName( self, cProgrammaticFnName ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            return &amp;quot;AddFive&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            return &amp;quot;AddSix&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getFunctionDescription( [in] string aProgrammaticName ); &lt;br /&gt;
    def getFunctionDescription( self, ccProgrammaticFnName ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            return &amp;quot;Adds five to the argument.&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            return &amp;quot;Add six to the argument.&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getDisplayArgumentName( [in] string aProgrammaticName &lt;br /&gt;
    #                         [in] long   nArgument ); &lt;br /&gt;
    def getDisplayArgumentName( self, ccProgrammaticFnName, nArgNum ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            if nArgNum == 0: &lt;br /&gt;
                return &amp;quot;number&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            if nArgNum == 0: &lt;br /&gt;
                return &amp;quot;number&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getArgumentDescription( [in] string aProgrammaticName &lt;br /&gt;
    #                         [in] long   nArgument ); &lt;br /&gt;
    def getArgumentDescription( self, ccProgrammaticFnName, nArgNum ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            if nArgNum == 0: &lt;br /&gt;
                return &amp;quot;A number to which five will be added.&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            if nArgNum == 0: &lt;br /&gt;
               return &amp;quot;A number to which six will be added.&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getProgrammaticCategoryName( [in] string aProgrammaticName ); &lt;br /&gt;
    def getProgrammaticCategoryName( self, ccProgrammaticFnName ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            return &amp;quot;Add-In&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            return &amp;quot;Add-In&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getDisplayCategoryName( [in] string aProgrammaticName ); &lt;br /&gt;
    def getDisplayCategoryName( self, ccProgrammaticFnName ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            return &amp;quot;Add-In&amp;quot; &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            return &amp;quot;Add-In&amp;quot; &lt;br /&gt;
        return &amp;quot;&amp;quot; &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XCompatibilityNames &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # sequence&amp;lt; LocalizedName &amp;gt; &lt;br /&gt;
    # getCompatibilityNames( [in] string aProgrammaticName ); &lt;br /&gt;
    def getCompatibilityNames( self, ccProgrammaticFnName ): &lt;br /&gt;
        if cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddFive&amp;quot;: &lt;br /&gt;
            return ( &lt;br /&gt;
                self.makeLocalizedName( self.makeLocale( &amp;quot;en&amp;quot;, &amp;quot;US&amp;quot;, &amp;quot;&amp;quot; ), &lt;br /&gt;
                                        &amp;quot;AddFive&amp;quot; ) &lt;br /&gt;
                ,) &lt;br /&gt;
        elif cProgrammaticFnName == &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1.AddSix&amp;quot;: &lt;br /&gt;
            return ( &lt;br /&gt;
                self.makeLocalizedName( self.makeLocale( &amp;quot;en&amp;quot;, &amp;quot;US&amp;quot;, &amp;quot;&amp;quot; ), &lt;br /&gt;
                                        &amp;quot;AddSix&amp;quot; ) &lt;br /&gt;
                ,) &lt;br /&gt;
        return () &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XLocalizable &lt;br /&gt;
    #   This is here because XAddIn inherits it. &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # void &lt;br /&gt;
    # setLocale( [in] Locale eLocale ); &lt;br /&gt;
    def setLocale( self, stLocale ): &lt;br /&gt;
        return &lt;br /&gt;
&lt;br /&gt;
    # Locale &lt;br /&gt;
    # getLocale(); &lt;br /&gt;
    def getLocale( self ): &lt;br /&gt;
        return self.makeLocale( &amp;quot;en&amp;quot;, &amp;quot;US&amp;quot;, &amp;quot;&amp;quot; ) &lt;br /&gt;
&lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
    #   Interface: XServiceName &lt;br /&gt;
    #---------------------------------------- &lt;br /&gt;
&lt;br /&gt;
    # string &lt;br /&gt;
    # getServiceName(); &lt;br /&gt;
    def getServiceName( self ): &lt;br /&gt;
        return &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1&amp;quot; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# add the class to the implementation container, &lt;br /&gt;
# which the loader uses to register/instantiate the component. &lt;br /&gt;
g_ImplementationHelper.addImplementation( \ &lt;br /&gt;
        # The class &lt;br /&gt;
   DannysCalcFunctions1, &lt;br /&gt;
        # The implementation name. &lt;br /&gt;
        # Change this name for your own service. &lt;br /&gt;
        &amp;quot;nom.DannyBrewer.test.DannysCalcFunctions1&amp;quot;, &lt;br /&gt;
        # A list of services that that are implemented. &lt;br /&gt;
   (&amp;quot;com.sun.star.sheet.AddIn&amp;quot;,), )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Final notes on the code by danny:&lt;br /&gt;
It is also worth noting that I have not figured out where to actually implement the two functions AddFive() and AddSix(). All of the above is just the infrastructure for making the two functions and their descriptions and argument lists known to Calc. &lt;br /&gt;
&lt;br /&gt;
I still have to finish reading the above linked section of the Developer&amp;#039;s Guide again. Maybe I can figure out what I&amp;#039;m missing. Or maybe there is a fully working Calc function example somewhere else (even in a different language?) that I can examine?&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Python&amp;diff=235888</id>
		<title>Python</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Python&amp;diff=235888"/>
		<updated>2015-02-17T16:08:10Z</updated>

		<summary type="html">&lt;p&gt;JZA: move content to the wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Extensions}}&lt;br /&gt;
[[image:Py-uno_128.png|PyUNO Logo]] [[image:Pyuno_logo_a.jpg]] &lt;br /&gt;
&lt;br /&gt;
=== Python and OpenOffice ===&lt;br /&gt;
Apache OpenOffice 4 ships with the Python scripting language, version 2.7. OpenOffice.org 3.1 and above shipped with Python version 2.6.1 and older OpenOffice.org releases shipped with Python version 2.3.4. This Python distribution via OpenOffice comes with the [[Uno]] module, which connects the [[API|UNO API]] to the python scripting language.  To run this version of Python on Linux, you can go directly to the OpenOffice PATH.  And as one would expect with any distribution of Python, AOO-Python can be run from the command line as well.&lt;br /&gt;
&lt;br /&gt;
If you already have a separate Python installation, you can import the uno module (the Python-UNO bridge) to it using [http://forum.openoffice.org/en/forum/viewtopic.php?f=45&amp;amp;t=36370&amp;amp;p=166783 these instructions].&lt;br /&gt;
&lt;br /&gt;
If you already have a different version of Python installed on Windows, you can also access the [[API|UNO API]] using the [http://forum.openoffice.org//en/forum/viewtopic.php?f=45&amp;amp;t=36608&amp;amp;p=167909 COM bridge] instead of the Python bridge. Requires the [http://sourceforge.net/projects/pywin32/ add-on pywin32] module so Python can talk to COM. Note that while the UNO API is uniform, the implementation by the two bridges is slightly different, so the syntax required by each is also sometimes different.&lt;br /&gt;
&lt;br /&gt;
==== Where is the IDE ? ====&lt;br /&gt;
OpenOffice&amp;#039;s IDE doesn&amp;#039;t support Python, so development has to be done from another editor that does.  Any volunteer for a binding is welcomed. Here is a nice [http://pythonconquerstheuniverse.wordpress.com/category/the-python-debugger/ blog post] about using [http://www.vim.org VIM] a common Unix/Linux text editor configured in a way that acts like an IDE. Windows users can use [http://www.vim.org/download.php#pc Gvim] and [http://macvim.org/ MacVim] for OSX users.&lt;br /&gt;
&lt;br /&gt;
==== Tips &amp;amp; Tricks ====&lt;br /&gt;
&lt;br /&gt;
Here is some useful information about using python in AOO.&lt;br /&gt;
&lt;br /&gt;
===== Debug output =====&lt;br /&gt;
&lt;br /&gt;
If you launch a python script, any error will silently break the execution, making your extension hard to debug.  To change this behaviour, one can change the&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;LogLevel&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
Have a look in &lt;br /&gt;
&amp;#039;&amp;#039;/path/to/aoo/program/&amp;#039;&amp;#039;&amp;#039;pythonscript.py&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
and replace &lt;br /&gt;
&amp;#039;&amp;#039;LogLevel.use = LogLevel.&amp;#039;&amp;#039;&amp;#039;NONE&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
with&lt;br /&gt;
&amp;#039;&amp;#039;LogLevel.use = LogLevel.&amp;#039;&amp;#039;&amp;#039;DEBUG&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
There are also currently-undocumented environment variables that tell the pyUno bridge to log every call.  Set the environment variable&lt;br /&gt;
&amp;#039;&amp;#039;export PYUNO_LOGLEVEL=ARGS&amp;#039;&amp;#039;&lt;br /&gt;
.  The output may be a little hard to read, but helpful nonetheless.&lt;br /&gt;
&lt;br /&gt;
Note that his applies only to Linux.  For Windows, you need some more switches, and the output gets written to files (there is no stdout on windows :-( ).&lt;br /&gt;
&lt;br /&gt;
There are still some error messages that won&amp;#039;t appear in these logs; this will improve in the near future (cws pyunofixes4).  Once the cws is integrated, I will document these switches on the official pyuno site. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Thanks to Joerg Budischewski&amp;#039;&amp;#039;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
=== Python specific information for Extension creation ===&lt;br /&gt;
To create extensions for python, it is important that you have enough familiarity with the UNO components, as well as with packaging your code for easy distribution through the &amp;#039;&amp;#039;OpenOffice package manager&amp;#039;&amp;#039;.  Please check the tutorials to learn how to component-ize your code, and how to deploy remote scripting through a service implementation.&lt;br /&gt;
&lt;br /&gt;
To learn to run Python on Windows, visit [[Using Python on Windows| this link]] for more detailed information.&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;center&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;0&amp;quot; style=&amp;quot;border: 0px solid rgb(134, 194, 230);&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| style=&amp;quot;width: 35%; padding-right: 15px;&amp;quot; | &amp;lt;div style=&amp;quot;border-style: solid solid none; border-color: rgb(134, 194, 230) rgb(134, 194, 230) -moz-use-text-color; border-width: 1px 1px medium; padding: 5px; font-size: 120%; font-weight: bold; background-color: rgb(203, 222, 250);&amp;quot;&amp;gt;Getting Started&amp;lt;/div&amp;gt; &amp;lt;div style=&amp;quot;border: 1px solid rgb(155, 192, 245); padding: 5px 5px 10px;&amp;quot;&amp;gt;&lt;br /&gt;
*[[Python/Python_Language_Binding|Python Language Binding]]&lt;br /&gt;
*[[Python/Python_Loader|Python Loader]]&lt;br /&gt;
*[[Using Python on Windows]] - New to Python? Learn how to use python on Windows&lt;br /&gt;
*[[Using Python on Linux]] - A must read for an overview on Python and AOO relations&lt;br /&gt;
* [[pyUNO bridge]] - Official page of the PyUNO bridge at the [http://udk.openoffice.org/ UDK site] - ([http://www.fatcow.com/edu/mathtex-be/ &amp;#039;&amp;#039;Belorussian translation&amp;#039;&amp;#039;])&lt;br /&gt;
* [[Python as a macro language]] in OpenOffice.org 2.x - How to use the Python scripting framework&lt;br /&gt;
* [[Python/Transfer_from_Basic_to_Python|Transfer from Basic to Python]]&lt;br /&gt;
* [http://lucasmanual.com/mywiki/OpenOffice PyUNO Manual] Lukasz created a pyUNO manual. &amp;#039;&amp;#039;&amp;#039;new&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* [[SQLAlquemyPyUNO|SQLAlchemy and PyUNO]] connecting OpenOffice to any database&lt;br /&gt;
* [http://www.linuxjournal.com/content/starting-stopping-and-connecting-openoffice-python Starting/Stopping and connecting using Python] From Linux Journal&lt;br /&gt;
* Introduction on testing pyUNO programs with [[doctests]]&lt;br /&gt;
* Create a [[PythonDialogBox|dialog box]] in PyUNO.&lt;br /&gt;
* [http://codesnippets.services.openoffice.org/Office/Office.ConnectViaPipe.snip Connect to Openoffice] from PyUNO&lt;br /&gt;
* [[PyUNO samples]] currently shipping with OpenOffice.org and the explanation.&lt;br /&gt;
* Enhanced [http://www.oooforum.org/forum/viewtopic.phtml?p=257496#257496 Capitalized.py] script by &amp;#039;&amp;#039;The gray Cardinal&amp;#039;&amp;#039; at the OpenOffice forum.&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;width: 35%; padding-right: 15px;&amp;quot; | &amp;lt;div style=&amp;quot;border-style: solid solid none; border-color: rgb(134, 194, 230) rgb(134, 194, 230) -moz-use-text-color; border-width: 1px 1px medium; padding: 5px; font-size: 120%; font-weight: bold; background-color: rgb(203, 222, 250);&amp;quot;&amp;gt;PYUNO Modules&amp;lt;/div&amp;gt; &amp;lt;div style=&amp;quot;border: 1px solid rgb(155, 192, 245); padding: 5px 5px 10px;&amp;quot;&amp;gt;&lt;br /&gt;
*[[Danny&amp;#039;s Python Modules]] - Collection guide from DannyB&amp;#039;s modules.&lt;br /&gt;
*[[PrinttoWriter.py]] - This makes it easy and convenient to print a bunch of text into a Writer document.&lt;br /&gt;
*[[CalcFunctions]] - Learn how Python can be used to develop Calc functions in Python&lt;br /&gt;
*[[[Python-Calc]] - Various scripts to deal with Calc&lt;br /&gt;
*[[PythonContainers]] - Python container components&lt;br /&gt;
*[[PyUNOServer]] - The PyUNOServer is a script that works as an XML server for OpenOffice.org Calc&lt;br /&gt;
*[[calcParser]] - calcParser is a small parser using the native SAX utilities within the OpenOffice.org python&lt;br /&gt;
*[[OoConfig]] - OoConfig is a Python extension that seeks to provide a configuration editing facility similar to Mozilla&amp;#039;s about:config&lt;br /&gt;
*[[Bibliographic/Hints and Tips/OOoRISExport.py|OOoRISExport.py]] - Exports the bibliographic database in RIS format. Also [http://bibliographic.openoffice.org/files/documents/124/3078/RISImport.py RISImport.py]&lt;br /&gt;
*[[Zotero_Plugin |Zotero Plugin]] - The Zotero plugin provides citation and bibliographic table insertion and editing functions for Writer documents.&lt;br /&gt;
*[http://oosheet.hacklab.com.br/ OOSheet] - High level python library to develop spreadsheet macros without the complexity of Uno. Focuses on spreadsheets, but may be useful for other documents.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Hacking Around ===&lt;br /&gt;
*[[UNO component packaging]] - How to create UNO components as well as the basics of script componentizing&lt;br /&gt;
*[http://www.oooforum.org/forum/viewtopic.phtml?p=38234#38234 Python component to parse XML] - Python is great to parse XML, PyUNO is also excellent when working with XML&lt;br /&gt;
*[[Example of Service in Python]] - Learn how to run Python as a service, this is useful for remote scripting.&lt;br /&gt;
*[http://www.oooforum.org/forum/viewtopic.phtml?p=76972#76972 Modify spreadsheet] - Example of storing and retrieving a custom attribute on a spreadsheet cell.&lt;br /&gt;
*A simple [[daemon in Python]] - Learn how to run Python as a daemon&lt;br /&gt;
*[[Loook.py]] - a simple Python tool that searches for text strings in OpenOffice.org.&lt;br /&gt;
*[[odt2txt.py]] - convert ODF to plain text using python (and convert the txt to html).&lt;br /&gt;
&lt;br /&gt;
=== Python rules OpenOffice (by B. Bois) ===&lt;br /&gt;
[[image:python_power_for_OOo.png|Python rules OpenOffice :-)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Extensions]]&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Uno]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/FAQ/Installation/How_do_I_install_Apache_OpenOffice_on_Mac_OS_X%3F&amp;diff=235882</id>
		<title>Documentation/FAQ/Installation/How do I install Apache OpenOffice on Mac OS X?</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/FAQ/Installation/How_do_I_install_Apache_OpenOffice_on_Mac_OS_X%3F&amp;diff=235882"/>
		<updated>2015-02-02T16:40:07Z</updated>

		<summary type="html">&lt;p&gt;JZA: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:How do I install OpenOffice on Mac OS X?}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section begin=question /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;How do I install OpenOffice on Mac OS X?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;section end=question /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section begin=answer /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- the main text was not tested --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Visit the OpenOffice website at http://www.openoffice.org and locate the icon with the download option on the top menu bar of the website with the word &amp;#039;Download&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
Click on it and you will be presented with a green area holding some options. Make sure your operating system &amp;#039;OSX 64-bits&amp;#039; is selected (unless you have an older mac which would be 32-bit). &lt;br /&gt;
&lt;br /&gt;
Select the version and language and click on &amp;#039;&amp;#039;&amp;#039;Download full installation&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
* Download the .dmg installation file.&lt;br /&gt;
&lt;br /&gt;
* Drag and drop the OOo icon to the Application icon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section end=answer /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/FAQ/Installation|1 Installation]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=User:JZA&amp;diff=235713</id>
		<title>User:JZA</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=User:JZA&amp;diff=235713"/>
		<updated>2014-10-24T16:33:06Z</updated>

		<summary type="html">&lt;p&gt;JZA: Reverted edits by JZA (talk) to last revision by Jza&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Experienced member of the community with good experience in the codebase of openoffice.org and leadership managing open source groups. Have participated in tasks realated to promotion, consulting and trainning in free and open source software. Had also work for multinationals on Linux system administration and business development.&lt;br /&gt;
&lt;br /&gt;
Had a professional background developed in the branch of IT in the United States, Eastern and Western Europe and Latin america.&lt;br /&gt;
&lt;br /&gt;
Name: Alexandro Colorado&lt;br /&gt;
[[image:JZA_jathumb.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
Position: [http://es.openoffice.org Co-Lead of OpenOffice.org Spanish]&lt;br /&gt;
&lt;br /&gt;
Years in the community: 8years (2002)&lt;br /&gt;
&lt;br /&gt;
Years as an [[OOoES]] Lead: 6years (2004)&lt;br /&gt;
&lt;br /&gt;
==== Position ====&lt;br /&gt;
* [[OOoES |OpenOffice.org ES]] community leader &lt;br /&gt;
* [http://bizdev.openoffice.org OpenOffice.org BizDev] community Co-lead&lt;br /&gt;
* [[Education_Project/Effort |OpenOffice.org Education]] community Co-lead&lt;br /&gt;
* [http://marketing.openoffice.org/contacts.html#namerica Community contact for Mexico]&lt;br /&gt;
&lt;br /&gt;
==== Projects involved ====&lt;br /&gt;
* [http://es.openoffice.org OpenOffice.org Espa&amp;amp;ntilde;ol]&lt;br /&gt;
** Web development&lt;br /&gt;
** Mailing list moderator&lt;br /&gt;
** Documentator&lt;br /&gt;
** Languge lead&lt;br /&gt;
* [http://xml.openoffice.org OpenOffice.org XML]&lt;br /&gt;
** Developer&lt;br /&gt;
* [http://dba.openoffice.org OpenOffice.org DBA]&lt;br /&gt;
** Documentator&lt;br /&gt;
* [http://marketing.openoffice.org OpenOffice.org Marketing]&lt;br /&gt;
** Marketing contact for Mexico&lt;br /&gt;
* [http://education.openoffice.org OpenOffice.org Education]&lt;br /&gt;
** Co-Lead for Education&lt;br /&gt;
** Certification tower lead&lt;br /&gt;
* [http://bizdev.openoffice.org OpenOffice.org BizDev]&lt;br /&gt;
** Co-Lead for BizDev&lt;br /&gt;
** Business database directory administrator&lt;br /&gt;
** Web development&lt;br /&gt;
&lt;br /&gt;
Others:&lt;br /&gt;
* [http://www.alexandrocolorado.com/blog Personal OpenOffice.org Blog]&lt;br /&gt;
* [http://legacy.odeo.com/channel/24806/view/ OOoCast OpenOffice.org Podcast]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=User:JZA&amp;diff=235712</id>
		<title>User:JZA</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=User:JZA&amp;diff=235712"/>
		<updated>2014-10-24T16:31:54Z</updated>

		<summary type="html">&lt;p&gt;JZA: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Experienced member of the community with good experience in the codebase of openoffice.org and leadership managing open source groups. Have participated in tasks realated to promotion, consulting and trainning in free and open source software. Had also work for multinationals on Linux system administration and business development.&lt;br /&gt;
&lt;br /&gt;
Had a professional background developed in the branch of IT in the United States, Eastern and Western Europe and Latin america.&lt;br /&gt;
&lt;br /&gt;
Name: Alexandro Colorado&lt;br /&gt;
[[image:JZA_jathumb.jpg|right]]&lt;br /&gt;
&lt;br /&gt;
Position: [http://es.openoffice.org Co-Lead of OpenOffice.org Spanish]&lt;br /&gt;
&lt;br /&gt;
Years in the community: 8years (2002)&lt;br /&gt;
&lt;br /&gt;
Years as an [[OOoES]] Lead: 6years (2004)&lt;br /&gt;
&lt;br /&gt;
==== Position ====&lt;br /&gt;
* [[OOoES |OpenOffice.org ES]] community leader &lt;br /&gt;
* [http://bizdev.openoffice.org OpenOffice.org BizDev] community Co-lead&lt;br /&gt;
* [[Education_Project/Effort |OpenOffice.org Education]] community Co-lead&lt;br /&gt;
* [http://marketing.openoffice.org/contacts.html#namerica Community contact for Latin america]&lt;br /&gt;
&lt;br /&gt;
==== Projects involved ====&lt;br /&gt;
* [http://es.openoffice.org OpenOffice.org Espa&amp;amp;ntilde;ol]&lt;br /&gt;
** Web development&lt;br /&gt;
** Mailing list moderator&lt;br /&gt;
** Documentator&lt;br /&gt;
** Languge lead&lt;br /&gt;
* [http://xml.openoffice.org OpenOffice.org XML]&lt;br /&gt;
** Developer&lt;br /&gt;
* [http://dba.openoffice.org OpenOffice.org DBA]&lt;br /&gt;
** Documentator&lt;br /&gt;
* [http://marketing.openoffice.org OpenOffice.org Marketing]&lt;br /&gt;
** Marketing contact for Mexico&lt;br /&gt;
* [http://education.openoffice.org OpenOffice.org Education]&lt;br /&gt;
** Co-Lead for Education&lt;br /&gt;
** Certification tower lead&lt;br /&gt;
* [http://bizdev.openoffice.org OpenOffice.org BizDev]&lt;br /&gt;
** Co-Lead for BizDev&lt;br /&gt;
** Business database directory administrator&lt;br /&gt;
** Web development&lt;br /&gt;
&lt;br /&gt;
Others:&lt;br /&gt;
* [http://www.alexandrocolorado.com/blog Personal OpenOffice.org Blog]&lt;br /&gt;
* [http://legacy.odeo.com/channel/24806/view/ OOoCast OpenOffice.org Podcast]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/Building_Guide_AOO&amp;diff=235677</id>
		<title>Documentation/Building Guide AOO</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/Building_Guide_AOO&amp;diff=235677"/>
		<updated>2014-10-05T16:09:07Z</updated>

		<summary type="html">&lt;p&gt;JZA: Added Notes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Apache OpenOffice Building Guide}}&lt;br /&gt;
&lt;br /&gt;
= Preface =&lt;br /&gt;
This guide will help you to build Apache OpenOffice from its source code.  It details the prerequisites and explains how to download the source code, prepare and then run the build. [[Documentation/Building_Guide_AOO/Step_by_step|Step-by-step instructions]] for resolving the pre-requisites of individual platforms and building on them are available.&lt;br /&gt;
  &lt;br /&gt;
Here is the short version for the brave and impatient:&lt;br /&gt;
# Download the source:  &amp;lt;code&amp;gt;svn co https://svn.apache.org/repos/asf/openoffice/trunk aoo&amp;lt;/code&amp;gt;&lt;br /&gt;
# Configure: &amp;lt;code&amp;gt;cd main/ ; autoconf ; ./configure &amp;lt;some-switches&amp;gt; ; ./bootstrap&amp;lt;/code&amp;gt;&lt;br /&gt;
# Build: &amp;lt;code&amp;gt;source &amp;lt;platform-dependend-name&amp;gt;.sh ; cd instsetoo_native ; build --all&amp;lt;/code&amp;gt;&lt;br /&gt;
# Wait for an hour or more (The build can take up to 3 hours.)&lt;br /&gt;
# Enjoy&lt;br /&gt;
&lt;br /&gt;
The detailed description below gives a broader introduction into the build process and explains for the various steps.&lt;br /&gt;
 &lt;br /&gt;
{{Template:Documentation/Note|This document is loosely based on an older [[Documentation/Building Guide|version]].  I have tried to avoid duplication and to move anything that all platforms have in common to this page.  Many details have been removed on purpose because they refer to older version of OpenOffice.}}&lt;br /&gt;
* How to use cache&lt;br /&gt;
&lt;br /&gt;
{{Documentation/SeeAlso|*[[How_to_build_Symphony%27s_source_code]] }}&lt;br /&gt;
&lt;br /&gt;
= Getting help =&lt;br /&gt;
You can get help by searching this wiki or by asking questions on the [http://openoffice.apache.org/mailing-lists.html#development-mailing-list-public developers mailing list].&lt;br /&gt;
&lt;br /&gt;
You can help us improve this guide by pointing out any errors (preferably after finding a solution).&lt;br /&gt;
Or don&amp;#039;t be shy and edit (and improve) these pages yourself.&lt;br /&gt;
&lt;br /&gt;
= Basics =&lt;br /&gt;
&lt;br /&gt;
In order to build Apache OpenOffice you need a proper environment.  This includes&lt;br /&gt;
* a command line interpreter, typically bourne shell compatible (sh or bash) inside a terminal. On Windows you will need to install Cygwin to provide it.&lt;br /&gt;
* C++ compiler and linker.  The exact choice depends on the operating system.&lt;br /&gt;
* Perl interpreter and several modules.&lt;br /&gt;
* Many tools from the Unix world like make or sed.&lt;br /&gt;
&lt;br /&gt;
See section [[#General_Build_Requirements | General Build Requirements]]&lt;br /&gt;
for an exact list of requirements.&lt;br /&gt;
&lt;br /&gt;
= Getting the source =&lt;br /&gt;
&lt;br /&gt;
The source code is available as SVN repository at https://svn.apache.org/repos/asf/openoffice&lt;br /&gt;
&lt;br /&gt;
Check it out with&lt;br /&gt;
&lt;br /&gt;
   svn co https://svn.apache.org/repos/asf/openoffice/trunk aoo&lt;br /&gt;
&lt;br /&gt;
More details about how to check out source code from SVN can be found [http://openoffice.apache.org/source.html here].&lt;br /&gt;
&lt;br /&gt;
== Space Requirements ==&lt;br /&gt;
&lt;br /&gt;
The checked out files take up somewhat over 5GB on disk (more than 150000 files in more than 7000 folders and the SVN overhead). &lt;br /&gt;
&lt;br /&gt;
After building this becomes (on Windows7) almost 17GB (more than 406000 files in more than 23000 folders).&lt;br /&gt;
&lt;br /&gt;
You can use git as well. There exists no guide for this, therefore ask on dev@openoffice.apache.org, if you want to use git.&lt;br /&gt;
&lt;br /&gt;
= Organization of the source and output tree =&lt;br /&gt;
&lt;br /&gt;
The source code has five top level directories:&lt;br /&gt;
;main/:contains most of the so called modules.  Each module typically provides one or more libraries.  The source code of the writer application for example can be found in main/sd/.&lt;br /&gt;
;test/:contains the new [[QA/test_automation_guide | automated testing framework]]&lt;br /&gt;
;ext_libraries/:is the new home of modules that build external libraries (libraries maintained outside of Apache OpenOffice and often outside Apache).&lt;br /&gt;
;ext_sources/:contains the tar balls (archives) of external libraries.  They are included both for convenience and to make sure that specific versions remain available.  Note that the source package of the Apache OpenOffice release does not contain any external tar balls. &lt;br /&gt;
;extras/:holds the localization data.&lt;br /&gt;
&lt;br /&gt;
Most tools and scripts that are used for building are located below &amp;lt;code&amp;gt;main/solenv/&amp;lt;/code&amp;gt;:&lt;br /&gt;
*dmake makefiles in &amp;lt;code&amp;gt;main/solenv/inc/&amp;lt;/code&amp;gt;&lt;br /&gt;
*gmake makefiles in &amp;lt;code&amp;gt;main/solenv/gbuild/&amp;lt;/code&amp;gt;&lt;br /&gt;
*executables and perl files in &amp;lt;code&amp;gt;main/solenv/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
*perl modules in &amp;lt;code&amp;gt;main/bin/modules/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Libraries and other output files that are shared between modules are stored in &amp;lt;code&amp;gt;main/solver/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=Building=&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
Building Apache OpenOffice consists of three steps:&lt;br /&gt;
;Configuring/bootstrapping:Detect platform, operating system, compiler, etc. and write the information into a shell script for later use.  The developer can turn on or off certain features in this phase.&lt;br /&gt;
;Building:Compile the source code, transform other input files, apply localization.&lt;br /&gt;
;Packing:Create a set of files, the installation set, that can be installed on the respective operating system.  This can be msi/cab files for windows, deb or rpm for Linux, dmg for Mac.&lt;br /&gt;
&lt;br /&gt;
The configure step has to be carried out only once.  Building and packing is necessary after every source code change.  There are short cuts to avoid parts of these steps (when you know what you are doing.)&lt;br /&gt;
&lt;br /&gt;
The building examples in this wiki document use only command line approaches to building. Depending on your expertise, it may be possible to use an IDE which allows specification of custom build scripts. &lt;br /&gt;
&lt;br /&gt;
== General Build Requirements ==&lt;br /&gt;
&lt;br /&gt;
The general requirements for all platforms are&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
! Requirement&lt;br /&gt;
! Description&lt;br /&gt;
! Configure switch&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| Java JDK&lt;br /&gt;
| Java Implementation compatible with [http://java.sun.com/j2se/1.5/ JDK 1.5] or [http://java.sun.com/javase/6/ JDK 1.6]. [http://openjdk.java.net/ OpenJDK] is supported as well.&lt;br /&gt;
&lt;br /&gt;
For Windows [http://www.oracle.com/technetwork/java/javase/downloads/index.html/ JDK 1.7] is recommended.&lt;br /&gt;
| --with-jdk-home=&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| Perl&lt;br /&gt;
| Perl 5 - note: for Windows Perl will be installed as part of the cygwin environment.&lt;br /&gt;
&lt;br /&gt;
Also required are the perl packages&lt;br /&gt;
    Archive::Zip&lt;br /&gt;
    LWP::UserAgent&lt;br /&gt;
    XML::Parser&lt;br /&gt;
They can be installed from the shell with (you may have to run it with super user/administrator rights)&lt;br /&gt;
    perl -MCPAN -e shell&lt;br /&gt;
If it is executed for the first time then CPAN will ask for configuration. Choose autoconfiguration.&lt;br /&gt;
Eventually the CPAN shell appears accepts commands.  Install missing modules with &lt;br /&gt;
    install &amp;lt;module-name&amp;gt;&lt;br /&gt;
Find more details [http://wiki.services.openoffice.org/wiki/CPAN_install here].&amp;lt;sup&amp;gt;5&amp;lt;/sup&amp;gt;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| CUPS&lt;br /&gt;
| cups headers. Provided by a cups-devel package or a libcups2-devel&lt;br /&gt;
&lt;br /&gt;
note: not for Windows&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| PAM&lt;br /&gt;
| PAM support. Provided by a pam-devel package or a libpam-dev&lt;br /&gt;
&lt;br /&gt;
note: not for Windows&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| Apache Ant &lt;br /&gt;
| [http://ant.apache.org/ Ant 1.9 or later] (see note)&lt;br /&gt;
| --with-ant-home=&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| Archiver&lt;br /&gt;
| zip and unzip - note: for Windows zip and unzip will be installed as part of the cygwin environment.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| gperf&lt;br /&gt;
| [http://www.gnu.org/software/gperf/gperf.html gperf] tool - note: for Windows gperf will be installed as part of the cygwin environment.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| NSS&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;&lt;br /&gt;
| For Windows the Mozilla build tools&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; are needed to build the nss module. They can be obtained [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/ here].&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| unowinreg.dll&lt;br /&gt;
| [http://tools.openoffice.org/unowinreg_prebuild/680/unowinreg.dll pre-built unowinreg.dll] (see note)&lt;br /&gt;
Without this file, configure will try to set up cross-compiling with windows.&lt;br /&gt;
note: Not for windows. Required on all non-windows platforms. Download with: &lt;br /&gt;
    cd $SRC/main &amp;amp;&amp;amp;  wget -O external/unowinreg/unowinreg.dll http://tools.openoffice.org/unowinreg_prebuild/680/unowinreg.dll&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Notes:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
# The nss module (&amp;quot;Network Security Services&amp;quot;) provides security services needed for e.g. password protection. NSS can be disabled using the configure switch &amp;lt;tt&amp;gt;--disable-nss-module&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# NSS is provided by the Mozilla project. Building it on Windows requires the [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32 MozillaBuild tools]. Get the latest version, install it and use the configure switch &amp;lt;tt&amp;gt;--with-mozilla-build&amp;lt;/tt&amp;gt; to tell configure where the tools are installed. For example: &amp;lt;tt&amp;gt;--with-mozilla-build=c:/mozilla-build&amp;lt;/tt&amp;gt;&lt;br /&gt;
# Please note that CPAN is not able to deal with usernames containing spaces. To work around this fact, when CPAN asks you to specify the CPAN build and cache directory, change the default suggestion to /cpan.&lt;br /&gt;
# Apache Ant: Assure a proper ant set-up by downloading and installing ant, in total, from the ant site linked above. If you are a Linux developer, your distro may not have ant setup correctly for building Apache OpenOffice.&lt;br /&gt;
# Use &amp;lt;tt&amp;gt;./configure --help&amp;lt;/tt&amp;gt; to see all possible configuration options&lt;br /&gt;
&lt;br /&gt;
See also the platform specific requirements for&lt;br /&gt;
*[[Documentation/Building_Guide_AOO/Building_on_Windows|Windows]]&lt;br /&gt;
*[[Documentation/Building_Guide_AOO/Building_on_Linux|Linux]]&lt;br /&gt;
*[[Documentation/Building_Guide_AOO/Building_on_MacOsX|MacOSX]]&lt;br /&gt;
&lt;br /&gt;
==Configuration and bootstrapping==&lt;br /&gt;
This is typically done only once after the source code is checked out.  Repeat this after changing your mind about options given to configure.&lt;br /&gt;
&lt;br /&gt;
The call to&lt;br /&gt;
   autoconf&lt;br /&gt;
creates the main/configure script from main/configure.in and some other input files.&lt;br /&gt;
&lt;br /&gt;
The set of options/switches given to configure depends on the platform and your choice of features. To see all configure options for your system, type:&lt;br /&gt;
  configure --help&lt;br /&gt;
&lt;br /&gt;
A typical configuration call starts like this --&lt;br /&gt;
    configure                                                                                   \&lt;br /&gt;
        --with-dmake-url=http://dmake.apache-extras.org.codespot.com/files/dmake-4.12.tar.bz2 \&lt;br /&gt;
        --with-epm-url=http://www.msweet.org/files/project2/epm-3.7-source.tar.gz                \&lt;br /&gt;
It tells configure where to find the source code of external tools dmake and epm.&lt;br /&gt;
&lt;br /&gt;
By default only source code under [http://www.apache.org/legal/3party.html#category-a category A] licenses is compiled and included.  Besides the Apache License 2.0 this includes for example BSD and MIT/X11 license.  If you want to enable features that rely on third party code under [http://www.apache.org/legal/3party.html#category-b category B] licenses (like MPL, CPL, EPL, etc) then add the option&lt;br /&gt;
        --enable-category-b&lt;br /&gt;
&lt;br /&gt;
For inclusion of externally hosted dictionary extensions add option&lt;br /&gt;
        --enable-bundled-dictionaries&lt;br /&gt;
Note that dictionaries rely on a category B third party library (hunspell). Therefore &amp;lt;code&amp;gt;--enable-category-b&amp;lt;/code&amp;gt; is a prerequisite for &amp;lt;code&amp;gt;--enable-bundled-dictionaries&amp;lt;/code&amp;gt;. Dictionaries have a variety of licenses and are bundled without modification: they are not compiled.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--with-lang&amp;lt;/code&amp;gt; option will introduce the build of additional language resources. This switch accepts one or more RFC 1766 language tags as arguments, unfortunately not all languages are supported. Check the &amp;lt;code&amp;gt;[http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/inc/langlist.mk?view=markup solenv/inc/langlist.mk]&amp;lt;/code&amp;gt; file for all the currently supported language tags. The environment variable WITH_LANG will then contain the language tags of the additional (en-US will always be build) languages. Example:&lt;br /&gt;
        --with-lang=&amp;quot;de fr&amp;quot;&lt;br /&gt;
enables the build of the localized German and French version.&lt;br /&gt;
&lt;br /&gt;
To build with symbolic generation, add option&lt;br /&gt;
        --enable-symbols&lt;br /&gt;
This would allow you to work with debugging symbols in gdb.&lt;br /&gt;
&lt;br /&gt;
By default the result binaries will be packaged in the default format used by your OS/Distribution. Sometimes you might need a &amp;#039;installed&amp;#039; format so that all files were put into installset directory. Add option&lt;br /&gt;
        --with-package-format=&amp;quot;installed&amp;quot;&lt;br /&gt;
This will speed up development process since it skipped packaging. In some cases, packaging rips the debugging symbol so this would be necessary for symbolic generation.&lt;br /&gt;
&lt;br /&gt;
You can run the rat scan while building with option&lt;br /&gt;
         --with-rat-scan&lt;br /&gt;
[[Documentation/Building_Guide_AOO/Rat_Scan|Here]] you can find details of the rat scan.&lt;br /&gt;
&lt;br /&gt;
Finish this step by running&lt;br /&gt;
    ./bootstrap&lt;br /&gt;
This will build dmake and epm, download missing source code tar balls of external libraries, and download missing external dictionary extensions.&lt;br /&gt;
&lt;br /&gt;
==Building==&lt;br /&gt;
Start by including the environment variables prepared by configure into your current environment with&lt;br /&gt;
   &amp;lt;tt&amp;gt;source &amp;lt;shell-script-name&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
where &amp;lt;shell-script-name&amp;gt; depends on your platform:&lt;br /&gt;
{| class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!platform id&lt;br /&gt;
!&amp;lt;shell-script-name&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| wntmsci12&lt;br /&gt;
| winenv.set.sh&lt;br /&gt;
|-&lt;br /&gt;
| unxlngi6&lt;br /&gt;
| LinuxX86Env.Set.sh&lt;br /&gt;
|-&lt;br /&gt;
| unxlngx6&lt;br /&gt;
| LinuxX86-64Env.Set.sh&lt;br /&gt;
|-&lt;br /&gt;
| unxmacci&lt;br /&gt;
| MacOSXX64Env.Set.sh&lt;br /&gt;
|}&lt;br /&gt;
Look into main/set_soenv for more platforms. (search for lines &amp;lt;code&amp;gt;$OUTPATH = &amp;quot;&amp;lt;platform&amp;gt;&amp;quot;;&amp;lt;/code&amp;gt; and the nearby line &amp;lt;code&amp;gt;$outfile = &amp;quot;&amp;lt;shell-script-name&amp;gt;&amp;quot;;&amp;lt;/code&amp;gt;.  Add the suffix &amp;lt;code&amp;gt;.sh&amp;lt;/code&amp;gt; for the bash variant.&lt;br /&gt;
&lt;br /&gt;
If you want to build the whole office and the install sets then&lt;br /&gt;
    cd main/instsetoo_native&lt;br /&gt;
    build --all&lt;br /&gt;
You may want to experiment with the -P options for multi process builds to reduce the build time.&lt;br /&gt;
    build --all -P&amp;lt;m&amp;gt; -- -P&amp;lt;n&amp;gt;&lt;br /&gt;
tells build to use &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; processes (build up to &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; modules in parallel) and &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; threads for each module.&lt;br /&gt;
&lt;br /&gt;
Details about creating installation sets can be found [[Building_installation_packages|here]].&lt;br /&gt;
&lt;br /&gt;
Building Apache OpenOffice uses a custom build command, build.pl, located in /main/solenv/bin.&lt;br /&gt;
You may find it helpful to learn more about build options from the [http://www.openoffice.org/tools/tools/build.html Build Documentation]&lt;br /&gt;
&lt;br /&gt;
==Partial Builds==&lt;br /&gt;
&lt;br /&gt;
Building the whole office takes a lot of time.  Therefore it may be preferable to build only parts after making changes to the source code.&lt;br /&gt;
There are two different types of partial builds:&lt;br /&gt;
;Compatible:Can be used only when the code changes do not change exported interfaces. Use with care and only when you know what you are doing.&lt;br /&gt;
;Incompatible:Use for code changes that modify exported C++ or IDL interfaces, that modify resources that are used by other modules, or when you are not sure.&lt;br /&gt;
:If you are a new developer, you should probably always assume your changes are &amp;quot;incompatible&amp;quot; and follow the instructions for &amp;#039;&amp;#039;&amp;#039;Incompatible Build&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
===Make Systems Used by Apache OpenOffice===&lt;br /&gt;
&lt;br /&gt;
For the following Build sections you should be aware that Apache OpenOffice uses two different &amp;#039;&amp;#039;&amp;#039;make&amp;#039;&amp;#039;&amp;#039; systems to build its modules.&lt;br /&gt;
*The older one is based on dmake&lt;br /&gt;
*The other and newer one is based on GNU make.  This system is often referred to as gbuild.&lt;br /&gt;
When a module contains, among others, a Makefile and a Module_&amp;lt;module&amp;gt;.mk file then it is a gbuild module.&lt;br /&gt;
&lt;br /&gt;
===Compatible Build===&lt;br /&gt;
&lt;br /&gt;
After changing code in module &amp;lt;module&amp;gt; which does not change any exported interfaces do&lt;br /&gt;
{|class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!dmake&lt;br /&gt;
!gbuild&lt;br /&gt;
|-&lt;br /&gt;
|  &lt;br /&gt;
    cd &amp;lt;module&amp;gt;&lt;br /&gt;
    build&lt;br /&gt;
    deliver&lt;br /&gt;
|&lt;br /&gt;
    cd &amp;lt;module&amp;gt;&lt;br /&gt;
    make -sr&lt;br /&gt;
No explicit call to &amp;lt;code&amp;gt;deliver&amp;lt;/code&amp;gt; is necessary for gbuild modules.&lt;br /&gt;
|}&lt;br /&gt;
to compile and deliver the resulting libraries to &amp;lt;code&amp;gt;main/solver/&amp;lt;/code&amp;gt;.  You may want to erase the output of a previous compilation:&lt;br /&gt;
{|class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!dmake&lt;br /&gt;
!gbuild&lt;br /&gt;
|-&lt;br /&gt;
|  &lt;br /&gt;
    cd &amp;lt;module&amp;gt;&lt;br /&gt;
    build --from &amp;lt;module&amp;gt; --prepare&lt;br /&gt;
or faster (but without the un-deliver)&lt;br /&gt;
    cd &amp;lt;module&amp;gt;&lt;br /&gt;
    rm -fr &amp;lt;platform&amp;gt;/&lt;br /&gt;
| &lt;br /&gt;
    cd &amp;lt;module&amp;gt;&lt;br /&gt;
    make clean&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Incompatible Build===&lt;br /&gt;
&lt;br /&gt;
Modifications that change exported interfaces require not only the module to be rebuild that contains the modified code.  All depending modules (dependencies are defined in &amp;lt;code&amp;gt;&amp;lt;module&amp;gt;/prj/build.lst&amp;lt;/code&amp;gt;) have to be rebuild as well.  This is best done from &amp;lt;code&amp;gt;main/instsetoo_native/&amp;lt;/code&amp;gt;:&lt;br /&gt;
  &amp;lt;tt&amp;gt;cd main/instsetoo_native/&amp;lt;/tt&amp;gt;&lt;br /&gt;
  &amp;lt;tt&amp;gt;build --from &amp;lt;incompatible-module&amp;gt; --prepare&amp;lt;/tt&amp;gt;&lt;br /&gt;
  &amp;lt;tt&amp;gt;build --from &amp;lt;incompatible-module&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second line removes the output of all modules that have to be recompiled. The drawback of this command is that the output of modules which are build via gbuild are not removed. Thus, the following additional command performed after the second one will do the trick:&lt;br /&gt;
  build --from &amp;lt;incompatible-module&amp;gt; --job=&amp;quot;make clean; make clean debug=t&amp;quot; --ignore&lt;br /&gt;
&lt;br /&gt;
===Frequently used options===&lt;br /&gt;
&lt;br /&gt;
In order to add debug information to libraries and executables, add the &amp;lt;code&amp;gt;debug&amp;lt;/code&amp;gt; switch to any &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; command:&lt;br /&gt;
{|class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!dmake&lt;br /&gt;
!gbuild&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
    cd &amp;lt;module&amp;gt;&lt;br /&gt;
    build debug=t&lt;br /&gt;
|&lt;br /&gt;
    cd &amp;lt;module&amp;gt;&lt;br /&gt;
    make -sr debug=t&lt;br /&gt;
|}&lt;br /&gt;
Remember that for the gbuild system you have to use the debug flag also when cleaning a module (otherwise eg the wrong precompiled headers are deleted and are not rebuilt):&lt;br /&gt;
    make clean debug=t&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can force make to rebuild dependency information by first deleting it with the depend option.  It would be rebuilt automatically with the next build:&lt;br /&gt;
{|class=&amp;quot;prettytable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!dmake&lt;br /&gt;
!gbuild&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
    cd &amp;lt;module&amp;gt;&lt;br /&gt;
    build depend=t&lt;br /&gt;
    build&lt;br /&gt;
|&lt;br /&gt;
    cd &amp;lt;module&amp;gt;&lt;br /&gt;
    make -sr depend=t&lt;br /&gt;
    make -sr&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= [http://wiki.openoffice.org/wiki/Documentation/Building_Guide_AOO/Step_by_step Step-by-Step Building Guide for Different Platforms] =&lt;br /&gt;
[[Category:Documentation]][[Category:Development]][[Category:Porting]]&lt;br /&gt;
&lt;br /&gt;
= Building Apache OpenOffice with an IDE =&lt;br /&gt;
== [https://wiki.openoffice.org/wiki/OpenOffice_and_Eclipse Building with Eclipse] ==&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Useful_XHTML_Tags&amp;diff=235303</id>
		<title>Documentation/DevGuide/AppendixB/Useful XHTML Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Useful_XHTML_Tags&amp;diff=235303"/>
		<updated>2014-06-15T00:09:11Z</updated>

		<summary type="html">&lt;p&gt;JZA: Source highlight&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/DevGuide/AppendixBTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|PrevPage=Documentation/DevGuide/AppendixB/Special Documentation Tags&lt;br /&gt;
|NextPage=Documentation/DevGuide/AppendixC/Universal Content Providers&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/DevGuideLanguages|Documentation/DevGuide/AppendixB/{{SUBPAGENAME}}}}&lt;br /&gt;
{{DISPLAYTITLE:Useful XHTML Tags}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
Only a few XHTML tags are required for writing the documentation in idl files. The most important ones are listed in this section.&lt;br /&gt;
&lt;br /&gt;
=== Paragraph: &amp;lt;nowiki&amp;gt;&amp;lt;p&amp;gt; ... &amp;lt;/p&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This tag marks a normal paragraph. Consider that line breaks and empty lines in the idl file do not cause a line break or a paragraph break in the layout version. Explicit paragraph break markups, are necessary.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|Do not use &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt; or CR/LF for marking paragraphs. CR and LF are ignored, except within &amp;lt;nowiki&amp;gt;&amp;lt;pre&amp;gt;...&amp;lt;/pre&amp;gt;&amp;lt;/nowiki&amp;gt; and &amp;lt;nowiki&amp;gt;&amp;lt;listing&amp;gt;...&amp;lt;/listing&amp;gt;&amp;lt;/nowiki&amp;gt; areas. The &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt; tag is only for rare cases of explicit linebreaks.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
  /** does this and that.&lt;br /&gt;
  &lt;br /&gt;
    This sentence should start with a &amp;quot;&amp;amp;lt;p&amp;amp;gt;&amp;quot;. If not, &lt;br /&gt;
    it still belongs to the previous paragraph!&lt;br /&gt;
  &lt;br /&gt;
    This still belongs to the first paragraph. &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    As this sentence is as well!&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Consider using &amp;lt;tt&amp;gt;&amp;amp;amp;lt;&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;&amp;amp;amp;gt;&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;, as shown in the example above.}}&lt;br /&gt;
&lt;br /&gt;
=== Line Break: &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This tag marks up a line break within the same paragraph. Consider line breaks and empty lines in the idl file do not cause a line break or a paragraph break when presented by the HTML browser. Explicit paragraph break markups are necessary.&lt;br /&gt;
&lt;br /&gt;
=== Unordered List: &amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; ... &amp;lt;/li&amp;gt;... &amp;lt;/ul&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags mark the beginning and end of an unordered list, as list items.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;source lang=html4strict&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the first item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the second item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the third item &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
results in a list similar to:&lt;br /&gt;
&lt;br /&gt;
* the first item&lt;br /&gt;
* the second item&lt;br /&gt;
* the third item&lt;br /&gt;
&lt;br /&gt;
=== Ordered List: &amp;lt;nowiki&amp;gt;&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; ... &amp;lt;/li&amp;gt;... &amp;lt;/ol&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags mark the beginning and end of an ordered list, as list items.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;source lang=html4strict&amp;gt;&amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the first item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the second item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the third item &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ol&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
results in a list similar to:&lt;br /&gt;
&lt;br /&gt;
1.the first item&lt;br /&gt;
&lt;br /&gt;
2.the second item&lt;br /&gt;
&lt;br /&gt;
3.the third item&lt;br /&gt;
&lt;br /&gt;
=== Definition List: &amp;lt;nowiki&amp;gt;&amp;lt;dl&amp;gt;&amp;lt;dt&amp;gt; ... &amp;lt;/dt&amp;gt;&amp;lt;dd&amp;gt; ... &amp;lt;/dd&amp;gt;... &amp;lt;/dl&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags mark the beginning and end of a definition list, the definition tags and the definition data. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;source lang=html4strict&amp;gt;&amp;lt;dl&amp;gt;&lt;br /&gt;
    &amp;lt;dt&amp;gt;the first item&amp;lt;/dt&amp;gt;&lt;br /&gt;
    &amp;lt;dd&amp;gt;asfd asdf asdf asdf asdf&amp;lt;/dd&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;dt&amp;gt;the second item&amp;lt;/dt&amp;gt;&lt;br /&gt;
    &amp;lt;dd&amp;gt;asfd asdf asdf asdf asdf&amp;lt;/dd&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;dt&amp;gt;the third item&amp;lt;/dt&amp;gt;&lt;br /&gt;
    &amp;lt;dd&amp;gt;asfd asdf asdf asdf asdf&amp;lt;/dd&amp;gt;&lt;br /&gt;
 &amp;lt;/dl&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
results in a list similar to:&lt;br /&gt;
&lt;br /&gt;
the first item&lt;br /&gt;
::asfd asdf asdf asdf asdf&lt;br /&gt;
the second item&lt;br /&gt;
::asfd asdf asdf asdf asdf&lt;br /&gt;
the third item&lt;br /&gt;
::asfd asdf asdf asdf asdf&lt;br /&gt;
&lt;br /&gt;
=== Table: &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;...&amp;lt;/td&amp;gt;...&amp;lt;/tr&amp;gt;...&amp;lt;/table&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Defines a table with rows (tr) and columns (td).&lt;br /&gt;
&lt;br /&gt;
=== Strong Emphasis: &amp;lt;nowiki&amp;gt;&amp;lt;strong&amp;gt; ... &amp;lt;/strong&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags present a piece of text that is emphasized. In most cases this is bold, but the HTML-client defines what it actually is.&lt;br /&gt;
&lt;br /&gt;
=== Slight Emphasis: &amp;lt;nowiki&amp;gt;&amp;lt;em&amp;gt; ... &amp;lt;/em&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags present a piece of text emphasized slightly. In most cases this is italic, but the HTML-client defines what it actually is .&lt;br /&gt;
&lt;br /&gt;
=== Anchor: &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;...&amp;quot;&amp;gt; ... &amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags specify a link to external documentation. The first &amp;quot;...&amp;quot; specifies the URL.&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide/Appendix]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Useful_XHTML_Tags&amp;diff=235302</id>
		<title>Documentation/DevGuide/AppendixB/Useful XHTML Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Useful_XHTML_Tags&amp;diff=235302"/>
		<updated>2014-06-15T00:07:45Z</updated>

		<summary type="html">&lt;p&gt;JZA: /* Unordered List:  ... ...  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/DevGuide/AppendixBTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|PrevPage=Documentation/DevGuide/AppendixB/Special Documentation Tags&lt;br /&gt;
|NextPage=Documentation/DevGuide/AppendixC/Universal Content Providers&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/DevGuideLanguages|Documentation/DevGuide/AppendixB/{{SUBPAGENAME}}}}&lt;br /&gt;
{{DISPLAYTITLE:Useful XHTML Tags}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
Only a few XHTML tags are required for writing the documentation in idl files. The most important ones are listed in this section.&lt;br /&gt;
&lt;br /&gt;
=== Paragraph: &amp;lt;nowiki&amp;gt;&amp;lt;p&amp;gt; ... &amp;lt;/p&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This tag marks a normal paragraph. Consider that line breaks and empty lines in the idl file do not cause a line break or a paragraph break in the layout version. Explicit paragraph break markups, are necessary.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|Do not use &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt; or CR/LF for marking paragraphs. CR and LF are ignored, except within &amp;lt;nowiki&amp;gt;&amp;lt;pre&amp;gt;...&amp;lt;/pre&amp;gt;&amp;lt;/nowiki&amp;gt; and &amp;lt;nowiki&amp;gt;&amp;lt;listing&amp;gt;...&amp;lt;/listing&amp;gt;&amp;lt;/nowiki&amp;gt; areas. The &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt; tag is only for rare cases of explicit linebreaks.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
  /** does this and that.&lt;br /&gt;
  &lt;br /&gt;
    This sentence should start with a &amp;quot;&amp;amp;lt;p&amp;amp;gt;&amp;quot;. If not, &lt;br /&gt;
    it still belongs to the previous paragraph!&lt;br /&gt;
  &lt;br /&gt;
    This still belongs to the first paragraph. &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    As this sentence is as well!&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Consider using &amp;lt;tt&amp;gt;&amp;amp;amp;lt;&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;&amp;amp;amp;gt;&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;, as shown in the example above.}}&lt;br /&gt;
&lt;br /&gt;
=== Line Break: &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This tag marks up a line break within the same paragraph. Consider line breaks and empty lines in the idl file do not cause a line break or a paragraph break when presented by the HTML browser. Explicit paragraph break markups are necessary.&lt;br /&gt;
&lt;br /&gt;
=== Unordered List: &amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; ... &amp;lt;/li&amp;gt;... &amp;lt;/ul&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags mark the beginning and end of an unordered list, as list items.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;source lang=html4strict&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the first item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the second item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the third item &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
results in a list similar to:&lt;br /&gt;
&lt;br /&gt;
* the first item&lt;br /&gt;
* the second item&lt;br /&gt;
* the third item&lt;br /&gt;
&lt;br /&gt;
=== Ordered List: &amp;lt;nowiki&amp;gt;&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; ... &amp;lt;/li&amp;gt;... &amp;lt;/ol&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags mark the beginning and end of an ordered list, as list items.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;source lang=html4&amp;gt;&amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the first item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the second item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the third item &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ol&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
results in a list similar to:&lt;br /&gt;
&lt;br /&gt;
1.the first item&lt;br /&gt;
&lt;br /&gt;
2.the second item&lt;br /&gt;
&lt;br /&gt;
3.the third item&lt;br /&gt;
&lt;br /&gt;
=== Definition List: &amp;lt;nowiki&amp;gt;&amp;lt;dl&amp;gt;&amp;lt;dt&amp;gt; ... &amp;lt;/dt&amp;gt;&amp;lt;dd&amp;gt; ... &amp;lt;/dd&amp;gt;... &amp;lt;/dl&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags mark the beginning and end of a definition list, the definition tags and the definition data. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;source lang=html4&amp;gt;&amp;lt;dl&amp;gt;&lt;br /&gt;
    &amp;lt;dt&amp;gt;the first item&amp;lt;/dt&amp;gt;&lt;br /&gt;
    &amp;lt;dd&amp;gt;asfd asdf asdf asdf asdf&amp;lt;/dd&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;dt&amp;gt;the second item&amp;lt;/dt&amp;gt;&lt;br /&gt;
    &amp;lt;dd&amp;gt;asfd asdf asdf asdf asdf&amp;lt;/dd&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;dt&amp;gt;the third item&amp;lt;/dt&amp;gt;&lt;br /&gt;
    &amp;lt;dd&amp;gt;asfd asdf asdf asdf asdf&amp;lt;/dd&amp;gt;&lt;br /&gt;
 &amp;lt;/dl&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
results in a list similar to:&lt;br /&gt;
&lt;br /&gt;
the first item&lt;br /&gt;
::asfd asdf asdf asdf asdf&lt;br /&gt;
the second item&lt;br /&gt;
::asfd asdf asdf asdf asdf&lt;br /&gt;
the third item&lt;br /&gt;
::asfd asdf asdf asdf asdf&lt;br /&gt;
&lt;br /&gt;
=== Table: &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;...&amp;lt;/td&amp;gt;...&amp;lt;/tr&amp;gt;...&amp;lt;/table&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Defines a table with rows (tr) and columns (td).&lt;br /&gt;
&lt;br /&gt;
=== Strong Emphasis: &amp;lt;nowiki&amp;gt;&amp;lt;strong&amp;gt; ... &amp;lt;/strong&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags present a piece of text that is emphasized. In most cases this is bold, but the HTML-client defines what it actually is.&lt;br /&gt;
&lt;br /&gt;
=== Slight Emphasis: &amp;lt;nowiki&amp;gt;&amp;lt;em&amp;gt; ... &amp;lt;/em&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags present a piece of text emphasized slightly. In most cases this is italic, but the HTML-client defines what it actually is .&lt;br /&gt;
&lt;br /&gt;
=== Anchor: &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;...&amp;quot;&amp;gt; ... &amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags specify a link to external documentation. The first &amp;quot;...&amp;quot; specifies the URL.&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide/Appendix]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Useful_XHTML_Tags&amp;diff=235301</id>
		<title>Documentation/DevGuide/AppendixB/Useful XHTML Tags</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Useful_XHTML_Tags&amp;diff=235301"/>
		<updated>2014-06-15T00:05:57Z</updated>

		<summary type="html">&lt;p&gt;JZA: Html highlight&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/DevGuide/AppendixBTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|PrevPage=Documentation/DevGuide/AppendixB/Special Documentation Tags&lt;br /&gt;
|NextPage=Documentation/DevGuide/AppendixC/Universal Content Providers&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/DevGuideLanguages|Documentation/DevGuide/AppendixB/{{SUBPAGENAME}}}}&lt;br /&gt;
{{DISPLAYTITLE:Useful XHTML Tags}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
Only a few XHTML tags are required for writing the documentation in idl files. The most important ones are listed in this section.&lt;br /&gt;
&lt;br /&gt;
=== Paragraph: &amp;lt;nowiki&amp;gt;&amp;lt;p&amp;gt; ... &amp;lt;/p&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This tag marks a normal paragraph. Consider that line breaks and empty lines in the idl file do not cause a line break or a paragraph break in the layout version. Explicit paragraph break markups, are necessary.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|Do not use &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt; or CR/LF for marking paragraphs. CR and LF are ignored, except within &amp;lt;nowiki&amp;gt;&amp;lt;pre&amp;gt;...&amp;lt;/pre&amp;gt;&amp;lt;/nowiki&amp;gt; and &amp;lt;nowiki&amp;gt;&amp;lt;listing&amp;gt;...&amp;lt;/listing&amp;gt;&amp;lt;/nowiki&amp;gt; areas. The &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt; tag is only for rare cases of explicit linebreaks.&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
  /** does this and that.&lt;br /&gt;
  &lt;br /&gt;
    This sentence should start with a &amp;quot;&amp;amp;lt;p&amp;amp;gt;&amp;quot;. If not, &lt;br /&gt;
    it still belongs to the previous paragraph!&lt;br /&gt;
  &lt;br /&gt;
    This still belongs to the first paragraph. &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    As this sentence is as well!&lt;br /&gt;
  */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Consider using &amp;lt;tt&amp;gt;&amp;amp;amp;lt;&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;&amp;lt;&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;&amp;amp;amp;gt;&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;&amp;gt;&amp;lt;/tt&amp;gt;, as shown in the example above.}}&lt;br /&gt;
&lt;br /&gt;
=== Line Break: &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This tag marks up a line break within the same paragraph. Consider line breaks and empty lines in the idl file do not cause a line break or a paragraph break when presented by the HTML browser. Explicit paragraph break markups are necessary.&lt;br /&gt;
&lt;br /&gt;
=== Unordered List: &amp;lt;nowiki&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; ... &amp;lt;/li&amp;gt;... &amp;lt;/ul&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags mark the beginning and end of an unordered list, as list items.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;source lang=html4&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the first item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the second item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the third item &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ul&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
results in a list similar to:&lt;br /&gt;
&lt;br /&gt;
* the first item&lt;br /&gt;
* the second item&lt;br /&gt;
* the third item&lt;br /&gt;
&lt;br /&gt;
=== Ordered List: &amp;lt;nowiki&amp;gt;&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; ... &amp;lt;/li&amp;gt;... &amp;lt;/ol&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags mark the beginning and end of an ordered list, as list items.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;source lang=html4&amp;gt;&amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the first item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the second item &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;the third item &amp;lt;/li&amp;gt;&lt;br /&gt;
 &amp;lt;/ol&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
results in a list similar to:&lt;br /&gt;
&lt;br /&gt;
1.the first item&lt;br /&gt;
&lt;br /&gt;
2.the second item&lt;br /&gt;
&lt;br /&gt;
3.the third item&lt;br /&gt;
&lt;br /&gt;
=== Definition List: &amp;lt;nowiki&amp;gt;&amp;lt;dl&amp;gt;&amp;lt;dt&amp;gt; ... &amp;lt;/dt&amp;gt;&amp;lt;dd&amp;gt; ... &amp;lt;/dd&amp;gt;... &amp;lt;/dl&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags mark the beginning and end of a definition list, the definition tags and the definition data. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;source lang=html4&amp;gt;&amp;lt;dl&amp;gt;&lt;br /&gt;
    &amp;lt;dt&amp;gt;the first item&amp;lt;/dt&amp;gt;&lt;br /&gt;
    &amp;lt;dd&amp;gt;asfd asdf asdf asdf asdf&amp;lt;/dd&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;dt&amp;gt;the second item&amp;lt;/dt&amp;gt;&lt;br /&gt;
    &amp;lt;dd&amp;gt;asfd asdf asdf asdf asdf&amp;lt;/dd&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &amp;lt;dt&amp;gt;the third item&amp;lt;/dt&amp;gt;&lt;br /&gt;
    &amp;lt;dd&amp;gt;asfd asdf asdf asdf asdf&amp;lt;/dd&amp;gt;&lt;br /&gt;
 &amp;lt;/dl&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
results in a list similar to:&lt;br /&gt;
&lt;br /&gt;
the first item&lt;br /&gt;
::asfd asdf asdf asdf asdf&lt;br /&gt;
the second item&lt;br /&gt;
::asfd asdf asdf asdf asdf&lt;br /&gt;
the third item&lt;br /&gt;
::asfd asdf asdf asdf asdf&lt;br /&gt;
&lt;br /&gt;
=== Table: &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;...&amp;lt;/td&amp;gt;...&amp;lt;/tr&amp;gt;...&amp;lt;/table&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Defines a table with rows (tr) and columns (td).&lt;br /&gt;
&lt;br /&gt;
=== Strong Emphasis: &amp;lt;nowiki&amp;gt;&amp;lt;strong&amp;gt; ... &amp;lt;/strong&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags present a piece of text that is emphasized. In most cases this is bold, but the HTML-client defines what it actually is.&lt;br /&gt;
&lt;br /&gt;
=== Slight Emphasis: &amp;lt;nowiki&amp;gt;&amp;lt;em&amp;gt; ... &amp;lt;/em&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags present a piece of text emphasized slightly. In most cases this is italic, but the HTML-client defines what it actually is .&lt;br /&gt;
&lt;br /&gt;
=== Anchor: &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;...&amp;quot;&amp;gt; ... &amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These tags specify a link to external documentation. The first &amp;quot;...&amp;quot; specifies the URL.&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide/Appendix]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Special_Markups&amp;diff=235300</id>
		<title>Documentation/DevGuide/AppendixB/Special Markups</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Special_Markups&amp;diff=235300"/>
		<updated>2014-06-14T23:20:18Z</updated>

		<summary type="html">&lt;p&gt;JZA: /*  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/DevGuide/AppendixBTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|PrevPage=Documentation/DevGuide/AppendixB/Element Documentation&lt;br /&gt;
|NextPage=Documentation/DevGuide/AppendixB/Special Documentation Tags&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/DevGuideLanguages|Documentation/DevGuide/AppendixB/{{SUBPAGENAME}}}}&lt;br /&gt;
{{DISPLAYTITLE:Special Markups}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
These markup tags are evaluated by the XSL processor that generates a layout version of the documentation, that is, into HTML or XHTML. These tags have to be well formed and in pairs with exactly the same upper and lowercase, as well.&lt;br /&gt;
&lt;br /&gt;
To accentuate identifiers in the generated documentation and generate hyperlinks automatically when building the cross-reference table and checking consistency, all identifiers have to be marked up. Additionally, it is important for proofreading, because a single-word method name cannot be distinguished by a verb. Identifiers have to be excluded from re-editing by the proofreading editor.&lt;br /&gt;
&lt;br /&gt;
The following markups are used:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;atom&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup is used for identifiers of atomar types, such as long, short, and string. If a sequence or array of the type is referred to, add the attribute dim with the number of bracket-pairs representing the number of dimensions. &lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;atom&amp;gt;long&amp;lt;/atom&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an example of sequences, see &amp;lt;nowiki&amp;gt;&amp;lt;type&amp;gt;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;type&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup is used for identifiers of interfaces, services, typedefs, structs, exceptions, enums and constants-groups. If a sequence or array of the type is referred to, add the attribute dim with the number of bracket-pairs representing the number of dimensions.&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;type scope=&amp;quot;com::sun::star::uno&amp;quot;&amp;gt;XInterface&amp;lt;/type&amp;gt;&lt;br /&gt;
 &amp;lt;type dim=&amp;quot;[][]&amp;quot;&amp;gt;PropertyValue&amp;lt;/type&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;member&amp;gt;&amp;lt;/nowiki&amp;gt;  ===&lt;br /&gt;
&lt;br /&gt;
This markup substitutes the deprecated method, field and property markups, and is used for fields of structs and exceptions, properties in service specifications and methods of interfaces.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;member scope=&amp;quot;com::sun::star::uno&amp;quot;&amp;gt;XInterface::queryInterface()&amp;lt;/member&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;const&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup is used for symbolic constant identifiers of constant groups and enums.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;const scope=&amp;quot;...&amp;quot;&amp;gt;ParagraphAdjust::LEFT&amp;lt;/const&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;TRUE/&amp;gt;, &amp;lt;FALSE/&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These markups represent the atomic constant for the boolean values TRUE and FALSE.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  @returns&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;TRUE/&amp;gt; if the number is valid, otherwise &amp;lt;FALSE/&amp;gt;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;NULL/&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup represents the atomic constant for a NULL value.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;void/&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup represents the atomic type void. This is identical to &amp;lt;nowiki&amp;gt;&amp;lt;atom&amp;gt;void&amp;lt;/atom&amp;gt;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;code&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup is used for inline code.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;nowiki&amp;gt;&amp;lt;code&amp;gt;queryInterface( NULL )&amp;lt;/code&amp;gt;&amp;lt;/nowiki&amp;gt; for:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;listing&amp;gt;&lt;br /&gt;
  This markup is used for multiple line code examples.&lt;br /&gt;
  Example:&lt;br /&gt;
  @example StarBASIC&lt;br /&gt;
  &amp;lt;listing&amp;gt;&lt;br /&gt;
  aCmp = StarDesktop.loadComponentFromURL( ... )&lt;br /&gt;
  if ( isnull(aCmp) )&lt;br /&gt;
  ....&lt;br /&gt;
  endif&lt;br /&gt;
  &amp;lt;/listing&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide/Appendix]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Special_Markups&amp;diff=235299</id>
		<title>Documentation/DevGuide/AppendixB/Special Markups</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Special_Markups&amp;diff=235299"/>
		<updated>2014-06-14T23:19:20Z</updated>

		<summary type="html">&lt;p&gt;JZA: Source highlited&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/DevGuide/AppendixBTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|PrevPage=Documentation/DevGuide/AppendixB/Element Documentation&lt;br /&gt;
|NextPage=Documentation/DevGuide/AppendixB/Special Documentation Tags&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/DevGuideLanguages|Documentation/DevGuide/AppendixB/{{SUBPAGENAME}}}}&lt;br /&gt;
{{DISPLAYTITLE:Special Markups}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
These markup tags are evaluated by the XSL processor that generates a layout version of the documentation, that is, into HTML or XHTML. These tags have to be well formed and in pairs with exactly the same upper and lowercase, as well.&lt;br /&gt;
&lt;br /&gt;
To accentuate identifiers in the generated documentation and generate hyperlinks automatically when building the cross-reference table and checking consistency, all identifiers have to be marked up. Additionally, it is important for proofreading, because a single-word method name cannot be distinguished by a verb. Identifiers have to be excluded from re-editing by the proofreading editor.&lt;br /&gt;
&lt;br /&gt;
The following markups are used:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;atom&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup is used for identifiers of atomar types, such as long, short, and string. If a sequence or array of the type is referred to, add the attribute dim with the number of bracket-pairs representing the number of dimensions. &lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;atom&amp;gt;long&amp;lt;/atom&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For an example of sequences, see &amp;lt;nowiki&amp;gt;&amp;lt;type&amp;gt;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;type&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup is used for identifiers of interfaces, services, typedefs, structs, exceptions, enums and constants-groups. If a sequence or array of the type is referred to, add the attribute dim with the number of bracket-pairs representing the number of dimensions.&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;type scope=&amp;quot;com::sun::star::uno&amp;quot;&amp;gt;XInterface&amp;lt;/type&amp;gt;&lt;br /&gt;
 &amp;lt;type dim=&amp;quot;[][]&amp;quot;&amp;gt;PropertyValue&amp;lt;/type&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;member&amp;gt;&amp;lt;/nowiki&amp;gt;  ===&lt;br /&gt;
&lt;br /&gt;
This markup substitutes the deprecated method, field and property markups, and is used for fields of structs and exceptions, properties in service specifications and methods of interfaces.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;member scope=&amp;quot;com::sun::star::uno&amp;quot;&amp;gt;XInterface::queryInterface()&amp;lt;/member&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;const&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup is used for symbolic constant identifiers of constant groups and enums.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;const scope=&amp;quot;...&amp;quot;&amp;gt;ParagraphAdjust::LEFT&amp;lt;/const&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;TRUE/&amp;gt;, &amp;lt;FALSE/&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
These markups represent the atomic constant for the boolean values TRUE and FALSE.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
  @returns&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;TRUE/&amp;gt; if the number is valid, otherwise &amp;lt;FALSE/&amp;gt;.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;NULL/&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup represents the atomic constant for a NULL value.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;void/&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup represents the atomic type void. This is identical to &amp;lt;nowiki&amp;gt;&amp;lt;atom&amp;gt;void&amp;lt;/atom&amp;gt;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;nowiki&amp;gt;&amp;lt;code&amp;gt;&amp;lt;/nowiki&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This markup is used for inline code.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;nowiki&amp;gt;&amp;lt;code&amp;gt;queryInterface( NULL )&amp;lt;/code&amp;gt;&amp;lt;/nowiki&amp;gt; for:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;listing&amp;gt;&lt;br /&gt;
  This markup is used for multiple line code examples.&lt;br /&gt;
  Example:&lt;br /&gt;
  @example StarBASIC&lt;br /&gt;
  &amp;lt;listing&amp;gt;&lt;br /&gt;
  aCmp = StarDesktop.loadComponentFromURL( ... )&lt;br /&gt;
  if ( isnull(aCmp) )&lt;br /&gt;
  ....&lt;br /&gt;
  endif&lt;br /&gt;
  &amp;lt;/listing&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide/Appendix]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Element_Documentation&amp;diff=235298</id>
		<title>Documentation/DevGuide/AppendixB/Element Documentation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Element_Documentation&amp;diff=235298"/>
		<updated>2014-06-14T22:43:40Z</updated>

		<summary type="html">&lt;p&gt;JZA: Cpp source hightlight&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/DevGuide/AppendixBTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|PrevPage=Documentation/DevGuide/AppendixB/File structure&lt;br /&gt;
|NextPage=Documentation/DevGuide/AppendixB/Special Markups&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/DevGuideLanguages|Documentation/DevGuide/AppendixB/{{SUBPAGENAME}}}}&lt;br /&gt;
{{DISPLAYTITLE:Element Documentation}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
=== General Element Documentation ===&lt;br /&gt;
&lt;br /&gt;
Each element consists of three parts:&lt;br /&gt;
&lt;br /&gt;
# a summary paragraph with XHTML/XML markups&lt;br /&gt;
# the main description with XHTML/XML markups&lt;br /&gt;
# extra parts formed by @-tags&lt;br /&gt;
&lt;br /&gt;
==== Summary Paragraph ====&lt;br /&gt;
&lt;br /&gt;
The first part ending with an XHTML paragraph tag, that is, &amp;lt;nowiki&amp;gt;&amp;lt;p&amp;gt;, &amp;lt;dl&amp;gt;, &amp;lt;ul&amp;gt;, &amp;lt;ol&amp;gt;&amp;lt;/nowiki&amp;gt; etc.) or &amp;quot;@...&amp;quot; tag, is used as the summary in indexes.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|In contrast to JavaDoc, the first sentence is not used for the summary, but the first paragraph.}}&lt;br /&gt;
&lt;br /&gt;
The first sentence begins with a lowercase letter if the name of the described element is the implied noun. In this case, the sentence must be logical when reading it with that name. Sometimes an auxiliary verb. in the most cases &amp;quot;is&amp;quot;, has to be inserted.&lt;br /&gt;
&lt;br /&gt;
==== Main Description ====&lt;br /&gt;
&lt;br /&gt;
Between the summary paragraph and the &amp;quot;@...&amp;quot; tag there should be a clear and complete description about the declared element. This part must be delimited from the summary paragraph with an XHTML paragraph tag, including &amp;quot;&amp;lt;nowiki&amp;gt;&amp;lt;dl&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;quot; and &amp;quot;&amp;lt;nowiki&amp;gt;&amp;lt;ol&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;quot;, that are starting a new paragraph.&lt;br /&gt;
&lt;br /&gt;
==== @-Tagged Part ====&lt;br /&gt;
&lt;br /&gt;
Put the @ tags at the end of each element&amp;#039;s documentation. The tags are dependent on the kind of element described. Each of the @-tag ends when the elements documentation ends or the next @-tag begins.&lt;br /&gt;
&lt;br /&gt;
The @author tag is superfluous, because the author is logged by the version control system. They are only used for {{PRODUCTNAME}} contributions if declarations are taken from other projects, such as Java.&lt;br /&gt;
&lt;br /&gt;
The @version tag, known from JavaDoc, is not valid, because there cannot be more than one version of any UNOIDL element, due to compatibility. &lt;br /&gt;
&lt;br /&gt;
On the same line behind the @-tag, only a single structural element is allowed. The parameter name is @param without the type and any attributes, the qualified exception is @throws , the qualified type is @see, and the programming language is @example. The @returns is by itself on the same line.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|Do not put normal text behind an @-tag on the same line:&lt;br /&gt;
&lt;br /&gt;
  /** ...&lt;br /&gt;
  &lt;br /&gt;
    @param nPos put nothing else but the argument name here!&lt;br /&gt;
    it is correct to put your documentation for the parameter here.&lt;br /&gt;
    &lt;br /&gt;
    @throws com::sun::star::beans::UnknownPropertyException nothing else here!&lt;br /&gt;
    when &amp;lt;nowiki&amp;gt;&amp;lt;var&amp;gt;aName&amp;lt;/var&amp;gt;&amp;lt;/nowiki&amp;gt; is not a known property.&lt;br /&gt;
  */  &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Example for a Major Element Documentation ===&lt;br /&gt;
&lt;br /&gt;
Each major element gets a header similar to the example shown below for an interface:&lt;br /&gt;
&amp;lt;source lang=Cpp&amp;gt;&lt;br /&gt;
  //===========================================================================&lt;br /&gt;
  /** controls lifetime of the object. Always needs a specified object owner.&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;nowiki&amp;gt;&amp;lt;p&amp;gt;&amp;lt;em&amp;gt;Logical&amp;lt;/em&amp;gt;&amp;lt;/nowiki&amp;gt; &amp;quot;Object&amp;quot; in this case means that the interfaces&lt;br /&gt;
    actually can be supported by internal (i.e. aggregated) physical&lt;br /&gt;
    objects. &amp;lt;nowiki&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    @see com::sun::star::uno::XInterface&lt;br /&gt;
      for further information.&lt;br /&gt;
  &lt;br /&gt;
    @since OOo 2.1.0&lt;br /&gt;
  */&lt;br /&gt;
  interface XComponent: XInterface&lt;br /&gt;
  {&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example for a Minor Element Documentation ===&lt;br /&gt;
&lt;br /&gt;
Each minor element gets a header similar to the example shown below for a method:&lt;br /&gt;
&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
  //------------------------------------------------------------------------&lt;br /&gt;
    /** adds an event listener to the object.&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;nowiki&amp;gt;&amp;lt;p&amp;gt;The broadcaster fires the disposing method of this listener if &lt;br /&gt;
    the &amp;lt;method&amp;gt;XComponent::dispose()&amp;lt;/method&amp;gt; method is called. &amp;lt;/p&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    @param xListener&lt;br /&gt;
    refers the the listener interface to be added.&lt;br /&gt;
  &lt;br /&gt;
    @returns&lt;br /&gt;
      &amp;lt;TRUE/&amp;gt; if the element is added, &amp;lt;FALSE/&amp;gt; otherwise.&lt;br /&gt;
  &lt;br /&gt;
    @see removeEventListener&lt;br /&gt;
    */&lt;br /&gt;
    boolean addEventListener( [in]XEventListener xListener );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide/Appendix]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Element_Documentation&amp;diff=235297</id>
		<title>Documentation/DevGuide/AppendixB/Element Documentation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/AppendixB/Element_Documentation&amp;diff=235297"/>
		<updated>2014-06-14T22:42:20Z</updated>

		<summary type="html">&lt;p&gt;JZA: Source hightlight&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/DevGuide/AppendixBTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|PrevPage=Documentation/DevGuide/AppendixB/File structure&lt;br /&gt;
|NextPage=Documentation/DevGuide/AppendixB/Special Markups&lt;br /&gt;
}}&lt;br /&gt;
{{Documentation/DevGuideLanguages|Documentation/DevGuide/AppendixB/{{SUBPAGENAME}}}}&lt;br /&gt;
{{DISPLAYTITLE:Element Documentation}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
=== General Element Documentation ===&lt;br /&gt;
&lt;br /&gt;
Each element consists of three parts:&lt;br /&gt;
&lt;br /&gt;
# a summary paragraph with XHTML/XML markups&lt;br /&gt;
# the main description with XHTML/XML markups&lt;br /&gt;
# extra parts formed by @-tags&lt;br /&gt;
&lt;br /&gt;
==== Summary Paragraph ====&lt;br /&gt;
&lt;br /&gt;
The first part ending with an XHTML paragraph tag, that is, &amp;lt;nowiki&amp;gt;&amp;lt;p&amp;gt;, &amp;lt;dl&amp;gt;, &amp;lt;ul&amp;gt;, &amp;lt;ol&amp;gt;&amp;lt;/nowiki&amp;gt; etc.) or &amp;quot;@...&amp;quot; tag, is used as the summary in indexes.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|In contrast to JavaDoc, the first sentence is not used for the summary, but the first paragraph.}}&lt;br /&gt;
&lt;br /&gt;
The first sentence begins with a lowercase letter if the name of the described element is the implied noun. In this case, the sentence must be logical when reading it with that name. Sometimes an auxiliary verb. in the most cases &amp;quot;is&amp;quot;, has to be inserted.&lt;br /&gt;
&lt;br /&gt;
==== Main Description ====&lt;br /&gt;
&lt;br /&gt;
Between the summary paragraph and the &amp;quot;@...&amp;quot; tag there should be a clear and complete description about the declared element. This part must be delimited from the summary paragraph with an XHTML paragraph tag, including &amp;quot;&amp;lt;nowiki&amp;gt;&amp;lt;dl&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;quot; and &amp;quot;&amp;lt;nowiki&amp;gt;&amp;lt;ol&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;quot;, that are starting a new paragraph.&lt;br /&gt;
&lt;br /&gt;
==== @-Tagged Part ====&lt;br /&gt;
&lt;br /&gt;
Put the @ tags at the end of each element&amp;#039;s documentation. The tags are dependent on the kind of element described. Each of the @-tag ends when the elements documentation ends or the next @-tag begins.&lt;br /&gt;
&lt;br /&gt;
The @author tag is superfluous, because the author is logged by the version control system. They are only used for {{PRODUCTNAME}} contributions if declarations are taken from other projects, such as Java.&lt;br /&gt;
&lt;br /&gt;
The @version tag, known from JavaDoc, is not valid, because there cannot be more than one version of any UNOIDL element, due to compatibility. &lt;br /&gt;
&lt;br /&gt;
On the same line behind the @-tag, only a single structural element is allowed. The parameter name is @param without the type and any attributes, the qualified exception is @throws , the qualified type is @see, and the programming language is @example. The @returns is by itself on the same line.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|Do not put normal text behind an @-tag on the same line:&lt;br /&gt;
&lt;br /&gt;
  /** ...&lt;br /&gt;
  &lt;br /&gt;
    @param nPos put nothing else but the argument name here!&lt;br /&gt;
    it is correct to put your documentation for the parameter here.&lt;br /&gt;
    &lt;br /&gt;
    @throws com::sun::star::beans::UnknownPropertyException nothing else here!&lt;br /&gt;
    when &amp;lt;nowiki&amp;gt;&amp;lt;var&amp;gt;aName&amp;lt;/var&amp;gt;&amp;lt;/nowiki&amp;gt; is not a known property.&lt;br /&gt;
  */  &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Example for a Major Element Documentation ===&lt;br /&gt;
&lt;br /&gt;
Each major element gets a header similar to the example shown below for an interface:&lt;br /&gt;
&amp;lt;source lang=Cpp&amp;gt;&lt;br /&gt;
  //===========================================================================&lt;br /&gt;
  /** controls lifetime of the object. Always needs a specified object owner.&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;nowiki&amp;gt;&amp;lt;p&amp;gt;&amp;lt;em&amp;gt;Logical&amp;lt;/em&amp;gt;&amp;lt;/nowiki&amp;gt; &amp;quot;Object&amp;quot; in this case means that the interfaces&lt;br /&gt;
    actually can be supported by internal (i.e. aggregated) physical&lt;br /&gt;
    objects. &amp;lt;nowiki&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    @see com::sun::star::uno::XInterface&lt;br /&gt;
      for further information.&lt;br /&gt;
  &lt;br /&gt;
    @since OOo 2.1.0&lt;br /&gt;
  */&lt;br /&gt;
  interface XComponent: XInterface&lt;br /&gt;
  {&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Example for a Minor Element Documentation ===&lt;br /&gt;
&lt;br /&gt;
Each minor element gets a header similar to the example shown below for a method:&lt;br /&gt;
&lt;br /&gt;
  //------------------------------------------------------------------------&lt;br /&gt;
    /** adds an event listener to the object.&lt;br /&gt;
  &lt;br /&gt;
    &amp;lt;nowiki&amp;gt;&amp;lt;p&amp;gt;The broadcaster fires the disposing method of this listener if &lt;br /&gt;
    the &amp;lt;method&amp;gt;XComponent::dispose()&amp;lt;/method&amp;gt; method is called. &amp;lt;/p&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
    @param xListener&lt;br /&gt;
    refers the the listener interface to be added.&lt;br /&gt;
  &lt;br /&gt;
    @returns&lt;br /&gt;
      &amp;lt;TRUE/&amp;gt; if the element is added, &amp;lt;FALSE/&amp;gt; otherwise.&lt;br /&gt;
  &lt;br /&gt;
    @see removeEventListener&lt;br /&gt;
    */&lt;br /&gt;
    boolean addEventListener( [in]XEventListener xListener );&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation/Developer&amp;#039;s Guide/Appendix]]&lt;/div&gt;</summary>
		<author><name>JZA</name></author>
	</entry>
</feed>