[GSoC] On "ODF Formulas in Writer"

Miklos Vajna vmiklos at collabora.co.uk
Tue Mar 11 04:29:50 PDT 2014


Hi Matteo,

On Sun, Mar 09, 2014 at 01:21:37AM -0500, Matteo Campanelli <matteo.campanelli at gmail.com> wrote:
> I am planning to apply to GSoC '14 and a few weeks ago I started hacking
> LibreOffice (I've been working on this Easy
> Hack<https://bugs.freedesktop.org/show_bug.cgi?id=53472>
> ).

Great! :-) Please don't forget to push your patch for review once you're
happy with it.

> I'm writing to start a discussion and ask some questions on the idea
> project in the subject of this email
> ([1<https://wiki.documentfoundation.org/Development/GSoC/Ideas#ODF_Formulas_in_Writer>
> ]).
> 
> Also - most important question (!!) - would there be anyone interested in
> mentoring this project?

AFAIK the project idea is from Cédric, but he's not mentoring Writer
projects this year. This doesn't mean you can't propose to work on this
project, but it's not the best Writer project you could pick up. ;-)

> My understanding of the issue:
> - Currently Writer uses its own, non-standard syntax for formulas. At the
> moment this syntax is both what is used/typed by the user and the one used
> for internal computations. (At a first glance, the class
> SwCalc<http://opengrok.libreoffice.org/search?q=&project=core&defs=SwCalc&refs=&path=&hist=>seems
> to be responsible for both parsing and interpreting these formulas,
> is that right?)

Yes, that sounds correct.

> - The goal of the project would be to enable users to write formulas in the
> ODF Format [2]<http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html>
> and use this same format for the internal computations.

Correct, what's currently written is like this:

<table:table-cell table:style-name="Table1.B1" table:formula="ooow:<A1>+<A2>" office:value-type="float" office:value="3">

The "ooow" part clearly indicates that it's something LO inherited from
OOo.

> - As far as I have understood, we may use the ixion library
> [3]<https://gitorious.org/ixion> to
> interpret ODF-style formulas. This library is already used by Writer for
> interpreting formulas in doc/docx files (which, I suppose, are first
> converted to the actual ODF format). [is this point of my interpretation
> correct? Could anyone provide code pointers for the computation of formula
> for .doc files?]

The ixion library is currently not part of LibreOffice in any way.
Regarding, .doc files, this is not handled in the filter (AFACS), just
the result of the formula is written to the file as a plain string.

> - Part of the project will have to deal with import/export filters and
> backward compatibility: first, files with formulas in the old-syntax should
> still be parsed correctly; second, users should have the option of saving
> in the old syntax or in the default new ODF syntax.

We have a general mechanism for that, in ODF 1.2 extended, probably you
could just write the new syntax, and you only need to make sure that the
old syntax can be read.

> Also, I have two additional questions:
> - the project idea page mentions changes in the code for the formula input
> bar. What should these changes to the UI consist of specifically? Are they
> mostly related to the strings produced by using the "Formula" dropdown menu
> in the bar?
> - Can anyone who is into the code roughly assess the relative hardness of
> the three subparts of this project (i.e. refactoring to use ODF and
> delegation to ixion, changes in the UI, adapting import/export filters)? In
> other words, which of these parts (if any) is likely to take longer
> compared to the others?

Probably the largest part is to make Writer core use the ODF formulas
(with the help of ixion), after that the ODF import/export is just
filter work, much easier. Regarding UI, it's about to change it, so that
it generates the ODF-syntax formulas, that's probably something you can
do incrementally once core support is there.

Additionally here, is a starter patch:

http://cgit.freedesktop.org/libreoffice/build/tree/patches/dev300/fields-table-formula.diff?h=master-backup

If you're interested in this project, you probably want to start with
porting that to current master. :-)

However, for now, I would suggest focusing getting your easy hack ready
& accepted; that's required even in case at the end you're interested in
some other LibreOffice idea.

Best,

Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20140311/0ae54b71/attachment.pgp>


More information about the LibreOffice mailing list