Import/export or store/restore XShape/XShapes in LibreOffice Draw via API

I want – as the title says – extract programmatically a shape from a Draw document through the api interface. Beside I want to import such a shape into a document as well.

I saw some predefined shapes in XML form and the document is stored as XML structure as well. Is there a known way to anybody out there to allow the storage and load of one shape?

What is this good for?

I want to allow to add user-defined objects programmatically, e.g. arrow heads, UML structures or even unicorns etc. .

Thanks in advance for any ideas,

J

P.S.: I work with LibreOffice Version: 5.2.4.2 . Access the interface through C# (so java and C++ would do it as well) but any ideas are welcome.