I'd like to write a application that opens a PowerPoint presentation and plays it to the end, all without user intervention. I've written a Java program (based on the PresentationDemo sample - see below) that:

Opens the presentation
For each page, sets the Change = 1 and Duration = 5
Sets IsAutomatic = False in the Presentation property set. Together with above displays each page for 5 seconds then moves on.
Starts the presentation.

However, this will stop as soon as the first animated shape is encounter and waits for user input before animating and proceeding (which is unacceptable for my application since there will be no user input). Explicitly disabling the Animations Allowed property (both in the UI and from code) doesn't appear to do anything - the presentation still waits for user click before proceeding. Have I misunderstood what this feature will do?

One possible solution is to set Custom Animation ~ Effect ~ Start = "After Previous" and set the Effect Options ~ Timing ~ Delay = "a few seconds", applying these settings to each relevant animated shape. Unfortunately, I can't find a way of doing this through the API. Is this method supported through the Java / C++ API?
Are there any other suggestions to accomplish hands off playing?

I'm currently using Java for prototyping, and will rewrite in C++ once complete. Running version 2.0.2 under FedoraCore4.

Thanks,

Andy


public class PresentationDemo
{
   public static void main( String args[] )
   {
       try
       {
           // Startup the loader
XComponentContext xOfficeContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); XMultiComponentFactory xServiceManager = xOfficeContext.getServiceManager(); Object oDesktop = xServiceManager.createInstanceWithContext( "com.sun.star.frame.Desktop", xOfficeContext ); XComponentLoader xCompLoader =(XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, oDesktop);

           // Open the document
           String  file_url = "/home/mine/OO_Test2/SimplePresentation.odp";
XComponent xComponent = xCompLoader.loadComponentFromURL( file_url, "_blank", 0, new com.sun.star.beans.PropertyValue[0] );

           int slide_show_duration = 2;
// Loop through each page and set the duration XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier)UnoRuntime.queryInterface( XDrawPagesSupplier.class, xComponent );
           XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
           int i;
           for ( i = 0; i < xDrawPages.getCount(); i++ )
{ System.out.println( "Page:" + i ); XDrawPage xDrawPage = (XDrawPage)UnoRuntime.queryInterface( XDrawPage.class, xDrawPages.getByIndex( i )); XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xDrawPage);

               xPropSet.setPropertyValue( "Change", new Integer( 1 ) );
xPropSet.setPropertyValue( "Duration", new Integer( slide_show_duration ) ); // Walk the animations object tree and set onClick to after previous // get the shape container for page one XShapes xShapes = (XShapes)UnoRuntime.queryInterface( XShapes.class, xDrawPage );

               int shape_index = 0;
for( shape_index = 0; shape_index < xShapes.getCount(); shape_index++ )
               {
XShape xShape = (XShape)UnoRuntime.queryInterface( XShape.class, xShapes.getByIndex( shape_index ) );

XPropertySet xShapePropSet = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xShape ); //String handler = AnyConverter.toString( xShapePropSet.getPropertyValue( "OnClick") ); //Object handler = xShapePropSet.getPropertyValue( "OnClick"); ClickAction action = (ClickAction) xShapePropSet.getPropertyValue( "OnClick" ); String bookmark = (String)xShapePropSet.getPropertyValue( "Bookmark"); AnimationEffect effect = (AnimationEffect)xShapePropSet.getPropertyValue( "Effect" ); // -1 means no order. 0 + (doc state 1 - are they incorrect?) means animated. -1 means none int presentationOrder = ((Integer)xShapePropSet.getPropertyValue( "PresentationOrder" )).intValue(); short delay = ((Short)xShapePropSet.getPropertyValue( "TextAnimationDelay" )).shortValue(); AnimationSpeed speed = (AnimationSpeed)xShapePropSet.getPropertyValue( "Speed" ); System.out.println(
                           "\tShape:" + shape_index +
                           " Action:" + action.getValue() +
                           " Effect:" + effect.getValue() +
                           " POrder:" + presentationOrder +
                           " Delay:" + delay +
                           " Speed:" + speed.getValue()
                           );

               }
           }
// start an endless presentation which is displayed in full-screen mode and placed on top XPresentationSupplier xPresSupplier = (XPresentationSupplier)UnoRuntime.queryInterface( XPresentationSupplier.class, xComponent );
           XPresentation xPresentation = xPresSupplier.getPresentation();

           // Start Presentation
XPropertySet xPresPropSet = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xPresentation ); xPresPropSet.setPropertyValue( "IsEndless", new Boolean( true ) ); xPresPropSet.setPropertyValue( "IsAlwaysOnTop", new Boolean( true ) ); //xPresPropSet.setPropertyValue( "AllowAnimations", new Boolean( true ) ); xPresPropSet.setPropertyValue( "AllowAnimations", new Boolean( false ) ); xPresPropSet.setPropertyValue( "IsAutomatic", new Boolean( false ) ); // Automatic slide transition! xPresPropSet.setPropertyValue( "IsMouseVisible", new Boolean( false ) ); xPresentation.start(); } catch( Exception ex )
       {
           System.out.println( ex );
       }
       System.exit( 0 );
   }





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to