Bug 119899 - Shape.Graphic.OriginURL is empty in Python UNO
Summary: Shape.Graphic.OriginURL is empty in Python UNO
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on: 91349
Blocks: Macro-Python
  Show dependency treegraph
Reported: 2018-09-15 21:14 UTC by Ofir
Modified: 2020-11-22 13:15 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

ODP with a graphic shape (23.28 KB, application/x-zip-compressed)
2018-09-15 21:16 UTC, Ofir

Note You need to log in before you can comment on or make changes to this bug.
Description Ofir 2018-09-15 21:14:41 UTC
Shape.GraphicURL was replaced in 6.1 with Shape.Graphic.OriginURL but when accessed with Python UNO it is empty and Shape.Graphic.Linked is False.
It might be related to:

Steps to Reproduce:
1. install libreoffice 6.1.x and libreoffice-script-provider-python in Ubuntu 18.04:
sudo add-apt-repository ppa:libreoffice/ppa
sudo apt-get update
sudo apt-get install libreoffice libreoffice-script-provider-python
2. start libreoffice from the command line
libreoffice "--accept=pipe,name=name;urp;StarOffice.Servicemanager"
3. open the attached ODP in libreoffice
4. open Python3 terminal and try to access shape.Graphic.OriginURL with UNO:

import uno
from pythonscript import ScriptContext

localContext = uno.getComponentContext()
resolver = localContext.ServiceManager.createInstanceWithContext(
'com.sun.star.bridge.UnoUrlResolver', localContext )
client = resolver.resolve("uno:pipe,"
XSCRIPTCONTEXT = ScriptContext(client, None, None)

doc = XSCRIPTCONTEXT.getDocument()
slide = doc.DrawPages.getByIndex(0)
shape = slide[0]


Actual Results:
shape.Graphic.OriginURL is an empty string
shape.Graphic.Linked is False

Expected Results:
shape.Graphic.OriginURL should give us the PNG URL.
shape.Graphic.Linked should be True

Reproducible: Always

User Profile Reset: No

Additional Info:
Build ID: 1:6.1.1~rc2-0ubuntu0.18.04.1~lo3
CPU threads: 1; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-US (en_IL); Calc: group threaded
Comment 1 Ofir 2018-09-15 21:16:21 UTC
Created attachment 144904 [details]
ODP with a graphic shape
Comment 2 Julien Nabet 2018-09-17 07:52:13 UTC
Tomaz: thought you might be interested in this one since it may concern graphic refactoring.
If I'm wrong, don't hesitate to uncc yourself and sorry for the noise.
Comment 3 Tomaz Vajngerl 2018-09-17 08:04:57 UTC
Shape.GraphicURL is replaced by Shape.Graphic.OriginURL only if the graphic is linked (that's why the switch Shape.Graphic.Linked). 
In the document you provided the graphic is embedded so it is expected that Shape.Graphic.Linked is false and Shape.Graphic.OriginURL is empty.
Comment 4 Ofir 2018-09-17 08:42:07 UTC
How can I get the name of the embedded image of the shape?
In the attached ODP it's
Comment 5 Tomaz Vajngerl 2018-09-17 08:44:17 UTC
Currently you can't.. why do you need that name?
Comment 6 Ofir 2018-09-17 09:02:09 UTC
I need access to the image file of the shape to work around animated gif/png bugs in imported PPTX [1], [2].
The image data in Shape.Graphic won't help because it's already missing the animation.

[1] https://bugs.documentfoundation.org/show_bug.cgi?id=91349
[2] https://bugs.documentfoundation.org/show_bug.cgi?id=92643
Comment 7 Tomaz Vajngerl 2018-09-17 15:46:55 UTC
OK I see, but your use-case is just working around bugs in LO. So instead of extending the interface for a use case that normal users don't really care about I find it much more sensible and easier to fix this 2 bugs.
Comment 8 Ofir 2018-09-17 16:28:45 UTC
The bugs are open since 2015.
This is just one example how the previous GraphicURL API gave us more tools compared to the new API.

I might be able to unzip the ODP and find the image name of graphic shapes but I find it limiting that such an important information can't be accessed with the UNO API.

In addition, I couldn't find a way to access the original and final image data of the Graphic. It has DIB and MaskDIB but I couldn't find info about them in the docs.
Comment 9 Xisco Faulí 2019-03-21 11:54:02 UTC
Let's move it to NEW and make it to depen on both bugs