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

Lubos Lunak l.lunak at suse.cz
Mon Aug 15 08:16:17 PDT 2011


 Hello,

 I'm implementing .docx OOXML support for writing math formulas. As this is 
something that could be used not only by Writer but also by other components, 
I want to implement the writing of the formula in Starmath. And even if I 
didn't want, Sm* classes (which implement and store the formulas) are in 
starmath/ , and sw-starmath do not link against each other.

 So, the question is, how do I call from sw to starmath without linking them 
together? I checked how the binary .doc filter does it, and it goes via ~10 
calls deep [1] that call some UNO interfaces and store the result in some 
private stream or whatever. But I find that needlessly complicated, as 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.

 The best I've come up with creating let's say 
offapi/com/sun/star/starmath/WriteMath.idl with the function, make SmModel 
inherit from that and cast&call using it in sw. But I have not much idea 
about UNO, so I don't know what the stuff under offapi/ actually really is 
about. Is this a good solution or does somebody know something better?


[1] :
#2  0x00007f3d55c1ea9f in SmDocShell::ConvertTo (this=0x1cd2b68, rMedium=...) 
at /home/llunak/build/src/l2/starmath/source/document.cxx:988
#3  0x00007f3d8373abd8 in SfxObjectShell::SaveTo_Impl (this=0x1cd2b68, 
rMedium=..., pSet=0x0) 
at /home/llunak/build/src/l2/sfx2/source/doc/objstor.cxx:1528
#4  0x00007f3d837415d7 in SfxObjectShell::PreDoSaveAs_Impl (this=0x1cd2b68, 
rFileName=..., aFilterName=..., pParams=0x1376608) 
at /home/llunak/build/src/l2/sfx2/source/doc/objstor.cxx:2749
#5  0x00007f3d83740bac in SfxObjectShell::CommonSaveAs_Impl (this=0x1cd2b68, 
aURL=..., aFilterName=..., aParams=0x2029258) 
at /home/llunak/build/src/l2/sfx2/source/doc/objstor.cxx:2611
#6  0x00007f3d8372d332 in SfxObjectShell::APISaveAs_Impl (this=0x1cd2b68, 
aFileName=..., aParams=0x2029258) 
at /home/llunak/build/src/l2/sfx2/source/doc/objserv.cxx:345
#7  0x00007f3d8377dc92 in SfxBaseModel::impl_store (this=0x1c0bf20, sURL=..., 
seqArguments=..., bSaveTo=1 '\001') 
at /home/llunak/build/src/l2/sfx2/source/doc/sfxbasemodel.cxx:2844
#8  0x00007f3d83777690 in SfxBaseModel::storeToURL (this=0x1c0bf20, rURL=..., 
rArgs=...) at /home/llunak/build/src/l2/sfx2/source/doc/sfxbasemodel.cxx:1750
#9  0x00007f3d5e9e27ea in SvxMSExportOLEObjects::ExportOLEObject 
(this=0x1be9558, rObj=..., rDestStg=...) 
at /home/llunak/build/src/l2/filter/source/msfilter/msoleexp.cxx:225
#10 0x00007f3d577c7496 in WW8Export::OutputOLENode (this=0x7fff66ec7330, 
rOLENode=...) 
at /home/llunak/build/src/l2/sw/source/filter/ww8/wrtww8gr.cxx:280

-- 
 Lubos Lunak
 l.lunak at suse.cz


More information about the LibreOffice mailing list