[Libreoffice] How to call from one component to another (sw->starmath)

Lubos Lunak l.lunak at suse.cz
Tue Aug 16 03:09:19 PDT 2011


On Tuesday 16 of August 2011, Caolán McNamara wrote:
> On Mon, 2011-08-15 at 17:16 +0200, Lubos Lunak wrote:
> > I already have a pointer to SmModel and SmDocShell (I can get it the same
> > way the .doc code does) and just need to call their method, passing the
> > XML serializer object as an argument, that's it.
>
> Probably matters what the destination format is like ? Is it a
> standalone thing and/or exists in a substorage/folder of the parent
> format where it doesn't care about what it is inside ? i.e. I'd sort of
> expect to basically just add another export filter to starmath for
> whatever that format is, add it to SmDocShell::ConvertTo and call that
> directly/indirectly. And have a save as... entry for the format if it
> makes sense to have it standalone ?

 The destination format is OOXML, and the formula is a part of one .xml file. 
It is standalone in the way that the whole formula is stored by starmath 
using Sm* classes and the XML subtree can be written out independently on the 
rest of the file. It is not standalone in the way that is it part of the .xml 
file and needs to be positioned inside the proper XML elements of the writer 
document.

 So using private streams is either not possible or only a complication 
depending on whether two sax_fastparser::FastSerializerHelper objects can be 
nested (I don't feel like trying, for these reasons). A standalone export 
file also wouldn't be right, as the formula needs to be inside a valid 
document.

> That's not going to work if the destination format needs hooks back into
> its surrounding container. Is that the problem ?

 No, starmath doesn't need to call back to writer. The problem is that this is 
still needlessly complicated. How about the attached patch?

-- 
 Lubos Lunak
 l.lunak at suse.cz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swsm.patch
Type: text/x-diff
Size: 5063 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110816/37cdd7bd/attachment.patch>


More information about the LibreOffice mailing list