Macro for redrawing slides in the 'slide sorter' view.

I have posted on the LibreOffice bugs site in detail about an issue with the rendering of images in the slide sorter view. Bug 115808 gives the most detail. It is here:
https://bugs.documentfoundation.org/show_bug.cgi?id=115808

As a workaround, I have written the following script that loops through all the slides and for each slide, it will
copy, paste, and delete, so that it forces LO to rerender the slides in “slide sorter” view. Can someone help me to replace the ‘copy, paste, delete’ with a more intelligent re-rendering of the slides in the slide sorter?

Please excuse my poor programming skills below. It’s my first LO macro script.

EM

=======================================================================

REM   You must be in 'slide sorter' view for this to work!!

Sub refresh
msg = "Start refresh?"
msgbox msg
oDoc = ThisComponent

REM  Go to slide sorter view 
oController = oDoc.CurrentController
oDispatch = createUnoService( "com.sun.star.frame.DispatchHelper")
oProvider = oController.Frame
oDispatch.executeDispatch(oProvider, ".uno:SlideSorterMultiPaneGUI","", 0, Array())
oSlideList = oDoc.getDrawPages()

REM loop through all slides and copy, paste, delete each one
For i = 0 to oDoc.getDrawPages().Count-1
  oSlide = oSlideList.getByIndex(i)
  oController = oDoc.CurrentController
  oDispatch = createUnoService( "com.sun.star.frame.DispatchHelper")
  oProvider = oController.Frame
  REM  replace this with something better
  oDispatch.executeDispatch(oProvider, ".uno:Copy","", 0, Array())
  oDispatch.executeDispatch(oProvider, ".uno:Paste", "", 0, Array())
  oDispatch.executeDispatch(oProvider, ".uno:Delete","", 0, Array())
Next i

REM return to the first slide
oFirstPage = oDoc.getDrawPages().getByIndex(0)
oDoc.CurrentController.setCurrentPage(oFirstPage)
msg = "refresh finished!"
msgbox msg
End Sub  

(Slightly edited for better readability by @Lupp )