diff options
Diffstat (limited to 'odk/examples/DevelopersGuide/Drawing/PresentationDemo.java')
-rw-r--r-- | odk/examples/DevelopersGuide/Drawing/PresentationDemo.java | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java b/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java index 652d8b51a0e8..61e62d2cfadf 100644 --- a/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java @@ -99,8 +99,7 @@ public class PresentationDemo // set the slide transition for the first page xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 ); - xShapes = (XShapes) - UnoRuntime.queryInterface( XShapes.class, xPage ); + xShapes = UnoRuntime.queryInterface( XShapes.class, xPage ); // set slide transition effect setSlideTransition( xPage, com.sun.star.presentation.FadeEffect.FADE_FROM_RIGHT, @@ -124,8 +123,7 @@ public class PresentationDemo // set the slide transition for the second page xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 1 ); - xShapes = (XShapes) - UnoRuntime.queryInterface( XShapes.class, xPage ); + xShapes = UnoRuntime.queryInterface( XShapes.class, xPage ); setSlideTransition( xPage, com.sun.star.presentation.FadeEffect.FADE_FROM_RIGHT, com.sun.star.presentation.AnimationSpeed.SLOW, @@ -145,8 +143,7 @@ public class PresentationDemo // the second object lets the presentation jump to page two // by using a ClickAction.BOOKMARK; xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 2 ); - xShapes = (XShapes) - UnoRuntime.queryInterface( XShapes.class, xPage ); + xShapes = UnoRuntime.queryInterface( XShapes.class, xPage ); setSlideTransition( xPage, com.sun.star.presentation.FadeEffect.ROLL_FROM_LEFT, com.sun.star.presentation.AnimationSpeed.MEDIUM, @@ -157,8 +154,7 @@ public class PresentationDemo xShapes.add( xShape ); ShapeHelper.addPortion( xShape, "click to go", false ); ShapeHelper.addPortion( xShape, "to first page", true ); - xShapePropSet = (XPropertySet) - UnoRuntime.queryInterface( XPropertySet.class, xShape ); + xShapePropSet = UnoRuntime.queryInterface( XPropertySet.class, xShape ); xShapePropSet.setPropertyValue("Effect", com.sun.star.presentation.AnimationEffect.FADE_FROM_BOTTOM ); xShapePropSet.setPropertyValue( @@ -171,15 +167,14 @@ public class PresentationDemo xShapes.add( xShape ); ShapeHelper.addPortion( xShape, "click to go", false ); ShapeHelper.addPortion( xShape, "to the second page", true ); - xShapePropSet = (XPropertySet) - UnoRuntime.queryInterface( XPropertySet.class, xShape ); + xShapePropSet = UnoRuntime.queryInterface( XPropertySet.class, xShape ); xShapePropSet.setPropertyValue("Effect", com.sun.star.presentation.AnimationEffect.FADE_FROM_BOTTOM ); xShapePropSet.setPropertyValue( "OnClick", com.sun.star.presentation.ClickAction.BOOKMARK ); // set the name of page two, and use it with the bookmark action - XNamed xPageName = (XNamed)UnoRuntime.queryInterface( + XNamed xPageName = UnoRuntime.queryInterface( XNamed.class, PageHelper.getDrawPageByIndex( xDrawDoc, 1 ) ); xPageName.setName( "page two" ); xShapePropSet.setPropertyValue( @@ -189,11 +184,9 @@ public class PresentationDemo /* start an endless presentation which is displayed in full-screen mode and placed on top */ - XPresentationSupplier xPresSupplier = (XPresentationSupplier) - UnoRuntime.queryInterface( XPresentationSupplier.class, xDrawDoc ); + XPresentationSupplier xPresSupplier = UnoRuntime.queryInterface( XPresentationSupplier.class, xDrawDoc ); XPresentation xPresentation = xPresSupplier.getPresentation(); - XPropertySet xPresPropSet = (XPropertySet) - UnoRuntime.queryInterface( XPropertySet.class, xPresentation ); + XPropertySet xPresPropSet = UnoRuntime.queryInterface( XPropertySet.class, xPresentation ); xPresPropSet.setPropertyValue( "IsEndless", new Boolean( true ) ); xPresPropSet.setPropertyValue( "IsAlwaysOnTop", new Boolean( true ) ); xPresPropSet.setPropertyValue( "Pause", new Integer( 0 ) ); @@ -216,14 +209,13 @@ public class PresentationDemo // the following test is only sensible if you do not exactly know // what type of page xPage is, for this purpose it can been tested // if the com.sun.star.presentation.DrawPage service is supported - XServiceInfo xInfo = (XServiceInfo)UnoRuntime.queryInterface( + XServiceInfo xInfo = UnoRuntime.queryInterface( XServiceInfo.class, xPage ); if ( xInfo.supportsService( "com.sun.star.presentation.DrawPage" ) == true ) { try { - XPropertySet xPropSet = (XPropertySet) - UnoRuntime.queryInterface( XPropertySet.class, xPage ); + XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, xPage ); xPropSet.setPropertyValue( "Effect", eEffect ); xPropSet.setPropertyValue( "Speed", eSpeed ); xPropSet.setPropertyValue( "Change", new Integer( nChange ) ); |