OOo has very little clipart. I was asked to write a macro that will create OOo clipart galleries from existing folders of clipart.

I figured out how to insert links from a URL

oTheme.insertURLByIndex(sURL, 0)

I figured out how to insert the object as a graphic

   Dim oProvider  'GraphicProvider service.
   oProvider = createUnoService("com.sun.star.graphic.GraphicProvider")

   Dim oProps(0) as new com.sun.star.beans.PropertyValue
   oProps(0).Name  = "URL"
   oProps(0).Value = sURL

   REM Returns a graphic object from the URL to the graphic.
   oTheme.insertGraphicByIndex(oProvider.queryGraphic(oProps()), 0)

Apparently, a large collection of available clipart exists in SVG format.
I installed the SVG importer from here:
http://www.ipd.uni-karlsruhe.de/~hauma/svg-import/

I looked at the API, and it looks like I can insert a draw document directly:
http://api.openoffice.org/docs/common/ref/com/sun/star/gallery/XGalleryTheme.html

I tried it using this code:

   Dim oDoc
   Dim ImportArgs(0) As New com.sun.star.beans.PropertyValue
   ImportArgs(0).Name  = "FilterName"
   ImportArgs(0).Value = "draw_svg_import"
   oDoc = StarDesktop.LoadComponentFromURL(sURL, "_blank", 0, ImportArgs())
   If NOT IsNull(oDoc) AND NOT IsEmpty(oDoc) Then
     oTheme.insertGraphicByIndex(oDoc, 0)
     oDoc.close(True)
   End If

A -1 is returned, which means that the image was not added (I can also see that the image is not added).

If you want to run the entire macro, it will be here until I resolve this problem (at which point, I will likely move it someplace on my macros page).

http://www.pitonyak.org/OOoGalleryImport.odt



--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to