https://bugs.documentfoundation.org/show_bug.cgi?id=167809
Bug ID: 167809
Summary: When adding an Image programmaticaly to Impress it
shows a placeholder with "Double click to add an
Image"
Product: LibreOffice
Version: 25.2.3.2 release
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Impress
Assignee: [email protected]
Reporter: [email protected]
Description:
In Impress(Presentation) When loading an image programmatically from a macro,
the image is loaded, but it's not possible to replace the placeholder "Double
click to add an Image" and shows the new image and the placeholder that does
not longer applies.
This is the python code used to add the image from a path:
```
def insert_image_in_presentation(img_path: str, width: int, height: int):
## insert_image_in_presentation('/tmp/miimage.png', 512, 512)
from com.sun.star.awt import Size
from com.sun.star.awt import Point
size = Size(width * 10, height * 10)
desktop = XSCRIPTCONTEXT.getDesktop()
doc = desktop.getCurrentComponent()
image = doc.createInstance("com.sun.star.presentation.GraphicObjectShape")
image.GraphicURL = uno.systemPathToFileUrl(img_path)
ctrllr = doc.CurrentController
draw_page = ctrllr.CurrentPage
draw_page.addTop(image)
added_image = draw_page[-1]
added_image.setSize(size)
position = Point(
((added_image.Parent.Width - (width * 10)) / 2),
((added_image.Parent.Height - (height * 10)) / 2),
)
added_image.setPosition(position)
added_image.setPropertyValue("ZOrder", draw_page.Count)
# The placeholder does not update
added_image.PlaceholderText = ""
added_image.setPropertyValue("PlaceholderText", "")
added_image.setPropertyValue("Title", "Stable Horde Generated Image")
added_image.setPropertyValue("Description", "This is a description of the
image")
added_image.Visible = True
doc.Modified = True
```
Alternatively, it's possible to download an extension with this same code at
https://github.com/ikks/libreoffice-stable-diffusion/blob/main/loshd.oxt
Steps to Reproduce:
1.In impress
2.Have a valid png file
2.In python use the provided function
Optionally, this code is being used in an extension that works correctly when
run in Writer, but with the placeholder in Impress.
https://github.com/ikks/libreoffice-stable-diffusion/blob/main/loshd.oxt
Actual Results:
The image is inserted in the presentation, but with a placeholder telling to
double click to add the image.
Expected Results:
The image to be inserted with the placeholder set programmatically or none
placeholder at all.
Reproducible: Always
User Profile Reset: Yes
Additional Info:
Version: 25.2.3.2 (X86_64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 8; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: en-US (C); UI: en-US
Debian package version: 4:25.2.3-2
Calc: threaded
--
You are receiving this mail because:
You are the assignee for the bug.