2013/10/14 LRN <lrn1986@...400...>:
When i started writing this message, i thought that i was going to ask about clipboard formats Inkscape understands. I thought that it would be enough to just swap the cairo-gdk surface used in my drawing function for a cairo-svg surface, write svg into memory, put it into clipboard and somehow paste into Inkscape.
This is fairly simple. You just need to use the GTK clipboard API. https://developer.gnome.org/gtk3/stable/gtk3-Clipboards.html
Specifically, you need to use gtk_clipboard_set_with_data() and then optionally gtk_clipboard_set_can_store().
So now i'm thinking of something different: create a template SVG document in Inkscape (putting placeholders in places where stuff should be inserted), give it to my application, and it will replace placehonders with real stuff (i hope i know XML well enough to just insert proper XML elements into right places) and save the result as an SVG.
For this you need a standalone SVG renderer with Cairo support to render the SVG page template, for example librsvg. After you render the template using rsvg_handle_render_cairo(), reuse the Cairo context to add your own content. https://developer.gnome.org/rsvg/2.40/
However, Inkscape does not seem to be terribly good at layout out text either, and copy-pasting drawings from Inkscape to OpenOffice produced mixed results (and i still don't know how to do it programmatically). So...what would you advise me to do?
If there are problems with copy and paste between Inkscape and OO.o / LibreOffice, please report them as bugs or discuss on this mailing list.
I'm not sure whether there's a way to paste into OO.o / LibreOffice from a program, but you might find something useful in the examples section here. In particular, the "GraphicsInserter" example might be relevant. http://api.libreoffice.org/
Regards, Krzysztof