I’m trying to write a macro that inserts images. My problem is that the insertion does not appear in the undo stack, so the user cannot undo it. I’m doing something like (in Python):
document = XSCRIPTCONTEXT.getDocument()
page = document.getCurrentController().getCurrentPage()
graphic = document.createInstance('com.sun.star.drawing.GraphicObjectShape')
graphic.setSize(Size(3000,2000))
graphic.setPosition(Point(1000,1000))
page.add(graphic)
Ultimately, I’d like to wrap this into an undo context, so there is only one undo step for the whole macro (which inserts multiple images). Any ideas how to get this to appear on the undo stack?