Cédric Bosdonnat - OpenOffice.orghttps://bosdonnat.fr/2010-09-24T22:03:00+02:00A geek's perspectiveGSoc 2010 Wrap-Up2010-09-24T22:03:00+02:002010-09-24T22:03:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2010-09-24:/gsoc-2010-wrap-up.html<p><img alt="GSoc 2010 Logo" src="http://2.bp.blogspot.com/_p15UnEJyA1c/TFrz3e7YzdI/AAAAAAAAAaA/OkBiYJBCB-M/s320/GSOC2010_MedRect_YearURL.png" title="GSoc 2010 Logo">End of september: it's time for Go-oo GSoc
2010 wrap-up. This term again, 6 students have been working hard during
their summer holidays to improve Go-oo. This year, the students needed
to get rid of the building problem before applying. <a href="http://www.freedesktop.org/wiki/Software/ooo-build/SummerOfCode/2010#Theexercise">That tiny
exercise</a> helped us a lot to chose motivated …</p><p><img alt="GSoc 2010 Logo" src="http://2.bp.blogspot.com/_p15UnEJyA1c/TFrz3e7YzdI/AAAAAAAAAaA/OkBiYJBCB-M/s320/GSOC2010_MedRect_YearURL.png" title="GSoc 2010 Logo">End of september: it's time for Go-oo GSoc
2010 wrap-up. This term again, 6 students have been working hard during
their summer holidays to improve Go-oo. This year, the students needed
to get rid of the building problem before applying. <a href="http://www.freedesktop.org/wiki/Software/ooo-build/SummerOfCode/2010#Theexercise">That tiny
exercise</a> helped us a lot to chose motivated students: all of them
managed to accomplish their task. The only drawback we had with a
project was mostly our fault (I mean the mentors): nobody was really
comfortable with that part of the code and the student lost quite some
time to try to understand it.</p>
<p>The completed projects are:</p>
<ul>
<li>New and improved RTF export filter by Miklos Vajna (<a href="http://cgit.freedesktop.org/libreoffice/writer/commit/?id=db6af6a208ed578625ef2df23f50ec982b562ca6">the code</a>)</li>
<li>Maths editor improvements by Jonas Jensen (<a href="http://cgit.freedesktop.org/libreoffice/build/commit/?id=d6b73c9d63b02142b9d48d9fed1573912ee3705e">the code</a>)</li>
<li>Maths object baseline aligment by Michal Spisiak (<a href="http://cgit.freedesktop.org/libreoffice/build/commit/?id=bba02943fd850a1f5aad66f51346038d19e643c3">the code</a>)</li>
<li>Add effects to styles by Larisa Raicevic (<a href="http://cgit.freedesktop.org/libreoffice/build/commit/?id=a0866751f996613466f7e10619c3c3f2ff54c38d">the code</a>)</li>
<li>Connect the gallery with OpenClipart by Tijana Milijanovic (<a href="http://cgit.freedesktop.org/libreoffice/build/commit/?id=f3a517b005a31607b373393600ac41237a55b1f4">the
code</a>)</li>
<li>Calc usability improvements by Thomas Dziedzic (<a href="http://cgit.freedesktop.org/libreoffice/build/commit/?id=ccc534c27bc51526a291e21797ac337a7a695346">the code</a>)</li>
</ul>
<p>This was my second year as mentor, and first year as organization admin.
We had really brilliant students this year and two of them, <a href="http://conference.opensuse.org/indico//contributionDisplay.py?contribId=86&sessionId=28&confId=0">Jonas</a>
and <a href="http://conference.opensuse.org/indico//contributionDisplay.py?contribId=81&sessionId=28&confId=0">Miklos</a> will even join us at <a href="http://en.opensuse.org/openSUSE:Conference">openSUSE conferences</a> in
Nürnberg to present their work. This year we have a lot of code that
can be almost directly be integrated to Go-oo builds. My biggest concern
now is how to make students continue to contribute after the end of GSoc
term...</p>
<p>I owe many thanks to all our students, but also to all the mentors who
did a great job as well (<a href="http://eric.bachard.org/news/index.php">Eric</a>, <a href="http://fridrich.blogspot.com/">Fridrich</a>, <a href="http://artax.karlin.mff.cuni.cz/~kendy/blog">Kendy</a>,
<a href="http://kohei.us/">Kohei</a>,Radek and <a href="http://blog.thebehrens.net">Thorsten</a>). I would like to thank Google for
allowing us to participate in the Summer of Code for the second
year.</p>Word binary files dumper2010-08-24T17:22:00+02:002010-08-24T17:22:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2010-08-24:/word-binary-files-dumper.html<p>I have been away quite a long time for vacation: a one month
trip around China with my wife. I wanted to write some blog post, but I
still couldn't find time for it... but I have something cooking here
that is worth talking about. I have started to write …</p><p>I have been away quite a long time for vacation: a one month
trip around China with my wife. I wanted to write some blog post, but I
still couldn't find time for it... but I have something cooking here
that is worth talking about. I have started to write a small command
line tool showing the internals of .doc files. Thanks to <a href="http://poi.apache.org/">apache POI</a>
and the <a href="http://msdn.microsoft.com/en-us/library/cc313153%28v=office.12%29.aspx">file format specs</a>, it currently outputs quite nicely the
paragraphs and their runs as well as the field descriptors. This helps
me a lot to understand what is going on in the OpenOffice.org WW8 import
filter, but is currently not complete.</p>
<p>The sources are available under GPL v3 on this gitorious repository:
<a href="http://gitorious.org/ww8dumper/ww8dumper">http://gitorious.org/ww8dumper/ww8dumper</a>, feel free to propose some
patches to make is progress!</p>Thanks for the dev workshop2010-07-10T09:58:00+02:002010-07-10T09:58:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2010-07-10:/thanks-for-the-dev-workshop.html<p>The OpenOffice.org and Go-oo hacking workshop has been run
smoothly with some persons already in french community, but also some
curious people. In this post, I would like to thank all of the attendees
for their courage and patience. I hope to see them soon hacking OOo and
try …</p><p>The OpenOffice.org and Go-oo hacking workshop has been run
smoothly with some persons already in french community, but also some
curious people. In this post, I would like to thank all of the attendees
for their courage and patience. I hope to see them soon hacking OOo and
try to motivate others to join us. This workshop wouldn't have been
possible without the help of <a href="http://aquinetic.org/en">@aquinetic</a>, an non-profit-making
association who kindly provided us four virtual machines running on
their brand new computing farm.</p>
<p>We started to think about how that help could continue in the future.
@quinetic would provide us two virtual machines on that very same
environment. This way, volunteers with slow machines would be able to
hack OpenOffice.org more easily.</p>OOo hacking workshop at LSM2010-06-21T09:28:00+02:002010-06-21T09:28:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2010-06-21:/ooo-hacking-workshop-at-lsm.html<p>For those who wanted to start hacking OOo, I will organize a
hacking workshop at LSM in Bordeaux (France) on July, 7th. All the
details are <a href="http://2010.rmll.info/Workshop-Hack-OpenOffice-org-without-pain-well-not-too-much.html">on the LSM agenda</a>. I hope to meet you there to practice
what has already been started here. I also hope that this would …</p><p>For those who wanted to start hacking OOo, I will organize a
hacking workshop at LSM in Bordeaux (France) on July, 7th. All the
details are <a href="http://2010.rmll.info/Workshop-Hack-OpenOffice-org-without-pain-well-not-too-much.html">on the LSM agenda</a>. I hope to meet you there to practice
what has already been started here. I also hope that this would be a
nice occasion to kick off the creation of a developer team in the french
OOo NL project.</p>Hacking OOo for dummies (2)2010-06-18T15:52:00+02:002010-06-18T15:52:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2010-06-18:/hacking-ooo-for-dummies-2.html<p>I hope that you all had the time to get your favourite OOo
flavour built before that post. We will now enter the real hacking part.
In order to have some kind of example hack, I will use the<a href="http://www.openoffice.org/issues/show_bug.cgi?id=2838">issue #2838
about auto-correction replacements and caps</a>. We will need the …</p><p>I hope that you all had the time to get your favourite OOo
flavour built before that post. We will now enter the real hacking part.
In order to have some kind of example hack, I will use the<a href="http://www.openoffice.org/issues/show_bug.cgi?id=2838">issue #2838
about auto-correction replacements and caps</a>. We will need the
following steps to fix the bug:</p>
<ol>
<li>Locate the concerned code</li>
<li>Understand it and fix it</li>
<li>Create a patch</li>
</ol>
<h3>Show me the code!</h3>
<h4>How is it organized?</h4>
<p>First of all, you need to globally understand how the OpenOffice.org and
Go-oo source code is organized. We will start with the organization of
the OpenOffice.org sources as these will be included in Go-oo. There is
a lot of code in OpenOffice.org and has all been split into what are
often called modules. These are coming from the CVS days and are the
root folders of the OOo sources. You probably won't go through all of
them, then here are some important ones:</p>
<ul>
<li><strong>sw, sd, sc, starmath</strong>: these are containing the sources of the
main applications of OOo, respectively Writer, Impress/Draw, Calc
and Math</li>
<li><strong>sfx2, svx, svtools, editeng, svl, framework</strong>: these are
containing some common code to all the apps. A lot of interesting
stuffs are sitting here</li>
<li><strong>offapi</strong>: contains all the IDL files for the UNO API definition</li>
<li><strong>xmloff</strong>: contains the ODF filters code</li>
<li><strong>instsetoo_native</strong>: is the top module needing all the others.
It's the one doing the final packaging</li>
<li><strong>solenv</strong>: contains the build macros and tools</li>
</ul>
<p>For the other modules, the best is to discover them once you'll need
them. There is a special folder named <strong>solver</strong> gathering all the build
results: of course this is not really a module. You can just ignore
everything in the <strong>binfilter</strong> as this is quite old and more or less
duplicated code.</p>
<p>On the Go-oo side, things are pretty much the same, expect that the
upstream sources are contained in the <strong>build</strong> directory. The folder
name is the milestone name and is looking like <strong>dev300-mXX</strong> or
<strong>oooXXX-mYY</strong>. Here are the important folders for Go-oo sources:</p>
<ul>
<li><strong>build</strong>: contains all the build results, including the upstream
sources unpacked and patched</li>
<li><strong>patches</strong>: contains the patches to apply. The
<strong>patches/dev300/apply</strong> file describes which patch to apply during
the build</li>
<li><strong>src</strong>: contains all the needed sources before unpacking them</li>
<li><strong>bin</strong>: contains the scripts used to build the sources as well as
some other useful tools</li>
<li><strong>doc</strong>: contains some hackers notes and patches to explain some
parts of the code</li>
</ul>
<h4>How do I find the code I need to hack?</h4>
<p>One of the easy ways to find some piece of code is to use the UI
strings. It's much better to use an en-US build (the default one) to
ease the task. In the case of the #2838 bug, here are a few steps
leading to useful infos:</p>
<ol>
<li>Run OpenOffice.org and open the <strong>Tools > Autocorrect options</strong>
menu. Then go to the <strong>Options</strong> tab. The string "<strong>Use replacement
table</strong>" is very likely to lead us to the option enabling the
replacement... and then to the replacement code itself.</li>
<li>In <a href="http://svn.services.openoffice.org/opengrok/">opengrok</a>, run a full search with that string. Don't forget
to add the double quotes to restrict the results. For the OpenGrok
search you need to specify the milestone of your sources; in most of
the cases there won't be any big difference... but who knows?</li>
<li>Spot the .src files in the results of the previous search: these are
containing the messages in en-US for the UI. In our case there are
two of them: one in sw and the other in cui (or svx for ooo320-mXX
milestones). A search of the identifier of the string
(<strong>ST_USE_REPLACE</strong> in our case) will help you to find in which
cxx file this string is used (<strong>cui/source/tabpages/autocdlg.cxx</strong>
in our case).</li>
<li>Now that we have some starting point in the code, we can read the
surrounding code to find out the interesting place to hack. In our
case, the UI string is used in the <strong>OfaSwAutoFmtOptionsPage</strong> class
representing the tab page of the dialog. This class is using
<strong>SvxSwAutoFmtFlags::bAutoCorrect</strong> and <strong>SvxAutoCorrect</strong> to store
the option: searching for them in the code will lead us to the code
actually doing the replacement.</li>
<li>Using that method we discovered that all the auto-corrections are
applied in <strong>SwAutoFormat::AutoCorrect</strong> and
<strong>SvxAutoCorrect::AutoCorrect</strong> methods. We now only have to
implement the changes in the methods
<strong>SwAutoCorrDoc::ChgAutoCorrWord</strong> and
<strong>SvxAutoCorrDoc::ChgAutoCorrWord</strong>.</li>
</ol>
<h3>Understanding the code and fixing it</h3>
<p><strong>If you are hacking Go-oo, you need to run some commands before
changing any line in the code. Jump to the next section to ease your
life!</strong></p>
<h4>ctags, opengrok and doxygen</h4>
<p>Understanding the code means being able to get the correct infos about
the surrounding code. There are several tools to help the developer in
that task. I'm mostly using ctags and the <a href="http://docs.go-oo.org/">go-oo doxygen
documentation</a> (and of course OpenGrok) to understand the OOo code. To
easily navigate in the source code, I usually create a ctags database
and use it in VIm (you can use it in Emacs as well but I don't know how
it works).</p>
<p>In any case installing ctags in mandatory:</p>
<div class="highlight"><pre><span></span><code>sudo zypper in ctags
</code></pre></div>
<p>To create your ctags database, on Go-oo:</p>
<div class="highlight"><pre><span></span><code>make tags
</code></pre></div>
<p>On OpenOffice.org you will need to do basically the same, but for this
you will need to <a href="http://cgit.freedesktop.org/ooo-build/ooo-build/tree/bin/create-tags">download the script</a> and run it from the root folder
of the sources.</p>
<p>Then in VIm you can use <strong>Ctrl+]</strong> to jump to the definition of the
selected type, and <strong>Ctrl+T</strong> to jump back to the previous place. The
command <strong>:ts SomeType</strong> will also give all the matching places found in
the ctags database. Generating the tags database will also allow you to
have automatic completion in VIm thanks to <a href="http://www.vim.org/scripts/script.php?script_id=1520">OmniCppComplete</a>. You
should search for the <a href="/tag/vim.html">previous VIm tips</a> I posted: they are really
useful when hacking OOo.</p>
<p>For VIm to find your tags file, don't forget to add this to your
<strong>\~/.vimrc</strong> file:</p>
<div class="highlight"><pre><span></span><code><span class="s2">" Tags files are searched first relative to the current file, then relative to</span>
<span class="s2">"</span> the current working directory, and last in the <span class="nv">$HOME</span> directory.
<span class="nb">set</span> <span class="nv">tags</span><span class="o">=</span>./tags,./../tags,./../../tags,./../../../tags,./../../../../tags,./../../../../../tags,tags,../tags,../../tags,../../../tags,../../../../tags,../../../../../tags,~/tags
</code></pre></div>
<h4>Hacking</h4>
<p>After the hack you will need to rebuild and test. There is no need to
rebuild everything as mentioned in the previous blog post. You will only
need to rebuild the modules you have changed. Of course some modules are
dependents and you may need to rebuild more modules. Before anything you
need to setup the environment variables for building OpenOffice.org. If
you are hacking Go-oo it all happens in the <strong>build/\<milestone></strong>
folder containing the upstream sources.</p>
<p>To setup the environment:</p>
<div class="highlight"><pre><span></span><code>. Linux*Env.Set.sh
</code></pre></div>
<p>Go into the module to rebuild and run the following command. Note that
the arguments provided here are useless is you aren't building with
icecream:</p>
<div class="highlight"><pre><span></span><code>build -P6 -- -P6
</code></pre></div>
<p>Now the hacked sources are built and the result have been generated in
the <strong>\$INPATH</strong> folder of the module. If you are hacking Go-oo there is
nothing more to do to test as the dev-install links to these folders. If
you are hacking vanilla OpenOffice.org you need to copy the .so and .res
files at the appropriate place in the installation (adding the writing
permission to your user on the existing files will certainly be needed).</p>
<p>In any case, if you want to be sure that all the dependent modules are
rebuilt, you need to run the following command in the
<strong>instsetoo_native</strong> module (and reinstall OOo for the upstream
version):</p>
<div class="highlight"><pre><span></span><code>build --all -P6 -- -P6
</code></pre></div>
<h4>Debugging</h4>
<p>Debugging is often necessary to see what is going wrong. As you may have
seen, we haven't used the configure options to build the debug symbols:
that was on purpose to avoid building loads of unnecessary build symbols
(they use place on the hard disk and take time during the build). Here
is how to get them for a given module.</p>
<p>First remove the output folder for the module</p>
<div class="highlight"><pre><span></span><code>rm -r <span class="nv">$INPATH</span>
</code></pre></div>
<p>Then rebuild with the debug symbols</p>
<div class="highlight"><pre><span></span><code>build <span class="nv">debug</span><span class="o">=</span>t -P6 -- -P6
</code></pre></div>
<p>Now that the symbols are generated, you will be able to use gdb to
actually debug. The goal of this tutorial isn't to make a master
debugger of you, but here are some useful commands and tips.</p>
<ul>
<li>You can find a <a href="http://cgit.freedesktop.org/ooo-build/ooo-build/tree/scratch/writer/gdbinit-cbosdo">copy of my .gdbinit file</a> on Go-oo git repository.
It contains useful functions grabbed here and there. Have a close
look at the <strong>ptu</strong> and pou functions: they will help you printing
OpenOffice.org strings (which aren't just <strong>char*</strong>).</li>
<li>To start gdb with OOo, go to the program folder of your install and
run <strong>gdb ./soffice.bin</strong>. If you are running a dev-install of
Go-oo, sourcing <strong>ooenv</strong> is mandatory before that.</li>
<li>To place a breakpoint, use the <strong>b</strong> command in gdb. The easiest way
is to give the filename and line where to stop, for example:<strong>b
doc.cxx:501</strong></li>
<li>The basic commands to know are <strong>run</strong>, <strong>step</strong>, <strong>next</strong>,
<strong>continue</strong> and <strong>print</strong>. I hope their names are clear enough for
you (or you will need to read gdb help).</li>
</ul>
<p>You can find a lot of debugging tricks on the <a href="http://www.freedesktop.org/wiki/Software/ooo-build/DebuggingIt">Go-oo DebuggingIt
page</a>.</p>
<h3>Creating the patch</h3>
<p>Now that you have hacked OOo to get your feature implemented, you will
need a patch to show to the other devs. This will be done differently
depending if you are hacking OpenOffice.org or Go-oo. Note that for
Go-oo users you need to run some commands before actually hacking.</p>
<h4>The OpenOffice.org way</h4>
<p>As the sources your have hacked are a local mercurial repository, you
simply need to go through the following steps:</p>
<div class="highlight"><pre><span></span><code>hg add path/to/each/new/file
hg commit <span class="c1">#You will need to type a message after that</span>
hg <span class="nb">export</span> tip >myhack.diff
</code></pre></div>
<p>The last command may need to vary if you ran several commits.</p>
<h4>The Go-oo way</h4>
<p>Before changing anything in the code, we need to create a new git
repository in the <strong>build/\<milestone></strong> folder: that will simplify the
patch creation later.</p>
<div class="highlight"><pre><span></span><code><span class="nb">cd</span> build/<milestone>
../../bin/create-gitignores.sh <span class="o">&&</span> git add . <span class="o">&&</span> git commit -m <span class="s2">"initial commit"</span> <span class="o">&&</span> git checkout -b myhack
</code></pre></div>
<p>Now everything is ready: you can hack quietly and continue with these
steps when your changes are ready to be shown to the world.</p>
<div class="highlight"><pre><span></span><code>git add path/to/each/new/file
git commit -a <span class="c1">#You will need to type a message after that</span>
git diff --no-prefix master >myhack.diff
</code></pre></div>
<p>In this case you will be working in a new branch and keep the master
branch untouched. You can commit as may times as you want the command to
create the diff will always be the same. There are plenty of ways to
handle the patches; a very nice one is described by <a href="http://freedesktop.org/wiki/ThorstenBehrens">Thorsten using
stg</a>.</p>
<p>The most complex task is left to you: getting familiar with the parts of
the OOo code interesting you. Of course nobody knows it all (or I would
really be impressed), but the more you hack, the more you will learn.
Don't forget to ask other developers on IRC or on mailing lists: others
can often have ideas to help you.</p>
<p>I still haven't really though about the next step, stay tuned...</p>Asian phonetic guide and doc export2010-06-16T17:57:00+02:002010-06-16T17:57:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2010-06-16:/asian-phonetic-guide-and-doc-export.html<p>In a <a href="https://bosdonnat.fr/asian-phonetic-guide-exported-in-docx.html">previous post</a> I was mentioning a bug in the asian
phonetic guide export to doc files. I finally fixed that one and
discovered that this is corresponding to upstream issue <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=79246">#79246</a>
(nearly 3 years old and 6 votes). The fix has been committed to the
<a href="http://cgit.freedesktop.org/ooo-build/ooo-build/commit/?id=0b5a7478bdd7fd1be304e9cb2b395ac7f42f9c61">master branch of …</a></p><p>In a <a href="https://bosdonnat.fr/asian-phonetic-guide-exported-in-docx.html">previous post</a> I was mentioning a bug in the asian
phonetic guide export to doc files. I finally fixed that one and
discovered that this is corresponding to upstream issue <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=79246">#79246</a>
(nearly 3 years old and 6 votes). The fix has been committed to the
<a href="http://cgit.freedesktop.org/ooo-build/ooo-build/commit/?id=0b5a7478bdd7fd1be304e9cb2b395ac7f42f9c61">master branch of the ooo-build</a> git repository and <a href="http://hg.services.openoffice.org/cws/cbosdo06/rev/9594519420b0">cbosdo06 CWS</a>.
This fix should be available in 3.3 for both ooo-build and
upstream.</p>Hacking OOo for dummies (1)2010-05-27T16:02:00+02:002010-05-27T16:02:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2010-05-27:/hacking-ooo-for-dummies-1.html<p>This is the first of the serie of posts to introduce OOo
development. It will be all about getting ready to hack, which means
getting the sources, installing the dependencies and building the
sources. The commands here are provided for openSUSE 11.2: you will
certainly need to adapt them …</p><p>This is the first of the serie of posts to introduce OOo
development. It will be all about getting ready to hack, which means
getting the sources, installing the dependencies and building the
sources. The commands here are provided for openSUSE 11.2: you will
certainly need to adapt them to your distribution.</p>
<h3>Getting the sources</h3>
<p>The sources are organized differently in upstream OpenOffice.org (the
official version) and Go-oo. Upstream sources are stored in a mercurial
repository and the development branches are called CWS (Child
WorkSpace). The code integration process is pretty different from Go-oo
where the sources are mainly composed of patches to apply on the
upstream sources. Those patches are stored in a git repository. For the
rest of the serie, I'll consider that the upstream sources are located
on <em>\~/upstream</em> and the Go-oo sources on <em>\~/go-oo</em> on your machine.</p>
<h4>The OpenOffice.org way</h4>
<p>First install Mercurial:</p>
<div class="highlight"><pre><span></span><code>sudo zypper in mercurial
</code></pre></div>
<p>Extract a clean copy of the sources in a folder that will never be
touched. In fact, you will see that the created directory only contains
a hidden folder and no source. I usually do this way to spare some
bandwidth because downloading all the sources is quite a long operation.</p>
<div class="highlight"><pre><span></span><code><span class="nb">cd</span> ~/upstream
hg clone -U http://hg.services.openoffice.org/DEV300 local_DEV300
</code></pre></div>
<p>This operation takes a really long time, you can go out and do some
sport (or whatever you like). After it is completed, you can see a
<em>local_DEV300</em> folder containing nothing but a hidden folder. This
contains a copy of the sources hosted on the OpenOffice.org servers. The
interest here is that you won't need to get everything when you will
need to update that copy with the latest sources... and then you'll need
to do less sport the next times!</p>
<p>In order to extract sources to build and hack, you will need to
duplicate the downloaded sources in another folder. It will be
<em>\~/upstream/myhack</em> in that tutorial. You will then be able to safely
hack in that folder and keep the previous one clean for the sources
updates.</p>
<div class="highlight"><pre><span></span><code>hg clone local_DEV300 myhack
</code></pre></div>
<p>You are now ready to move to the build step.</p>
<h4>The Go-oo way</h4>
<p>First install Git:</p>
<div class="highlight"><pre><span></span><code>sudo zypper in git
</code></pre></div>
<p>Extract the latest sources:</p>
<div class="highlight"><pre><span></span><code><span class="nb">cd</span> ~/go-oo
git clone git://anongit.freedesktop.org/git/ooo-build/ooo-build
</code></pre></div>
<p>Note that the master branch is unstable and may not build. You should
<a href="http://go-oo.org/developers/">ask the developers on IRC or on the mailing-list</a> to check if the
master is usable at that time. Otherwise, you may prefer to extract the
sources of a stable branch. See the Go-oo wiki for more informations on
<a href="http://freedesktop.org/wiki/Software/ooo-build/GettingIt#Gettingaparticularbranch">how to get a particular branch</a>. The sources are now happily sitting
in a newly created <em>ooo-build</em> folder: you can move to the next step!</p>
<h3>Building</h3>
<p>In order to build you will need a lot of packages and dependencies. This
step only needs to be done once for each machine you are building on. On
openSUSE there is a nice trick to quickly install most of the
dependencies for building OpenOffice.org or Go-oo:</p>
<div class="highlight"><pre><span></span><code><span class="c1"># Enable the openSUSE sources package repository</span>
sudo zypper mr -r repo-source
<span class="c1"># Install the dependencies</span>
sudo zypper si -d OpenOffice_org-bootstrap
</code></pre></div>
<p>Some dependencies will certainly be still missing as this install the
ones to build the OOo version shipped with openSUSE and we will build a
new version in most of the cases. Here is a command to install the
missing dependencies (for the current versions)</p>
<div class="highlight"><pre><span></span><code>sudo zypper in java-1_6_0-sun-devel junit4
</code></pre></div>
<p>As the Java JDK installation has updated some script run for each new
shell you need to open a new shell to continue.</p>
<p>In order to speedup the build if you have a multi-core machine or
several machines, you should carefully read <a href="http://people.gnome.org/~michael/blog/icecream.html">Michael's blog post on
icecream</a>. The steps after starting the daemon aren't necessary for
our cases: this needs to be adapted to OpenOffice.org build system (or
won't be needed for Go-oo). Icecream will allow you to build on
several cores / machines at the same time and then gain precious time.
If you have a default installation of openSUSE, don't forget to change
the firewall settings by either turn it off or add the rules to allow
icecream through it.</p>
<h4>The OpenOffice.org way</h4>
<p>In order to configure the build you need to issue the following
commands. Of course you can add some more parameters to the configure to
spare some build time.</p>
<div class="highlight"><pre><span></span><code>./configure --with-use-shell<span class="o">=</span>bash --disable-build-mozilla
touch external/unowinreg/unowinreg.dll
</code></pre></div>
<p>Copy the mozilla binaries from the page
<a href="http://tools.openoffice.org/moz_prebuild/OOo3.2/">http://tools.openoffice.org/moz_prebuild/OOo3.2/</a> into the
<em>\~/upstream/myhack/moz/zipped</em> folder. The files to copy are depending
on the architecture you are building on. Read carefully the error
message of the configure to know which files to download and restart the
configure command. Once the configuration is finished, you need to run
the following commands:</p>
<div class="highlight"><pre><span></span><code>./bootstrap
. Linux*Env.Set.sh
</code></pre></div>
<p>Note that the last command has to be issued any time you need to build
some part of the OpenOffice.org sources: it sets a whole lot of
environment variables used during the build. Without having run that
command the <em>build</em> tool won't be found in the <em>PATH</em>. The first command
generally needs to be called only at the first build.</p>
<p>For the ones who are going to perform a parallel build using icecream,
the following commands are needed to build:</p>
<div class="highlight"><pre><span></span><code><span class="nb">export</span> <span class="nv">CXX</span><span class="o">=</span>/opt/icecream/bin/g++
<span class="nb">export</span> <span class="nv">CC</span><span class="o">=</span>/opt/icecream/bin/gcc
<span class="nb">cd</span> instsetoo_native
build --all -P6 -- -P6
</code></pre></div>
<p>For others simply run</p>
<div class="highlight"><pre><span></span><code>make
</code></pre></div>
<h4>The Go-oo way</h4>
<p>The first thing to do is to configure the build. The arguments I'm using
here are really generic: I usually don't build the KDE parts and some
others to avoid installing some more dependencies. If you didn't install
<em>icecream</em> in the previous step you can remove the corresponding
options. The max jobs option specifies the maximum number of parallel
jobs to run during the build.</p>
<div class="highlight"><pre><span></span><code><span class="nb">cd</span> ooo-build
</code></pre></div>
<p>./autogen.sh --with-distro=SUSE-11.2 --with-gcc-speedup=icecream --with-max-jobs=6</p>
<p>Now that the build is configured you can download the upstream sources
needed to apply Go-oo patches. This step takes a while the first time
and much less the next times as it uses git to download the upstream
sources.</p>
<div class="highlight"><pre><span></span><code>./download
</code></pre></div>
<p>Then you can actually build the sources using Gnu make. There is nothing
to worry about the parallel build: the makefiles will handle it for you
if you have used the proper options for the configure step.</p>
<div class="highlight"><pre><span></span><code>make
</code></pre></div>
<h3>After the build</h3>
<p>Keep an eye on the build as this will take a lot of time and can break
if there is something wrong in the sources or with your configuration.
Now that your sources are built, you will need to learn how to hack
OpenOffice.org. In the mean time you will certainly want to play with
your freshly built toy. Here are some details about it.</p>
<h4>The OpenOffice.org way</h4>
<p>The quickest way is to follow <a href="http://blogs.sun.com/GullFOSS/entry/the_fastest_way_to_get">that blog post</a>.</p>
<div class="highlight"><pre><span></span><code><span class="nb">export</span> <span class="nv">LOCALINSTALLDIR</span><span class="o">=</span>~/upstream/myhack-install
<span class="nb">cd</span> ~/upstream/myhack/instsetoo_native/util
dmake openoffice_en-US <span class="nv">PKGFORMAT</span><span class="o">=</span>installed
</code></pre></div>
<p>To run the freshly installed OpenOffice.org:</p>
<div class="highlight"><pre><span></span><code><span class="nb">cd</span> ~/upstream/myhack-install/openoffice.org3/program
./soffice.bin
</code></pre></div>
<p>Note that this installation copies all the needed files from the build
tree. If anything changed in the sources, you will need to copy the
changed files from the build to the installation.</p>
<h4>The Go-oo way</h4>
<p>Go-oo provides some useful tricks to install a development instance. By
running the following command you will have an OOo installed in
\~/go-oo/ooo-build/build/install and the files of this install will be
linked to the corresponding files in the build tree. Thus after a change
and rebuild of the sources, there is nothing to do to have an updated
install.</p>
<div class="highlight"><pre><span></span><code>make dev-install
</code></pre></div>
<p>To run the installed OOo, you need to source the <em>ooenv</em> file. Here is
how to do it:</p>
<div class="highlight"><pre><span></span><code><span class="nb">cd</span> ~/go-oo/ooo-build/build/install/program
. ooenv
./soffice.bin
</code></pre></div>
<p>Happy building until the next step!</p>OOo francophone hackers group2010-05-20T22:12:00+02:002010-05-20T22:12:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2010-05-20:/ooo-francophone-hackers-group.html<p>For some times, I'm fixing some simple bugs in OpenOffice.org. I'm
starting to think that, with some help, any C++ developer could dive
into OOo's code to fix such bugs. This would help the project to go even
faster and bring some more connections between the users and the …</p><p>For some times, I'm fixing some simple bugs in OpenOffice.org. I'm
starting to think that, with some help, any C++ developer could dive
into OOo's code to fix such bugs. This would help the project to go even
faster and bring some more connections between the users and the
developers. I find it pretty hard to believe that there are only two
developers among the OOo francophone NL project members. In order to
verify that, I decided to create some OOo hackers group inside the Fr NL
project. The principle is easy: experienced developers are mentoring the
newcomers. This small team will discuss the bugs and features it will
want to fix or implement inside the Fr project. The criteria for the bug
selection are simple too: first take the issues in IssueZilla with
numerous votes and the oldest ones. If you want to join that starting
team, don't hesitate: jump in and send an email to present yourself to
the dev@fr.openoffice.org mailing list. The interest to keep that team
in the French NL project is that people who aren't comfortable with
english will be able to be helped.</p>
<p>As all this small world will need to find some useful documentation to
get the sources, build and hack OOo, I'll start a blogs posts / tutorial
serie explaining how to do that. As I'm also a member of the Go-oo team,
I'll of course give the details for the vanilla version of OOo, but also
for Go-oo: this way everybody will be happy! All my machines are running
openSUSE 11 or SLED 11 (guess why ;) ): then I'll provide the commands
for this linux distribution... you are free to post comments for the
other distros.</p>
<p>Until next time for the first step: <em>Get the sources and build...</em></p>Asian phonetic guide exported in Docx2010-05-10T15:42:00+02:002010-05-10T15:42:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2010-05-10:/asian-phonetic-guide-exported-in-docx.html<p>The asian phonetic guide is a useful feature when learning an
asian language. Last week I worked on writing it in the docx files. The
feature is now happily sitting in the <a href="http://cgit.freedesktop.org/ooo-build/ooo-build/tree/patches/dev300/docx-fixes02.diff">docx-fixes02.diff</a> patch in the
go-oo git repository. Here are some screenshots of the feature in Word
and …</p><p>The asian phonetic guide is a useful feature when learning an
asian language. Last week I worked on writing it in the docx files. The
feature is now happily sitting in the <a href="http://cgit.freedesktop.org/ooo-build/ooo-build/tree/patches/dev300/docx-fixes02.diff">docx-fixes02.diff</a> patch in the
go-oo git repository. Here are some screenshots of the feature in Word
and OpenOffice.org for those eager to see what it is.</p>
<p><img alt="Phonetic guide in OOo" src="https://bosdonnat.fr/data/ruby-ooo.png"></p>
<p>Phonetic guide in OOo</p>
<p><img alt="Phonetic guide reopened in word" src="https://bosdonnat.fr/data/ruby-word-fix.png"></p>
<p>Phonetic guide reopened in word</p>
<p>The phonetic guide configuration options in OpenOffice.org and Word
aren't the same. What is working here is the export of the text with
it's usual properties and the alignement of the pronounciation. Note
that the characters on the above sample are grouped in the OOo dialog,
but not when opening Word's dialog: this comes from the different color
setting applied to one of the characters.</p>
<p>When testing this code, I also discovered a strange compatibility issue
between Word 97 and Word 2007 when opening the .doc version of the file:</p>
<ul>
<li>For Word 97, the field for the ruby text in the doc file needs to be
{ EQ \* jc0 \* "Font:Arial" \* hps12 \o(\s\up
10(kong3zi); 孔子 ) }*</li>
<li>For Word 2007, the field for the ruby text in the doc file needs to
be { EQ \* jc0 \* "Font:Arial" \* hps12 \o(\s\up
10(kong3zi), 孔子 ) }*</li>
</ul>
<p>Then when saving a file with a phonetic guide in Word 97 and opening it
in Word 2007, all the fields need to be changed to have commas as
function parameters separator (instead of
semi-colon).</p>Windows 7, Office 2010 and user freedom2010-05-07T11:49:00+02:002010-05-07T11:49:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2010-05-07:/windows-7-office-2010-and-user-freedom.html<p>As I needed to perform some tests on Windows 7 and Office 2010
these days and I had two interesting surprises.</p>
<ol>
<li>Office 2010 asks the user to choose between ODF and OOXML as default
storing format.</li>
<li>Windows 7 asks which Web browser to use / install</li>
</ol>
<p>Here are two screenshots to …</p><p>As I needed to perform some tests on Windows 7 and Office 2010
these days and I had two interesting surprises.</p>
<ol>
<li>Office 2010 asks the user to choose between ODF and OOXML as default
storing format.</li>
<li>Windows 7 asks which Web browser to use / install</li>
</ol>
<p>Here are two screenshots to show these choices... they may be biased but
at least they are existing.</p>
<p><img alt="Office 2010 format choice" src="http://static.pcinpact.com/images/bd/news/mini-80584-office-2010-ballot-screen.png"></p>
<p>Office 2010 format choice</p>
<p><a href="https://bosdonnat.fr/data/win7-browser.png"><img alt="Windows 7 browser choice" src="https://bosdonnat.fr/data/win7-browser-300x166.png"></a></p>
<p>Windows 7 browser choice</p>
<p>I hope more people will then install Firefox on Windows and make it
their default web browser.... but the most interesting point is about
Office 2010: OpenOffice.org marketing centered on ODF support won't make
the difference by now. We need to focus much more on:</p>
<ul>
<li><strong>innovating features</strong>. Copying what Office 2010 does is good to
ensure compatibility, but we need to keep adding some useful
features that aren't yet in Office 2010 for users to find something
interesting in the OpenOffice.org product.</li>
<li>the <strong>values of open source and community</strong> as that's our main
differenciator. How could we as a community show to the users that
they have something to gain to contact us and be part of the
adventure?</li>
</ul>Asian layout export improved2010-04-29T15:27:00+02:002010-04-29T15:27:00+02:00Cédrictag:bosdonnat.fr,2010-04-29:/asian-layout-export-improved.html<p>I recently had a look at the .docx export of the document grid
for asian characters. It was not implemented at all and the .doc export
was buggy. After some time constantly not skipping a word in the OOXML
specifications, I finally had a working implementation and could fix the …</p><p>I recently had a look at the .docx export of the document grid
for asian characters. It was not implemented at all and the .doc export
was buggy. After some time constantly not skipping a word in the OOXML
specifications, I finally had a working implementation and could fix the
.doc export. Here are some screenshots to help you understand what I'm
writing about. Mind the number of asian characters per line...</p>
<p><a href="https://bosdonnat.fr/data/grid-ooo.png"><img alt="The layout in OOo" src="https://bosdonnat.fr/data/grid-ooo-300x252.png"></a></p>
<p>The layout in OOo</p>
<p><a href="https://bosdonnat.fr/data/grid-doc-bug.png"><img alt="The buggy layout in Word" src="https://bosdonnat.fr/data/grid-doc-bug-300x300.png"></a></p>
<p>The buggy layout in Word</p>
<p><a href="https://bosdonnat.fr/data/grid-docx-fix.png"><img alt="The layout in Word after the changes" src="https://bosdonnat.fr/data/grid-docx-fix-300x296.png"></a></p>
<p>The layout in Word after the changes</p>
<p>The fix is already available on the <a href="http://cgit.freedesktop.org/ooo-build/ooo-build/">master branch of ooo-build git
repo</a>.</p>Using the drawinglayer in Writer2010-03-19T12:40:00+01:002010-03-19T12:40:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2010-03-19:/using-the-drawinglayer-in-writer.html<p>You may not know what the drawinglayer is and what it would
bring to borders in Writer. This is a new framework for drawing stuffs
on the screen in OpenOffice.org. It offers a nice and easy API to render
complex shapes. When implementing the new engraved / embossed / inset /
outset …</p><p>You may not know what the drawinglayer is and what it would
bring to borders in Writer. This is a new framework for drawing stuffs
on the screen in OpenOffice.org. It offers a nice and easy API to render
complex shapes. When implementing the new engraved / embossed / inset /
outset border types in OpenOffice.org, I have seen the big difference
between the rendering in Writer or Calc and the rendering for impress
tables. To give you an idea of what happens, here are several
motivations to change the way to render borders in Calc and Writer:</p>
<ol>
<li>There are 3 different codes to currently render borders: one for
Writer floating objects, one for Writer tables and calc and the last
one for impress tables. Every time I change the core border
structure, I need to tweak those three places... having only one
rendering code for all of them would <strong>ease the maintenance of the
borders drawing</strong>.</li>
<li>The current code is drawing rectangles... which provides strange
result for the new 3D border types. For Impress tables I have
changed the drawinglayer implementation to clip the polygons
properly. In order to significantly <strong>improve the rendering result</strong>
in Calc and Writer I need to use this drawinglayer.</li>
</ol>
<p>I have just completed a first implementation for the Writer objects and
tables: some screenshots will help you to understand the whole story...</p>
<p><a href="https://bosdonnat.fr/data/embossed-before.png"><img alt="Embossed table before the hack" src="https://bosdonnat.fr/data/embossed-before-300x105.png"></a></p>
<p>Embossed table before the hack</p>
<p><a href="https://bosdonnat.fr/data/embossed-after.png"><img alt="Embosse table with the drawinlayer" src="https://bosdonnat.fr/data/embossed-after-300x113.png"></a></p>
<p>Embossed table with the drawinlayer</p>
<p><a href="https://bosdonnat.fr/data/outset-after.png"><img alt="Outset table with the drawinglayer" src="https://bosdonnat.fr/data/outset-after-300x117.png"></a></p>
<p>Outset table with the drawinglayer</p>
<p>The changes will soon be committed to <a href="http://cgit.freedesktop.org/ooo-build/ooo-build/">ooo-build git repository</a>...
but the patch won't be applied by default as it's still work in
progress.</p>GSoc 2010, let's go for ooo-build!2010-03-19T11:41:00+01:002010-03-19T11:41:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2010-03-19:/gsoc-2010-lets-go-for-ooo-build.html<p><a href="http://socghop.appspot.com/gsoc/program/home/google/gsoc2010"><img alt="" src="http://code.google.com/images/2010soclogo.jpg" title="GSoc 2010 logo"></a>Yesterday evening we received the good news from
Google: <a href="http://go-oo.org/">ooo-build</a> will be a mentoring organization this year again.
This year we will have the pleasure to share projects slots with
<a href="http://wiki.ooo4kids.org/index.php/Main_Page">ooo4kids</a>, the new OpenOffice.org based Office suite for 7/12 years
old children. I hope that we will have …</p><p><a href="http://socghop.appspot.com/gsoc/program/home/google/gsoc2010"><img alt="" src="http://code.google.com/images/2010soclogo.jpg" title="GSoc 2010 logo"></a>Yesterday evening we received the good news from
Google: <a href="http://go-oo.org/">ooo-build</a> will be a mentoring organization this year again.
This year we will have the pleasure to share projects slots with
<a href="http://wiki.ooo4kids.org/index.php/Main_Page">ooo4kids</a>, the new OpenOffice.org based Office suite for 7/12 years
old children. I hope that we will have motivated and fantastic students
this year too!</p>
<p>It's now time to choose some project and submit your ideas to the
community. Check out the <a href="http://www.freedesktop.org/wiki/Software/ooo-build/SummerOfCode/2010">project ideas wiki page</a> and don't hesitate
to ask for some additional information or discuss your ideas with us on
the IRC (#go-oo on irc.freenode.net), <a href="http://lists.freedesktop.org/mailman/listinfo/ooo-build">mailing list</a> or by private
email with the mentor. Please note that we are requiring each student
submitting a project to solve a simple coding <a href="http://www.freedesktop.org/wiki/Software/ooo-build/SummerOfCode/2010#Theexercise">exercise described on the
wiki page</a>.</p>
<p>Many thanks to Google Summer of Code organization team for allowing us
to live this hacking experience again!</p>Borders types fight: round 22010-02-19T19:03:00+01:002010-02-19T19:03:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2010-02-19:/borders-types-fight-round-2.html<p>In the first round I have added the dotted and dashed border
types. The challenging part of it was to draw the dashed lines
everywhere in Calc, Writer and Impress / Draw. More informations can be
found in the <a href="https://bosdonnat.fr/dotted-border-types-in-calc-and-writer.html">previous blog post</a>. The second round aims at improving
the interoperability with …</p><p>In the first round I have added the dotted and dashed border
types. The challenging part of it was to draw the dashed lines
everywhere in Calc, Writer and Impress / Draw. More informations can be
found in the <a href="https://bosdonnat.fr/dotted-border-types-in-calc-and-writer.html">previous blog post</a>. The second round aims at improving
the interoperability with Word border types. The interesting features to
support are:</p>
<ul>
<li>Separated border types and width selection. For the moment,
OpenOffice.org provides a small set of predefined borders... but
what if one wants 1.75pt dashed border? As shown by the border tabs
screenshot, there are now 2 separate controls: one to select the
border type and one to set the border width.</li>
<li>Support the other types from Word. Some of them are already
supported by ODF but not implemented in OpenOffice.org. For example
Word inset, outset, threeDEngraved and threeDEmbossed can be mapped
to ODF / CSS inset, ouset, grooved and ridged border types.</li>
</ul>
<p>Implementing these features brings its lot of problems. One of the most
important one is that I needed to reengineer Word's behaviour to have
something approching for the lines colors and widths. After some time
measuring Word borders and getting its different colors I could get some
useful infos. For curious readers, I have placed the <a href="http://cgit.freedesktop.org/ooo-build/ooo-build/tree/doc/word-embossed-colors.ods">spreadsheet that I
used to determine the functions for the embossed/engraved colors</a> in
the go-oo git repository.</p>
<p>Here are some screenshots of what I have already implemented in my local
build.</p>
<p><a href="https://bosdonnat.fr/data/borders-tab.png"><img alt="The new borders selection" src="https://bosdonnat.fr/data/borders-tab-300x207.png"></a></p>
<p>The new borders selection</p>
<p><a href="https://bosdonnat.fr/data/border-types.png"><img alt="Some of the new border types" src="https://bosdonnat.fr/data/border-types-300x207.png"></a></p>
<p>Some of the new border types</p>
<p><a href="https://bosdonnat.fr/data/screenshot1.png"><img alt="A Writer table with a nice embossed border" src="https://bosdonnat.fr/data/screenshot1-300x201.png"></a></p>
<p>A Writer table with a nice embossed border</p>
<p>This work is still not published as there are loads of remaining
problems and stuffs to fix:</p>
<ul>
<li>As I have changed<em>SvxBorderLine</em>, I need to adapt all the code using
it in Calc and Impress. Writer is almost completely update now.</li>
<li>The changes aren't persisted in the files for the moment.</li>
<li>The whole border width calculation has to be reworked at least in
Writer because of the ouset and inset widths in Word. Word adapts
the total width of these borders to the maximum width of the borders
in the row or column., whereas OpenOffice.org doesn't take care of
the other widths. Here is a small screenshot from Word to better see
the problem.</li>
</ul>
<p><a href="https://bosdonnat.fr/data/word-outinset.png"><img alt="Outset widths in Word" src="https://bosdonnat.fr/data/word-outinset-300x143.png"></a></p>
<p>Outset widths in Word</p>Nice popups for every toolbar2010-02-05T18:41:00+01:002010-02-05T18:41:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2010-02-05:/nice-popups-for-every-toolbar.html<p>In the Go-oo team, we wanted to refactor some toolbar popups
to tend to some general look. The following screenshots give a good idea
of the differences between those popups.</p>
<p><a href="https://bosdonnat.fr/data/toolbar-differences.png"><img alt="Differences between the toolbars" src="https://bosdonnat.fr/data/toolbar-differences-300x136.png"></a></p>
<p>Then I changed the popup windows by something looking more like the
third of the above screenshots. For some popups …</p><p>In the Go-oo team, we wanted to refactor some toolbar popups
to tend to some general look. The following screenshots give a good idea
of the differences between those popups.</p>
<p><a href="https://bosdonnat.fr/data/toolbar-differences.png"><img alt="Differences between the toolbars" src="https://bosdonnat.fr/data/toolbar-differences-300x136.png"></a></p>
<p>Then I changed the popup windows by something looking more like the
third of the above screenshots. For some popups I even removed the menu
to use normal dialog controls: the effect was pretty awful with the
openSUSE 11.2 default GTK theme (with black menus). Here are some
screenshots to better realize what has changed, though there are other
refactored popups...</p>
<p><a href="https://bosdonnat.fr/data/toolbars.png"><img alt="Some changed toolbars" src="https://bosdonnat.fr/data/toolbars-272x300.png"></a></p>
<p><a href="http://cgit.freedesktop.org/ooo-build/ooo-build/tree/patches/dev300/toolbar-decorations-fix.diff">The patch</a> has been committed to ooo-build master branch, but is not
yet applied as there are still some crashes to fix when reopening the
toolbar.</p>Dotted border types in Calc and Writer2009-12-17T13:56:00+01:002009-12-17T13:56:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2009-12-17:/dotted-border-types-in-calc-and-writer.html<p>As this has often heard people complaining about the lack of
dotted and dashed line types in Calc and Writer, I have started to
implement it (139 votes on <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=8275">i#8275</a>). Kohei told me that these line
types are heavily used by the Japanese administration in their forms.
Even thought …</p><p>As this has often heard people complaining about the lack of
dotted and dashed line types in Calc and Writer, I have started to
implement it (139 votes on <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=8275">i#8275</a>). Kohei told me that these line
types are heavily used by the Japanese administration in their forms.
Even thought I am in the early development of this feature, this post
exposes the progress.</p>
<p>What is working:</p>
<ul>
<li>Dotted lines have been added to the border types selection list and
the border selection control has been updated according to it.</li>
<li>Writer tables and Calc now show dotted lines as well as the other
writer objects supporting borders (frames, pictures or pages for
example).</li>
<li>Some ugly display in the border selection control has been fixed
(<a href="http://qa.openoffice.org/issues/show_bug.cgi?id=86716">i#86716</a>)</li>
</ul>
<p>What still has to be done:</p>
<ul>
<li>Loading (saving) the dotted lines style from (to) the different file
formats</li>
<li>Make the current changes more generic to support other kinds of
lines like dashed lines.</li>
</ul>
<p>This is one step to improve the interoperability with Word and Excel
documents, but only the dashed and dotted types will be handled as the
others can't be stored in OpenDocument. ODF uses the XSL-FO border
style...</p>
<p>Now here is the time for the screenshots:</p>
<p><a href="https://bosdonnat.fr/data/calc-border-types.png"><img alt="Dotted borders in Calc" src="https://bosdonnat.fr/data/calc-border-types-300x104.png"></a></p>
<p>Dotted borders in Calc</p>
<p><a href="https://bosdonnat.fr/data/writer-border-types.png"><img alt="Dotted borders in writer" src="https://bosdonnat.fr/data/writer-border-types.png"></a></p>
<p>Dotted borders in writer</p>
<p>Here are two screenshots to compare the borders format dialog before and
after the fix.</p>
<p><a href="https://bosdonnat.fr/data/table-format.png"><img alt="Border format dialog before the fix" src="https://bosdonnat.fr/data/table-format-300x221.png"></a></p>
<p>Border format dialog before the fix</p>
<p><a href="https://bosdonnat.fr/data/table-format-fixed.png"><img alt="Border format dialog with the fix" src="https://bosdonnat.fr/data/table-format-fixed-300x221.png"></a></p>
<p>Border format dialog with the fix</p>
<p>Given the fact that the development is still not finished, there is
still no patch available, but please be patient: it will come soon...</p>
<p><strong>EDIT</strong>: the patch is available on <a href="http://cgit.freedesktop.org/ooo-build/ooo-build/tree/patches/dev300/border-types.diff">Go-oo git repository</a>.</p>Apologies2009-09-14T09:22:00+02:002009-09-14T09:22:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-09-14:/apologies.html<p>Writing a blog article when facts are still too recent isn't
always a good idea. When writing <a href="https://bosdonnat.fr/automatic-hard-spaces-for-french.html">my previous post</a>, I was quite upset
with the fact that the automated tests and specifications blocked the
integration of <em>cbosdo01</em> CWS. I recognize that I have been too critic
regarding Mathias and …</p><p>Writing a blog article when facts are still too recent isn't
always a good idea. When writing <a href="https://bosdonnat.fr/automatic-hard-spaces-for-french.html">my previous post</a>, I was quite upset
with the fact that the automated tests and specifications blocked the
integration of <em>cbosdo01</em> CWS. I recognize that I have been too critic
regarding Mathias and Stefan who spent a lot of time to test that CWS on
the very last days before the feature freeze.</p>
<p>Thank you Stefan and Mathias for your work, and please accept my
apologies for having written such so hard
words.</p>Automatic hard spaces for french2009-09-11T18:27:00+02:002009-09-11T18:27:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-09-11:/automatic-hard-spaces-for-french.html<p>I heard many french people complaining that Writer isn't
adding the hard spaces automatically before the double punctuation
signs. When going through the list of Writer issues on
bugzilla.novell.com, I found out that there was an issue filed on that
topic <a href="https://bugzilla.novell.com/show_bug.cgi?id=278233">n#278233</a>. A quick search on IssueZilla …</p><p>I heard many french people complaining that Writer isn't
adding the hard spaces automatically before the double punctuation
signs. When going through the list of Writer issues on
bugzilla.novell.com, I found out that there was an issue filed on that
topic <a href="https://bugzilla.novell.com/show_bug.cgi?id=278233">n#278233</a>. A quick search on IssueZilla gave me the
corresponding upstream issue <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=17169">i#17169</a> (6 years old).</p>
<p>As I already <a href="https://bosdonnat.fr/internationalized-1st-autocorrection.html">hacked the autocorrection some times ago</a>, I decided to
fix that one quite quickly when my wife was working during the week-end.
The implementation took only a few hours: the lengthier part of the
process was the creation of the CWS and the build for the tests. My
changes have been proposed upstream in the <strong>cbosdo01</strong> CWS. After a
hard time trying to get it QAed, this CWS won't be integrated before 3.3
as Sun is asking for specifications! The changes have then been
<a href="http://cgit.freedesktop.org/ooo-build/ooo-build/commit/?id=4e3aa880bf4cff092884cd6ca3ca7662a66001e2">committed to go-oo git repo</a>: <strong>the patch will be available in 3.2
for go-oo</strong>.</p>
<p>Here is a small screencast for the rest of the world: french people will
now what I am talking about whithout viewing it.<br>
<a href="https://bosdonnat.fr/data/hard_spaces.ogg"><img alt="thumb-hard_spaces.ogg" src="https://bosdonnat.fr/data/thumb-hard_spaces.ogg-300x197.png"></a><strong>EDIT</strong></p>
<ul>
<li>The autocorrection hack I did some times ago wasn't that one... but
related to i18n ordinal suffixes.</li>
<li>I have been too critic towards the Sun devs who tested that CWS, I
have written <a href="https://bosdonnat.fr/apologies.html">my apologies here</a>.</li>
</ul>Docx import: the unacceptable regression!2009-09-05T11:14:00+02:002009-09-05T11:14:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-09-05:/docx-import-the-unacceptable-regression.html<p>You may remember that I have started my first CWS some times
ago to upstream my docx import changes. I had to quickly rebase it to
<strong>dev300-m56</strong> as the 3.2 feature freeze is nearing and the QA of a CWS
could take quite some time. After a hard time …</p><p>You may remember that I have started my first CWS some times
ago to upstream my docx import changes. I had to quickly rebase it to
<strong>dev300-m56</strong> as the 3.2 feature freeze is nearing and the QA of a CWS
could take quite some time. After a hard time working on that rebase, I
uncovered a serious issue: any docx containing a picture or a shape make
OOo crash on import. It turns out that Kendy has already reported that
issue (<a href="http://www.openoffice.org/issues/show_bug.cgi?id=104155">i104155</a>). This is clearly a regression from the upstream.</p>
<p><strong>How does it comes QA didn't uncover this enormous regression?</strong></p>
<p>As a developer I have some sample documents to test the features I am
improving and I open each of these documents to check if everything goes
nicely. When doing the QA of big changes like those ones, a set of
OOXML documents should be used to test potential regressions. This has
apparently not been done this time. How does it come that no Docx
document with a picture or a shape in it has been loaded during the QA
of a CWS changing the import of OOXML shapes?</p>
<p><strong>I don't blame the developer introducing the regression here as this
can happen to any one of us... but the way the QA is
done!</strong></p>Opening an issue's page from Vim (improved)2009-08-18T15:49:00+02:002009-08-18T15:49:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-08-18:/opening-an-issues-page-from-vim-improved.html<p>You may remember one of my previous posts on a <a href="https://bosdonnat.fr/opening-an-issues-page-from-vim.html">Vim script I
wrote to quickly open an issue in the browser</a> from the OOo sources.
As the <em>patches/dev300/apply</em> file is containing issues numbers
formatted differently (in the form <strong>i#XXXXX</strong> instead of
<strong>#iXXXXX#</strong>), I decided to tweak …</p><p>You may remember one of my previous posts on a <a href="https://bosdonnat.fr/opening-an-issues-page-from-vim.html">Vim script I
wrote to quickly open an issue in the browser</a> from the OOo sources.
As the <em>patches/dev300/apply</em> file is containing issues numbers
formatted differently (in the form <strong>i#XXXXX</strong> instead of
<strong>#iXXXXX#</strong>), I decided to tweak my script to support this other
issues format.</p>
<p>The previous OpenIssue function was using <em>expand("\<cword>")</em> in order
to get the selected issue. This is not working for the new format I
wanted to support as <strong>#</strong> is a words delimiter. Thanks to
<a href="http://hermitte.free.fr/vim/general.php3#expl_words_tools">word_tools.vim from Luc Hermitte</a>, I have written a new function
getting all the issues formats. Here is the new code:</p>
<div class="highlight"><pre><span></span><code><span class="c">" Get the issue number under the cursor. An issue number is containing</span>
<span class="c">" digits, lating letters and #. The # characters are removed from the result.</span>
<span class="c">" </span>
<span class="c">" Code heavily inspired from the words_tools.vim of Luc Hermitte</span>
<span class="c">" http://hermitte.free.fr/vim/ressources/dollar_VIM/plugin/words_tools_vim.html</span>
<span class="k">function</span><span class="p">!</span> GetCurrentIssueText<span class="p">()</span>
<span class="k">let</span> <span class="k">c</span> <span class="p">=</span> <span class="k">col</span> <span class="p">(</span><span class="s1">'.'</span><span class="p">)</span><span class="m">-1</span>
<span class="k">let</span> <span class="k">l</span> <span class="p">=</span> line<span class="p">(</span><span class="s1">'.'</span><span class="p">)</span>
<span class="k">let</span> <span class="k">ll</span> <span class="p">=</span> getline<span class="p">(</span><span class="k">l</span><span class="p">)</span>
<span class="k">let</span> ll1 <span class="p">=</span> strpart<span class="p">(</span><span class="k">ll</span><span class="p">,</span><span class="m">0</span><span class="p">,</span><span class="k">c</span><span class="p">)</span>
<span class="k">let</span> ll1 <span class="p">=</span> matchstr<span class="p">(</span>ll1<span class="p">,</span><span class="s1">'[0-9#a-zA-Z]*$'</span><span class="p">)</span>
<span class="k">if</span> strlen<span class="p">(</span>ll1<span class="p">)</span> <span class="p">==</span> <span class="m">0</span>
<span class="k">return</span> ll1
<span class="k">else</span>
<span class="k">let</span> ll2 <span class="p">=</span> strpart<span class="p">(</span><span class="k">ll</span><span class="p">,</span><span class="k">c</span><span class="p">,</span>strlen<span class="p">(</span><span class="k">ll</span><span class="p">)-</span><span class="k">c</span><span class="p">+</span><span class="m">1</span><span class="p">)</span>
<span class="k">let</span> ll2 <span class="p">=</span> strpart<span class="p">(</span>ll2<span class="p">,</span><span class="m">0</span><span class="p">,</span><span class="k">match</span><span class="p">(</span>ll2<span class="p">,</span><span class="s1">'$\|[^0-9#a-zA-Z]'</span><span class="p">))</span>
<span class="k">let</span> text <span class="p">=</span> ll1.ll2
<span class="k">let</span> text <span class="p">=</span> substitute<span class="p">(</span> text<span class="p">,</span> <span class="s2">"#"</span><span class="p">,</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"g"</span> <span class="p">)</span>
<span class="k">return</span> text
<span class="k">endif</span>
<span class="k">endfunction</span>
<span class="c">" Open IssueZilla / Bugzilla for the selected issue</span>
<span class="k">function</span><span class="p">!</span> OpenIssue<span class="p">(</span> <span class="p">)</span>
<span class="k">let</span> s:browser <span class="p">=</span> <span class="s2">"firefox"</span>
<span class="k">let</span> s:issueText <span class="p">=</span> GetCurrentIssueText<span class="p">(</span> <span class="p">)</span>
<span class="k">let</span> s:urlTemplate <span class="p">=</span> <span class="s2">""</span>
<span class="k">let</span> s:pattern <span class="p">=</span> <span class="s2">"\\(\\a\\+\\)\\(\\d\\+\\)"</span>
<span class="k">let</span> s:prefix <span class="p">=</span> substitute<span class="p">(</span> s:issueText<span class="p">,</span> s:pattern<span class="p">,</span> <span class="s2">"\\1"</span><span class="p">,</span> <span class="s2">""</span> <span class="p">)</span>
<span class="k">let</span> s:id <span class="p">=</span> substitute<span class="p">(</span> s:issueText<span class="p">,</span> s:pattern<span class="p">,</span> <span class="s2">"\\2"</span><span class="p">,</span> <span class="s2">""</span> <span class="p">)</span>
<span class="k">if</span> s:prefix <span class="p">==</span> <span class="s2">"i"</span>
<span class="k">let</span> s:urlTemplate <span class="p">=</span> <span class="s2">"http://qa.openoffice.org/issues/show_bug.cgi?id=%"</span>
<span class="k">elseif</span> s:prefix <span class="p">==</span> <span class="s2">"n"</span>
<span class="k">let</span> s:urlTemplate <span class="p">=</span> <span class="s2">"https://bugzilla.novell.com/show_bug.cgi?id=%"</span>
<span class="k">endif</span>
<span class="k">if</span> s:urlTemplate <span class="p">!=</span> <span class="s2">""</span>
<span class="k">let</span> s:url <span class="p">=</span> substitute<span class="p">(</span> s:urlTemplate<span class="p">,</span> <span class="s2">"%"</span><span class="p">,</span> s:id<span class="p">,</span> <span class="s2">"g"</span> <span class="p">)</span>
<span class="k">let</span> s:cmd <span class="p">=</span> <span class="s2">"silent !"</span> . s:browser . <span class="s2">" "</span> . s:url . <span class="s2">"&"</span>
execute s:cmd
<span class="k">endif</span>
<span class="k">endfunction</span>
map :<span class="k">call</span> OpenIssue<span class="p">()</span>
</code></pre></div>EndNote and Bibus fields are finally read in OOo2009-08-14T15:00:00+02:002009-08-14T15:00:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-08-14:/endnote-and-bibus-fields-are-finally-read-in-ooo.html<p>From my previous job experience, I knew that there were some
problems for EndNote users to read their documents in OpenOffice.org. I
decided to found out a sample document and try to see what is wrong.</p>
<p>Here is the sample document I used: <a href="http://sitemaker.umich.edu/emeier.dt/view_profiles/da.data/1037375/SampleWork/editstyle_sample.doc">editstyle_sample.doc</a>. There are
two problems …</p><p>From my previous job experience, I knew that there were some
problems for EndNote users to read their documents in OpenOffice.org. I
decided to found out a sample document and try to see what is wrong.</p>
<p>Here is the sample document I used: <a href="http://sitemaker.umich.edu/emeier.dt/view_profiles/da.data/1037375/SampleWork/editstyle_sample.doc">editstyle_sample.doc</a>. There are
two problems in this document:</p>
<ol>
<li>the field below the "References" text isn't imported at all</li>
<li>all the other fields are imported as plain text</li>
</ol>
<p>I fixed the first problem thanks to Florian (in fact, he did it all). As
always, <a href="http://cgit.freedesktop.org/ooo-build/ooo-build/tree/patches/dev300/sw-ww8-field-fix.diff">the patch is available on the go-oo git repo</a>. I have also
attached it to the upstream issue <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=61075">i#61075</a>. Here are some
screenshots to show the difference:</p>
<p><a href="https://bosdonnat.fr/data/ww8-fields-nf.png"><img alt="The initial missing field" src="https://bosdonnat.fr/data/ww8-fields-nf-300x223.png"></a></p>
<p>The initial missing field</p>
<p><a href="https://bosdonnat.fr/data/ww8-fields-fix.png"><img alt="The imported .doc fields" src="https://bosdonnat.fr/data/ww8-fields-fix-300x199.png"></a></p>
<p>The imported .doc fields</p>
<p>Fixing the second point is another problem. What users would at least
expect is to keep the word fields when saving the document back to .doc.
This isn't the case because OOo is importing only the field's text
replacement. In order to do that, ODF should have some mechanism to
store the MSWord field code. This would be useless for OOo, but it could
allow to save the document back to .doc with the fields.</p>
<p>The issue <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=89667">i#89667</a> about Bibus fields has been fixed by this patch:
it was the same problem.</p>Fixed an old kerning issue2009-08-13T17:13:00+02:002009-08-13T17:13:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-08-13:/fixed-an-old-kerning-issue.html<p>During the week I discovered an interesting issue around the
kerning <a href="https://bugzilla.novell.com/show_bug.cgi?id=464436">n#464436</a> and <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=26519">i#26519</a>. After some time spent with
Florian and Thorsten, we finally found what was going wrong. Here is a
summary of the problem:</p>
<ul>
<li>If you have a non-printable character between two letters, no
kerning is …</li></ul><p>During the week I discovered an interesting issue around the
kerning <a href="https://bugzilla.novell.com/show_bug.cgi?id=464436">n#464436</a> and <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=26519">i#26519</a>. After some time spent with
Florian and Thorsten, we finally found what was going wrong. Here is a
summary of the problem:</p>
<ul>
<li>If you have a non-printable character between two letters, no
kerning is applied to those characters on linux.</li>
<li>If you have one of the two characters with a different attribute
(eg, font color), the kerning isn't applied to those characters as
well on linux.</li>
</ul>
<p>Here are some screenshot visually explaining the problem and showing the
fix. On those screenshots, the problems are happenning between the A and
V.</p>
<p>The non fixed versions:</p>
<p><a href="https://bosdonnat.fr/data/kerning-fmt.png"><img alt="Formatting without the kerning" src="https://bosdonnat.fr/data/kerning-fmt-300x223.png"></a></p>
<p>Formatting without the kerning</p>
<p><a href="https://bosdonnat.fr/data/kerning-np.png"><img alt="Non printable character without kerning" src="https://bosdonnat.fr/data/kerning-np-300x134.png"></a></p>
<p>Non printable character without kerning</p>
<p>The fixed versions:</p>
<p><a href="https://bosdonnat.fr/data/fix-kerning-fmt.png"><img alt="Formatting with fixed kerning" src="https://bosdonnat.fr/data/fix-kerning-fmt-300x214.png"></a></p>
<p>Formatting with fixed kerning</p>
<p><a href="https://bosdonnat.fr/data/fix-kerning-np.png"><img alt="Non printable character with kerning fixed" src="https://bosdonnat.fr/data/fix-kerning-np-300x130.png"></a></p>
<p>Non printable character with kerning fixed</p>
<p>The patch is attached at the upstream issue and available in go-oo git
repo at: </p>
<p><a href="http://cgit.freedesktop.org/ooo-build/ooo-build/tree/patches/dev300/vcl-kerning-fix.diff">http://cgit.freedesktop.org/ooo-build/ooo-build/tree/patches/dev300/vcl-kerning-fix.diff</a></p>GSoc: Hacking Writer's toolbars2009-07-01T17:55:00+02:002009-07-01T17:55:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-07-01:/gsoc-hacking-writers-toolbars.html<p>These last days, I dived into the way OpenOffice.org toolbars
are defined in Writer to help Maja on her problems (( See <a href="http://gsoc-ovcica.blogspot.com/2009/06/missing-parts-inserted-but-no-progress.html">her blog post</a>)).
There are several points which were hard to guess, but the navigation toolbar
is now nice and connected to the C++ code:</p>
<ul>
<li>
<p>As Maja has …</p></li></ul><p>These last days, I dived into the way OpenOffice.org toolbars
are defined in Writer to help Maja on her problems (( See <a href="http://gsoc-ovcica.blogspot.com/2009/06/missing-parts-inserted-but-no-progress.html">her blog post</a>)).
There are several points which were hard to guess, but the navigation toolbar
is now nice and connected to the C++ code:</p>
<ul>
<li>
<p>As Maja has stated it, it is necessary to set <strong>Properties</strong> node in the
command definition in the XCU file. This is really strange and
completely stupid, but it works.</p>
<p>:::diff
+ <node oor:name=".uno:NavigateForward" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Forward</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node></p>
</li>
<li>
<p>The file <em>sfx2/source/appl/workwin.cxx</em> had to be completed to help
make the equivalence between the resource ID and the toolbar name in
the XML configuration.</p>
<p>:::diff
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index b5a26d6..6780959 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -143,6 +143,7 @@ static const ResIdToResName pToolBarResToName[] =
{ 23031, "mediaobjectbar" }, //draw/impress
{ 25060, "mediaobjectbar" }, //calc
{ 23311, "mediaobjectbar" }, //writer
+ { 23313, "navigationobjectbar" }, //writer
{ 0, "" }
};</p>
</li>
</ul>
<p>The value here isn't taken out of my hat, but is the value of the
<em>RID_NAVIGATION_TOOLBOX</em> constant registered with the navigation
shell.</p>
<ul>
<li>The class <em>SwNavigationShell</em> had to be instanciated in the
<em>SwView::SelectShell</em> method.</li>
</ul>
<p>The complete patch is available on my freedesktop.org account for those
who want to see the code:<br>
<a href="http://people.freedesktop.org/~cbosdo/gsoc/navigation.diff">http://people.freedesktop.org/~cbosdo/gsoc/navigation.diff</a></p>
<p>Many thanks Thorsten to have helped me understand the horror of the
toolbars.</p>Numbering imports in docx files2009-05-13T18:11:00+02:002009-05-13T18:11:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-05-13:/numbering-imports-in-docx-files.html<p>Here are some hot news from the docx import front. I am
currently working on the numberings and outline import. There were
several problems:</p>
<ul>
<li>the outline styles weren't defined</li>
<li>the numbering layout properties weren't properly set</li>
<li>the suffix and the number of parent levels weren't correctly set.</li>
</ul>
<p>As usual here …</p><p>Here are some hot news from the docx import front. I am
currently working on the numberings and outline import. There were
several problems:</p>
<ul>
<li>the outline styles weren't defined</li>
<li>the numbering layout properties weren't properly set</li>
<li>the suffix and the number of parent levels weren't correctly set.</li>
</ul>
<p>As usual here are some screenshots to better understand the problem. You
can find the sample document attached to <a href="https://bugzilla.novell.com/show_bug.cgi?id=478583">this issue</a>. I have added an
other interesting screenshot to compare with the import of the same file
converted to .doc by Word 2007.</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/word-num.png"><img alt="The file in Word" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/word-num-150x150.png"></a></p>
<p>The file in word </p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-nf-num.png"><img alt="Import without the patch" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-nf-num-150x150.png"></a></p>
<p>Import without the patch</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-doc-num.png"><img alt="Import of a .doc file" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-doc-num-150x150.png"></a></p>
<p>Import of a .doc file</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/odfconv-num.png"><img alt="Imported using OdfConverter" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/odfconv-num-150x150.png"></a></p>
<p>Imported using OdfConverter</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-fix-num.png"><img alt="Import with the fixes" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-fix-num-150x146.png"></a></p>
<p>Import with the fixes</p>
<p>The patch isn't yet committed to the master branch as it is still
experimental and not complete...</p>Opening an issue's page from Vim2009-05-11T16:29:00+02:002009-05-11T16:29:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-05-11:/opening-an-issues-page-from-vim.html<p>As I have been tired to have to navigate to the issues query page on
either OOo IssueZilla or Novell Bugzilla when I have a comment like
#iXXXX#, I wrote a small Vim function to do it for me. Here is the
script I have added to my .vimrc.</p>
<div class="highlight"><pre><span></span><code><span class="c">" Open …</span></code></pre></div><p>As I have been tired to have to navigate to the issues query page on
either OOo IssueZilla or Novell Bugzilla when I have a comment like
#iXXXX#, I wrote a small Vim function to do it for me. Here is the
script I have added to my .vimrc.</p>
<div class="highlight"><pre><span></span><code><span class="c">" Open IssueZilla / Bugzilla for the selected issue</span>
<span class="k">function</span><span class="p">!</span> OpenIssue<span class="p">(</span> <span class="p">)</span>
<span class="k">let</span> s:browser <span class="p">=</span> <span class="s2">"firefox"</span>
<span class="k">let</span> s:wordUnderCursor <span class="p">=</span> expand<span class="p">(</span><span class="s2">""</span><span class="p">)</span>
<span class="k">let</span> s:urlTemplate <span class="p">=</span> <span class="s2">""</span>
<span class="k">let</span> s:pattern <span class="p">=</span> <span class="s2">"\\(\\a\\+\\)\\(\\d\\+\\)"</span>
<span class="k">let</span> s:prefix <span class="p">=</span> substitute<span class="p">(</span> s:wordUnderCursor<span class="p">,</span> s:pattern<span class="p">,</span> <span class="s2">"\\1"</span><span class="p">,</span> <span class="s2">""</span> <span class="p">)</span>
<span class="k">let</span> s:id <span class="p">=</span> substitute<span class="p">(</span> s:wordUnderCursor<span class="p">,</span> s:pattern<span class="p">,</span> <span class="s2">"\\2"</span><span class="p">,</span> <span class="s2">""</span> <span class="p">)</span>
<span class="k">if</span> s:prefix <span class="p">==</span> <span class="s2">"i"</span>
<span class="k">let</span> s:urlTemplate <span class="p">=</span> <span class="s2">"http://qa.openoffice.org/issues/show_bug.cgi?id=%"</span>
<span class="k">elseif</span> s:prefix <span class="p">==</span> <span class="s2">"n"</span>
<span class="k">let</span> s:urlTemplate <span class="p">=</span> <span class="s2">"https://bugzilla.novell.com/show_bug.cgi?id=%"</span>
<span class="k">endif</span>
<span class="k">if</span> s:urlTemplate <span class="p">!=</span> <span class="s2">""</span>
<span class="k">let</span> s:url <span class="p">=</span> substitute<span class="p">(</span> s:urlTemplate<span class="p">,</span> <span class="s2">"%"</span><span class="p">,</span> s:id<span class="p">,</span> <span class="s2">"g"</span> <span class="p">)</span>
<span class="k">let</span> s:cmd <span class="p">=</span> <span class="s2">"silent !"</span> . s:browser . <span class="s2">" "</span> . s:url . <span class="s2">"&"</span>
execute s:cmd
<span class="k">endif</span>
<span class="k">endfunction</span>
map :<span class="k">call</span> OpenIssue<span class="p">()</span>
</code></pre></div>
<p>To run the script, place the cursor on a word in the form iXXXXX or
nXXXXX and hit <strong>Ctrl-i</strong>. you will certainly need to tweak to script if
you which to add other shortcuts or use another browser. Of course, this
is not cross-platform and could be much more configurable. If you have
some improvements in this area, please propose them! Many thanks to
<a href="http://vim.wikia.com/wiki/Online_documentation_for_word_under_cursor">this Vim tip</a> which helped me a lot to write this script.</p>Gdb utilities2009-04-27T18:30:00+02:002009-04-27T18:30:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-04-27:/gdb-utilities.html<p>While chatting this morning with Eric, I found out that I was
using some gdb useful methods unknown to some other fellow developers.
Here is are some links to help debugging OOo.</p>
<ul>
<li>An interesting forum thread giving two ways to <a href="http://help.lockergnome.com/linux/GDB-capabilities-exploring-STL-classes--ftopict279673.html">easily print the
content of STL containers</a></li>
<li>gdb functions to …</li></ul><p>While chatting this morning with Eric, I found out that I was
using some gdb useful methods unknown to some other fellow developers.
Here is are some links to help debugging OOo.</p>
<ul>
<li>An interesting forum thread giving two ways to <a href="http://help.lockergnome.com/linux/GDB-capabilities-exploring-STL-classes--ftopict279673.html">easily print the
content of STL containers</a></li>
<li>gdb functions to <a href="http://wiki.services.openoffice.org/wiki/Debugging#The_recommended_.gdbinit_file">print the OOo internal strings</a></li>
</ul>
<p>If anyone has some other links or tips, I would be glad to try
them.</p>Docx shapes import: with text2009-04-22T10:39:00+02:002009-04-22T10:39:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-04-22:/docx-shapes-import-with-text.html<p>Importing the text inside the shapes from docx files is a
complex problem in OpenOffice.org. Most of the problem comes from the
fact that there are two text engines in OOo like in older versions of
Word:</p>
<ul>
<li>the Writer text engine used in the text documents and in the …</li></ul><p>Importing the text inside the shapes from docx files is a
complex problem in OpenOffice.org. Most of the problem comes from the
fact that there are two text engines in OOo like in older versions of
Word:</p>
<ul>
<li>the Writer text engine used in the text documents and in the text
frames</li>
<li>the edit engine used in Draw / Impress and for the shapes content in
Writer.</li>
</ul>
<p>The edit engine is supporting only simple formatted text, whereas the
Writer text engine is supporting other objects like tables, pictures,
etc. In Word 2007 any shape can contain any piece of content: not only
text. The problem when importing is then: how to import the shapes
containing complex text? A short term solution is to create a text frame
for any rectangle shape containing text and keeping shapes for anything
else. Some data could then be lost, for example if an ellipse shape is
containing a table. A long term solution would be to get rid of the edit
engine and use the writer engine everywhere...</p>
<p>I managed to create the shape or frame depending on the docx input and
to set the text in it. There is a really annoying thing with the text
frames and shapes: their UNO APIs are completely different: then all the
work with the shape properties have to be done another time with the
frame properties... Couldn't at least the fill / line properties be the
same for both TextFrame and Shape services ?</p>
<p>Here are some screenshots showing the import of a docx file with shapes
containing text. There is no screenshot for the OdfConverter as the
generated odf document makes OOo crash!</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/vml-text-mso.png"><img alt="The original document" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/vml-text-mso-150x150.png"></a></p>
<p>The original document</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/vml-text-nofix.png"><img alt="Imported with a non fixed OOo" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/vml-text-nofix-150x150.png"></a></p>
<p>Imported with a non fixed OOo</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/vml-text-fix.png"><img alt="Imported with the fixed OOo" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/vml-text-fix-150x150.png"></a></p>
<p>Imported with the fixed OOo</p>Shapes in Writer2009-04-01T11:51:00+02:002009-04-01T11:51:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2009-04-01:/shapes-in-writer.html<p>I'm currently working on importing the shapes' content of docx
files in OpenOffice.org and I found some troubling differences between
OOo and Word on this point.</p>
<ul>
<li>A shape Word can contain text, tables and other objects. A shape in
OOo can only contain text; to have a table inside …</li></ul><p>I'm currently working on importing the shapes' content of docx
files in OpenOffice.org and I found some troubling differences between
OOo and Word on this point.</p>
<ul>
<li>A shape Word can contain text, tables and other objects. A shape in
OOo can only contain text; to have a table inside a shape you need
to create a frame and then insert the table. The old doc import
filter is importing all the rectangle shape containing text as
frames as there is no difference between a textbox and a shape in
.doc files. The problems comes for the other shapes: e.g. an ellipse
contains a table in Word will be imported as an ellipse shape in
writer without the table. Data are lost here! Would it be worse an
effort to have shapes handled and laid out like frames?</li>
<li>A shape in Word can be rotated, and when the background is filled
with a picture, this one is also rotated with the shape (in fact
this is an option). A shape can be rotated in Writer, but the
picture can't be rotated. This leads to some ugly results when
importing such .doc file. Why can't a Writer shape be rotated in the
same way than draw shapes? Even for a user, it's fairly complicated
to rotate a shape in Writer...</li>
<li>In Writer, even the UNO API can set custom bitmaps as the background
of shapes, but there is nothing in the UI to select a custom picture
as the shape background. Isn't that strange?</li>
</ul>
<p>Here are two screenshots showing a .doc file in Word and OpenOffice.org
to better see the above differences.</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/shapes-word.png"><img alt="Shapes in word" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/shapes-word-150x150.png"></a></p>
<p>Shapes in word </p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/shapes-ooo.png"><img alt="Shapes in OpenOffice.org" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/shapes-ooo-150x150.png"></a></p>
<p>Shapes in OpenOffice.org</p>Docx shapes import: first steps2009-03-27T18:02:00+01:002009-03-27T18:02:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2009-03-27:/docx-shapes-import-first-steps.html<p>One of the other big areas for improvement in the docx files
import is the import of the shapes, text boxes and other VML stuffs. The
fact is simple: there is no shape imported yet! The challenge here is to
reuse and expand some code of the <em>oox</em> module in …</p><p>One of the other big areas for improvement in the docx files
import is the import of the shapes, text boxes and other VML stuffs. The
fact is simple: there is no shape imported yet! The challenge here is to
reuse and expand some code of the <em>oox</em> module in order to share it with
the import of xlsx and pptx. After some time investigating how things
are working in the VML import code of oox and the <em>writerfilter</em>, I
found that the XML tokens between the two modules were using the same
constants but not the namespaces.</p>
<p>After having fixed this tokens issue, I managed to import some shapes.
After some hacks in the <em>oox</em> and the <em>writerfilter</em> module, here are
some results for the import:</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/mso1.png"><img alt="Shapes in Word 2007" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/mso1-150x150.png"></a></p>
<p>Shapes in Word 2007</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/odfconv1.png"><img alt="Shapes imported with OdfConverter" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/odfconv1-150x150.png"></a></p>
<p>Shapes imported with OdfConverter </p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-hacks.png"><img alt="Shapes imported in OOo with some hacks" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-hacks-150x150.png"></a></p>
<p>Shapes imported in OOo with some hacks </p>
<p>There are still a lot of things to do here, including:</p>
<ul>
<li>Create text frames where a rectangle shape can't be enough</li>
<li>Complete the VML import</li>
</ul>
<p>This is a first step and I hope to show more progresses
soon.</p>docx nested tables import2009-03-24T15:58:00+01:002009-03-24T15:58:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2009-03-24:/docx-nested-tables-import.html<p>The last weeks have been quite hard: I was working on
difficult parts of the writerfilter and sw code. I was working on a
patch to import the nested tables in the docx files. As you will be able
to see it, the import is much better, even thought it …</p><p>The last weeks have been quite hard: I was working on
difficult parts of the writerfilter and sw code. I was working on a
patch to import the nested tables in the docx files. As you will be able
to see it, the import is much better, even thought it is not yet
perfect. As usual, here are some screenshots to help you understand what
has changed.</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/mso.png"><img alt="Nested tables in Word 2007" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/mso-150x150.png"></a></p>
<p>Nested tables in Word 2007</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-nf.png"><img alt="Nested tables imported by OOo without patch" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-nf-150x150.png"></a></p>
<p>Nested tables imported by OOo without patch</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/odfconv.png"><img alt="Nested tables imported using OdfConverter" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/odfconv-150x150.png"></a></p>
<p>Nested tables imported using OdfConverter</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-fixed.png"><img alt="Nested tables imported by OOo with the all docx import patches" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/ooo-fixed-150x150.png"></a></p>
<p>Nested tables imported by OOo with the all docx import patches </p>
<p>Of course, in the above screenshots, the one of the non-fixed OOo
doesn't include any of the previous docx import patches I previously
mentionned, whereas the one with the fixed OOo includes them
all.</p>gdb and SwDoc2009-03-20T19:10:00+01:002009-03-20T19:10:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2009-03-20:/gdb-and-swdoc.html<p>Today I needed to see what happened in a Writer document. In
order to do this I used gdb to explore the state of the <em>SwDoc</em> object.
I was particularly interested in the nodes which where present, but
checking the type, sub-type of all of them can be long. Then …</p><p>Today I needed to see what happened in a Writer document. In
order to do this I used gdb to explore the state of the <em>SwDoc</em> object.
I was particularly interested in the nodes which where present, but
checking the type, sub-type of all of them can be long. Then I created a
small gdb define to help in this task. Here is the code, needing the
functions defined on the wiki
<a href="http://wiki.services.openoffice.org/wiki/Debugging#The_recommended_.gdbinit_file">http://wiki.services.openoffice.org/wiki/Debugging#The_recommended_.gdbinit_file</a>:</p>
<div class="highlight"><pre><span></span><code><span class="n">def</span> <span class="n">pIndent</span>
<span class="k">set</span> <span class="err">$</span><span class="k">level</span> <span class="o">=</span> <span class="err">$</span><span class="n">arg0</span>
<span class="k">set</span> <span class="err">$</span><span class="n">iLevel</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">while</span> <span class="p">(</span> <span class="err">$</span><span class="n">iLevel</span> <span class="o"><</span> <span class="err">$</span><span class="k">level</span> <span class="p">)</span>
<span class="n">printf</span> <span class="ss">"\t"</span>
<span class="k">set</span> <span class="err">$</span><span class="n">iLevel</span> <span class="o">=</span> <span class="err">$</span><span class="n">iLevel</span> <span class="o">+</span> <span class="mi">1</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">def</span> <span class="n">pNodes</span>
<span class="k">set</span> <span class="err">$</span><span class="n">doc</span> <span class="o">=</span> <span class="err">$</span><span class="n">arg0</span>
<span class="k">set</span> <span class="err">$</span><span class="k">size</span> <span class="o">=</span> <span class="err">$</span><span class="n">doc</span><span class="o">-></span><span class="n">aNodes</span><span class="o">-></span><span class="n">nSize</span>
<span class="k">set</span> <span class="err">$</span><span class="n">iNodes</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">set</span> <span class="err">$</span><span class="n">indent</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">while</span> <span class="p">(</span> <span class="err">$</span><span class="n">iNodes</span><span class="o">++<</span><span class="err">$</span><span class="k">size</span> <span class="o">&&</span> <span class="err">$</span><span class="n">iNodes</span><span class="o"><</span><span class="mi">255</span> <span class="p">)</span>
<span class="k">set</span> <span class="err">$</span><span class="n">node</span><span class="o">=</span><span class="err">$</span><span class="n">doc</span><span class="o">-></span><span class="n">aNodes</span><span class="p">[</span><span class="err">$</span><span class="n">iNodes</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="k">if</span> <span class="p">(</span> <span class="err">$</span><span class="n">node</span><span class="o">-></span><span class="n">nNodeType</span> <span class="o">==</span> <span class="mi">1</span> <span class="p">)</span>
<span class="k">set</span> <span class="err">$</span><span class="n">indent</span> <span class="o">=</span> <span class="err">$</span><span class="n">indent</span> <span class="o">-</span> <span class="mi">1</span>
<span class="k">end</span>
<span class="n">pIndent</span> <span class="err">$</span><span class="n">indent</span>
<span class="n">printf</span> <span class="ss">"Node %d - Type: %d, SoS: %d"</span><span class="p">,</span> <span class="err">$</span><span class="n">iNodes</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="err">$</span><span class="n">node</span><span class="o">-></span><span class="n">nNodeType</span><span class="p">,</span> <span class="err">$</span><span class="n">node</span><span class="o">-></span><span class="n">pStartOfSection</span><span class="o">-></span><span class="n">nOffset</span>
<span class="k">if</span> <span class="p">(</span> <span class="err">$</span><span class="n">node</span><span class="o">-></span><span class="n">nNodeType</span> <span class="o">==</span> <span class="mi">2</span> <span class="o">||</span> <span class="err">$</span><span class="n">node</span><span class="o">-></span><span class="n">nNodeType</span> <span class="o">==</span> <span class="mi">6</span> <span class="p">)</span>
<span class="n">printf</span> <span class="ss">", EoS: %d"</span><span class="p">,</span> <span class="err">$</span><span class="n">node</span><span class="o">-></span><span class="n">GetStartNode</span><span class="p">(</span> <span class="p">)</span><span class="o">-></span><span class="n">pEndOfSection</span><span class="o">-></span><span class="n">nOffset</span>
<span class="k">set</span> <span class="err">$</span><span class="n">indent</span> <span class="o">=</span> <span class="err">$</span><span class="n">indent</span> <span class="o">+</span> <span class="mi">1</span>
<span class="k">end</span>
<span class="k">if</span> <span class="p">(</span> <span class="err">$</span><span class="n">node</span><span class="o">-></span><span class="n">IsTxtNode</span><span class="p">(</span> <span class="p">)</span> <span class="p">)</span>
<span class="n">printf</span> <span class="ss">", Text: "</span>
<span class="k">set</span> <span class="err">$</span><span class="n">txt</span> <span class="o">=</span> <span class="err">$</span><span class="n">node</span><span class="o">-></span><span class="n">GetTxtNode</span><span class="p">(</span> <span class="p">)</span><span class="o">-></span><span class="n">aText</span>
<span class="n">ptu</span> <span class="err">$</span><span class="n">txt</span>
<span class="k">else</span>
<span class="n">printf</span> <span class="ss">"\n"</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre></div>
<p>The values in this file are needed to better understand the ouput:
<a href="http://svn.services.openoffice.org/opengrok/xref/DEV300_m40/sw/inc/ndtyp.hxx">http://svn.services.openoffice.org/opengrok/xref/DEV300_m40/sw/inc/ndtyp.hxx</a>.
This function has to be called with the instance of the <em>SwDoc</em> object
as parameter.</p>Last docx import fixes2009-03-13T16:15:00+01:002009-03-13T16:15:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2009-03-13:/last-docx-import-fixes.html<p>I had no time to write a post for each new fix I made this
week, then here is a summary of what happened. Don't blame me for
providing screenshots only for some very visible points instead of every
fix.</p>
<h4>Changes tracking import</h4>
<p>This was and is still a big …</p><p>I had no time to write a post for each new fix I made this
week, then here is a summary of what happened. Don't blame me for
providing screenshots only for some very visible points instead of every
fix.</p>
<h4>Changes tracking import</h4>
<p>This was and is still a big area for improvement. I first fixed what I
saw easily in some example documents but it's quite hard to find every
single bug in there. If you find others, please don't hesitate to leave
me a message or some issue either on IZ or Novell's bugzilla. Here is a
list of what have been fixed for the changes tracking:</p>
<ul>
<li>When inserting a footnote or endnote, the imported redline was
completely wrong</li>
<li>When there are several changes on the same piece of text only one
was imported</li>
<li>The added / removed paragraphs weren't imported</li>
<li>The changes weren't shown by default in OOo when opening a document
with changes</li>
<li>The changes weren't tracked in OOo as the documents settings weren't
read at all. The settings.xml import has been fixed / started, but
it currently handles only this property.</li>
</ul>
<p>There are some points to be aware of if you want to try to find other
changes tracking issues:</p>
<ul>
<li>Compare with what is imported by OOo when opening the same file in
.doc: OOo doesn't support all the changes tracks of Word: checking
what the .doc import does is a quick way to check if OOo can usually
handle this kind of change.</li>
<li>Open the <em>"Review & Approve"</em> dialog in OOo and compare these
entries with the changes in Word: OOo isn't showing the changes in
the same way than Word and there might be some display problems.</li>
</ul>
<h4>Page number alignement</h4>
<p>There where problems of page numbers alignement in some cases: this came
from a too large minimum width of the frame. By defining this constant
to 0, the frame is now fitting to its content automatically
(<a href="http://qa.openoffice.org/issues/show_bug.cgi?id=93786">i#93786</a>)</p>
<h4>Page borders import</h4>
<p>The page borders weren't imported at all: it is now fixed. Here are some
screenshots to better understand what happened. The test document is
attached to the issue <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=100176">i#00176</a>.</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/pgborder-mso.png"><img alt="Page borders in Word 2007" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/pgborder-mso-150x150.png"></a></p>
<p>Page borders in Word 2007</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/pgborder-ooo.png"><img alt="Page borders imported in OOo" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/pgborder-ooo-150x150.png"></a></p>
<p>Page borders imported in OOo</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/pgborder-odfconv.png"><img alt="Page Borders imported with OdfConverter" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/pgborder-odfconv-150x150.png"></a></p>
<p>Page Borders imported with OdfConverter</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ooxml/pgborder-fixed.png"><img alt="Page borders import fixed" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/pgborder-fixed-150x150.png"></a></p>
<p>Page borders import fixed</p>
<h4>A CWS for all those fixes</h4>
<p>As it starts to make a small amount of changes to the code, I have also
created a CWS to up-stream the changes:
<strong>writerfilter32bugfixes01</strong>.</p>Pictures in docx import2009-03-04T18:12:00+01:002009-03-04T18:12:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2009-03-04:/pictures-in-docx-import.html<p>As I explained it in a previous post, I am working on fixing
docx import in OpenOffice.org. I have fixed a bug on the pictures import
recently. The patch fixes the issues i#97645 and i#96021. The i#96021
issue fix isn't complete yet, because it has something …</p><p>As I explained it in a previous post, I am working on fixing
docx import in OpenOffice.org. I have fixed a bug on the pictures import
recently. The patch fixes the issues i#97645 and i#96021. The i#96021
issue fix isn't complete yet, because it has something to do with shapes
import which aren't working at all. The patch has been committed to
go-oo trunk. As one of the fixes isn't complete, I still haven't
submitted it to the upstream.</p>
<p>Here are some screenshots to show the differences:</p>
<p><img alt="Picture in Word 2007" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/picture-mso.png"></p>
<p>Picture in Word 2007</p>
<p><img alt="Pictures import in OOo without the patch" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/pcture-nf.png"></p>
<p>Pictures import in OOo without the patch</p>
<p><img alt="Picture import in OOo using OdfConverter" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/picture-conv.png"></p>
<p>Picture import in OOo using OdfConverter</p>
<p><img alt="Picture imported in OOo with the patch" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/picture-ooo.png"></p>
<p>Picture imported in OOo with the patch</p>
<p>Thanks again Andrew for providing your useful reference document and
pointing out the bugs.</p>OOXML tables import in docx files fixed2009-02-20T19:10:00+01:002009-02-20T19:10:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2009-02-20:/ooxml-tables-import-in-docx-files-fixed.html<p>Thanks to Andrew Ziem in his post <a href="http://www.oooninja.com/2008/12/better-office-docx-converter.html">A Better Office .docx
converter</a>, I have discovered a place needing many improvements in
OOo. I started to fix the border problem exposed in Andrew's document,
but then found that the table styles weren't imported. This problem is
now fixed in go-oo trunk …</p><p>Thanks to Andrew Ziem in his post <a href="http://www.oooninja.com/2008/12/better-office-docx-converter.html">A Better Office .docx
converter</a>, I have discovered a place needing many improvements in
OOo. I started to fix the border problem exposed in Andrew's document,
but then found that the table styles weren't imported. This problem is
now fixed in go-oo trunk and a patch has been submitted on IssueZilla.</p>
<p>The best way to understand the problem is to consider the following
screenshots. To show how important these styles are, simply consider
that the simple-black-border tables in word are using a style.</p>
<p>The document in Word 2007:</p>
<p><img alt="Tables in Word 2007" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/tables-import-mso.png"></p>
<p>Tables in Word 2007</p>
<p>The document opened by OpenOffice.org (dev300m40):</p>
<p><img alt="Tables in OOo without the fixes" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/table-import-ooo-nf1.png"></p>
<p>Tables in OOo without the fixes</p>
<p>The document opened by ooo-build using the OdfConverter:</p>
<p><img alt="Tables in OOo using OdfConverter" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/table-import-ooo-odfconv1.png"></p>
<p>Tables in OOo using OdfConverter</p>
<p>The document opened by OpenOffice.org with the fixes:</p>
<p><img alt="Tables imported by OOo after fixes" src="https://bosdonnat.fr/data/OpenOffice.org/ooxml/table-import-ooo.png"></p>
<p>Tables imported by OOo after fixes</p>
<p>As Andrew pointed it, there are still other places of improvements in
the docx files import; I will continue to fix them: many thanks
Andrew!</p>Bootstrapping OOo from Java2008-12-13T15:10:00+01:002008-12-13T15:10:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2008-12-13:/bootstrapping-ooo-from-java.html<p>As you may have read it I have been working for some time on a
new system to bootstrap OpenOffice.org from the Eclipse integration. I
will take this occasion to explain how to bootstrap OOo in a Java
application.</p>
<h3>The problem</h3>
<p>You may have already encountered that problem, because …</p><p>As you may have read it I have been working for some time on a
new system to bootstrap OpenOffice.org from the Eclipse integration. I
will take this occasion to explain how to bootstrap OOo in a Java
application.</p>
<h3>The problem</h3>
<p>You may have already encountered that problem, because it is quite
common: when using the <code>Bootstrap</code> class provided by OpenOffice.org jars
a message like <strong>No office executable has been found</strong> is often
displayed. After some investigations we often discover that this is a
<code>ClassLoader</code> problem. There are many documentations and code snippets
on the web explaining what are class loaders in Java, but it is often
hard to apply to our problem.</p>
<p>In fact the <code>Boostrap</code> class will try to find the <code>soffice</code> file using
its class loader. In Java each class is loaded by a class loader. Class
loaders are organized in a tree structure: a class loader has a parent
(generally the one used to load the class of the class loader). On the
top of the tree there is the JVM classloader. When looking for a class
or resource, a class loader will look if it can load the class or
resource, and will delegate to its parent if that resource or class file
can't be found be that class loader.</p>
<p>This means that I can create a simple Java application bootstrapping OOo
with no custom class loader. But that implies that the <code>LD_LIBRARY_PATH</code>
and <code>CLASSPATH</code> variables are properly set before starting the
application. Defining a custom class loader using the OpenOffice.org
installation path would be a much better idea: this is what I will show
in the next lines.</p>
<h3>A custom class loader for OOo classes</h3>
<p>The class loader that we need to create has only to inherit from the
<code>URLClassLoader</code> and be provided the URL to the OpenOffice.org jars and
library directories. For OpenOffice.org 3 it means that you need to add
the URLs for:</p>
<ul>
<li>every Jar file of the Basis layer, in
<code>/path/to/ooo/basis-link/program/classes</code></li>
<li>every Jar file of the URE, in
<code>/path/to/ooo/basis-link/ure-link/share/java</code></li>
<li>the Basis layer program directory, ie:
<code>/path/to/ooo/basis-link/program</code></li>
<li>the URE lib directory, ie: <code>/path/to/ooo/basis-link/ure-link/lib</code></li>
</ul>
<p>We also need to add our application's own code to the URLs in order to
load our OOo-specific classes by that class loader.</p>
<p>Here is a sample class loader extracted from the Eclipse integration
code (simplified). <code>IOOo</code> is an interface describing the OpenOffice.org
instance to use:</p>
<div class="highlight"><pre><span></span><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">OfficeClassLoader</span> <span class="kd">extends</span> <span class="n">URLClassLoader</span> <span class="p">{</span>
<span class="kd">public</span> <span class="nf">OfficeClassLoader</span><span class="p">(</span><span class="n">IOOo</span> <span class="n">pOOo</span><span class="p">,</span> <span class="n">ClassLoader</span> <span class="n">pParent</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">super</span><span class="p">(</span><span class="n">getUrls</span><span class="p">(</span><span class="n">pOOo</span><span class="p">),</span> <span class="n">pParent</span><span class="p">);</span>
<span class="p">}</span>
<span class="kd">private</span> <span class="kd">static</span> <span class="n">URL</span><span class="o">[]</span> <span class="nf">getUrls</span><span class="p">(</span><span class="n">IOOo</span> <span class="n">pOOo</span><span class="p">)</span> <span class="p">{</span>
<span class="n">LinkedList</span> <span class="n">oUrls</span> <span class="o">=</span> <span class="k">new</span> <span class="n">LinkedList</span><span class="p">();</span>
<span class="k">try</span> <span class="p">{</span>
<span class="n">String</span><span class="o">[]</span> <span class="n">javaPaths</span> <span class="o">=</span> <span class="n">pOOo</span><span class="p">.</span><span class="na">getClassesPath</span><span class="p">();</span>
<span class="n">URL</span> <span class="n">bundleUrl</span> <span class="o">=</span> <span class="n">OOEclipsePlugin</span><span class="p">.</span><span class="na">getDefault</span><span class="p">().</span><span class="na">getBundle</span><span class="p">().</span><span class="na">getResource</span><span class="p">(</span><span class="s">"/"</span><span class="p">);</span> <span class="c1">//$NON-NLS-1$</span>
<span class="n">URL</span> <span class="n">plugin</span> <span class="o">=</span> <span class="n">FileLocator</span><span class="p">.</span><span class="na">resolve</span><span class="p">(</span><span class="n">bundleUrl</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="n">String</span> <span class="n">path</span> <span class="p">:</span> <span class="n">javaPaths</span><span class="p">)</span> <span class="p">{</span>
<span class="n">File</span> <span class="n">dir</span> <span class="o">=</span> <span class="k">new</span> <span class="n">File</span><span class="p">(</span><span class="n">path</span><span class="p">);</span>
<span class="n">File</span><span class="o">[]</span> <span class="n">jars</span> <span class="o">=</span> <span class="n">dir</span><span class="p">.</span><span class="na">listFiles</span><span class="p">(</span><span class="k">new</span> <span class="n">FileFilter</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">public</span> <span class="kt">boolean</span> <span class="nf">accept</span><span class="p">(</span><span class="n">File</span> <span class="n">pTested</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">pTested</span><span class="p">.</span><span class="na">getName</span><span class="p">().</span><span class="na">endsWith</span><span class="p">(</span><span class="s">".jar"</span><span class="p">);</span> <span class="c1">//$NON-NLS-1$</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="k">for</span> <span class="p">(</span><span class="n">File</span> <span class="n">jar</span> <span class="p">:</span> <span class="n">jars</span><span class="p">)</span> <span class="p">{</span>
<span class="n">oUrls</span><span class="p">.</span><span class="na">add</span><span class="p">(</span><span class="n">jar</span><span class="p">.</span><span class="na">toURI</span><span class="p">().</span><span class="na">toURL</span><span class="p">());</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="n">String</span><span class="o">[]</span> <span class="n">libsPath</span> <span class="o">=</span> <span class="n">pOOo</span><span class="p">.</span><span class="na">getLibsPath</span><span class="p">();</span>
<span class="k">for</span> <span class="p">(</span><span class="n">String</span> <span class="n">path</span> <span class="p">:</span> <span class="n">libsPath</span><span class="p">)</span> <span class="p">{</span>
<span class="n">oUrls</span><span class="p">.</span><span class="na">add</span><span class="p">(</span><span class="k">new</span> <span class="n">File</span><span class="p">(</span><span class="n">path</span><span class="p">).</span><span class="na">toURI</span><span class="p">().</span><span class="na">toURL</span><span class="p">());</span>
<span class="p">}</span>
<span class="n">oUrls</span><span class="p">.</span><span class="na">add</span><span class="p">(</span><span class="n">plugin</span><span class="p">);</span>
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="n">Exception</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
<span class="n">PluginLogger</span><span class="p">.</span><span class="na">error</span><span class="p">(</span><span class="s">"Failed to create the OfficeClassLoader"</span><span class="p">,</span> <span class="n">e</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">return</span> <span class="n">oUrls</span><span class="p">.</span><span class="na">toArray</span><span class="p">(</span><span class="k">new</span> <span class="n">URL</span><span class="o">[</span><span class="n">oUrls</span><span class="p">.</span><span class="na">size</span><span class="p">()</span><span class="o">]</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>Now that we have that class loader, how should it be used? The only
point to know is that we need to be sure that our classes bootstrapping
OpenOffice.org and handling its API have to be loaded by this custom
class loader. This means that we have to use the Java introspection API
to instanciate the class and run the desired method. Here is a small
example using the above class loader:</p>
<div class="highlight"><pre><span></span><code><span class="n">OfficeClassLoader</span> <span class="n">oooClassLoader</span> <span class="o">=</span> <span class="k">new</span> <span class="n">OfficeClassLoader</span><span class="p">.</span><span class="na">getClassLoader</span><span class="p">(</span><span class="n">getOOo</span><span class="p">(),</span>
<span class="n">TypesGetter</span><span class="p">.</span><span class="na">class</span><span class="p">.</span><span class="na">getClassLoader</span><span class="p">());</span>
<span class="n">Class</span> <span class="n">clazz</span> <span class="o">=</span> <span class="n">oooClassLoader</span><span class="p">.</span><span class="na">loadClass</span><span class="p">(</span><span class="s">"org.openoffice.test.MyOOoAction"</span><span class="p">);</span>
<span class="n">Object</span> <span class="n">myAction</span> <span class="o">=</span> <span class="n">clazz</span><span class="p">.</span><span class="na">newInstance</span><span class="p">();</span>
</code></pre></div>
<p>The <code>MyOOoAction</code> class can now call the famous <code>Bootstrap.bootstrap()</code>
method and use the connection to OpenOffice.org.</p>
<h3>Tips & Tricks</h3>
<p>However, this is not exactly what I have done for the Eclipse
integration. I had several needs:</p>
<ul>
<li>the action classes needed to return some results to be used
somewhere else. These results are classes of the Eclipse integration
which are not related to the OpenOffice.org API at all. If I add the
URL of the Eclipse plugin code to the class loader URLs, I can
instanciate those classes in the OOo-specific classes. However Java
does consider that class <code>A</code> loaded by <code>ClassLoader1</code> is not the
same thing than class <code>A</code> loaded by <code>ClassLoader2</code>. I cannot cast
those results using classes loaded by an other class loader: the
shared classes have to be loaded by the Eclipse plugin class loader.</li>
<li>the Eclipse integration can start and stop OpenOffice.org several
times in the application lifetime. The same OpenOffice.org libraries
can't be loaded twice by two different instances of the same class
loader.</li>
</ul>
<p>In order to address those two needs, I had to:</p>
<ul>
<li>Redefine the <code>loadClass</code> method of the <code>OfficeClassLoader</code> in order
to make it load only the OOo-specific classes of the Eclipse
Integration. All the other classes have to be loaded by the parent
class loader: the normal one of the Eclipse plugin. In order to do
this I had to impose that all the OOo-specific classes are grouped
into one precise package.</li>
<li>Cache the class loader and re-use them when I needed to bootstrap
again the same instance of OOo.</li>
</ul>Unit tests for OOo extensions2008-10-02T15:15:00+02:002008-10-02T15:15:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-10-02:/unit-tests-for-ooo-extensions.html<p>I have explained <a href="https://bosdonnat.fr/test-coverage-for-ooo-extensions.html">in one of my last posts</a> how to measure
the coverage of the test of a Java OpenOffice.org extension. These
white-box tests are generally not enough to ensure the quality of a
development. XUnit tests are often used by developers to automate the
tests. What about …</p><p>I have explained <a href="https://bosdonnat.fr/test-coverage-for-ooo-extensions.html">in one of my last posts</a> how to measure
the coverage of the test of a Java OpenOffice.org extension. These
white-box tests are generally not enough to ensure the quality of a
development. XUnit tests are often used by developers to automate the
tests. What about unit tests for an OpenOffice.org extension? Is there
any way to automate the tests of a Java extension for OpenOffice.org? To
improve the quality of the COOoder extension, I wanted to create some
unit tests. I will present here some basic classes to use to create easy
tests.</p>
<h3>Theoretically...</h3>
<p>Before presenting any code snippet, I need to explain the general
principle of the unit tests for OpenOffice.org. The key concept of the
following is that OpenOffice.org can be launched and controlled by a
remote program. A JUnit test is a normal Java program and the idea is to
make it bootstrap OOo, connect to it and execute the tests. Here is a
small sequence diagram of what happens:</p>
<p><img alt="Sequence diagram" src="/images/ooo/unittest_1.png" title="Sequence diagram"></p>
<p>OpenOffice.org is bootstrapped once at the beginning by the test suite
and stopped when all tests are run (this part has been forgotten on the
diagram). The remote OpenOffice.org context is transmitted to all the
test cases which can use it to set the fixture up, run the test and tear
the fixture down.</p>
<h3>...and practically</h3>
<p>To implement all this nice feature, I have created some base classes for
the tests cases and suites. They both inherits from the JUnit
corresponding classes. The classes are in the
<code>org.openoffice.coooder.test.base</code> package in the ooo-build project:</p>
<ul>
<li><code>Bootstrap</code>: the OpenOffice.org <code>Bootstrap</code> class modified to easily
bootstrap the office</li>
<li><code>UnoTestSuite</code>: the test suite to use to run all the unit tests for
OpenOffice.org</li>
<li><code>UnoTestCase</code>: the OpenOffice.org context-aware test case. This
abstract class has to be the base of all the unit tests for
OpenOffice.org Java extensions.</li>
</ul>
<p>To correctly bootstrap the office, the <code>program</code> folder of the
OpenOffice.org installation has to be added to the<code>LD_LIBRARY_PATH</code>
variable (<code>PATH</code> on windows and <code>DYLIB_LIBRARY_PATH</code> on MacOS). This
folder has to be passed as a property to the JUnit launcher using the
following JVM parameter:</p>
<div class="highlight"><pre><span></span><code><span class="err">-Dopenoffice.program.path=/usr/lib/openoffice/program</span>
</code></pre></div>
<p>Now there is only to write the tests. Here is an example of test suite
and a test case:</p>
<div class="highlight"><pre><span></span><code><span class="cm">/**</span>
<span class="cm"> * The test case class with two tests</span>
<span class="cm"> */</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">DummyTest</span> <span class="kd">extends</span> <span class="n">UnoTestCase</span> <span class="p">{</span>
<span class="kd">private</span> <span class="n">XTextDocument</span> <span class="n">mTestDoc</span><span class="p">;</span>
<span class="kd">public</span> <span class="nf">DummyTest</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">super</span><span class="p">();</span>
<span class="p">}</span>
<span class="kd">public</span> <span class="nf">DummyTest</span><span class="p">(</span><span class="n">String</span> <span class="n">pName</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">super</span><span class="p">(</span><span class="n">pName</span><span class="p">);</span>
<span class="p">}</span>
<span class="cm">/**</span>
<span class="cm"> * Fixture setup: creates an empty writer document</span>
<span class="cm"> */</span>
<span class="kd">protected</span> <span class="kt">void</span> <span class="nf">setUp</span><span class="p">()</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="p">{</span>
<span class="n">mTestDoc</span> <span class="o">=</span> <span class="n">loadDocument</span><span class="p">(</span><span class="s">"private:factory/swriter"</span><span class="p">);</span>
<span class="p">}</span>
<span class="cm">/**</span>
<span class="cm"> * Fixture tear down: closes the document without saving</span>
<span class="cm"> */</span>
<span class="kd">protected</span> <span class="kt">void</span> <span class="nf">tearDown</span><span class="p">()</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="p">{</span>
<span class="n">XCloseable</span> <span class="n">xCloseable</span> <span class="o">=</span> <span class="p">(</span><span class="n">XCloseable</span><span class="p">)</span><span class="n">UnoRuntime</span><span class="p">.</span><span class="na">queryInterface</span><span class="p">(</span>
<span class="n">XCloseable</span><span class="p">.</span><span class="na">class</span><span class="p">,</span> <span class="n">mTestDoc</span><span class="p">);</span>
<span class="n">xCloseable</span><span class="p">.</span><span class="na">close</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
<span class="p">}</span>
<span class="cm">/**</span>
<span class="cm"> * One correct test</span>
<span class="cm"> */</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">testHello</span><span class="p">()</span> <span class="p">{</span>
<span class="k">try</span> <span class="p">{</span>
<span class="n">String</span> <span class="n">hello</span> <span class="o">=</span> <span class="s">"Hello world!"</span><span class="p">;</span>
<span class="n">mTestDoc</span><span class="p">.</span><span class="na">getText</span><span class="p">().</span><span class="na">setString</span><span class="p">(</span><span class="n">hello</span><span class="p">);</span>
<span class="n">assertEquals</span><span class="p">(</span><span class="n">hello</span><span class="p">,</span> <span class="n">mTestDoc</span><span class="p">.</span><span class="na">getText</span><span class="p">().</span><span class="na">getString</span><span class="p">());</span>
<span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="n">Exception</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fail</span><span class="p">(</span><span class="s">"Shouldn't have thrown an exception"</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="cm">/**</span>
<span class="cm"> * One failing test</span>
<span class="cm"> */</span>
<span class="kd">public</span> <span class="kt">void</span> <span class="nf">testFailure</span><span class="p">()</span> <span class="p">{</span>
<span class="n">fail</span><span class="p">(</span><span class="s">"test will fail here"</span><span class="p">);</span>
<span class="p">}</span>
<span class="kd">private</span> <span class="n">XTextDocument</span> <span class="nf">loadDocument</span><span class="p">(</span><span class="n">String</span> <span class="n">pUrl</span><span class="p">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="p">{</span>
<span class="n">XMultiComponentFactory</span> <span class="n">xMngr</span> <span class="o">=</span> <span class="n">getContext</span><span class="p">().</span><span class="na">getServiceManager</span><span class="p">();</span>
<span class="n">Object</span> <span class="n">oDesktop</span> <span class="o">=</span> <span class="n">xMngr</span><span class="p">.</span><span class="na">createInstanceWithContext</span><span class="p">(</span><span class="s">"com.sun.star.frame.Desktop"</span><span class="p">,</span> <span class="n">getContext</span><span class="p">());</span>
<span class="n">XComponentLoader</span> <span class="n">xLoader</span> <span class="o">=</span> <span class="p">(</span><span class="n">XComponentLoader</span><span class="p">)</span><span class="n">UnoRuntime</span><span class="p">.</span><span class="na">queryInterface</span><span class="p">(</span>
<span class="n">XComponentLoader</span><span class="p">.</span><span class="na">class</span><span class="p">,</span> <span class="n">oDesktop</span><span class="p">);</span>
<span class="n">XComponent</span> <span class="n">xDoc</span> <span class="o">=</span> <span class="n">xLoader</span><span class="p">.</span><span class="na">loadComponentFromURL</span><span class="p">(</span><span class="n">pUrl</span><span class="p">,</span> <span class="s">"_default"</span><span class="p">,</span>
<span class="n">FrameSearchFlag</span><span class="p">.</span><span class="na">ALL</span><span class="p">,</span> <span class="k">new</span> <span class="n">PropertyValue</span><span class="o">[</span><span class="mi">0</span><span class="o">]</span><span class="p">);</span>
<span class="n">XTextDocument</span> <span class="n">xTextDoc</span> <span class="o">=</span> <span class="p">(</span><span class="n">XTextDocument</span><span class="p">)</span><span class="n">UnoRuntime</span><span class="p">.</span><span class="na">queryInterface</span><span class="p">(</span><span class="n">XTextDocument</span><span class="p">.</span><span class="na">class</span><span class="p">,</span> <span class="n">xDoc</span><span class="p">);</span>
<span class="k">return</span> <span class="n">xTextDoc</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="cm">/**</span>
<span class="cm"> * The test suite class.</span>
<span class="cm"> */</span>
<span class="kd">public</span> <span class="kd">class</span> <span class="nc">AllTests</span> <span class="p">{</span>
<span class="kd">public</span> <span class="kd">static</span> <span class="n">Test</span> <span class="nf">suite</span><span class="p">()</span> <span class="p">{</span>
<span class="c1">// The tests to run by the suite</span>
<span class="n">Class</span><span class="o">[]</span> <span class="n">testClasses</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Class</span><span class="o">[]</span> <span class="p">{</span>
<span class="n">DummyTest</span><span class="p">.</span><span class="na">class</span>
<span class="p">};</span>
<span class="c1">// Create the test suite</span>
<span class="n">UnoTestSuite</span> <span class="n">suite</span> <span class="o">=</span> <span class="k">new</span> <span class="n">UnoTestSuite</span><span class="p">(</span><span class="n">testClasses</span><span class="p">);</span>
<span class="k">return</span> <span class="n">suite</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>OpenOffice.org codeswarm2008-09-29T17:11:00+02:002008-09-29T17:11:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-09-29:/openofficeorg-codeswarm.html<p>You may have already heard of <a href="http://vis.cs.ucdavis.edu/~ogawa/codeswarm/">codeswarm</a>. This small
project, helps you to create a video from the commits logs of project.
Some open source projects have their codeswarm, but not OpenOffice.org.
At the beginning I wanted to have a codeswarm of both OOo and ooo-build,
but the OOo …</p><p>You may have already heard of <a href="http://vis.cs.ucdavis.edu/~ogawa/codeswarm/">codeswarm</a>. This small
project, helps you to create a video from the commits logs of project.
Some open source projects have their codeswarm, but not OpenOffice.org.
At the beginning I wanted to have a codeswarm of both OOo and ooo-build,
but the OOo CVS logs are too huge for my computer to run codeswarm on
them.</p>
<p>However, I managed to get the codeswarm for ooo-build project. These
kind of videos are much more interesting when you know the people
committing:</p>
<iframe src="http://player.vimeo.com/video/1840832" width="400" height="300" frameborder="0"></iframe>
<p><a href="http://vimeo.com/1840832?pg=embed&sec=1840832">ooo-build codeswarm</a> from <a href="http://vimeo.com/user792889?pg=embed&sec=1840832">Cédric Bosdonnat</a> on
<a href="http://vimeo.com?pg=embed&sec=1840832">Vimeo</a></p>Test coverage for OOo Extensions2008-09-23T09:54:00+02:002008-09-23T09:54:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-09-23:/test-coverage-for-ooo-extensions.html<p>Testing code is always one the most important part in the
development process. Testing OpenOffice.org extensions cannot be often
automated, but it would be interesting to know whether the tests are
enough or not. Having some code coverage informations for the tests can
be really useful.</p>
<p>This post explains …</p><p>Testing code is always one the most important part in the
development process. Testing OpenOffice.org extensions cannot be often
automated, but it would be interesting to know whether the tests are
enough or not. Having some code coverage informations for the tests can
be really useful.</p>
<p>This post explains how to measure the code coverage of a Java extension
for OpenOffice.org. There are some traps in the path leading to the data
and you should read the complete article to avoid them.</p>A better COOoder is here2008-09-12T12:56:00+02:002008-09-12T12:56:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-09-12:/a-better-coooder-is-here.html<p>This new version of the syntax highlighting extension for
OpenOffice.org brings the announced features. Many thanks for those who
brought their improvement ideas.</p>
<ul>
<li>The language definition files are written on one line: 40% of time
is thus gained during the definition file reading.</li>
<li>The regular expressions used to find …</li></ul><p>This new version of the syntax highlighting extension for
OpenOffice.org brings the announced features. Many thanks for those who
brought their improvement ideas.</p>
<ul>
<li>The language definition files are written on one line: 40% of time
is thus gained during the definition file reading.</li>
<li>The regular expressions used to find the keywords are compiled and
stored in a regexp cache: this gains only 3% of time on the snippet
highlighting... but it's already interesting on huge snippets.</li>
<li>A progress bar is now showing the highlighting progress.</li>
<li>The languages names are sorted in the listbox... but their display
name is still not shown.</li>
<li>A fix for problems with keywords starting with the character <strong>?</strong>.</li>
</ul>
<p>The update site is not ready and the updated sources will be soon
available on the Gnome SVN in the ooo-build project.</p>
<p><a href="https://bosdonnat.fr/data/COOoder.oxt">COOoder.oxt</a></p>
<p><strong>EDIT</strong> The sources can be browsed on <a href="https://github.com/cbosdo/coooder">GitHub</a></p>GeSHi for OpenOffice.org2008-07-05T09:50:00+02:002008-07-05T09:50:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-07-05:/geshi-for-openofficeorg.html<p>As I have promised it in a later post, here is a first version
of the OpenOffice.org extension for syntax highlighting. There are still
some things to improve like:</p>
<ul>
<li>reading the languages files: this could certainly be optimized to
avoid parsing the language file at each parsing time.</li>
<li>generating …</li></ul><p>As I have promised it in a later post, here is a first version
of the OpenOffice.org extension for syntax highlighting. There are still
some things to improve like:</p>
<ul>
<li>reading the languages files: this could certainly be optimized to
avoid parsing the language file at each parsing time.</li>
<li>generating the languages files: add a parameter to remove the new
lines in the XML definitions of the language.</li>
<li>present the display names of the languages and sort them by
alphabetical order in the language selection dialog.</li>
<li>add some error dialogs for the user to understand problems.</li>
</ul>
<p>Do not hesitate to report any bug here if you find some.
<a href="https://bosdonnat.fr/data/COOoder.oxt">COOoder.oxt</a></p>
<p><strong>Edit 2008, 06/07:</strong><br>
<a href="https://github.com/cbosdo/coooder">Sources</a></p>OOo for coders (2)2008-06-13T08:59:00+02:002008-06-13T08:59:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-06-13:/ooo-for-coders-2.html<p>Some times ago I have written a post about an OpenOffice.org
extension to present code snippets in <a href="https://bosdonnat.fr/ooo-for-coders.html">OOo with syntax highlighting</a>.
You may thing that this project is forgotten... but I'm writing here to
tell the contrary: I'm coding it when I have some time between work and
social …</p><p>Some times ago I have written a post about an OpenOffice.org
extension to present code snippets in <a href="https://bosdonnat.fr/ooo-for-coders.html">OOo with syntax highlighting</a>.
You may thing that this project is forgotten... but I'm writing here to
tell the contrary: I'm coding it when I have some time between work and
social life, that is to say slowly.</p>
<p>The GeSHi engine is now almost completely ported to OpenOffice.org: I
only need to add the support for the case insensitivity. However I'm not
providing anthing yet because there are a few things that are still
missing:</p>
<ul>
<li>Proper language definition files in XML support. The current tests
are done with a code snippet mixing several languages with a hard
coded language definition. The next step is to define an XML schema
for the language definition files and make the language service read
it.</li>
<li>A tool converting the GeSHi configuration files into the XML
language definition files.</li>
<li>The automated creation of the styles from the language definition
during thhe syntax highlighting. The styles are currently used but
manually defined.</li>
<li>A GUI to apply the syntax highlighting.</li>
</ul>
<p>I will provide some dev snapshot of the extension when it will be usable
even if you have to configure some things manually. However I can't
promise any date... this will completely depend on my available time and
mood. Stay tuned...</p>Getting an OOo CWS2008-05-12T16:56:00+02:002008-05-12T16:56:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-05-12:/getting-an-ooo-cws.html<p>Recently, I wanted to build OOo with some features like canvas support.
As I had some errors when building the canvas module, <a href="http://eric.bachard.free.fr/news/">ericb2</a> told me
that I should get the <em>canvas05</em> CWS<footnote>CWS: Child Work
Space</footnote> and build OpenOffice.org with it. As I didn't know how
to do it …</p><p>Recently, I wanted to build OOo with some features like canvas support.
As I had some errors when building the canvas module, <a href="http://eric.bachard.free.fr/news/">ericb2</a> told me
that I should get the <em>canvas05</em> CWS<footnote>CWS: Child Work
Space</footnote> and build OpenOffice.org with it. As I didn't know how
to do it, Eric explained it on <code>#education.openoffice.org</code> channel.
Here is a condensed version of what Eric explained on IRC for people
who'ld like to check out a CWS.</p>
<p><strong>Getting informations on the CWS</strong></p>
<p>The first thing to do is to get some informations about the desired CWS.
For this, search the wanted CWS in <a href="https://tools.services.openoffice.org/EIS2/GuestLogon">EIS</a>. A search by the CWS name
will do the trick here as we know it: <em>canvas05</em>. Click on the CWS name
in the search results and then on the <strong>All</strong> link to see all the CWS
informations.</p>
<p>In our case, the useful informations are:</p>
<ul>
<li>the current milestone, which is the milestone against which to build
the CWS. Here the milestone for <em>canvas05</em> is <em>m9</em></li>
<li>the list of the CVS modules changed by the CWS. Here these are:
basecmp, basegfx, canvas, comphelper, cppcanvas, goodies, offapi,
officecfg, offuh, scp2, sd, sdext, slideshow, scx, testshl2, tools,
unoil, vcl</li>
<li>the MWS<footnote>MWS: Master Work Space</footnote> of the CWS'
creation. Here it's <em>SRC680</em></li>
</ul>
<p><strong>Getting the sources</strong></p>
<p>First, be sure to have the sources of the correct OpenOffice.org
milestone. If not, check them out using the following command. For more
informations on how to access the OpenOffice.org CVS, read <a href="http://wiki.services.openoffice.org/wiki/CVS">this
page</a>. In this command, <code>DEV300</code> is the MWS and <code>m9</code> the milestone of
the desired version. Before executing this command, be sure to have set
the <code>CVSROOT</code> environment variable.</p>
<div class="highlight"><pre><span></span><code>cvs -z4 co -r DEV300_m9 OpenOffice3
</code></pre></div>
<p>Now that the OpenOffice.org sources are checked out, it's time to check
out the sources of the CWS. To do this, use a shell command (Windows
users, can use it with Cygwin or can translate it) like the following.
In this command:</p>
<ul>
<li>the list of the <code>for</code> loop is the list of the changed modules for
the CWS</li>
<li>
<p>the tag to extract is build using the MWS of the CWS creation and
the CWS name</p>
<p>:::sh
for i in basebmp basegfx canvas comphelper cppcanvas goodies offapi officecfg offuh scp2 sd sdext slideshow svx testshl2 tools unoil vcl
do
mv $i $i"_old"
cvs -z4 co -r cws_src680_canvas05 $i
done</p>
</li>
</ul>
<p>After this, there is "only" to build OpenOffice.org with the CWS. </p>Improving the uno-skeletonmaker2008-05-06T10:34:00+02:002008-05-06T10:34:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-05-06:/improving-the-uno-skeletonmaker.html<p>As many of the readers may wonder what is the <code>uno-skeletonmaker</code>, I
will start with a short explanation of its use. The <code>uno-skeletonmaker</code>
is a command line tool provided in the OpenOffice.org SDK which
generates a skeleton of code for the implementation of an UNO IDL
service specification. This …</p><p>As many of the readers may wonder what is the <code>uno-skeletonmaker</code>, I
will start with a short explanation of its use. The <code>uno-skeletonmaker</code>
is a command line tool provided in the OpenOffice.org SDK which
generates a skeleton of code for the implementation of an UNO IDL
service specification. This tool can generate either C++ or Java. The
<code>uno-skeletonmaker</code> is mainly used in the Eclipse and NetBeans
integrations for OpenOffice.org.</p>
<p><strong>Why do I would like to improve the <code>uno-skeletonmaker</code>?</strong></p>
<p>In fact the code generated by this tool is not really acceptable for a
OpenOffice.org extensions beginner developer. For example, the methods
generated for an interface attributes in Java simply does nothing and
there is no <code>TODO</code> comment to inform the developer that something has to
be written there. What could be great has been started in the C++ code
generation: these methods have a default body using a private member.
The problem with the C++ generated code is that the member is not
defined.</p>
<p>By talking with Noel Power at the Go-OOCon in Prague, we found
interesting to improve (may be redevelop) the <code>uno-skeletonmaker</code> for it
to be able to manage code style definitions. The need is that every
coder or enterprise has its own code style and would like to have it
applied by the <code>uno-skeletonmaker</code>. An other interesting point of making
the <code>uno-skeletonmaker</code> templateable would be to have to ability to add
new languages more easily (e.g. Python).</p>
<p>I've started hacking the <code>uno-skeletonmaker</code> to fix the attributes
methods generation problems and I will certainly add the support of
singletons code generation. However, I won't make the
<code>uno-skeletonmaker</code> templateable during the nights because its quite a
long job. If anyone wants to do it, feel free to propose yourself on the
<code>dev AT api</code> mailing list: its a quite small piece of code with really
few dependencies. </p>Discovering VIm2008-04-19T21:50:00+02:002008-04-19T21:50:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-04-19:/discovering-vim.html<p><strong>This post is not intended to participate in any troll
throwing competition and doesn't aim at (re)starting any flame war with
emacs users.</strong></p>
<p>I'm using vim for some times, but in many occasions I could see how few
of its features I am using. I discovered today some interesting …</p><p><strong>This post is not intended to participate in any troll
throwing competition and doesn't aim at (re)starting any flame war with
emacs users.</strong></p>
<p>I'm using vim for some times, but in many occasions I could see how few
of its features I am using. I discovered today some interesting features
for coders like autocompletion, mass insertion, going to matching
parentheses. Here are some useful links:</p>
<ul>
<li><a href="http://www.43things.com/things/view/253990/learn-vim">http://www.43things.com/things/view/253990/learn-vim</a></li>
<li><a href="http://www.cs.utah.edu/~kad/vim/vimnotes.shtml">http://www.cs.utah.edu/~kad/vim/vimnotes.shtml</a></li>
<li><a href="http://www.vim.org/tips/tip.php?tip_id=194">http://www.vim.org/tips/tip.php?tip_id=194</a></li>
</ul>
<p>There is even a page in OpenOffice.org wiki to help <a href="http://wiki.services.openoffice.org/wiki/Editor_Vim">configure Vim for
OpenOffice.org</a> developement. I think that I'll try all this out
soon... </p>OOo for coders ?2008-04-08T11:48:00+02:002008-04-08T11:48:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2008-04-08:/ooo-for-coders.html<p>From my first project report containing code at school I had
the need to create a syntax highlighting tool for OpenOffice.org. These
last years I had no time to do it. Even if I don't have more currently,
having stopped the Eclipse plugin for OpenOffice.org development gives
me …</p><p>From my first project report containing code at school I had
the need to create a syntax highlighting tool for OpenOffice.org. These
last years I had no time to do it. Even if I don't have more currently,
having stopped the Eclipse plugin for OpenOffice.org development gives
me a little more time for it.</p>
<p>To implement such a tool, I started from <a href="http://qbnz.com/highlighter/">GeSHi</a>, the famous PHP tool
for syntax highlightinh. I'm converting the GeSHi algorithm into a Java
extension for OpenOffice.org. The only problem is that applying
OpenOffice.org styles for the highlighting imposes rethinking some parts
of the algorithm. For example:</p>
<ul>
<li>GeSHi adds the style for a string before having found its end. In
OpenOffice.org I need to get the end of the string before defining
its style.</li>
<li>GeSHi defines the style of the escaped characters first and then
finds the end of the string. In OpenOffice.org I first need to get
the end of the string to set the string style before setting the
escaped characters style.</li>
</ul>
<p>After some other troubles like these there will be an OpenOffice.org
extension to format source code in a clean and easy way. Thus stay
tuned... </p>Filters in OOo2008-03-10T15:55:00+01:002008-03-10T15:55:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2008-03-10:/filters-in-ooo.html<p>Today, I wanted to get the list of the export and import
filters managed by OpenOffice.org. It took me quite a long time to find
out how to automatically distinguish an import filter form an export
filter.</p>
<p>The first thing to look for is any API to get the …</p><p>Today, I wanted to get the list of the export and import
filters managed by OpenOffice.org. It took me quite a long time to find
out how to automatically distinguish an import filter form an export
filter.</p>
<p>The first thing to look for is any API to get the list of the managed
filters. This can be achieved using the
<code>com.sun.star.document.FilterFactory</code> service. With this service, you
have the internal names of all the filters and you can access there
display name and configuration. Here is an example to get the data for
the HTML filter:</p>
<div class="highlight"><pre><span></span><code><span class="err">Function getHtmlFilter()</span>
<span class="err"> oFilterFactory = createUnoService("com.sun.star.document.FilterFactory")</span>
<span class="err"> getHtmlFilter() = oFilter.getByName("HTML")</span>
<span class="err">End Function</span>
</code></pre></div>
<p>The IDL reference for the FilterFactory service is quite interesting
when you can read the line:</p>
<blockquote>
<p>Flags [integer] They describe the filter more specific.<br>
(e.g. they mark it as IMPORT/EXPORT or DEFAULT filter.)</p>
</blockquote>
<p>The main problem of this documentation is that the <code>Flags</code> property
value contains an integer resulting from added constants. There is no
documentation or API for these constants... Here is the start of the
difficult part of the exercise. I had to look in the sources for some
minutes to find the right file where these constants are defined:
<a href="http://lxr.go-oo.org/source/framework/sfx2/inc/sfx2/docfilt.hxx">framework/sfx2/inc/sfx2/docfilt.hxx</a>. There you can learn that the
value for the <code>IMPORT</code> constant is <code>1</code> and the value for the <code>EXPORT</code>
constant is <code>2</code>. </p>
<p>Here is a sample of OOoBasic code to get the list of the import
filters and the list of the export filters.</p>
<div class="highlight"><pre><span></span><code><span class="n">Sub</span> <span class="n">Main</span><span class="p">()</span>
<span class="n">oFilterFactory</span> <span class="o">=</span> <span class="n">createUnoService</span><span class="p">(</span><span class="ss">"com.sun.star.document.FilterFactory"</span><span class="p">)</span>
<span class="n">aNames</span> <span class="o">=</span> <span class="n">oFilterFactory</span><span class="p">.</span><span class="n">getElementNames</span><span class="p">()</span>
<span class="n">Dim</span> <span class="n">aExports</span><span class="p">()</span>
<span class="n">Dim</span> <span class="n">aImports</span><span class="p">()</span>
<span class="k">For</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span> <span class="k">To</span> <span class="n">UBound</span><span class="p">(</span><span class="n">aNames</span><span class="p">)</span>
<span class="n">sName_i</span> <span class="o">=</span> <span class="n">aNames</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
<span class="n">xFilter</span> <span class="o">=</span> <span class="n">oFilterFactory</span><span class="p">.</span><span class="n">getByName</span><span class="p">(</span><span class="n">sName_i</span><span class="p">)</span>
<span class="n">nFlag</span> <span class="o">=</span> <span class="n">getFlag</span><span class="p">(</span><span class="n">xFilter</span><span class="p">)</span>
<span class="k">If</span> <span class="n">nFlag</span> <span class="k">mod</span> <span class="mi">2</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">Then</span>
<span class="n">nNbExport</span> <span class="o">=</span> <span class="n">UBound</span><span class="p">(</span><span class="n">aExports</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">ReDim</span> <span class="k">Preserve</span> <span class="n">aExports</span><span class="p">(</span><span class="n">nNbExport</span><span class="p">)</span>
<span class="n">aExports</span><span class="p">(</span><span class="n">nNbExport</span><span class="p">)</span> <span class="o">=</span> <span class="n">sName_i</span>
<span class="k">Else</span>
<span class="n">nNbImport</span> <span class="o">=</span> <span class="n">UBound</span><span class="p">(</span><span class="n">aImports</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">ReDim</span> <span class="k">Preserve</span> <span class="n">aImports</span><span class="p">(</span><span class="n">nNbImport</span><span class="p">)</span>
<span class="n">aImports</span><span class="p">(</span><span class="n">nNbImport</span><span class="p">)</span> <span class="o">=</span> <span class="n">sName_i</span>
<span class="k">End</span> <span class="k">If</span>
<span class="k">Next</span> <span class="n">i</span>
<span class="n">sExports</span> <span class="o">=</span> <span class="ss">""</span>
<span class="k">For</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span> <span class="k">To</span> <span class="n">UBound</span><span class="p">(</span><span class="n">aExports</span><span class="p">)</span>
<span class="n">sExports</span> <span class="o">=</span> <span class="n">sExports</span> <span class="o">&</span> <span class="n">aExports</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">&</span> <span class="n">chr</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="k">Next</span> <span class="n">i</span>
<span class="n">sImports</span> <span class="o">=</span> <span class="ss">""</span>
<span class="k">For</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span> <span class="k">To</span> <span class="n">UBound</span><span class="p">(</span><span class="n">aImports</span><span class="p">)</span>
<span class="n">sImports</span> <span class="o">=</span> <span class="n">sImports</span> <span class="o">&</span> <span class="n">aImports</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">&</span> <span class="n">chr</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="k">Next</span> <span class="n">i</span>
<span class="n">sStats</span> <span class="o">=</span> <span class="ss">"Nb Filters: "</span> <span class="o">&</span> <span class="n">UBound</span><span class="p">(</span><span class="n">aNames</span><span class="p">)</span> <span class="o">&</span> <span class="n">chr</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="n">sStats</span> <span class="o">=</span> <span class="n">sStats</span> <span class="o">&</span> <span class="ss">"Nb Exports: "</span> <span class="o">&</span> <span class="n">UBound</span><span class="p">(</span><span class="n">aExports</span><span class="p">)</span> <span class="o">&</span> <span class="n">chr</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="n">sStats</span> <span class="o">=</span> <span class="n">sStats</span> <span class="o">&</span> <span class="ss">"Nb Imports: "</span> <span class="o">&</span> <span class="n">UBound</span><span class="p">(</span><span class="n">aImports</span><span class="p">)</span> <span class="o">&</span> <span class="n">chr</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="n">MsgBox</span> <span class="n">sStats</span>
<span class="n">msgbox</span> <span class="n">sImports</span>
<span class="n">msgbox</span> <span class="n">sExports</span>
<span class="k">End</span> <span class="n">Sub</span>
<span class="k">Function</span> <span class="n">getFlag</span><span class="p">(</span><span class="n">xFilter</span><span class="p">)</span>
<span class="n">getFlag</span><span class="p">()</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="k">For</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span> <span class="k">To</span> <span class="n">UBound</span><span class="p">(</span><span class="n">xFilter</span><span class="p">)</span>
<span class="n">xProp_i</span> <span class="o">=</span> <span class="n">xFilter</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
<span class="k">If</span> <span class="n">xProp_i</span><span class="p">.</span><span class="n">Name</span> <span class="o">=</span> <span class="ss">"Flags"</span> <span class="k">Then</span>
<span class="n">getFlag</span><span class="p">()</span> <span class="o">=</span> <span class="n">xProp_i</span><span class="p">.</span><span class="n">Value</span>
<span class="k">End</span> <span class="k">If</span>
<span class="k">Next</span> <span class="n">i</span>
<span class="k">End</span> <span class="k">Function</span>
</code></pre></div>
<p>Using this discovery and the <a href="http://api.openoffice.org/docs/common/ref/com/sun/star/document/TypeDetection.html"><code>com.sun.star.document.TypeDetection</code></a> service you can
compute quite the same filters than the one of the standard OpenOffice.org file picker dialog.</p>Handling URL in OOo2007-11-23T12:07:00+01:002007-11-23T12:07:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2007-11-23:/handling-url-in-ooo.html<p>As I'm usually using the OOo API from Basic code, I'm using
the <code>convertToUrl()</code> and <code>convertFromUrl()</code> Basic functions to handle
URLs. The problem is that I had to do the same in Java extension. Of
course, the <code>toExternalString()</code> method of a Java URL object doesn't
return an OOo internal URL …</p><p>As I'm usually using the OOo API from Basic code, I'm using
the <code>convertToUrl()</code> and <code>convertFromUrl()</code> Basic functions to handle
URLs. The problem is that I had to do the same in Java extension. Of
course, the <code>toExternalString()</code> method of a Java URL object doesn't
return an OOo internal URL usable in method like
<code>loadComponentFromUrl()</code>.</p>
<p>Hopefully, I found out the <a href="http://api.openoffice.org/docs/common/ref/com/sun/star/uri/ExternalUriReferenceTranslator.html"><code>ExternalUriReferenceTranslator</code></a> service
which convert between OOo internal URLs and normal URLs. Here is a code
sample which could help to see how it works.</p>
<div class="highlight"><pre><span></span><code><span class="kd">public</span> <span class="kd">static</span> <span class="n">String</span> <span class="nf">convertToUrl</span><span class="p">(</span><span class="n">String</span> <span class="n">pFilePath</span><span class="p">,</span> <span class="n">XComponentContext</span> <span class="n">pComponentContext</span> <span class="p">)</span> <span class="kd">throws</span> <span class="n">MalformedURLException</span> <span class="p">{</span>
<span class="n">String</span> <span class="n">internalUrl</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
<span class="n">URL</span> <span class="n">externalUrl</span> <span class="o">=</span> <span class="k">new</span> <span class="n">File</span><span class="p">(</span><span class="n">pFilePath</span><span class="p">).</span><span class="na">toURL</span><span class="p">();</span>
<span class="n">XExternalUriReferenceTranslator</span> <span class="n">translator</span> <span class="o">=</span> <span class="n">ExternalUriReferenceTranslator</span><span class="p">.</span><span class="na">create</span><span class="p">(</span>
<span class="n">pComponentContext</span><span class="p">);</span>
<span class="n">internalUrl</span> <span class="o">=</span> <span class="n">translator</span><span class="p">.</span><span class="na">translateToInternal</span><span class="p">(</span><span class="n">externalUrl</span><span class="p">.</span><span class="na">toExternalForm</span><span class="p">());</span>
<span class="k">return</span> <span class="n">internalUrl</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>List of file types handled by OpenOffice.org2007-11-05T12:32:00+01:002007-11-05T12:32:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2007-11-05:/list-of-file-types-handled-by-openofficeorg.html<p>I recently wanted to get the list of all file types handled by
OpenOffice.org using the API. Of course I wanted to get their
internationalized names. I discovered a very interesting service while
browsing the API reference: <a href="http://api.openoffice.org/docs/common/ref/com/sun/star/document/TypeDetection.html"><code>com.sun.star.document.TypeDetection</code></a>.
Here is a sample of StarBasic code …</p><p>I recently wanted to get the list of all file types handled by
OpenOffice.org using the API. Of course I wanted to get their
internationalized names. I discovered a very interesting service while
browsing the API reference: <a href="http://api.openoffice.org/docs/common/ref/com/sun/star/document/TypeDetection.html"><code>com.sun.star.document.TypeDetection</code></a>.
Here is a sample of StarBasic code getting the names of the file types.</p>
<div class="highlight"><pre><span></span><code><span class="n">Sub</span> <span class="n">TestTypes</span>
<span class="n">oTypeDetection</span> <span class="o">=</span> <span class="n">createUnoService</span><span class="p">(</span> <span class="ss">"com.sun.star.document.TypeDetection"</span> <span class="p">)</span>
<span class="n">aNames</span> <span class="o">=</span> <span class="n">oTypeDetection</span><span class="p">.</span><span class="n">ElementNames</span>
<span class="n">sTypes</span> <span class="o">=</span> <span class="ss">""</span>
<span class="k">For</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span> <span class="k">To</span> <span class="n">UBound</span><span class="p">(</span> <span class="n">aNames</span> <span class="p">)</span>
<span class="n">oType</span> <span class="o">=</span> <span class="n">oTypeDetection</span><span class="p">.</span><span class="n">getByName</span><span class="p">(</span> <span class="n">aNames</span><span class="p">(</span> <span class="n">i</span> <span class="p">)</span> <span class="p">)</span>
<span class="n">sTypes</span> <span class="o">=</span> <span class="n">sTypes</span> <span class="o">&</span> <span class="n">getUIName</span><span class="p">(</span> <span class="n">oType</span> <span class="p">)</span> <span class="o">&</span> <span class="n">chr</span><span class="p">(</span> <span class="mi">10</span> <span class="p">)</span>
<span class="k">Next</span> <span class="n">i</span>
<span class="n">MsgBox</span> <span class="n">sTypes</span>
<span class="k">End</span> <span class="n">Sub</span>
<span class="k">Function</span> <span class="n">getUIName</span><span class="p">(</span> <span class="n">oType</span> <span class="k">As</span> <span class="n">Variant</span> <span class="p">)</span>
<span class="n">sName</span> <span class="o">=</span> <span class="ss">""</span>
<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">While</span> <span class="p">(</span> <span class="n">sName</span> <span class="o">=</span> <span class="ss">""</span> <span class="k">And</span> <span class="n">i</span> <span class="o"><=</span> <span class="n">UBound</span><span class="p">(</span> <span class="n">oType</span> <span class="p">)</span> <span class="p">)</span>
<span class="k">If</span> <span class="p">(</span> <span class="n">oType</span><span class="p">(</span> <span class="n">i</span> <span class="p">).</span><span class="n">Name</span> <span class="o">=</span> <span class="ss">"UIName"</span> <span class="p">)</span> <span class="k">Then</span>
<span class="n">sName</span> <span class="o">=</span> <span class="n">oType</span><span class="p">(</span> <span class="n">i</span> <span class="p">).</span><span class="n">Value</span>
<span class="k">End</span> <span class="k">If</span>
<span class="n">i</span> <span class="o">=</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">1</span>
<span class="n">Wend</span>
<span class="n">getUIName</span><span class="p">(</span> <span class="p">)</span> <span class="o">=</span> <span class="n">sName</span>
<span class="k">End</span> <span class="k">Function</span>
</code></pre></div>
<p>I hope that this could help you. </p>The Gecko and the Gull2007-05-04T08:22:00+02:002007-05-04T08:22:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2007-05-04:/the-gecko-and-the-gull.html<p>Is it a unknown fable from La Fontaine? Not really, in fact it
has more to do about OpenOffice.org and Mozilla. I was trying to tamper
with some web pages and I wanted to check whether we could integrate
easily a small web-browser inside OpenOffice.org.</p>
<p>Hopefully, there is …</p><p>Is it a unknown fable from La Fontaine? Not really, in fact it
has more to do about OpenOffice.org and Mozilla. I was trying to tamper
with some web pages and I wanted to check whether we could integrate
easily a small web-browser inside OpenOffice.org.</p>
<p>Hopefully, there is an interesting feature coming up with Eclipse 3.3
which helps a lot: <a href="http://download.eclipse.org/eclipse/downloads/drops/S-3.3M6-200703231616/eclipse-news-M6.html">SWT provides the ability to create a Browser</a>
composite which runs the <a href="http://en.wikipedia.org/wiki/XULRunner">xulrunner</a> (<a href="ftp://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/">downloads</a>). This means that
we could perfectly imagine a small Java extension to OpenOffice.org
which provides a UNO service to show any XUL or HTML page.</p>
<p>Here is a small snippet I created to test this on windows:</p>
<div class="highlight"><pre><span></span><code><span class="n">Display</span> <span class="n">display</span> <span class="o">=</span> <span class="n">Display</span><span class="p">.</span><span class="na">getDefault</span><span class="p">();</span>
<span class="kd">final</span> <span class="n">Shell</span> <span class="n">shell</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Shell</span><span class="p">(</span><span class="n">display</span><span class="p">);</span>
<span class="n">shell</span><span class="p">.</span><span class="na">setText</span><span class="p">(</span><span class="s">"My OOo Browser"</span><span class="p">);</span>
<span class="n">shell</span><span class="p">.</span><span class="na">setSize</span><span class="p">(</span><span class="mi">400</span><span class="p">,</span> <span class="mi">300</span><span class="p">);</span>
<span class="n">shell</span><span class="p">.</span><span class="na">setLayout</span><span class="p">(</span><span class="k">new</span> <span class="n">GridLayout</span><span class="p">());</span>
<span class="n">System</span><span class="p">.</span><span class="na">setProperty</span><span class="p">(</span><span class="s">"org.eclipse.swt.browser.XULRunnerPath"</span><span class="p">,</span>
<span class="s">"C:\\Documents and Settings\\Cbosdonnat\\Mes documents\\xulrunner"</span><span class="p">);</span>
<span class="n">Browser</span> <span class="n">browser</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Browser</span><span class="p">(</span><span class="n">shell</span><span class="p">,</span> <span class="n">SWT</span><span class="p">.</span><span class="na">MOZILLA</span><span class="p">);</span>
<span class="n">browser</span><span class="p">.</span><span class="na">setLayoutData</span><span class="p">(</span><span class="k">new</span> <span class="n">GridData</span><span class="p">(</span><span class="n">GridData</span><span class="p">.</span><span class="na">FILL_BOTH</span><span class="p">));</span>
<span class="n">browser</span><span class="p">.</span><span class="na">setUrl</span><span class="p">(</span><span class="s">"http://fr.openoffice.org"</span><span class="p">);</span>
<span class="n">shell</span><span class="p">.</span><span class="na">open</span><span class="p">();</span>
<span class="k">while</span> <span class="p">(</span><span class="o">!</span><span class="n">shell</span><span class="p">.</span><span class="na">isDisposed</span> <span class="p">())</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">display</span><span class="p">.</span><span class="na">readAndDispatch</span> <span class="p">())</span> <span class="n">display</span><span class="p">.</span><span class="na">sleep</span> <span class="p">();</span>
<span class="p">}</span>
<span class="n">display</span><span class="p">.</span><span class="na">dispose</span> <span class="p">();</span>
</code></pre></div>
<p>I let you imagine the kind of interesting applications we could do using
this... Of course the same principle is working on Linux and I would
like to test it on MacOS, but I let you translate the above code for
it. </p>A complete document template2006-10-30T12:39:00+01:002006-10-30T12:39:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2006-10-30:/a-complete-document-template.html<p>I just remembered that I still don't have brought back all the
content of my old wiki. Today, I'ld like to highlight an interesting
document... which was my first contribution to OpenOffice.org. It's a
writer document template to use in project documentation. I designed it
for a school project …</p><p>I just remembered that I still don't have brought back all the
content of my old wiki. Today, I'ld like to highlight an interesting
document... which was my first contribution to OpenOffice.org. It's a
writer document template to use in project documentation. I designed it
for a school project documentation quality management, but it can be
applied to many other circumstances. You can also have a look at this
document, because it contains interesting macros too.</p>
<p><a href="https://bosdonnat.fr/data/modeleprojet.ott">modeleprojet.ott</a></p>
<p><strong>Beware, the document is in french</strong></p>Press around the OOoCon20062006-09-19T15:26:00+02:002006-09-19T15:26:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2006-09-19:/press-around-the-ooocon2006.html<p>There were several journalists present at the OOoCon2006 last week.
They have spread the word around them to bring OpenOffice.org to
everyone. This article exposes some local TV grabs or newspapers. If you
found other articles about OOoCon2006 that aren't listed here, please
tell me: I'll add them.</p>
<p><strong>The …</strong></p><p>There were several journalists present at the OOoCon2006 last week.
They have spread the word around them to bring OpenOffice.org to
everyone. This article exposes some local TV grabs or newspapers. If you
found other articles about OOoCon2006 that aren't listed here, please
tell me: I'll add them.</p>
<p><strong>The videos can be read using any player supporting Theora and Vorbis,
eg: <a href="http://www.videolan.org">Videolan</a></strong> </p>
<p><a href="https://bosdonnat.fr/data/ooocon2006/20mn_Lyon_2006-09-11.jpg">20 minutes</a>
<a href="https://bosdonnat.fr/data/ooocon2006/metro1-2006-09-12.png">Metro #1</a>
<a href="https://bosdonnat.fr/data/ooocon2006/metro2-2006-09-12.png">Metro #2</a>
<a href="https://bosdonnat.fr/data/ooocon2006/Lyon-Capitale_2006-09-05.pdf">Lyon Capitale 2006-09-05</a>
<a href="https://bosdonnat.fr/data/ooocon2006/Lyon-Capitale_2006-09-12.png">Lyon Capitale 2006-09-12</a>
<a href="https://bosdonnat.fr/data/ooocon2006/m6_Lyon_2006-09-12.ogm">M6 Lyon</a>
<a href="https://bosdonnat.fr/data/ooocon2006/France3_Rhone-Alpes_2006-09-12.ogm">France 3 Rhone-Alpes</a></p>OOoCon2006, it's over2006-09-19T08:12:00+02:002006-09-19T08:12:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2006-09-19:/ooocon2006-its-over.html<p>Now the OpenOffice.org conferences 2006 are closed and the normal life
has taken its old rythm now. This article is only about to thank you all
for making this year's conferences a big event, quite like a family one.</p>
<p>Being prepared during several month by many persons on both …</p><p>Now the OpenOffice.org conferences 2006 are closed and the normal life
has taken its old rythm now. This article is only about to thank you all
for making this year's conferences a big event, quite like a family one.</p>
<p>Being prepared during several month by many persons on both
OpenOffice.org and INSA Lyon side, my first thanks are coming to all
those who helped us making it possible: Sophie, Marie-Jo, Jean-François
and Charles from OpenOffice.org and Yves Condemine, Patrick Pollet,
Cédric Grand, Anne Mouriquand from INSA. I am sure to forget many
persons here, but I think that they will recognize themselves.</p>
<p>To help us keep the conferences in our mind, the <a href="http://ooocon.kiberpipa.org/">kiberpipa team</a> who
did an extraordinary job, provides us the video archives of the
conferences and offers to host your photos of the event.</p>
<p>Again, thanks to you all. </p>Uno IDL syntax highlighting in PHP2006-08-20T11:20:00+02:002006-08-20T11:20:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2006-08-20:/uno-idl-syntax-highlighting-in-php.html<p>Uno IDL is the component specification language of OpenOffice.org. Here
is a solution to show some highlighted Uno IDL code. It uses <a href="http://qbnz.com/highlighter/">GeSHi</a>
and you need to add a language file describing how to parse and colorize
you Uno IDL code. As this language file doesn't exist I created …</p><p>Uno IDL is the component specification language of OpenOffice.org. Here
is a solution to show some highlighted Uno IDL code. It uses <a href="http://qbnz.com/highlighter/">GeSHi</a>
and you need to add a language file describing how to parse and colorize
you Uno IDL code. As this language file doesn't exist I created one.</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/idl.phps">Download the GeSHi language file now</a></p>UNO-IDL types introspection in Java2006-03-11T10:57:00+01:002006-03-11T10:57:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2006-03-11:/uno-idl-types-introspection-in-java.html<p>Since the beginning of the Google Summer of Code 2005 when I started the
OpenOffice.org Eclipse Integration project, I wanted to provide a code
completion feature for UNO-IDL. At the beginning I thought at a huge
mecanism using IDL parsers to fetch the informations. However, I
investigate a bit …</p><p>Since the beginning of the Google Summer of Code 2005 when I started the
OpenOffice.org Eclipse Integration project, I wanted to provide a code
completion feature for UNO-IDL. At the beginning I thought at a huge
mecanism using IDL parsers to fetch the informations. However, I
investigate a bit more on Juergen and Laurent ideas: using the UNO
reflection API to introspect any type.</p>
<p>After a small test, I could manage to do it in a small Java application.
I'll try to explain what I did. All the code provided is in very simple
Java main and should be launched with a correct ClassPath (the
OpenOffice.org jars) and <code>LD_LIBRARY_PATH</code> set to your OpenOffice.org
program directory. This is because OOo Jars use the OOo shared
libraries.</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/ReflectionTest.java">Download the whole code now</a></p>
<p>First thing to do is to bootstrap OpenOffice.org to get a component
context. There is no mystery in this code: using the Bootstrap class and
one of its method is the best way to do it.</p>
<div class="highlight"><pre><span></span><code><span class="k">try</span> <span class="p">{</span>
<span class="c1">//*****************************************************************************</span>
<span class="c1">// 1- Bootstrap of OpenOffice.org</span>
<span class="c1">//*****************************************************************************</span>
<span class="n">String</span> <span class="n">sofficepath</span> <span class="o">=</span> <span class="s">"file:///opt/openoffice.org2.0/program"</span><span class="p">;</span>
<span class="n">String</span> <span class="n">unoini</span> <span class="o">=</span> <span class="n">sofficepath</span> <span class="o">+</span> <span class="s">"/unorc"</span><span class="p">;</span> <span class="c1">// To change in uno.ini for Windows</span>
<span class="n">Hashtable</span> <span class="n">params</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Hashtable</span><span class="p">();</span>
<span class="n">params</span><span class="p">.</span><span class="na">put</span><span class="p">(</span><span class="s">"SYSBINDIR"</span><span class="p">,</span> <span class="n">sofficepath</span><span class="p">);</span>
<span class="n">XComponentContext</span> <span class="n">xCtx</span> <span class="o">=</span> <span class="n">Bootstrap</span><span class="p">.</span><span class="na">defaultBootstrap_InitialComponentContext</span><span class="p">(</span>
<span class="n">unoini</span><span class="p">,</span> <span class="n">params</span><span class="p">);</span>
<span class="n">System</span><span class="p">.</span><span class="na">out</span><span class="p">.</span><span class="na">println</span><span class="p">(</span><span class="s">">>> OOo has been bootstrapped"</span><span class="p">);</span>
</code></pre></div>
<p>This second part of code loads a types registry external to
OpenOffice.org. You will have to load some if you want to introspect in
addons or components types (I mean types which aren't defined in the
OpenOffice.org API)</p>
<div class="highlight"><pre><span></span><code> <span class="c1">//*****************************************************************************</span>
<span class="c1">// 2- Opening a local types regitry</span>
<span class="c1">//*****************************************************************************</span>
<span class="n">String</span> <span class="n">localRegistry</span> <span class="o">=</span> <span class="s">"file:///path/to/your/types.rdb"</span><span class="p">;</span>
<span class="n">XMultiComponentFactory</span> <span class="n">xMCF</span> <span class="o">=</span> <span class="n">xCtx</span><span class="p">.</span><span class="na">getServiceManager</span><span class="p">();</span>
<span class="n">XSimpleRegistry</span> <span class="n">xReg</span> <span class="o">=</span> <span class="p">(</span><span class="n">XSimpleRegistry</span><span class="p">)</span><span class="n">UnoRuntime</span><span class="p">.</span><span class="na">queryInterface</span><span class="p">(</span>
<span class="n">XSimpleRegistry</span><span class="p">.</span><span class="na">class</span><span class="p">,</span>
<span class="n">xMCF</span><span class="p">.</span><span class="na">createInstanceWithContext</span><span class="p">(</span><span class="s">"com.sun.star.registry.SimpleRegistry"</span><span class="p">,</span>
<span class="n">xCtx</span><span class="p">));</span>
<span class="n">xReg</span><span class="p">.</span><span class="na">open</span><span class="p">(</span><span class="n">localRegistry</span><span class="p">,</span> <span class="kc">true</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span>
<span class="n">System</span><span class="p">.</span><span class="na">out</span><span class="p">.</span><span class="na">println</span><span class="p">(</span><span class="s">">>> Local Registry opened"</span><span class="p">);</span>
</code></pre></div>
<p>The thirsd part is the interesting one for this blog article. The first
thing to do before introspecting, is to create a
<code>com.sun.star.reflection.CoreReflection</code> service. This one will provide
two simple methods:</p>
<ul>
<li><code>forName()</code>: gets a type definition from a string representing the
type<br>
name (dot-separated, eg: <code>com.sun.star.uno.XInterface</code>)</li>
<li><code>getType()</code>: gets a type definition from an any UNO object.</li>
</ul>
<p>In our case, we imagine that we don't have any running object to
introspect, but we have just its name (remain that is for code
completion purpose), thus we will use the <code>forName()</code> method (see point
3.1 in the code).</p>
<p>When we have the desired <code>XIdlClass</code>, we can do what we like with:
asking its name, its methods or attributes and so on. To get more help
on this please report to the <a href="http://api.openoffice.org/docs/common/ref/com/sun/star/reflection/XIdlClass.html"><code>com.sun.star.reflection.XIdlClass</code>
API</a>.</p>
<div class="highlight"><pre><span></span><code> <span class="c1">//*****************************************************************************</span>
<span class="c1">// 3- Getting the methods of XInterface</span>
<span class="c1">//*****************************************************************************</span>
<span class="c1">//**** 3.1 - Creating a CoreReflection service</span>
<span class="n">Object</span> <span class="n">oReflection</span> <span class="o">=</span> <span class="n">xCtx</span><span class="p">.</span><span class="na">getServiceManager</span><span class="p">().</span><span class="na">createInstanceWithContext</span><span class="p">(</span>
<span class="s">"com.sun.star.reflection.CoreReflection"</span><span class="p">,</span> <span class="n">xCtx</span><span class="p">);</span>
<span class="n">XIdlReflection</span> <span class="n">xReflection</span> <span class="o">=</span> <span class="p">(</span><span class="n">XIdlReflection</span><span class="p">)</span><span class="n">UnoRuntime</span><span class="p">.</span><span class="na">queryInterface</span><span class="p">(</span>
<span class="n">XIdlReflection</span><span class="p">.</span><span class="na">class</span><span class="p">,</span> <span class="n">oReflection</span><span class="p">);</span>
<span class="n">System</span><span class="p">.</span><span class="na">out</span><span class="p">.</span><span class="na">println</span><span class="p">(</span><span class="s">">>> Reflection service fetched"</span><span class="p">);</span>
<span class="c1">//**** 3.2 - Using XIdlReflexion.forName() like Class.forName() in Java</span>
<span class="n">XIdlClass</span> <span class="n">xClazz</span> <span class="o">=</span> <span class="n">xReflection</span><span class="p">.</span><span class="na">forName</span><span class="p">(</span><span class="s">"com.sun.star.uno.XInterface"</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">xClazz</span> <span class="o">!=</span> <span class="kc">null</span><span class="p">)</span> <span class="p">{</span>
<span class="n">System</span><span class="p">.</span><span class="na">out</span><span class="p">.</span><span class="na">println</span><span class="p">(</span><span class="s">">>> IdlClass found: "</span> <span class="o">+</span> <span class="n">xClazz</span><span class="p">.</span><span class="na">getName</span><span class="p">());</span>
<span class="c1">// Check for it's methods</span>
<span class="n">System</span><span class="p">.</span><span class="na">out</span><span class="p">.</span><span class="na">println</span><span class="p">(</span><span class="s">">>> Methods:"</span><span class="p">);</span>
<span class="c1">//**** 3.3 - A simple use of XIdlClass to list the methods</span>
<span class="n">XIdlMethod</span><span class="o">[]</span> <span class="n">methods</span> <span class="o">=</span> <span class="n">xClazz</span><span class="p">.</span><span class="na">getMethods</span><span class="p">();</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">i</span><span class="o"><</span><span class="n">methods</span><span class="p">.</span><span class="na">length</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="n">System</span><span class="p">.</span><span class="na">out</span><span class="p">.</span><span class="na">println</span><span class="p">(</span><span class="s">" * "</span> <span class="o">+</span> <span class="n">methods</span><span class="o">[</span><span class="n">i</span><span class="o">]</span><span class="p">.</span><span class="na">getName</span><span class="p">());</span>
<span class="p">}</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="n">System</span><span class="p">.</span><span class="na">out</span><span class="p">.</span><span class="na">println</span><span class="p">(</span><span class="s">">>> No IdlClass found"</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div>
<p>The rest is the normal ending of a try-catch block and is provided only
for the reader to copy-paste the code.</p>
<div class="highlight"><pre><span></span><code><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="n">Exception</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
<span class="n">e</span><span class="p">.</span><span class="na">printStackTrace</span><span class="p">();</span>
<span class="p">}</span>
<span class="n">System</span><span class="p">.</span><span class="na">exit</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
</code></pre></div>
<p>So you can imagine that I will now have a lot of work to integrate this
in the plugin, but you will have it in an indetermined delay...
depending on my time.</p>Patch for OOoBean and the office termination2006-03-04T10:55:00+01:002006-03-04T10:55:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2006-03-04:/patch-for-ooobean-and-the-office-termination.html<p>I experienced some problems properly <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=60473">closing OpenOffice.org from the
OOoBean</a>. Joachim Lingner told me there was an issue for this. As the
solution was quite simple to realize and test, I did it.</p>
<p>I just added a terminateOOo() method that terminate OOo if there is only
the bean on …</p><p>I experienced some problems properly <a href="http://qa.openoffice.org/issues/show_bug.cgi?id=60473">closing OpenOffice.org from the
OOoBean</a>. Joachim Lingner told me there was an issue for this. As the
solution was quite simple to realize and test, I did it.</p>
<p>I just added a terminateOOo() method that terminate OOo if there is only
the bean on the desktop and stops the bean connection otherwise. The
method returns a boolean to indicate whether the office is terminated or
not.</p>Handling GStreamer throught UNO2006-01-23T10:45:00+01:002006-01-23T10:45:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2006-01-23:/handling-gstreamer-throught-uno.html<p>Big news, I have a first working version of an UNO component to handle
GStreamer from UNO code. This will allow using gstreamer features within
UNO framework such as macro but also Java, c++ or pyUNO programs.</p>
<p>This component has many advantages for OpenOffice.org: it uses a free
multimedia …</p><p>Big news, I have a first working version of an UNO component to handle
GStreamer from UNO code. This will allow using gstreamer features within
UNO framework such as macro but also Java, c++ or pyUNO programs.</p>
<p>This component has many advantages for OpenOffice.org: it uses a free
multimedia framework, and provide an API. This API has to be extended
and doesn't give access to every GStreamer feature.</p>
<p><em>Of course this is still under development, and may not work in some
cases. However, every feedback is welcome. Note that the component's
page will be back soon.</em> Many thanks to Laurent Godard who help me to
debug and test the component</p>Creating an URE application in C++2005-12-07T10:42:00+01:002005-12-07T10:42:00+01:00Cédric Bosdonnattag:bosdonnat.fr,2005-12-07:/creating-an-ure-application-in-c.html<p>I just have finished to write a tutorial on how to create a simple C++
application based on the URE. This paper is written for URE and UNO
beginners and might be missing some important informations.</p>
<p>I would really appreciate every return to modify this tutorial and make
it better …</p><p>I just have finished to write a tutorial on how to create a simple C++
application based on the URE. This paper is written for URE and UNO
beginners and might be missing some important informations.</p>
<p>I would really appreciate every return to modify this tutorial and make
it better: it may be a tool to spread UNO around the world. The tutorial
is refering to an article I wrote earlier: " <a href="https://bosdonnat.fr/a-uno-ure-exercise.html">A UNO/URE exercise</a>".</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/uretutorial.odt">Download the tutorial now</a></p>A UNO-URE exercise2005-10-29T10:33:00+02:002005-10-29T10:33:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2005-10-29:/a-uno-ure-exercise.html<p>I just have completed to write and document a small exercise to learn
the basis for C++ URE based applications. Just get the joint archive and
look at the README file for the instructions.</p>
<p>In the archive you will find: the correction, the question and the
makefile for the build …</p><p>I just have completed to write and document a small exercise to learn
the basis for C++ URE based applications. Just get the joint archive and
look at the README file for the instructions.</p>
<p>In the archive you will find: the correction, the question and the
makefile for the build. In a few words, the exercise consists in writing
the specifications and implementation of an application using a Banker
and a Customer asking for money. Completing the exercise without looking
at the answer takes approximatly working 2 or 3 days ;)</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/exercise.tgz">Download the exercise now</a></p>UNO Component for URE test.2005-10-18T10:20:00+02:002005-10-18T10:20:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2005-10-18:/uno-component-for-ure-test.html<p>I have written an example of URE application just saying Hello URE world
in two languages: C++ and Java. To run this example you will need an
UNIX environment, that is to say a UNIX or an emulation like cygwin. It
uses the following tools:</p>
<ul>
<li>GNU Make</li>
<li>G++ 3.3 …</li></ul><p>I have written an example of URE application just saying Hello URE world
in two languages: C++ and Java. To run this example you will need an
UNIX environment, that is to say a UNIX or an emulation like cygwin. It
uses the following tools:</p>
<ul>
<li>GNU Make</li>
<li>G++ 3.3</li>
<li>OpenOffice.org 2.0 SDK</li>
<li>URE installed in /opt/openoffice.org/ure/</li>
</ul>
<h3>Howto run the example ?</h3>
<p>You just have to launch <strong>make</strong> to build the component. Launch
<strong>unotest</strong> to run the URE starting with the C++ implementation and the
Java one. To clear the directory, use <strong>make purge</strong>.</p>
<h3>How does it work ?</h3>
<p>This example is the one given in <a href="https://bosdonnat.fr/my-first-ure-component-in-java.html">this post of my blog</a>. It has been
completed by a C++ implementation. The principle in C++ is the same than
in Java: the major problem is the compilation chain. You can study it by
reading the content of the makefile contained in the archive. To
understand the makefile syntax, please refer to <a<br></a<br>
href="http://theory.uwinnipeg.ca/localfiles/infofiles/make/make_5.html#SEC4">
this page</a>.</p>
<p><a href="https://bosdonnat.fr/data/OpenOffice.org/unotest.tgz">Download the test now</a></p>My first URE Component in Java2005-10-10T10:11:00+02:002005-10-10T10:11:00+02:00Cédric Bosdonnattag:bosdonnat.fr,2005-10-10:/my-first-ure-component-in-java.html<p>How to create a new URE based application ? The documentation is quite
hard to find, but the main important thing is: create a UNO component
implementing the <code>com.sun.star.lang.XMain</code> interface. This one will
contain a method <em>run()</em>. I'll explain how to create a "Hello URE World"
application …</p><p>How to create a new URE based application ? The documentation is quite
hard to find, but the main important thing is: create a UNO component
implementing the <code>com.sun.star.lang.XMain</code> interface. This one will
contain a method <em>run()</em>. I'll explain how to create a "Hello URE World"
application.</p>
<!--more-->
<p>The project will be organized in the following way:</p>
<ul>
<li><strong>idl</strong> diretory containing the application UNOIDL specifications</li>
<li><strong>source</strong> directory containing the implementation of the UNOIDL
types</li>
<li><strong>program</strong> directory which will contain the application registries
and libraries</li>
<li><strong>MANIFEST.MF</strong> file which will describe the registration class of
the component</li>
<li><strong>Makefile</strong> file to make the build much easier</li>
<li><strong>unotest</strong> file to launch the newly created application</li>
</ul>
<h3>UNOIDL file definition</h3>
<p>The file <code>idl/org/unotest/Main.idl</code> will describe a simple service
<code>org.unotest.Main</code> exporting the XMain interface this gives the
following code:</p>
<div class="highlight"><pre><span></span><code><span class="err">module org { module unotest {</span>
<span class="err"> service Main: com::sun::star::lang::XMain {</span>
<span class="err"> create ();</span>
<span class="err"> }</span>
<span class="err">}; };</span>
</code></pre></div>
<p>Note that this service is a new style one: defining constructors and
exporting a single interface.</p>
<h3>Java implementation</h3>
<p>Now just create a <code>org.unotest.comp.MyMain</code> Java class in the
<code>source/org/unotest/comp/MyMain.java</code> file. This class will implement
the following three methods:</p>
<div class="highlight"><pre><span></span><code><span class="kd">public</span> <span class="kt">int</span> <span class="nf">run</span> <span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">arguments</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// Printing Hello URE World ;) and exit</span>
<span class="n">System</span><span class="p">.</span><span class="na">out</span><span class="p">.</span><span class="na">println</span><span class="p">(</span><span class="s">"Hello URE World ;)"</span><span class="p">);</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div>
<p>__getServiceFactory(...) and __writeRegistryServiceInfo(...) are
used for the component registration. They implementation is fully
described in the <a href="http://api.openoffice.org/docs/DevelopersGuide/Components/Components.htm#1+5+Simple+Component+in+Java">chapters 4.5.3 and 4.5.4 of the OpenOffice.org
Developer Guide</a></p>
<h3>Generation of the component</h3>
<p>The component generation works like the OpenOffice.org components
generation, however there are some tricky things to know:</p>
<ul>
<li><strong>use the URE regmerge and regcomp tools</strong>. Otherwise you will get
some Loader exceptions when trying to use regcomp on your component.</li>
<li>do not put your class files directly in your current directory: this
is a new issue that will be corrected. If you do not respect this
advice, the regcomp tool will use the class files in your current
directory before the one in your jar file.</li>
</ul>
<p>In our unotest case, the build instructions are written in the Makefile.
It should use the following tools:</p>
<ol>
<li>idlc -Ourd -I\$(SDK_HOME}/idl idl/org/unotest/Main.idl</li>
<li>\$(URE_HOME)/bin/regmerge program/types.rdb UCR urd/Main.urd</li>
<li>javamaker -Torg.unotest.Main -BUCR program/types.rdbb
-X\$(URE_HOME)/share/misc/services.rdb
-X\$(URE_HOME)/share/misc/types.rdb</li>
<li>javac -d . -cp \$(CLASSPATH) source/org/unotest/comp/MyMain.java</li>
<li>jar cfm program/unotest.uno.jar MANIFEST.MF
org/unotest/compMyMain.class org/unotest/Main.class</li>
<li>rm -Rf org</li>
<li>\$(URE_HOME)/bin/regcomp -register -br
\$(URE_HOME)/share/misc/types.rdb -br
\$(URE_HOME)/share/misc/services.rdb -r program/services.rdb -c
file://\$(PWD)/program/unotest.uno.jar -classpath \$(CLASSPATH)</li>
</ol>
<p>What will these commands do ?</p>
<ol>
<li>Compile your UNOIDL specification to create the urd/Main.urd
registry</li>
<li>Merge the generated urd file in the program/types.rdb registry</li>
<li>Create the org/unotest/Main.class file</li>
<li>Compile your java implementation of the service</li>
<li>Create the jar file of the component</li>
<li>Delete the unused class files to avoid problems with regcomp</li>
<li>Register the component in the URE</li>
</ol>
<h3>Launching the application</h3>
<p>In the unotest file, you just have to put a call to the uno tool
contained in the URE:</p>
<div class="highlight"><pre><span></span><code> <span class="err">$</span><span class="n">URE_HOME</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">uno</span> <span class="o">-</span><span class="n">c</span> <span class="n">org</span><span class="p">.</span><span class="n">unotest</span><span class="p">.</span><span class="n">comp</span><span class="p">.</span><span class="n">MyMain</span>
<span class="o">-</span><span class="n">l</span> <span class="n">file</span><span class="p">:</span><span class="o">//</span><span class="ss">`pwd`</span><span class="o">/</span><span class="n">program</span><span class="o">/</span><span class="n">unotest</span><span class="p">.</span><span class="n">uno</span><span class="p">.</span><span class="n">jar</span>
<span class="o">-</span><span class="n">ro</span> <span class="n">program</span><span class="o">/</span><span class="n">services</span><span class="p">.</span><span class="n">rdb</span>
<span class="o">-</span><span class="n">ro</span> <span class="n">program</span><span class="o">/</span><span class="n">types</span><span class="p">.</span><span class="n">rdb</span>
<span class="o">-</span><span class="n">ro</span> <span class="err">$</span><span class="n">URE_HOME</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">misc</span><span class="o">/</span><span class="n">services</span><span class="p">.</span><span class="n">rdb</span>
<span class="o">-</span><span class="n">ro</span> <span class="err">$</span><span class="n">URE_HOME</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">misc</span><span class="o">/</span><span class="n">types</span><span class="p">.</span><span class="n">rdb</span>
</code></pre></div>
<p>Thus when launching the unotest file, you will launch the URE with you
org.unotest.comp.MyMain as the main class to load at the beginning. This
will print you the expected "<em>Hello URE World ;)</em>"</p>
<p>The next step is to do the same with a C++ component... but I'm still
working on it.</p>