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)
Version:
(earliest affected)
6.1.1.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on: 91349
Blocks: Macro-Python
  Show dependency treegraph
 
Reported: 2018-09-15 21:14 UTC by Ofir
Modified: 2023-11-08 10:37 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


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

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
Description:
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:
https://bugs.documentfoundation.org/show_bug.cgi?id=117427

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,"
"name=name;" 
"urp;"
"StarOffice.ComponentContext")
XSCRIPTCONTEXT = ScriptContext(client, None, None)

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

print(shape.Graphic.OriginURL)
print(shape.Graphic.Linked)

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:
Version: 6.1.1.2
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
10000201000001F4000000A0083619F766F01773.png
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
Comment 10 QA Administrators 2022-11-23 03:44:39 UTC
Dear Ofir,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug