LibreOffice Impress macro to read a slide's animation event duration and delay times

68 views Asked by At

I'm writing a basic macro in LibreOffice Impress which builds a custom slide show that will run for a specified length of time. The slide show consists of a set of auto-advancing slides. My problem is that if a slide includes animation e.g. a shape fade in, I can't find it's duration and delay times. Without these times I can't calculate how long the slide will be displayed for.

enter image description here

Using PropertySetInfo and getPropertyByName() method I've found the Effect property but there is no sign of Duration or Delay properties. Can somebody point me towards where they may be stored in the model?

1

There are 1 answers

0
Jim K On

Similar questions were asked here and here with no solution.

The MRI tool shows a property TextAnimationDelay for a shape that is documented as, "This is the delay in thousandths of a second between each of the animation steps." However, the value was 0. I also tried this, hoping to get the list of animations on a particular slide as shown at the top of the side panel, but it didn't have the expected number of elements:

oAnimationsEnum = oSlide.getAnimationNode().createEnumeration()

Instead of going through the API, you could unzip the .odp file and look for where the values are stored, similar to what is suggested here:

Find the relevant anim:par element. Set smil:begin="1s" on the relevant elements.

Once you figure out how to do it manually, write a script to do it automatically — unzip the file, then do the parsing. The basic idea requires only a few lines of Python code, although this particular task might require more code due to how the values in question are stored.

Since ultimately you need this information in a Basic macro, your script could print out a Basic language array of the values, which you could copy and paste into the macro code. The values would need to be generated again if the delays are changed.