Sub Test
GlobalScope.BasicLibraries.loadLibrary ("XrayTool")
oDoc = ThisComponent
oStorage = oDoc.DocumentStorage.getByName("Pictures")
aElem = oStorage.getElementNames()
for each sItem in aElem
msgbox sItem
next
oSheet = oDoc.CurrentController.ActiveSheet
oSel = oDoc.CurrentSelection
oShape = oSel.Annotation.AnnotationShape
oBMP = oShape.FillBitmap
xray oBMP
End sub
DocumentStorage returns the embedded picture
But where is the jpg in oBMP?
1.
As far as I can see the mentioned property OriginURL is only supported in LibO since V 6.1.
2.
The property is only set for images inserted as links.
3.
The area backgrounds for Calc annotations can't be loaded as links.
4.
Writer annotations have no Area properties.
On Windows 10: LibreOffice 25.2.2 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
The original report and the posts below in bug tdf#119899 are somehow misleading.
1. The effect is independent of the used programming language.
2. The property .OriginURL still contains the image's filepath if the image is inserted as link.
3. I forgot how LibO did it in very old versions. They may possibly have stored the URL even if the image was embedded. If so, the information gave some insight into the file system of the source computer if the document was delivered to somebody else. To avoid this may have been a reason to set the url = "" if the picture was embedded. Very faintly I remember a related discussion.
Just tested With LibO V3.3. The path (different property names) gave for an embedded image a cryptic internal storage (starting with vnd.star...) with many digits at the end. This is no longer supported.
On Windows 10: LibreOffice 25.2.2 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München