[tryton-debian-vcs] openoffice-python branch upstream created. fd210b421351dac04f7673d845780dd8c41fa807

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Nov 27 16:46:18 UTC 2013


The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/openoffice-python.git;a=commitdiff;h=fd210b421351dac04f7673d845780dd8c41fa807
commit fd210b421351dac04f7673d845780dd8c41fa807
Author: Daniel Baumann <daniel at debian.org>
Date:   Sun Jul 10 15:34:33 2011 +0200

    Adding upstream version 0.1+20110209.

diff --git a/PKG-INFO b/PKG-INFO
index 73447b0..41ad18d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: openoffice-python
-Version: 0.1-20110129
+Version: 0.1-20110209
 Summary: Enhanced Python interfaces to OpenOffice.org
 Home-page: http://openoffice-python.origo.ethz.ch/
 Author: Hartmut Goebel
diff --git a/openoffice/officehelper.py b/openoffice/officehelper.py
index 26b4f72..a4bd254 100644
--- a/openoffice/officehelper.py
+++ b/openoffice/officehelper.py
@@ -67,6 +67,7 @@ def _build_cmd_args(connectString, unaccept=False):
             return __soffice_executable
         for p in [os.path.dirname(uno.__file__),
                   '/opt/libreoffice/program',
+                  '/usr/lib/libreoffice/program',
                   '/usr/lib/openoffice/program',
                   '/usr/lib/ooo/program',
                   '/usr/bin',
diff --git a/openoffice_python.egg-info/PKG-INFO b/openoffice_python.egg-info/PKG-INFO
index 73447b0..41ad18d 100644
--- a/openoffice_python.egg-info/PKG-INFO
+++ b/openoffice_python.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: openoffice-python
-Version: 0.1-20110129
+Version: 0.1-20110209
 Summary: Enhanced Python interfaces to OpenOffice.org
 Home-page: http://openoffice-python.origo.ethz.ch/
 Author: Hartmut Goebel
diff --git a/setup.cfg b/setup.cfg
index 8ef0fea..a9ba4bd 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,7 +6,7 @@ doc_files = README
 formats = bztar
 
 [egg_info]
-tag_build = -20110129
+tag_build = -20110209
 tag_date = 0
 tag_svn_revision = 0
 
commit 3c5f35c97f311c42efc629bd767fbd39fc509118
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Feb 6 14:23:58 2011 +0100

    Adding upstream version 0.1+20110129.

diff --git a/PKG-INFO b/PKG-INFO
index 3af3e35..73447b0 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,15 +1,42 @@
 Metadata-Version: 1.1
 Name: openoffice-python
-Version: 0.1-r34-20090228
+Version: 0.1-20110129
 Summary: Enhanced Python interfaces to OpenOffice.org
 Home-page: http://openoffice-python.origo.ethz.ch/
 Author: Hartmut Goebel
 Author-email: h.goebel at goebel-consult.de
 License: GPLv3
 Download-URL: http://openoffice-python.origo.ethz.ch/download
-Description: UNKNOWN
+Description: =========================
+        openoffice-python
+        =========================
+        ------------------------------------------------------------
+        Python libraries for interacting with OpenOffice.org
+        ------------------------------------------------------------
+        
+        Homepage: http://openoffice-python.origo.ethz.ch/
+        
+        Aim of this project is to support
+        
+            * users writing complex macros for OpenOffice in Python
+        
+            * developers interacting with OpenOffice from outside (eg. use
+              OpenOffice to print a file)
+        
+        The library is designed to supports both writing macros (called by
+        OOo) and interacting with OOo from an external Python programm (using
+        the UNO bridge).
+        
+        The "UNO bridge" side is meant to implement a more Pythonic and
+        high-level interface than Danny Bewers OOoLib. While the "Macro" side
+        is meant to support writing macros. Well, there will be a big
+        intersection between these parts :-)
+        
+        For more information, eg. related projects, please visit
+        <http://openoffice-python.origo.ethz.ch/>.
+        
 Platform: POSIX
-Classifier: Development Status :: 3 - Beta
+Classifier: Development Status :: 4 - Beta
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: GNU General Public License (GPL)
 Classifier: Operating System :: POSIX
diff --git a/openoffice/officehelper.py b/openoffice/officehelper.py
index 2725224..26b4f72 100644
--- a/openoffice/officehelper.py
+++ b/openoffice/officehelper.py
@@ -66,7 +66,9 @@ def _build_cmd_args(connectString, unaccept=False):
         if __soffice_executable:
             return __soffice_executable
         for p in [os.path.dirname(uno.__file__),
+                  '/opt/libreoffice/program',
                   '/usr/lib/openoffice/program',
+                  '/usr/lib/ooo/program',
                   '/usr/bin',
                   '/usr/local/bin',
                   ]:
@@ -74,6 +76,7 @@ def _build_cmd_args(connectString, unaccept=False):
             if os.path.exists(office):
                 break
         else:
+            import glob
             pathes = glob.glob('/usr/lib/ooo-[234].*/program/soffice')
             if not pathes:
                 raise BootstrapExceptions('soffice executable not found')
diff --git a/openoffice_python.egg-info/PKG-INFO b/openoffice_python.egg-info/PKG-INFO
index 3af3e35..73447b0 100644
--- a/openoffice_python.egg-info/PKG-INFO
+++ b/openoffice_python.egg-info/PKG-INFO
@@ -1,15 +1,42 @@
 Metadata-Version: 1.1
 Name: openoffice-python
-Version: 0.1-r34-20090228
+Version: 0.1-20110129
 Summary: Enhanced Python interfaces to OpenOffice.org
 Home-page: http://openoffice-python.origo.ethz.ch/
 Author: Hartmut Goebel
 Author-email: h.goebel at goebel-consult.de
 License: GPLv3
 Download-URL: http://openoffice-python.origo.ethz.ch/download
-Description: UNKNOWN
+Description: =========================
+        openoffice-python
+        =========================
+        ------------------------------------------------------------
+        Python libraries for interacting with OpenOffice.org
+        ------------------------------------------------------------
+        
+        Homepage: http://openoffice-python.origo.ethz.ch/
+        
+        Aim of this project is to support
+        
+            * users writing complex macros for OpenOffice in Python
+        
+            * developers interacting with OpenOffice from outside (eg. use
+              OpenOffice to print a file)
+        
+        The library is designed to supports both writing macros (called by
+        OOo) and interacting with OOo from an external Python programm (using
+        the UNO bridge).
+        
+        The "UNO bridge" side is meant to implement a more Pythonic and
+        high-level interface than Danny Bewers OOoLib. While the "Macro" side
+        is meant to support writing macros. Well, there will be a big
+        intersection between these parts :-)
+        
+        For more information, eg. related projects, please visit
+        <http://openoffice-python.origo.ethz.ch/>.
+        
 Platform: POSIX
-Classifier: Development Status :: 3 - Beta
+Classifier: Development Status :: 4 - Beta
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: GNU General Public License (GPL)
 Classifier: Operating System :: POSIX
diff --git a/setup.cfg b/setup.cfg
index f79f6f6..8ef0fea 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,12 +6,12 @@ doc_files = README
 formats = bztar
 
 [egg_info]
-tag_build = -r34-20090228
+tag_build = -20110129
 tag_date = 0
 tag_svn_revision = 0
 
 [aliases]
 release = egg_info sdist bdist_egg bdist_msi register
-daily = egg_info --tag-date --tag-svn-revision sdist bdist_egg
+snapshot = egg_info --tag-date sdist bdist_egg register
 devel = develop --install-dir ~/lib/python/ --script-dir ~/bin
 
diff --git a/setup.py b/setup.py
index de741d7..5a5c7c7 100644
--- a/setup.py
+++ b/setup.py
@@ -16,6 +16,7 @@ if version < '2.2.3':
 setup(
     name='openoffice-python',
     description='Enhanced Python interfaces to OpenOffice.org',
+    long_description= open("README").read(),
     packages=['openoffice'],
     version='0.1',
     author='Hartmut Goebel',
@@ -25,7 +26,7 @@ setup(
     platforms=['POSIX'],
     license='GPLv3',
     classifiers=[
-        'Development Status :: 3 - Beta',
+        'Development Status :: 4 - Beta',
         'Intended Audience :: Developers',
         'License :: OSI Approved :: GNU General Public License (GPL)',
         'Operating System :: POSIX',
commit f9fb1f06795e8113ceeb9c90e121a79323ad5076
Author: Daniel Baumann <daniel at debian.org>
Date:   Sun Mar 22 13:34:38 2009 +0100

    Adding upstream version 0.1+r34.

diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..32d0415
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,15 @@
+
+* openoffice-python is licenced under the GNU GPL v3.
+
+* sample-scripts/PrintToWriter.py is licenced unter the GNU LGPL 2.1
+  (or at your option any later version)
+
+
+Abbreviations
+-------------------
+
+:GNU GPL v3: GNU General Public License version 3, see enclosed file
+      'LICENSE-gpl-3.0.txt'.
+
+:GNU LGPL: GNU Lesser General Public License, see
+       <http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>
diff --git a/LICENSE-gpl-3.0.txt b/LICENSE-gpl-3.0.txt
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/LICENSE-gpl-3.0.txt
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..23b1c22
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,3 @@
+include LICENSE-gpl-3.0.txt
+include MANIFEST.in
+exclude projectlogo.*
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..3af3e35
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,18 @@
+Metadata-Version: 1.1
+Name: openoffice-python
+Version: 0.1-r34-20090228
+Summary: Enhanced Python interfaces to OpenOffice.org
+Home-page: http://openoffice-python.origo.ethz.ch/
+Author: Hartmut Goebel
+Author-email: h.goebel at goebel-consult.de
+License: GPLv3
+Download-URL: http://openoffice-python.origo.ethz.ch/download
+Description: UNKNOWN
+Platform: POSIX
+Classifier: Development Status :: 3 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: Operating System :: POSIX
+Classifier: Programming Language :: Python
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires: python(>=2.3)
diff --git a/README b/README
new file mode 100644
index 0000000..b909306
--- /dev/null
+++ b/README
@@ -0,0 +1,27 @@
+=========================
+openoffice-python
+=========================
+------------------------------------------------------------
+Python libraries for interacting with OpenOffice.org
+------------------------------------------------------------
+
+Homepage: http://openoffice-python.origo.ethz.ch/
+
+Aim of this project is to support
+
+    * users writing complex macros for OpenOffice in Python
+
+    * developers interacting with OpenOffice from outside (eg. use
+      OpenOffice to print a file)
+
+The library is designed to supports both writing macros (called by
+OOo) and interacting with OOo from an external Python programm (using
+the UNO bridge).
+
+The "UNO bridge" side is meant to implement a more Pythonic and
+high-level interface than Danny Bewers OOoLib. While the "Macro" side
+is meant to support writing macros. Well, there will be a big
+intersection between these parts :-)
+
+For more information, eg. related projects, please visit
+<http://openoffice-python.origo.ethz.ch/>.
diff --git a/SConstruct b/SConstruct
new file mode 100644
index 0000000..e2a0d07
--- /dev/null
+++ b/SConstruct
@@ -0,0 +1,13 @@
+# -*- mode: python ; coding: utf-8 -*-
+#
+# Build requirements
+# - inkscape
+
+import os
+
+env = Environment()
+env.SConsignFile()
+
+# create PNG projectlogo for project homepage
+env.Command('projectlogo.png', 'projectlogo.svg',
+            'inkscape -z -f $SOURCE -e $TARGET --export-height=100')
diff --git a/openoffice/ListenerProcAdapters.py b/openoffice/ListenerProcAdapters.py
new file mode 100644
index 0000000..5b7babb
--- /dev/null
+++ b/openoffice/ListenerProcAdapters.py
@@ -0,0 +1,81 @@
+#**********************************************************************
+#
+#   Danny.OOo.Listeners.ListenerProcAdapters.py
+#
+#   A module to easily work with OpenOffice.org.
+#
+#**********************************************************************
+#   Copyright (c) 2003-2004 Danny Brewer
+#   d29583 at groovegarden.com
+#
+#   This library is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU Lesser General Public
+#   License as published by the Free Software Foundation; either
+#   version 2.1 of the License, or (at your option) any later version.
+#
+#   This library is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#   Lesser General Public License for more details.
+#
+#   You should have received a copy of the GNU Lesser General Public
+#   License along with this library; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#   See:  http://www.gnu.org/licenses/lgpl.html
+#
+#**********************************************************************
+#   If you make changes, please append to the change log below.
+#
+#   Change Log
+#   Danny Brewer         Revised 2004-06-05-01
+#
+#**********************************************************************
+
+
+# OOo's libraries
+import uno
+import unohelper
+from com.sun.star.awt import XActionListener, XItemListener, XTextListener
+
+__all__ = ['ActionListenerAdapter', 'ItemListenerAdapter',
+           'TextListenerAdapter']
+
+class __ProcAdapter_MixIn:
+    """An ActionListener adapter.
+
+    When actionPerformed is called, this will call an arbitrary python
+    procedure, with this signature:
+
+         procToCall(actionEvent, *args)
+
+    1. the oActionEvent
+    2. any other parameters you specified to this object's constructor
+       (as a tuple).
+    """
+    def __init__(self, procToCall, args=()):
+        self.procToCall = procToCall
+        self.args = args # additional arguments to be passed to procToCall
+        super(__ProcAdapter_MixIn, self).__init__()
+
+
+
+class ActionListenerAdapter(__ProcAdapter_MixIn, unohelper.Base, XActionListener):
+    """This class implements com.sun.star.awt.XActionListener."""
+    def actionPerformed(self, event):
+        # event is a com.sun.star.awt.ActionEvent struct.
+        return self.procToCall(event, *self.args)
+    
+class ItemListenerAdapter(__ProcAdapter_MixIn, unohelper.Base, XItemListener):
+    # This object implements com.sun.star.awt.XItemListener.
+
+    def itemStateChanged(self, event):
+        # event is a com.sun.star.awt.ItemEvent struct.
+        return self.procToCall(event, *self.args)
+
+class TextListenerAdapter(__ProcAdapter_MixIn, unohelper.Base, XTextListener):
+    # This object implements com.sun.star.awt.XTextistener.
+
+    def textChanged( self, event):
+        # event is a com.sun.star.awt.TextEvent struct.
+        return self.procToCall(event, *self.args)
diff --git a/openoffice/__init__.py b/openoffice/__init__.py
new file mode 100644
index 0000000..b24217e
--- /dev/null
+++ b/openoffice/__init__.py
@@ -0,0 +1,28 @@
+# -*- mode: python ; coding: utf-8 -*-
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+
+__author__ = "Hartmut Goebel <h.goebel at goebel-consult.de>"
+__copyright__ = "Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>"
+__licence__ = "GPLv3 - GNU General Public License v3"
+
+import uno
+from com.sun.star.beans import PropertyValue
+
+def iter(elems, prefix=''):
+    # todo: getByIndex verwenden??
+    if hasattr(elems, 'createEnumeration'):
+        enumerator = elems.createEnumeration()
+        while enumerator.hasMoreElements():
+            yield enumerator.nextElement()
+    else:
+        for name in elems.ElementNames:
+            if name.startswith(prefix):
+                yield elems.getByName(name)
+
+def Properties(**kw):
+    return  tuple([PropertyValue(k, 0, v,0)
+                   for k,v in kw.iteritems()])
diff --git a/openoffice/colors.py b/openoffice/colors.py
new file mode 100644
index 0000000..1b0f746
--- /dev/null
+++ b/openoffice/colors.py
@@ -0,0 +1,136 @@
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+
+__author__ = "Hartmut Goebel <h.goebel at goebel-consult.de>"
+__copyright__ = "Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>"
+__licence__ = "GPLv3 - GNU General Public License v3"
+
+#------------------------------------------------------------
+#   Color manipulation
+#------------------------------------------------------------
+
+import math
+
+def rgb2hsb(red, green, blue):
+    """RGB to HSB color space conversion routine.
+    red, green and blue are all numbers from 0 to 255.
+    This routine returns three floating point numbers, hue, saturation, brightness.
+    hue, saturation and brightness are all from 0.0 to 1.0.
+    """
+    c_min = min(red, green, blue)
+    c_max = max(red, green, blue)
+
+    if c_min == c_max:
+        # Grayscale
+        return 0.0, 0.0, float(c_max)
+    elif red == c_min:
+        d = green - blue
+        h = 3.0
+    elif green == c_min:
+        d = blue - red
+        h = 5.0
+    else:
+        d = red - green
+        h = 1.0
+
+    hue = (h - (float(d) / (c_max - c_min))) / 6.0
+    saturation = (c_max - c_min) / float(c_max)
+    brightness = c_max / 255.0
+
+    return hue, saturation, brightness
+
+
+
+def hsb2rgb(hue, saturation, brightness):
+    """HSB to RGB color space conversion routine.
+    hue, saturation and brightness are all from 0.0 to 1.0.
+    This routine returns three integer numbers, red, green, blue.
+    red, green and blue are all numbers from 0 to 255.
+    """
+    # Scale the brightness from a range of 0.0 thru 1.0
+    #  to a range of 0.0 thru 255.0
+    # Then truncate to an integer.
+    brightness = int(min(brightness * 256.0, 255.0))
+    #brightness = int(brightness * 255.0) # hG assumes this is correct
+    
+    if saturation == 0.0:
+        # Grayscale because there is no saturation
+        red = green = blue = brightness
+    else:
+        # Make hue angle be within a single rotation.
+        # If the hue is > 1.0 or < 0.0, then it has
+        #  "gone around the color wheel" too many times.
+        #  For example, a value of 1.2 means that it has
+        #  gone around the wheel 1.2 times, which is really
+        #  the same ending angle as 0.2 trips around the wheel.
+        # Scale it back to the 0.0 to 1.0 range.
+        hue = hue - math.floor(hue)
+        hue = hue * 6.0
+        # Separate hue into int and fractional parts
+        hue_i = int(hue)
+        hue = hue - hue_i
+        # Is hue even?
+        if hue_i % 2 == 0:
+            hue = 1.0 - hue
+        #
+        p = brightness * (1.0 - saturation)
+        q = brightness * (1.0 - saturation * f)
+        
+        if hue_i == 1:
+            red, green, blue = q, brightness, p
+        elif hue_i == 2:
+            red, green, blue = p, brightness, q
+        elif hue_i == 3:
+            red, green, blue = p, q, brightness
+        elif hue_i == 4:
+            red, green, blue = q, p, brightness
+        elif hue_i == 5:
+            red, green, blue = brightness, p, q
+        else:
+            red, green, blue = brightness, q, p
+   
+    return red, green, blue
+
+
+
+def rgb(red, green, blue):
+    """Return an integer which represents a color.
+    The color is specified in RGB notation.
+    Each of red, green and blue must be a number from 0 to 255.
+    """
+    return (int(red) & 255) << 16 | (int(green) & 255) << 8 | (int(blue) & 255)
+
+
+def hsb(hue, saturation, brightness):
+    """Return an integer which represents a color.
+    The color is specified in HSB notation.
+    Each of hue, saturation and brightness must be a number from 0.0 to 1.0.
+    """
+    return rgb(hsb2rgb(hue, saturation, brightness))
+
+
+def red(color):
+    """Return the Red component of a color as an integer from 0 to 255.
+    color is an integer representing a color.
+    This function is complimentary to the rgbColor function.
+    """
+    return (int(color) >> 16) & 255
+
+
+def green(color):
+    """Return the Green component of a color as an integer from 0 to 255.
+    color is an integer representing a color.
+    This function is complimentary to the rgbColor function.
+    """
+    return (int(color) >> 8) & 255
+
+
+def blue(color):
+    """Return the Blue component of a color as an integer from 0 to 255.
+    color is an integer representing a color.
+    This function is complimentary to the rgbColor function.
+    """
+    return int(color) & 255
diff --git a/openoffice/config.py b/openoffice/config.py
new file mode 100644
index 0000000..e7c7c68
--- /dev/null
+++ b/openoffice/config.py
@@ -0,0 +1,91 @@
+#**********************************************************************
+#
+#   Danny.OOo.ConfigLib.py
+#
+#   A module to easily work with OpenOffice.org.
+#
+#**********************************************************************
+#   Copyright (c) 2003-2004 Danny Brewer
+#   d29583 at groovegarden.com
+#
+#   This library is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU Lesser General Public
+#   License as published by the Free Software Foundation; either
+#   version 2.1 of the License, or (at your option) any later version.
+#
+#   This library is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#   Lesser General Public License for more details.
+#
+#   You should have received a copy of the GNU Lesser General Public
+#   License along with this library; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#   See:  http://www.gnu.org/licenses/lgpl.html
+#
+#**********************************************************************
+#   If you make changes, please append to the change log below.
+#
+#   Change Log
+#   Danny Brewer         Revised 2004-06-20-01
+#
+#**********************************************************************
+
+
+# OOo's libraries
+import uno
+
+#from com.sun.star.beans import PropertyValue
+
+import openoffice
+from openoffice import Properties
+
+
+def getConfigAccess(nodePath, writeAccess=False, enableSync=True,
+                    lazyWrite=False):
+    """An easy way to obtain a configuration node from the configuration manager."""
+    localContext = uno.getComponentContext()
+    configProvider = localContext.ServiceManager.createInstanceWithArguments(
+        "com.sun.star.configuration.ConfigurationProvider",
+        Properties(enablesync=enableSync))
+   
+    if writeAccess:
+        serviceName = "com.sun.star.configuration.ConfigurationUpdateAccess"
+    else:
+        serviceName = "com.sun.star.configuration.ConfigurationAccess"
+
+    configAccess = configProvider.createInstanceWithArguments(serviceName,
+        Properties(nodepath=nodePath, lazywrite=lazyWrite))
+
+    return configAccess
+
+
+if __name__ == '__main__':
+    print '-- AddonUI --'
+    cfg = getConfigAccess("/org.openoffice.Office.Addons/AddonUI")
+    for name in cfg.ElementNames:
+        print name #, cfg.getByName(name)
+        #print
+    elem = cfg.getByName("AddonMenu")
+    #import pyXray
+    #import openoffice.interact
+    #ctx = openoffice.interact.Context()
+    #pyXray.XrayBox(ctx.context, elem)
+    #for name in elem.ElementNames:
+    #    print name, cfg.getByName(name)
+    #    print
+    #for name in openoffice.iter(elem):
+    #    print dir(name) #.value
+        
+    #for name in elem.getElementNames():
+
+    print '-- Some user data --'
+    cfg = getConfigAccess("/org.openoffice.UserProfile/Data")
+    print 'Organisation', cfg.o
+    print 'Firstname', cfg.givenname
+    print 'Lastname', cfg.sn
+    print 'Initials', cfg.initials
+    print 'Title', cfg.title
+    print 'Position', cfg.position
+    print 'Email', cfg.mail
diff --git a/openoffice/datatypes.py b/openoffice/datatypes.py
new file mode 100644
index 0000000..214c4e9
--- /dev/null
+++ b/openoffice/datatypes.py
@@ -0,0 +1,17 @@
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+
+__author__ = "Hartmut Goebel <h.goebel at goebel-consult.de>"
+__copyright__ = "Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>"
+__licence__ = "GPLv3 - GNU General Public License v3"
+
+
+def Array(*args):
+    """
+    This is just sugar coating so that code from OOoBasic which
+    contains the Array() function can work perfectly in PYTHON.
+    """
+    return tuple(args)
diff --git a/openoffice/dialogs.py b/openoffice/dialogs.py
new file mode 100644
index 0000000..43dbb0d
--- /dev/null
+++ b/openoffice/dialogs.py
@@ -0,0 +1,567 @@
+#**********************************************************************
+#
+#   Danny.OOo.DialogLib.py
+#
+#   A module to easily work with OpenOffice.org.
+#
+#**********************************************************************
+#   Copyright (c) 2003-2004 Danny Brewer
+#   d29583 at groovegarden.com
+#
+#   This library is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU Lesser General Public
+#   License as published by the Free Software Foundation; either
+#   version 2.1 of the License, or (at your option) any later version.
+#
+#   This library is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#   Lesser General Public License for more details.
+#
+#   You should have received a copy of the GNU Lesser General Public
+#   License along with this library; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#   See:  http://www.gnu.org/licenses/lgpl.html
+#
+#**********************************************************************
+#   If you make changes, please append to the change log below.
+#
+#   Change Log
+#   Danny Brewer         Revised 2004-06-05-01
+#
+#**********************************************************************
+
+
+
+# OOo's libraries
+import uno
+import unohelper
+
+# Danny's libraries
+from Danny.OOo.OOoLib import createUnoService, createUnoStruct
+from Danny.OOo.Listeners.ListenerProcAdapters import *
+#from Danny.OOo.Listeners.TopWindowListener import TopWindowListener
+
+
+
+# The global Awt Toolkit.
+# This is initialized the first time it is needed.
+#goAwtToolkit = createUnoService("com.sun.star.awt.Toolkit")
+goAwtToolkit = None
+#
+def getAwtToolkit():
+    global goAwtToolkit
+    if goAwtToolkit == None:
+        goAwtToolkit = createUnoService("com.sun.star.awt.Toolkit")
+    return goAwtToolkit
+
+
+
+# This class builds dialog boxes.
+# This can be used in two different ways...
+# 1. by subclassing it (elegant)
+# 2. without subclassing it (less elegant)
+class DBModalDialog:
+    """Class to build a dialog box from the com.sun.star.awt.* services.
+    This doesn't do anything you couldn't already do using OOo's UNO API,
+     this just makes it much easier.
+    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.
+    """
+    def __init__(self, positionX=None, positionY=None, width=None, height=None,
+                 title=None):
+        self.model = createUnoService("com.sun.star.awt.UncontrolDialogModel")
+        if positionX is not None:  self.model.PositionX = positionX
+        if positionY is not None:  self.model.PositionY = positionY
+        if width     is not None:  self.model.Width     = width
+        if height    is not None:  self.model.Height    = height
+        if title     is not None:  self.model.Title     = title
+        self.dialogControl = createUnoService("com.sun.star.awt.UncontrolDialog")
+        self.dialogControl.setModel(self.model)
+
+    def release(self):
+        """Release resources.
+        After calling this, you can no longer use this object.
+        """
+        self.dialogControl.dispose()
+
+    #--------------------------------------------------
+    #   Dialog box adjustments
+    #--------------------------------------------------
+   
+    def setDialogPosition(self, x, y):
+        self.model.PositionX = x
+        self.model.PositionY = y
+
+    def setDialogSize(self, width, height):
+        self.model.Width = width
+        self.model.Height = height
+
+    def setDialogTitle(self, caption):
+        self.model.Title = caption
+
+    def setVisible(self, visible):
+        self.dialogControl.setVisible(visible)
+
+
+    #--------------------------------------------------
+    #   com.sun.star.awt.UncontrolButton
+    #--------------------------------------------------
+
+    # After you add a Button control, you can call self.setControlModelProperty()
+    #  passing any of the properties for a...
+    #       com.sun.star.awt.UncontrolButtonModel
+    #       com.sun.star.awt.UncontrolDialogElement
+    #       com.sun.star.awt.UncontrolModel
+    def addButton(self, ctrlName, positionX, positionY, width, height,
+                       label=None,
+                       actionListenerProc=None,
+                       tabIndex=None):
+        self.addControl("com.sun.star.awt.UncontrolButtonModel",
+                         ctrlName, positionX, positionY, width, height,
+                         label=label,
+                         tabIndex=tabIndex)
+        if actionListenerProc is not None:
+            self.addActionListenerProc(ctrlName, actionListenerProc)
+
+    def setButtonLabel(self, ctrlName, label):
+        """Set the label of the control."""
+        control = self.getControl(ctrlName)
+        control.setLabel(label)
+   
+    #--------------------------------------------------
+    #   com.sun.star.awt.UncontrolCheckBox
+    #--------------------------------------------------
+
+    # After you add a CheckBox control, you can call self.setControlModelProperty()
+    #  passing any of the properties for a...
+    #       com.sun.star.awt.UncontrolCheckBoxModel
+    #       com.sun.star.awt.UncontrolDialogElement
+    #       com.sun.star.awt.UncontrolModel
+    def addCheckBox(self, ctrlName, positionX, positionY, width, height,
+                       label=None,
+                       itemListenerProc=None,
+                       tabIndex=None):
+        self.addControl("com.sun.star.awt.UncontrolCheckBoxModel",
+                         ctrlName, positionX, positionY, width, height,
+                         label=label,
+                         tabIndex=tabIndex)
+        if itemListenerProc is not None:
+            self.addItemListenerProc(ctrlName, itemListenerProc)
+
+    def setCheckBoxLabel(self, ctrlName, label):
+        """Set the label of the control."""
+        control = self.getControl(ctrlName)
+        control.setLabel(label)
+
+    def getCheckBoxState(self, ctrlName):
+        """Get the state of the control."""
+        control = self.getControl(ctrlName)
+        return control.getState();
+
+    def setCheckBoxState(self, ctrlName, state):
+        """Set the state of the control."""
+        control = self.getControl(ctrlName)
+        control.setState(state)
+
+    def enableCheckBoxTriState(self, ctrlName, triStateEnable):
+        """Enable or disable the tri state mode of the control."""
+        control = self.getControl(ctrlName)
+        control.enableTriState(triaStateEnable)
+
+   
+    #--------------------------------------------------
+    #   com.sun.star.awt.UncontrolFixedText
+    #--------------------------------------------------
+
+    def addFixedText(self, ctrlName, positionX, positionY, width, height,
+                           label=None):
+        self.addControl("com.sun.star.awt.UncontrolFixedTextModel",
+                         ctrlName, positionX, positionY, width, height,
+                         label=label)
+           
+    #--------------------------------------------------
+    #   Add Controls to dialog
+    #--------------------------------------------------
+
+    def addControl(self, ctrlServiceName,
+                        ctrlName, positionX, positionY, width, height,
+                        label=None, tabIndex=None):
+        controlModel = self.model.createInstance(ctrlServiceName)
+        self.model.insertByName(ctrlName, controlModel)
+
+        # if negative coordinates are given for X or Y position,
+        #  then make that coordinate be relative to the right/bottom
+        #  edge of the dialog box instead of to the left/top.
+        if positionX < 0: positionX = self.model.Width  + positionX - width
+        if positionY < 0: positionY = self.model.Height + positionY - height
+        controlModel.PositionX = positionX
+        controlModel.PositionY = positionY
+        controlModel.Width = width
+        controlModel.Height = height
+        controlModel.Name = ctrlName
+       
+        if label is not None:
+            controlModel.Label = label
+
+        if tabIndex is not None:
+            controlModel.TabIndex = tabIndex
+
+    #--------------------------------------------------
+    #   Access controls and control models
+    #--------------------------------------------------
+
+    def getControl(self, ctrlName):
+        """Get the control (not its model) for a particular control name.
+        The control returned includes the service com.sun.star.awt.Uncontrol,
+         and another control-specific service which inherits from it.
+        """
+        control = self.dialogControl.getControl(ctrlName)
+        return control
+
+    def getControlModel(self, ctrlName):
+        """Get the control model (not the control) for a particular control name.
+        The model returned includes the service UncontrolModel,
+         and another control-specific service which inherits from it.
+        """
+        control = self.getControl(ctrlName)
+        controlModel = control.getModel()
+        return controlModel
+
+
+    #--------------------------------------------------
+    #   Adjust properties of control models
+    #--------------------------------------------------
+
+    def setControlModelProperty(self, ctrlName, propertyName, value):
+        """Set the value of a property of a control's model.
+        This affects the control model, not the control.
+        """
+        controlModel = self.getControlModel(ctrlName)
+        controlModel.setPropertyValue(propertyName, value)
+
+    def getControlModelProperty(self, ctrlName, propertyName):
+        """Get the value of a property of a control's model.
+        This affects the control model, not the control.
+        """
+        controlModel = self.getControlModel(ctrlName)
+        return controlModel.getPropertyValue(propertyName)
+
+
+    #--------------------------------------------------
+    #   Sugar coated property adjustments to control models.
+    #--------------------------------------------------
+
+    def setEnabled(self, ctrlName, enabled=True):
+        """Supported controls...
+            UncontrolButtonModel
+            UncontrolCheckBoxModel
+        """
+        self.setControlModelProperty(ctrlName, "Enabled", enabled)
+
+    def getEnabled(self, ctrlName):
+        """Supported controls...
+            UncontrolButtonModel
+            UncontrolCheckBoxModel
+        """
+        return self.getControlModelProperty(ctrlName, "Enabled")
+
+    def setState(self, ctrlName, state):
+        """Supported controls...
+            UncontrolButtonModel
+            UncontrolCheckBoxModel
+        """
+        self.setControlModelProperty(ctrlName, "State", state)
+
+    def getState(self, ctrlName):
+        """Supported controls...
+            UncontrolButtonModel
+            UncontrolCheckBoxModel
+        """
+        return self.getControlModelProperty(ctrlName, "State")
+
+    def setLabel(self, ctrlName, label):
+        """Supported controls...
+            UncontrolButtonModel
+            UncontrolCheckBoxModel
+        """
+        self.setControlModelProperty(ctrlName, "Label", label)
+
+    def getLabel(self, ctrlName):
+        """Supported controls...
+            UncontrolButtonModel
+            UncontrolCheckBoxModel
+        """
+        return self.getControlModelProperty(ctrlName, "Label")
+
+    def setHelpText(self, ctrlName, helpText):
+        """Supported controls...
+            UncontrolButtonModel
+            UncontrolCheckBoxModel
+        """
+        self.setControlModelProperty(ctrlName, "HelpText", helpText)
+
+    def getHelpText(self, ctrlName):
+        """Supported controls...
+            UncontrolButtonModel
+            UncontrolCheckBoxModel
+        """
+        return self.getControlModelProperty(ctrlName, "HelpText")
+
+
+    #--------------------------------------------------
+    #   Adjust controls (not models)
+    #--------------------------------------------------
+
+    # The following apply to all controls which are a
+    #   com.sun.star.awt.Uncontrol
+
+    def setDesignMode(self, ctrlName, designMode=True):
+        self.getControl(ctrlName).setDesignMode(designMode)
+
+    def isDesignMode(self, ctrlName, designMode=True):
+        return self.getControl(ctrlName).isDesignMode()
+ 
+    def isTransparent(self, ctrlName, designMode=True):
+        return self.getControl(ctrlName).isTransparent()
+     
+
+    # The following apply to all controls which are a
+    #   com.sun.star.awt.UncontrolDialogElement
+
+    def setPosition(self, ctrlName, positionX, positionY):
+        self.setControlModelProperty(ctrlName, "PositionX", positionX)
+        self.setControlModelProperty(ctrlName, "PositionY", positionY)
+    def setPositionX(self, ctrlName, positionX):
+        self.setControlModelProperty(ctrlName, "PositionX", positionX)
+    def setPositionY(self, ctrlName, positionY):
+        self.setControlModelProperty(ctrlName, "PositionY", positionY)
+    def getPositionX(self, ctrlName):
+        return self.getControlModelProperty(ctrlName, "PositionX")
+    def getPositionY(self, ctrlName):
+        return self.getControlModelProperty(ctrlName, "PositionY")
+
+    def setSize(self, ctrlName, width, height):
+        self.setControlModelProperty(ctrlName, "Width", width)
+        self.setControlModelProperty(ctrlName, "Height", height)
+    def setWidth(self, ctrlName, width):
+        self.setControlModelProperty(ctrlName, "Width", width)
+    def setHeight(self, ctrlName, height):
+        self.setControlModelProperty(ctrlName, "Height", height)
+    def getWidth(self, ctrlName):
+        return self.getControlModelProperty(ctrlName, "Width")
+    def getHeight(self, ctrlName):
+        return self.getControlModelProperty(ctrlName, "Height")
+
+    def setTabIndex(self, ctrlName, width, tabIndex):
+        self.setControlModelProperty(ctrlName, "TabIndex", tabIndex)
+    def getTabIndex(self, ctrlName):
+        return self.getControlModelProperty(ctrlName, "TabIndex")
+
+    def setStep(self, ctrlName, width, step):
+        self.setControlModelProperty(ctrlName, "Step", step)
+    def getStep(self, ctrlName):
+        return self.getControlModelProperty(ctrlName, "Step")
+
+    def setTag(self, ctrlName, width, tag):
+        self.setControlModelProperty(ctrlName, "Tag", tag)
+    def getTag(self, ctrlName):
+        return self.getControlModelProperty(ctrlName, "Tag")
+
+
+    #--------------------------------------------------
+    #   Add listeners to controls.
+    #--------------------------------------------------
+
+    # This applies to...
+    #   UncontrolButton
+    def addActionListenerProc(self, ctrlName, actionListenerProc):
+        """Create an com.sun.star.awt.XActionListener object and add it to a control.
+        A listener object is created which will call the python procedure actionListenerProc.
+        The actionListenerProc can be either a method or a global procedure.
+        The following controls support XActionListener:
+            UncontrolButton
+        """
+        control = self.getControl(ctrlName)
+        actionListener = ActionListenerProcAdapter(actionListenerProc)
+        control.addActionListener(actionListener)
+
+    # This applies to...
+    #   UncontrolCheckBox
+    def addItemListenerProc(self, ctrlName, itemListenerProc):
+        """Create an com.sun.star.awt.XItemListener object and add it to a control.
+        A listener object is created which will call the python procedure itemListenerProc.
+        The itemListenerProc can be either a method or a global procedure.
+        The following controls support XActionListener:
+            UncontrolCheckBox
+        """
+        control = self.getControl(ctrlName)
+        actionListener = ItemListenerProcAdapter(itemListenerProc)
+        control.addItemListener(actionListener)
+
+    #--------------------------------------------------
+    #   Display the modal dialog.
+    #--------------------------------------------------
+
+    def doModalDialog(self):
+        """Display the dialog as a modal dialog."""
+        self.dialogControl.setVisible(True)
+        self.dialogControl.execute()
+
+    def endExecute(self):
+        """Call this from within one of the listeners to end the modal dialog.
+        For instance, the listener on your OK or Cancel button would call this to end the dialog.
+        """
+        self.dialogControl.endExecute()
+
+
+
+
+#--------------------------------------------------
+# Example of Dialog box built by subclassing the DBModalDialog class.
+
+class Test1Dialog(DBModalDialog):
+    def __init__(self):
+        DBModalDialog.__init__(self)
+        self.setDialogPosition(60, 50)
+        self.setDialogSize(150, 80)
+        self.setDialogTitle("My Test1 Dialog")
+        self.addButton("btnOK", -10, -10, 30, 14, "OK",
+                        actionListenerProc = self.btnOK_clicked)
+        self.addButton("btnCancel", -50, -10, 30, 14, "Cancel",
+                        actionListenerProc = self.btnCancel_clicked)
+        self.okClicks = 0
+        self.cancelClicks = 0
+
+    # Called when the OK button is clicked.
+    def btnOK_clicked(self, event):
+        self.okClicks += 1
+
+    # Called when the Cancel button is clicked.
+    def btnCancel_clicked(self, event):
+        self.cancelClicks += 1
+
+def Test1():
+    testDialog =  Test1Dialog()
+
+    # Display dialog box.
+    # This does not return until the dialog box is dismissed.
+    testDialog.doModalDialog()
+   
+    # Print out the global button click counters.
+    print testDialog.cancelClicks, testDialog.okClicks
+
+
+
+#--------------------------------------------------
+# Example of modal creating a dialog box without subclassing DBModalDialog.
+
+# Global vars to keep track of button clicks.
+okClicks = 0
+cancelClicks = 0
+# Global procs, called as event listeners on button clicks.
+def OKClicked(event):
+    global okClicks
+    okClicks += 1
+def CancelClicked(event):
+    global cancelClicks
+    cancelClicks += 1
+
+# Create a modal dialog box without subclassing DBModalDialog.
+def Test2():
+    testDialog = DBModalDialog(60, 50, 150, 80, "My Test2 Dialog")
+    testDialog.addButton("btnOK", -10, -10, 30, 14, "OK")
+    testDialog.addButton("btnCancel", -50, -10, 30, 14, "Cancel")
+    testDialog.addFixedText("lbl01", 10, 10, 30, 14, "Test1")
+
+    # Install global event listener procs.
+    # Use the addActionListenerProc() routine instead of supplying the event
+    #  listener to the addButton() as in first example.
+    testDialog.addActionListenerProc("btnOK", OKClicked)
+    testDialog.addActionListenerProc("btnCancel", CancelClicked)
+
+    # Display dialog box.
+    # This does not return until the dialog box is dismissed.
+    testDialog.doModalDialog()
+
+    # Print out the global button click counters.
+    print cancelClicks, okClicks
+
+
+
+
+#--------------------------------------------------
+# Example of Dialog box built by subclassing the DBModalDialog class.
+
+class ModalDoggieKittyMonkeyDialog(DBModalDialog):
+    def __init__(self):       
+        self.numDoggies = 0
+        self.numKitties = 0
+        self.numMonkeys = 0
+        self.tails = False
+        self.okay = False
+
+        DBModalDialog.__init__(self, 60, 50, 200, 90, "Doggie/Kitty/Monkey Dialog")
+
+        # Add an OK and a Cancel button.
+        # Both buttons share an action listener named "self.btnOkOrCancel_clicked".
+        self.addButton("btnOK", -10, -10, 50, 14, "OK",
+                        actionListenerProc = self.btnOkOrCancel_clicked)
+        self.addButton("btnCancel", -10 - 50 - 10, -10, 50, 14, "Cancel",
+                        actionListenerProc = self.btnOkOrCancel_clicked)
+
+        # Add three buttons.
+        self.addButton("btnDoggie", 5, 10, 50, 14, "Add Doggie",
+                        actionListenerProc = self.btnDoggie_Clicked)
+        self.addButton("btnKitty", 5, 30, 50, 14, "Add Kitty",
+                        actionListenerProc = self.btnKitty_Clicked)
+        self.addButton("btnMonkey", 5, 50, 50, 14, "Add Monkey",
+                        actionListenerProc = self.btnMonkey_Clicked)
+
+        # Add a label to the dialog.
+        self.addFixedText("lbl1", 60, 10, 100, 14, "Add some doggies, kitties, and monkeys.")
+
+        # Add a checkbox to the dialog.
+        self.addCheckBox("chkTails", 60, 30, 50, 14, "With tails",
+                          itemListenerProc = self.chkTails_changed)
+
+    def btnOkOrCancel_clicked(self, event):
+        """Called when the OK or Cancel button is clicked."""
+        if event.Source.getModel().Name == "btnOK":
+            self.okay = True
+        self.endExecute()
+
+    def btnDoggie_Clicked(self, event):
+        """Called with the Doggie button is clicked."""
+        self.numDoggies += 1
+
+    def btnKitty_Clicked(self, event):
+        """Called with the Kitty button is clicked."""
+        self.numKitties += 1
+
+    def btnMonkey_Clicked(self, event):
+        """Called with the Monkey button is clicked."""
+        self.numMonkeys += 1
+
+    def chkTails_changed(self, event):
+        """Called when the Tails checkbox is clicked."""
+        self.tails = self.getState("chkTails")
+
+
+def Test3():
+    testDialog = ModalDoggieKittyMonkeyDialog()
+    testDialog.doModalDialog()
+   
+    # Print out the global button click counters.
+    print testDialog.numDoggies, testDialog.numKitties, testDialog.numMonkeys
+    print "okay:", testDialog.okay,
+    print "tails:", testDialog.tails, testDialog.getState("chkTails")
+
+
+
+
+
+#>>> import Danny.OOo.DialogLib
+#>>> reload(Danny.OOo.DialogLib); from Danny.OOo.DialogLib import *
diff --git a/openoffice/interact.py b/openoffice/interact.py
new file mode 100644
index 0000000..bb63ded
--- /dev/null
+++ b/openoffice/interact.py
@@ -0,0 +1,160 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+
+__author__ = "Hartmut Goebel <h.goebel at goebel-consult.de>"
+__copyright__ = "Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>"
+__licence__ = "GPLv3 - GNU General Public License v3"
+
+import unohelper
+import openoffice.officehelper as officehelper
+from com.sun.star.beans import PropertyValue
+
+import openoffice.streams
+
+import os
+
+class Context:
+    # Todo:
+    # - Make desktop, unoService and coreRelefection into slots (or such)
+    # - find out which objects are singletons anyway
+    def __init__(self, pipename=None, host=None, port=None):
+        """Start OOo and connect to it"""
+        self.context = officehelper.bootstrap(pipename=pipename,
+                                              host=host, port=port)
+        self._desktop = None
+
+    def desktop(self):
+        if self._desktop is None:
+            self._desktop = Desktop(self)
+        return self._desktop
+
+    def unoService(self, className):
+        return self.context.ServiceManager.createInstanceWithContext(className,
+                                                                     self.context)
+
+    def coreReflection(self):
+        return self.createUnoService("com.sun.star.reflection.CoreReflection")
+
+    def ceateUnoStruct(self, typeName):
+        """
+        Create a UNO struct.
+        Similar to the function of the same name in OOo Basic.
+        """
+        # Get the IDL class for the type name
+        idlClass = self.coreReflection().forName(typeName)
+        rv, struct = idlClass.createObject(None)
+        return struct
+    
+    #----  API helpers ---------------
+
+    def hasUnoInterfaces(self, obj, *interfaceNames):
+        """
+        Similar to Basic's HasUnoInterfaces() function.
+        """
+        wantedInterfaces = set(interfaceNames)
+        # Get the Introspection service and the object info
+        introspect = self.createUnoService("com.sun.star.beans.Introspection")
+        objInfo = introspect.inspect( oObject )
+   
+        # Get List of all methods of the object.
+        methods = objInfo.getMethods(uno.getConstantByName("com.sun.star.beans.MethodConcept.ALL"))
+        # Get the classes (=interfaces) these methods are defined by
+        supportedInterfaces = set([method.getDeclaringClass().getName()
+                                   for method in methods])
+        return wantedInterfaces <= supportedInterfaces
+
+
+class Desktop:
+    def __init__(self, ctx=None, pipename=None, host=None, port=None):
+        if ctx is None:
+            ctx = Context(pipename=pipename, host=host, port=port)
+        self._ctx = ctx
+        # Verbindung zur Oberflaeche
+        self._desktop = ctx.context.ServiceManager.createInstanceWithContext(
+            "com.sun.star.frame.Desktop", ctx.context)
+        self._ctx._desktop = self._desktop
+
+
+    def newDoc(self, doctype, **kw):
+        """
+        Create a new document.
+
+        ''doctype'' may be one of swriter, scalc, simpress, sdraw,
+        smath or sbase.
+        """
+        return self.openURL("private:factory/" + doctype, **kw)
+
+
+    def openURL(self, url, target='_default', hidden=False,
+                readonly=False, preview=False, stream=None):
+        """
+        Open a document from it's URL.
+
+        This argumens will be passed to loadComponentFromURL() as
+        Properties:
+
+        - hidden: do not open windows for this document, hide it
+        - readonly: open in read-only mode
+        - preview: open in preview mode
+        - stream: use this stream as "InputStream" (only usefull with
+                  url='private:stream'. You should use openStream() instead.
+        
+        Allowed values for 'target' are:
+
+        :_self: Returns the frame itself. The same as with an empty
+               target frame name. This means to search for a frame you
+               already have, but it is legal.
+        :_top: Returns the top frame of the called frame. The first
+               frame where isTop() returns true when traveling up the
+               hierarchy. If the starting frame does not have a parent
+               frame, the call is treated as a search for "_self".
+               This behavior is compatible to the frame targeting in a
+               web browser.
+        :_parent: Returns the next frame above in the frame hierarchy.
+               If the starting frame does not have a parent frame, the
+               call is treated as a search for "_self". This behavior
+               is compatible to the frame targeting in a web browser.
+        :_blank: Creates a new top-level frame as a child frame of the
+               desktop. If the called frame is not part of the desktop
+               hierarchy, this call fails. Using the "_blank" target
+               loads open documents again that result in a read-only
+               document, depending on the UCB content provider for the
+               component. If loading is done as a result of a user
+               action, this becomes confusing to theusers, therefore
+               the "_default" target is recommended in calls from a
+               user interface, instead of "_blank". Refer to the next
+               section for a discussion about the _default target..
+        :_default: Similar to "_blank", but the implementation defines
+               further behavior that has to be documented by the
+               implementer. The com.sun.star.frame.XComponentLoader
+               implemented at the desktop object shows the following
+               default behavior.
+        """
+        properties = (
+            PropertyValue("Hidden",   0, bool(hidden), 0),
+            PropertyValue("ReadOnly", 0, bool(readonly), 0),
+            PropertyValue("Preview",  0, bool(preview), 0),
+            PropertyValue("InputStream", 0, stream, 0),
+            )
+        return self._desktop.loadComponentFromURL(url, target, 0, properties)
+
+    def openFile(self, filename, **kw):
+        filename = os.path.expanduser(filename)
+        filename = os.path.abspath(filename)
+        url = unohelper.systemPathToFileUrl(filename)
+        return self.openURL(url, **kw)
+
+    def openStream(self, filehandle, **kw):
+        if not isinstance(filehandle, openoffice.streams.InputStream):
+            filehandle = openoffice.streams.InputStream(filehandle)
+        return self.openURL("private:stream", stream=filehandle, **kw)
+
+        
+if __name__ == '___main__':
+    desktop = Desktop()
+    doc = desktop.newDoc("swriter")
diff --git a/openoffice/officehelper.py b/openoffice/officehelper.py
new file mode 100644
index 0000000..2725224
--- /dev/null
+++ b/openoffice/officehelper.py
@@ -0,0 +1,159 @@
+# -*- mode: python ; coding: utf-8 -*-
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+# Originally based on officehelper.py 1.2 comming with OOo
+#
+
+__author__ = "Hartmut Goebel <h.goebel at goebel-consult.de>"
+__copyright__ = "Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>"
+__licence__ = "GPLv3 - GNU General Public License v3"
+
+import os
+import random
+import sys
+from time import sleep
+
+import uno
+from com.sun.star.connection import NoConnectException
+
+class BootstrapException(Exception): pass
+
+__soffice_executable = None
+    
+def _build_connect_string(pipename=None, host=None, port=None):
+    """
+    Returns a connection description string to be used to connect to
+    this process via UnoUrlResolver().resolve().
+
+    Pass either a pipename for a named pipe or host and port for a
+    socket connection.
+
+    Note: You should use the naemd pipe whenever possible, since
+    socket are unsecure: Everybody can connect to a socket and access
+    your documents without any access control.
+    """
+    if pipename:
+        connectString = "pipe,name=%s" % pipename
+    else:
+        connectString = 'socket'
+        if host: connectString += ',host='+str(host)
+        if port: connectString += ',port='+str(port)
+    return connectString
+
+
+def _build_cmd_args(connectString, unaccept=False):
+    """
+    Returns command arguments (including executable and options)
+    suitable for staring an background OOo instance listening on named
+    pipe or socket descripted in parameter 'connectString'.
+
+    If unaccept is true, the parmeter '-accept=...' will become
+    '-unaccept=...' for making the instance unlisten.
+    """
+
+    def find_executable():
+        """
+        Find 'soffice' executable.
+
+        Normaly soffice should be in the same directory as uno.py, but eg.
+        Debian does not obaj to this convention. Thus we need to search
+        the executable.
+        """
+        global __soffice_executable
+        if __soffice_executable:
+            return __soffice_executable
+        for p in [os.path.dirname(uno.__file__),
+                  '/usr/lib/openoffice/program',
+                  '/usr/bin',
+                  '/usr/local/bin',
+                  ]:
+            office = os.path.join(p, "soffice")
+            if os.path.exists(office):
+                break
+        else:
+            pathes = glob.glob('/usr/lib/ooo-[234].*/program/soffice')
+            if not pathes:
+                raise BootstrapExceptions('soffice executable not found')
+            pathes.sort(reverse=True)
+            office = pathes[0]
+        __soffice_executable = office
+        return office
+
+    # soffice script used on *ix, Mac; soffice.exe used on Windoof
+    office = find_executable()
+    if sys.platform.startswith("win"):
+        office += ".exe"
+
+    # -headless includes -invisible (which includes -nologo -nodefault)
+    accept = unaccept and '-unaccept' or '-accept'
+    cmdArray = (office,
+                "-headless", "-norestore", "%s=%s;urp;" %
+                (accept, connectString))
+    return cmdArray
+
+
+def _start_OOo(connectString):
+    """Start an OOo process listening on named pipe or socket
+    descripted in parameter 'connectString'.
+    """
+    cmdArray = _build_cmd_args(connectString)
+    # Start the office proces, don't check for exit status since
+    # an exception is caught anyway if the office terminates
+    # unexpectedly.
+    return os.spawnv(os.P_NOWAIT, cmdArray[0], cmdArray)
+
+
+def connect(connectString):
+    """
+    Connect to an OOo instance listening on named pipe or socket
+    descripted in parameter 'connectString'.
+    """
+    localContext = uno.getComponentContext()
+    resolver = localContext.ServiceManager.createInstanceWithContext(
+        "com.sun.star.bridge.UnoUrlResolver", localContext)
+    connect = "uno:" + connectString + ";urp;StarOffice.ComponentContext"
+
+    # Wait until an office is started, but loop only 20 times (10 seconds)
+    for i in range(20):
+        try:
+            context = resolver.resolve(connect)
+            break
+        except NoConnectException:
+            sleep(0.5)  # Sleep 1/2 second.
+    else:
+        # for-loop completed without 'break' (this is: no connection found)
+        raise BootstrapException("Cannot connect to soffice server.")
+
+    return context
+
+
+def bootstrap(pipename=None, host=None, port=None):
+    """Bootstrap OOo and PyUNO Runtime.
+
+    If either pipename, host or port are given, connect to the OOo
+    instance listening on this pipe or hosst/port. (This is mainly for
+    convenience, so programms do not need to distinguish these cases.)
+
+    If non of these parameters are give, the soffice process is
+    started opening a named pipe of random name, then the local
+    context is used to access the pipe.
+
+    This function directly returns the remote component context, from
+    whereon you can get the ServiceManager by calling
+    getServiceManager() on the returned object.
+    """
+    if pipename or host or port:
+        connectString = _build_connect_string(pipename=pipename,
+                                              host=host, port=port)
+    else:
+        # Generate a random pipe name.
+        pipename = "uno" + str(random.random())[2:]
+        connectString = _build_connect_string(pipename=pipename)
+        # start OOo listening on this named pipe
+        _start_OOo(connectString)
+    # get component context and return it
+    context = connect(connectString)
+    return context
diff --git a/openoffice/streams.py b/openoffice/streams.py
new file mode 100644
index 0000000..ecae397
--- /dev/null
+++ b/openoffice/streams.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+
+__author__ = "Hartmut Goebel <h.goebel at goebel-consult.de>"
+__copyright__ = "Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>"
+__licence__ = "GPLv3 - GNU General Public License v3"
+
+import uno
+import unohelper
+from com.sun.star.io import XInputStream, XOutputStream, XSeekable
+
+class InputStream(unohelper.Base, XInputStream, XSeekable):
+    def __init__(self, stream):
+        self.f = stream
+
+    def skipBytes(self, count):
+        self.f.read(count)
+
+    def readBytes(self, retSeq, count):
+        s = self.f.read(count)
+        return len(s), uno.ByteSequence(s)
+
+    def readSomeBytes(self, retSeq , count):
+        return self.readBytes(retSeq, count)
+
+    def available(self):
+        return 0
+
+    def closeInput(self):
+        self.f.close()
+
+    def seek(self, pos):
+        self.f.seek(pos)
+
+    def getPosition(self):
+        return self.f.tell()
+    
+    def getLength(self):
+        f = self.f # shortcut
+        pos = f.tell()
+        f.seek(0, 2)
+        len = f.tell()
+        f.seek(pos)
+        return len
+    
+
+class OutputStream(unohelper.Base, XOutputStream):
+    def __init__(self, stream):
+        self.f = stream
+
+    def writeBytes(self, seq):
+        self.f.write(seq.value)
+
+    def closeOutput(self):
+        self.f.flush()
+
+    def flush(self):
+        self.f.flush()
diff --git a/openoffice/styles.py b/openoffice/styles.py
new file mode 100644
index 0000000..b7b4eb5
--- /dev/null
+++ b/openoffice/styles.py
@@ -0,0 +1,48 @@
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+
+__author__ = "Hartmut Goebel <h.goebel at goebel-consult.de>"
+__copyright__ = "Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>"
+__licence__ = "GPLv3 - GNU General Public License v3"
+
+class NoSuchStyleFamily(Exception): pass
+
+def getStyle(doc, family, name):
+    """
+    Lookup a style from the document.
+    """
+    styleFamily = doc.getStyleFamilies().getByName(family)
+    if not styleFamily:
+        raise NoSuchStyleFamily(family)
+    style = None
+    if styleFamily.hasByName(name):
+        style = styleFamily.getByName(name)
+    return style
+
+
+def defineStyle( doc, family, name, parent=None):
+    """
+    Add a new style to the style catalog if it is not already present.
+    This returns the style object so that you can alter its properties.
+    """
+    styleFamily = doc.getStyleFamilies().getByName(family)
+    if not styleFamily:
+        raise NoSuchStyleFamily(family)
+
+    style = None
+    if styleFamily.hasByName(name):
+        style = styleFamily.getByName(name)
+    if not style:
+        # Create new style object
+        style = doc.createInstance("com.sun.star.style.Style")
+        # Set its parent style
+        if parent is not None:
+            parentName = parent.Name # todo: is this correct?
+            style.setParentStyle(parentName)
+        # Add the new style to the style family
+        styleFamily.insertByName(name, style)
+    return style
+
diff --git a/openoffice/windowsListeners.py b/openoffice/windowsListeners.py
new file mode 100644
index 0000000..ebfe1a8
--- /dev/null
+++ b/openoffice/windowsListeners.py
@@ -0,0 +1,198 @@
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+
+__author__ = "Hartmut Goebel <h.goebel at goebel-consult.de>"
+__copyright__ = "Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>"
+__licence__ = "GPLv3 - GNU General Public License v3"
+
+from com.sun.star.awt import XTopWindowListener, XWindowListener, \
+ XFocusListener, XKeyListener, XMouseListener, XPaintListener, \
+ XEventListener
+
+
+class TopWindowListener(XTopWindowListener):
+    #   Note that com.sun.star.lang.EventObject has the following members:
+    #       Source  which is a  com.sun.star.uno.XInterface
+    #           refers to the object that fired the event.
+
+    def __init__(self, *args, **kw):
+        super(self, TopWindowListener).__init__(*args, **kw)
+        # Since this class implements the XTopWindowListener interface,
+        #  add ourself as a listener to our own window.
+        self._window.addTopWindowListener(self)
+        
+    def windowOpened(self, event):
+        """Is invoked when a window has been opened."""
+        pass
+
+    def windowClosing(self, event):
+        """Is invoked when a window is in the process of being closed.
+        The close operation can be overridden at this point."""
+        self._window.dispose()
+
+    def windowClosed(self, event):
+        """Is invoked when a window has been closed."""
+        pass
+
+    def windowMinimized(self, event):
+        """Is invoked when a window is iconified."""
+        pass
+
+    def windowNormalized(self, event):
+        """Is invoked when a window is de-iconified."""
+        pass
+
+    def windowActivated(self, event):
+        """is invoked when a window is activated."""
+        pass
+
+    def windowDeactivated(self, event):
+        """Is invoked when a window is de-activated."""
+        pass
+
+
+class WindowListener(XWindowListener):
+    #   Note that com.sun.star.awt.WindowEvent has the following members:
+    #       long X      long Y
+    #       long Width  long Height
+    #       long LeftInset    long TopInset
+    #       long RightInset   long BottomInset
+
+    def __init__(self, *args, **kw):
+        super(self, WindowListener).__init__(*args, **kw)
+        # Since this class implements the XWindowListener interface,
+        #  add ourself as a listener to our own window.
+        self._window.addWindowListener(self)
+
+    def windowResized(self, event):
+        """Is invoked when the window has been resized."""
+        pass
+
+    def windowMoved(self, event):
+        """Is invoked when the window has been moved."""
+        pass
+
+    def windowShown(self, event):
+        """Is invoked when the window has been shown."""
+        # please note the type of parameter is described
+        #  above in the comment for XTopWindowListener.
+        pass
+
+    def windowHidden(self, event):
+        """Is invoked when the window has been hidden."""
+        # please note the type of parameter is described
+        #  above in the comment for XTopWindowListener.
+        pass
+
+
+class FocusListener(XFocusListener):
+    #   Note that com.sun.star.awt.FocusEvent has the following members:
+    #       short FocusFlags
+    #       com.sun.star.uno.XInterface NextFocus
+    #       boolean Temporary
+
+    def __init__(self, *args, **kw):
+        super(self, FocusListener).__init__(*args, **kw)
+        # Since this class implements the XFocusListener interface,
+        #  add ourself as a listener to our own window.
+        self._window.addFocusListener(self)
+
+    def focusGained(self, event):
+        """Is invoked when a window gains the keyboard focus."""
+        pass
+
+    def focusLost(self, event):
+        """Is invoked when a window loses the keyboard focus."""
+        pass
+
+class KeyListener(XKeyListener):
+    #   Note that com.sun.star.awt.KeyEvent has the following members:
+    #       short KeyCode   (constant from com.sun.star.awt.Key)
+    #       char  KeyChar
+    #       short KeyFunc   (constant from com.sun.star.awt.KeyFunction)
+
+    def __init__(self, *args, **kw):
+        super(self, KeyListener).__init__(*args, **kw)
+        # Since this class implements the XKeyListener interface,
+        #  add ourself as a listener to our own window.
+        self._window.addKeyListener(self)
+
+    def keyPressed(self, event):
+        """Is invoked when a key has been pressed."""
+        pass
+
+    def keyReleased(self, event):
+        """Is invoked when a key has been released."""
+        pass
+
+
+class MouseListener(XMouseListener):
+    #   Note that com.sun.star.awt.MouseEvent has the following members:
+    #       short Buttons       (constant from com.sun.star.awt.MouseButton)
+    #       short X     short Y
+    #       long ClickCount
+    #       boolean PupupTrigger
+
+    def __init__(self, *args, **kw):
+        super(self, MouseListener).__init__(*args, **kw)
+        # Since this class implements the XMouseListener interface,
+        #  add ourself as a listener to our own window.
+        self._window.addMouseListener(self)
+
+    def mousePressed(self, event):
+        """Is invoked when a mouse button has been pressed on a window."""
+        pass
+
+    def mouseReleased(self, event):
+        """Is invoked when a mouse button has been released on a window."""
+        pass
+
+    def mouseEntered(self, event):
+        """Is invoked when the mouse enters a window."""
+        pass
+
+    def mouseExited(self, event):
+        """Is invoked when the mouse exits a window."""
+        pass
+
+
+class PaintListener(XPaintListener):
+    #   Note that com.sun.star.awt.Painevent has the following members:
+    #       com.sun.star.awt.Rectangle UpdateRect
+    #       short Count
+
+    def __init__(self, *args, **kw):
+        super(self, PaintListener).__init__(*args, **kw)
+        # Since this class implements the XPaintListener interface,
+        #  add ourself as a listener to our own window.
+        self._window.addPaintListener(self)
+
+    # [oneway] void
+    # windowPaint([in] Painevent event);
+    def windowPaint(self, event):
+        """
+        Is invoked when a region of the window became invalid, e.g.
+        when another window has been moved away.
+        """
+        pass
+
+
+class EventListener(XEventListener):
+    #   Note that com.sun.star.lang.EventObject has the following members:
+    #       Source  which is a  com.sun.star.uno.XInterface
+    #           refers to the object that fired the event.
+
+    def __init__(self, *args, **kw):
+        super(self, EventListener).__init__(*args, **kw)
+
+    # void
+    # disposing([in] com.sun.star.lang.EventObject event);
+    def disposing(self, event):
+        """
+        Gets called when the broadcaster is about to be disposed.
+        """
+        pass
+
diff --git a/openoffice_python.egg-info/PKG-INFO b/openoffice_python.egg-info/PKG-INFO
new file mode 100644
index 0000000..3af3e35
--- /dev/null
+++ b/openoffice_python.egg-info/PKG-INFO
@@ -0,0 +1,18 @@
+Metadata-Version: 1.1
+Name: openoffice-python
+Version: 0.1-r34-20090228
+Summary: Enhanced Python interfaces to OpenOffice.org
+Home-page: http://openoffice-python.origo.ethz.ch/
+Author: Hartmut Goebel
+Author-email: h.goebel at goebel-consult.de
+License: GPLv3
+Download-URL: http://openoffice-python.origo.ethz.ch/download
+Description: UNKNOWN
+Platform: POSIX
+Classifier: Development Status :: 3 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: Operating System :: POSIX
+Classifier: Programming Language :: Python
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires: python(>=2.3)
diff --git a/openoffice_python.egg-info/SOURCES.txt b/openoffice_python.egg-info/SOURCES.txt
new file mode 100644
index 0000000..f843b4f
--- /dev/null
+++ b/openoffice_python.egg-info/SOURCES.txt
@@ -0,0 +1,27 @@
+COPYING
+LICENSE-gpl-3.0.txt
+MANIFEST.in
+README
+SConstruct
+setup.cfg
+setup.py
+openoffice/ListenerProcAdapters.py
+openoffice/__init__.py
+openoffice/colors.py
+openoffice/config.py
+openoffice/datatypes.py
+openoffice/dialogs.py
+openoffice/interact.py
+openoffice/officehelper.py
+openoffice/streams.py
+openoffice/styles.py
+openoffice/windowsListeners.py
+openoffice_python.egg-info/PKG-INFO
+openoffice_python.egg-info/SOURCES.txt
+openoffice_python.egg-info/dependency_links.txt
+openoffice_python.egg-info/top_level.txt
+sample-scripts/PrintToWriter.py
+sample-scripts/check-installation
+sample-scripts/odf2pdf.py
+sample-scripts/ooo-server
+sample-scripts/open-stream.py
\ No newline at end of file
diff --git a/openoffice_python.egg-info/dependency_links.txt b/openoffice_python.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/openoffice_python.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/openoffice_python.egg-info/top_level.txt b/openoffice_python.egg-info/top_level.txt
new file mode 100644
index 0000000..b221f0d
--- /dev/null
+++ b/openoffice_python.egg-info/top_level.txt
@@ -0,0 +1 @@
+openoffice
diff --git a/sample-scripts/PrintToWriter.py b/sample-scripts/PrintToWriter.py
new file mode 100644
index 0000000..df97341
--- /dev/null
+++ b/sample-scripts/PrintToWriter.py
@@ -0,0 +1,119 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#**********************************************************************
+#
+#  PrintToWriter.py - sample script for openoffice-python
+#
+# This implements a simple class which makes it easy and convenient
+# to print a bunch of text into a Writer document.
+#
+#  http://openoffice-python.origo.ethz.ch/
+#
+#**********************************************************************
+#
+# Copyright (c) 2003-2004 Danny Brewer <d29583 at groovegarden.com>
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+#
+# This library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+# See:  http://www.gnu.org/licenses/lgpl.html
+#
+#**********************************************************************
+#
+# If you make changes, please append to the change log below.
+#
+# Change Log
+# Danny Brewer     2004-06-05 Revised 
+# Hartmut Goebel   2008-03-09 Major changes, adopted for
+#                             openoffice-python
+#
+#**********************************************************************
+
+import uno
+import openoffice.interact
+
+_ControlCharacter = "com.sun.star.text.ControlCharacter"
+
+PARAGRAPH_BREAK  = uno.getConstantByName(_ControlCharacter+ ".PARAGRAPH_BREAK")
+LINE_BREAK       = uno.getConstantByName(_ControlCharacter+ ".LINE_BREAK")
+HARD_HYPHEN      = uno.getConstantByName(_ControlCharacter+ ".HARD_HYPHEN")
+SOFT_HYPHEN      = uno.getConstantByName(_ControlCharacter+ ".SOFT_HYPHEN")
+HARD_SPACE       = uno.getConstantByName(_ControlCharacter+ ".HARD_SPACE")
+APPEND_PARAGRAPH = uno.getConstantByName(_ControlCharacter+ ".APPEND_PARAGRAPH")
+
+class PrintToWriter:
+    """
+    A class which allows conveniently printing stuff into a Writer
+    document.
+    
+    Very useful for debugging, general output purposes, or even for
+    creating reports.
+    """
+    
+    def __init__(self, desktop=None):
+        if not desktop:
+            desktop = openoffice.interact.Desktop() # todo: defaultDesktop?
+        self._doc = desktop.newDoc('swriter', )#target='_blank', hidden=1)
+        self._text = self._doc.getText()
+        self._cursor = self._text.createTextCursor()
+
+    def writeControlCharacter(self, char, absorb=False):
+        # todo: what does 'absort' mean?
+        self._text.insertControlCharacter(self._cursor, char, absorb)
+
+    def write(self, string, absorb=False):
+        self._text.insertString(self._cursor, str(string), absorb)
+
+    def writelines(self, lines, absorb=False):
+        for line in lines:
+            self._text.insertString(self._cursor, line, absorb)
+
+    def writeTab(self, absorb=False):
+        self.write("\t", absorb)
+
+    def paragraphBreak(self, absorb=False):
+        self.writeControlCharacter(PARAGRAPH_BREAK, absorb)
+
+    def writeLn(self, *args):
+        self.writelines(args)
+        self.paragraphBreak()
+
+    def writeTabSeparated(self, *args):
+        if not args:
+            return
+        arg = args[0]
+        self.write(arg)
+        for arg in args[1:]:
+            self.writeTab()
+            self.write(arg)
+
+
+if __name__ == '__main__':
+    """
+    An example of how to use the PrintToWriter class to trivially
+    create a new Writer document, and write out text into it.
+    """
+    doc = PrintToWriter()
+    doc.writeLn("Hello World")
+    doc.writeTabSeparated("String", 123, 456.23, True)
+    doc.writeLn()
+    doc.writeLn()
+
+    doc.writeLn("Tab delimited values ...")
+   
+    doc.writeTabSeparated(123, 456, 789); doc.writeLn()
+    doc.writeTabSeparated(465, 522, 835); doc.writeLn()
+    doc.writeTabSeparated(886, 164, 741); doc.writeLn() 
diff --git a/sample-scripts/check-installation b/sample-scripts/check-installation
new file mode 100755
index 0000000..93593f2
--- /dev/null
+++ b/sample-scripts/check-installation
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+Check whether openoffice-python can talk to OpenOffice. If not, try to
+find the problem.
+"""
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+
+import sys
+import platform
+import random
+import pprint
+
+pyver = '.'.join(map(str, sys.version_info[:2]))
+
+def print_pythonpath():
+    print
+    print "Modules are searched in this places (aka sys.path, $PYTHONPATH)"
+    pprint.pprint(sys.path)
+    
+#print_pythonpath()
+
+try:
+    import uno
+except ImportError:
+    print "Can't import the uno-bridge module 'uno'."
+    if platform.system == 'Windows':
+        print "Make sure you have a installed version of OpenOffice.org which"
+        print "is matching your Python version", pyver, "and the file uno.py is on"
+        print "your $PYTHONPATH."
+    else:
+        print "Make sure the package 'openoffice.org-pyuno' is installed,"
+        print "is matching your Python version", pyver, "and the file uno.py is on"
+        print "your $PYTHONPATH."
+        if platform.dist()[0] == 'debian':
+            print "For Debian, Ubuntu and related distributions, the package"
+            print "is called, eg. 'python-uno'."
+
+    print_pythonpath()
+    raise SystemExit(21)
+
+openoffice = None
+
+try:
+    import openoffice
+    import openoffice.interact
+    import openoffice.officehelper as OH
+except ImportError, e:
+    print "Can't import openoffice-python module 'openoffice.interact'."
+    print "Make sure the Python package 'openoffice.interact' is installed"
+    print "for your Python version", pyver
+    print "This was the error message:"
+    print e
+    print_pythonpath()
+    if openoffice:
+        print 'openoffice.__file__ :', openoffice.__file__
+    raise SystemExit(22)
+
+def bootstrap(pipename=None, host=None, port=None):
+    if pipename or host or port:
+        print "Try connecting to already running OOo"
+        connectString = OH._build_connect_string(pipename=pipename,
+                                                 host=host, port=port)
+        print "using connection string", repr(connectString)
+    else:
+        # Generate a random pipe name.
+        pipename = "uno" + str(random.random())[2:]
+        connectString = OH._build_connect_string(pipename=pipename)
+        print "Starting OOo for listening on", connectString
+        print "Will use command",
+        print OH._build_cmd_args(connectString)
+        # start OOo listening on this named pipe
+        pid = OH._start_OOo(connectString)
+        print "Started OOo with process id", pid
+
+    print
+    print "Now trying to connect to OOo."
+    sys.stdout.flush()
+    try:
+        context = OH.connect(connectString)
+        print "Connecting with context", context
+    except OH.BootstrapException:
+        raise
+        print "Can not connect to OOo. Please check whether it is running at"
+        print "all."
+        print "Try starting it using this command:"
+        print 
+        
+    return context
+
+if __name__ == '__main__':
+    import optparse
+    parser = optparse.OptionParser('%prog [options]')
+    group = parser.add_option_group('To connect to already running server use:')
+    group.add_option('--host',  #default='localhost',
+                     help="hostname/ip of server (default: %default)")
+    group.add_option('--port',  default=2002, type=int,
+                     help="port the server is listening on (default: %default)")
+
+    opts, args = parser.parse_args()
+    if not opts.host:
+        opts.port = None
+    context = bootstrap(host=opts.host, port=opts.port)
+
+    if context:
+        print
+        print "Looks good."
+        print
+    else:
+        print "When reporting problems, please give this OS information"
+        print platform.platform()
+        print "and this PYTHONPATH:"
+        for p in sys.path:
+            print '  ', repr(p)
+        print
+        raise SystemExit(20)
diff --git a/sample-scripts/odf2pdf.py b/sample-scripts/odf2pdf.py
new file mode 100644
index 0000000..c0f6cfb
--- /dev/null
+++ b/sample-scripts/odf2pdf.py
@@ -0,0 +1,71 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+"""
+This sample script opens a ODF file using OpenOffice.org and
+exports it as PDF.
+"""
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+# Based on some ideas from LX-office's 'oo-uno-convert-pdf.py'
+# (see <http:///www.lx-office.org>).
+#
+# This is just a sample script for openoffice-python. If you are
+# looking for a converter which supports more formats, you may have a
+# look at <http://www.artofsolving.com/opensource/pyodconverter>
+# (which does not use openoffiec-python).
+#
+
+import openoffice.interact
+import unohelper
+from com.sun.star.beans import PropertyValue
+
+import sys
+import os.path
+
+def write_pdf(doc, pdf_filename):
+    out_props = (
+        PropertyValue("FilterName", 0, "writer_pdf_Export", 0),
+        PropertyValue("Overwrite", 0, True, 0),
+        )
+    pdf_filename = os.path.expanduser(pdf_filename)
+    pdf_filename = os.path.abspath(pdf_filename)
+    pdf_url = unohelper.systemPathToFileUrl(pdf_filename)
+    print >> sys.stderr, pdf_url
+    doc.storeToURL(pdf_url, out_props)
+
+
+def convert2pdf(odf_filename, pdf_filename=None, opts=None):
+    desktop = openoffice.interact.Desktop(host=opts.host, port=opts.port)
+    # If the file does not exist, this will fail with:
+    # openoffice.interact.IllegalArgumentException: URL seems to be
+    #                      an unsupported one.
+    # (where the module name is missleading!)
+    doc = desktop.openFile(odf_filename, hidden=True)
+    if not pdf_filename:
+        pdf_filename = os.path.splitext(odf_filename)[0] + '.pdf'
+    write_pdf(doc, pdf_filename)
+    doc.dispose()
+    if opts.tear_down:
+        print >> sys.stderr, "Tear down is not yet implemented."
+        #desktop.teardown()
+
+if __name__ == '__main__':
+    import optparse
+    parser = optparse.OptionParser('%prog [options] ODF-Filename [PDF-Filename]')
+    parser.add_option('--tear-down', action='store_true',
+                      help="tear down OOo after convertion")
+    group = parser.add_option_group('To connect to already running server use:')
+    group.add_option('--host',  #default='localhost',
+                     help="hostname/ip of server (default: %default)")
+    group.add_option('--port',  default=2002, type=int,
+                     help="port the server is listening on (default: %default)")
+
+    opts, args = parser.parse_args()
+    if len(args) == 0 or len(args) > 2:
+        parser.error('expects one or two arguments')
+    if not opts.host:
+        opts.port = None
+    convert2pdf(*args, **{'opts': opts})
diff --git a/sample-scripts/ooo-server b/sample-scripts/ooo-server
new file mode 100644
index 0000000..6c3636b
--- /dev/null
+++ b/sample-scripts/ooo-server
@@ -0,0 +1,109 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+"""
+Manage a OOo server: start, stop and unlisten.
+
+If you want a full-blown server, help enhancing this script! See
+source for comments.
+
+Some ideas taken from Dag Wieers unoconv
+<http://dag.wieers.com/home-made/unoconv/>
+"""
+
+# Todo:
+#
+# * Implement a full-blown deamon for Unix and a full-blown service
+#   for Windows. Should this restart OOo automatically if it crashed?
+#
+# * Design issue: OOo behaves different depending whether there is
+#   already an instance running: If one it running, the new process
+#   returns. If there is no instance running yet, he new porcess will
+#   _not_ return. But how determine whether the server started
+#   successfully or there has been an error?
+#
+
+from openoffice.officehelper import _build_cmd_args, _build_connect_string, \
+     BootstrapException
+from openoffice.interact import Desktop
+
+import subprocess
+import sys
+
+def start(pipename=None, host=None, port=None):
+    """
+    Start an OOo instance which listens on pipename or host/port.
+    If there is already an running instance, it will be reused (done
+    by OOo automatically).
+    """
+    connectString = _build_connect_string(pipename, host, port)
+    cmdArray = _build_cmd_args(connectString)
+    # Todo: OOo starts a new instance, if noone is running. This is a
+    # drawback, since one can not tell, whether he has started the
+    # instancce or is reusing an already running one.
+    subprocess.Popen(cmdArray).pid
+
+
+def unlisten(pipename=None, host=None, port=None):
+    """
+    Tell the OOo instance listening on pipename or host/port to stop
+    listening on this connection.
+    """
+    connectString = _build_connect_string(pipename, host, port)
+    cmdArray = _build_cmd_args(connectString, unaccept=True)
+    subprocess.Popen(cmdArray).pid
+
+
+def stop(pipename=None, host=None, port=None):
+    '''
+    Stop the OOo instance listening pipename or host/port.
+
+    Note: If there is no instance listening on pipename or host/port,
+    none will be stopped, since it can not be reached.
+    '''
+    # Connect to the instance listening on host/port
+    try:
+        desktop = Desktop(host=host, port=port)._desktop # todo: use slots
+    except BootstrapException:
+        print >> sys.stderr, 'Could not contact OOo instance to stop it. Perhaps is was not running at all.'
+        raise SystemExit(1)
+
+    if desktop.CurrentFrame:
+        ### If there is a GUI now attached to the instance, disable only listener
+        unlisten(pipename, host, port)
+    else:
+        ### If there is no GUI attached to the instance, terminate instance
+        unlisten(pipename, host, port)
+        try:
+            desktop.terminate()
+        except DisposedException:
+            pass
+    
+
+if __name__ == '__main__':
+    import optparse
+    parser = optparse.OptionParser('%prog [options] '
+                                   '[ start | unlisten | stop ]')
+    parser.add_option('--host',  default='localhost',
+                      help="server address to listen on (default: %default, "
+                           "use '0.0.0.0' for listening on all IPv4 addresses)")
+    parser.add_option('--port',  default=2002, type=int,
+                      help="port to listen on (default: %default)")
+    opts, args = parser.parse_args()
+
+    if len(args) != 1:
+        parser.error('requiers exactly one argument')
+
+    cmd = args[0].lower()
+    if cmd == 'start':
+        start(host=opts.host, port=opts.port)
+    elif  cmd == 'unlisten':
+        unlisten(host=opts.host, port=opts.port)
+    elif  cmd == 'stop':
+        stop(host=opts.host, port=opts.port)
+    else:
+        parser.error('unknown action %r' % cmd)
diff --git a/sample-scripts/open-stream.py b/sample-scripts/open-stream.py
new file mode 100644
index 0000000..314d35f
--- /dev/null
+++ b/sample-scripts/open-stream.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>
+# Licenced under the GNU General Public License v3 (GPLv3)
+# see file LICENSE-gpl-3.0.txt
+#
+
+__author__ = "Hartmut Goebel <h.goebel at goebel-consult.de>"
+__copyright__ = "Copyright (c) 2008 by Hartmut Goebel <h.goebel at goebel-consult.de>"
+__licence__ = "GPLv3 - GNU General Public License v3"
+
+import openoffice.interact
+
+def loadAsStream(odf_filename, opts=None):
+    desktop = openoffice.interact.Desktop(host=opts.host, port=opts.port)
+
+    stream = open(odf_filename)
+    if 0:
+        # using a file-like object works, too
+        import StringIO
+        stream = StringIO.StringIO(stream.read())
+
+    doc = desktop.openStream(stream, hidden=True)
+    doc.dispose()
+
+
+if __name__ == '__main__':
+    import optparse
+    parser = optparse.OptionParser('%prog [options] ODF-Filename')
+    group = parser.add_option_group('To connect to already running server use:')
+    group.add_option('--host',  #default='localhost',
+                     help="hostname/ip of server (default: %default)")
+    group.add_option('--port',  default=2002, type=int,
+                     help="port the server is listening on (default: %default)")
+
+    opts, args = parser.parse_args()
+    if len(args) != 1:
+        parser.error('expects exactly one argument')
+    if not opts.host:
+        opts.port = None
+    loadAsStream(*args, **{'opts': opts})
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..f79f6f6
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,17 @@
+[bdist_rpm]
+doc_files = README
+	LICENSE-gpl-3.0.txt
+
+[sdist]
+formats = bztar
+
+[egg_info]
+tag_build = -r34-20090228
+tag_date = 0
+tag_svn_revision = 0
+
+[aliases]
+release = egg_info sdist bdist_egg bdist_msi register
+daily = egg_info --tag-date --tag-svn-revision sdist bdist_egg
+devel = develop --install-dir ~/lib/python/ --script-dir ~/bin
+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..de741d7
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+try:
+    from setuptools import setup
+except ImportError:
+    from distutils.core import setup
+
+# patch distutils if it can't cope with the "classifiers" or
+# "download_url" keywords
+from sys import version
+if version < '2.2.3':
+    from distutils.dist import DistributionMetadata
+    DistributionMetadata.classifiers = None
+    DistributionMetadata.download_url = None
+
+setup(
+    name='openoffice-python',
+    description='Enhanced Python interfaces to OpenOffice.org',
+    packages=['openoffice'],
+    version='0.1',
+    author='Hartmut Goebel',
+    author_email='h.goebel at goebel-consult.de',
+    url          = "http://openoffice-python.origo.ethz.ch/",
+    download_url = "http://openoffice-python.origo.ethz.ch/download",
+    platforms=['POSIX'],
+    license='GPLv3',
+    classifiers=[
+        'Development Status :: 3 - Beta',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: GNU General Public License (GPL)',
+        'Operating System :: POSIX',
+        'Programming Language :: Python',
+        'Topic :: Software Development :: Libraries :: Python Modules'
+        ],
+    requires=['python(>=2.3)'],
+    )
-- 
openoffice-python



More information about the tryton-debian-vcs mailing list