Presentations


The Presentation service contains properties (see Table 21 ) and methods that control a specific presentation. You can create multiple presentation objects for different types of presentations. For example, you might have one presentation that runs continuously at a trade show and one that requires manual intervention-for example, for a client sales visit. The document's getPresentation() method returns a new presentation object. After setting a presentation's properties as shown in Table 21, the methods start() and end() are used to start and stop a presentation. The method rehearseTimings() starts a presentation while displaying a running clock to help you determine the running time of your presentation. See Listing 29 .

Listing 29: SimplePresentation is found in the Graphic module in this chapter's source code files as SC15.sxi.
start example
 Sub SimplePresentation()   Dim oPres   oPres = ThisComponent.getPresentation()   oPres.UsePen = True   REM This will start the presentation.   REM Be ready to press the space bar to move through the slides.   oPres.Start() End Sub 
end example
 
Table 21: Properties defined by the the com.sun. star.presentation. Presentation service.

Property

Description

AllowAnimations

If True, animations are enabled.

CustomShow

Name of a customized show to use for this presentation; an empty value is allowed.

FirstPage

Name of the first page in the presentation; an empty value is allowed.

IsAlwaysOnTop

If True, the presentation window is always the top window.

IsAutomatic

If True, page changes happen automatically.

IsEndless

If True, the presentation repeats endlessly.

IsFullScreen

If True, the presentation runs in full-screen mode.

IsLivePresentation

If True, the presentation runs in live mode.

IsMouseVisible

If True, the mouse is visible during the presentation.

Pause

Long Integer duration that the black screen is displayed after the presentation is finished.

StartWithNavigator

If True, the Navigator opens at the start of the presentation.

UsePen

If True, a pen appears during the presentation so that you can draw on the screen.

A custom presentation can show the presentation's pages in any order. Pages can be shown multiple times or not at all. The getCustomPresentations() method returns a custom presentations object that contains all custom presentations (see Table 22 ).

Table 22: Some methods supported by the XCustomPresentationSupplier interface.

Method

Description

createInstance()

Create a custom presentation.

getByName(String)

Get a custom presentation by name.

getElementNames()

Array of custom presentation names .

hasByName(String)

Return True if the custom presentation with the specified name exists.

hasElements()

Return True if the page contains at least one custom presentation.

insertByName(String, Custom Presentation)

Insert a custom presentation by name.

removeByName(String)

Remove the named custom presentation.

replaceByName(String, CustomPresentation)

Replace a custom presentation by name.

A custom presentation (shown in Listing 30 ) is a container for draw pages that supports the XNamed and XIndexedAccess interfaces. Create the custom presentation, add the draw pages in the order that you want them to appear, and then save the custom presentation. A custom presentation is displayed in exactly the same way that regular presentations are displayed, using a Presentation object, but the CustomShow attribute is set to reference the custom presentation.

Listing 30: CustomPresentation is found in the Graphic module in this chapter's source code files as SC15.sxi.
start example
 Sub CustomPresentation()   Dim oPres   'Presentations, both customer and regular   Dim oPages  'Draw pages   oPres  = ThisComponent.getCustomPresentations().createInstance()   If NOT ThisComponent.getCustomPresentations().hasByName("custom") Then     oPages = ThisComponent.getDrawPages()     REM Display pages 0, 2, 1, 0     oPres.insertByIndex(0, oPages.getByIndex(0))     oPres.insertByIndex(1, oPages.getByIndex(2))     oPres.insertByIndex(2, oPages.getByIndex(1))     oPres.insertByIndex(3, oPages.getByIndex(0))     ThisComponent.getCustomPresentations().insertByName("custom", oPres)   End If   REM Now, run the customer presentation.   oPres = ThisComponent.getPresentation()   oPres.CustomShow = "custom"   oPres.Start() End Sub 
end example
 

Presentation Draw Pages

Draw pages in a presentation document are slightly different from those in a drawing document. The properties in Table 23 dictate how and when page transitions occur while showing presentations.

Table 23: Properties defined by the com.sun.star.presentation.DrawPage service.

Property

Description

Change

Long Integer that specifies what causes a page change.

  • 0 - A mouse-click triggers the next animation or page change.

  • 1 - The page change is automatic.

  • 2 - Object effects run automatically, but the user must click on the page to change it.

Duration

Long Integer time in seconds the page is shown if the Change property is set to 1.

Effect

Effect used to fade in or out (see Table 24).

Layout

Index of the presentation layout page if this is not zero.

Speed

Speed of the fade-in effect using the com.sun.star.presentation.AnimationSpeed enumeration: SLOW, MEDIUM, or FAST.

Table 24: Values defined by the com.sun.star.presentation.FadeEffect enumeration.

Values

Values

Values

NONE

DISSOLVE

RANDOM

VERTICAL_STRIPES

VERTICAL_CHECKERBOARD

VERTICAL_LINES

HORIZONTAL_STRIPES

HORIZONTAL_CHECKERBOARD

HORIZONTAL_LINES

FADE_FROM_LEFT

FADE_FROM_TOP

FADE_FROM_RIGHT

FADE_FROM_BOTTOM

FADE_FROM_UPPERLEFT

FADE_FROM_UPPERRIGHT

FADE_FROM_LOWERLEFT

FADE_FROM_LOWERRIGHT

MOVE_FROM_LEFT

MOVE_FROM_TOP

MOVE_FROM_RIGHT

MOVE_FROM_BOTTOM

MOVE_FROM_UPPERLEFT

MOVE_FROM_UPPERRIGHT

MOVE_FROM_LOWERRIGHT

MOVE_FROM_LOWERLEFT

UNCOVER_TO_LEFT

UNCOVER_TO_UPPERLEFT

UNCOVER_TO_TOP

UNCOVER_TO_UPPERRIGHT

UNCOVER_TO_RIGHT

UNCOVER_TO_LOWERRIGHT

UNCOVER_TO_BOTTOM

UNCOVER_TO_LOWERLEFT

FADE_TO_CENTER

FADE_FROM_CENTER

CLOCKWISE

COUNTER_CLOCKWISE

ROLL_FROM_LEFT

ROLL_FROM_TOP

ROLL_FROM_RIGHT

ROLL_FROM_BOTTOM

CLOSE_VERTICAL

CLOSE_HORIZONTAL

OPEN_VERTICAL

OPEN_HORIZONTAL

STRETCH_FROM_LEFT

STRETCH_FROM_TOP

STRETCH_FROM_RIGHT

STRETCH_FROM_BOTTOM

WAVYLINE_FROM_LEFT

WAVYLINE_FROM_TOP

WAVYLINE_FROM_RIGHT

WAVYLINE_FROM_BOTTOM

SPIRALIN_LEFT

SPIRALIN_RIGHT

SPIRALOUT_LEFT

SPIRALOUT_RIGHT

Page transitions are governed by the Effect property of the presentation draw page (see Table 24 ). The macro in Listing 31 sets the transitions on all draw pages to RANDOM.

Listing 31: SetTransitionEffects is found in the Graphic module in this chapter's source code files as SC15.sxi.
start example
 Sub SetTransitionEffects()   Dim oPages  'Draw pages   Dim i%   oPages = ThisComponent.getDrawPages()   For i = 0 To oPages.getCount() - 1     With oPages.getByIndex(i)       .Effect = com.sun.star.presentation.FadeEffect.RANDOM       .Change = 1       .Duration = 2       .Speed = com.sun.star.presentation.AnimationSpeed.FAST     End With   Next End Sub 
end example
 

Presentation Shapes

Shapes contained in Impress documents differ from shapes in Draw documents in that they support the com.sun.star.presentation.Shape service. The presentation Shape service provides properties that define special behavior to enhance presentations (see Table 25 ).

Table 25: Properties defined by the com.sun.star.presentation.Shape service.

Property

Description

Bookmark

Generic URL string used if the OnClick property requires a URL.

DimColor

Color for dimming this shape if DimPrevious is True and DimHide is False.

DimHide

If True and DimPrevious is True, the shape is hidden.

DimPrevious

If True, the shape is dimmed after executing its animation effect.

Effect

Animation effect for this shape (see Table 26).

IsEmptyPresentationObject

True if this is the default presentation shape and it is empty.

IsPresentationObject

True if this is a presentation object.

OnClick

Specify an action if the user clicks the shape (see Table 27).

PlayFull

If True, the sound of this shape is played in full.

PresentationOrder

Long Integer representing the order in which the shapes are animated.

Sound

URL string for a sound file that is played while the shape's animation is running.

SoundOn

If True, sound is played during the animation.

Speed

Speed of the fade-in effect using the com.sun.star.presentation.AnimationSpeed enumeration: SLOW, MEDIUM, or FAST.

TextEffect

Animation effect for the text inside this shape (see Table 26).

Verb

Long Integer "ole2" verb if the ClickAction is VERB.

Table 26: Values defined by the com.sun.star.presentation.AnimationEffect enumeration.

Property

Property

Property

NONE

RANDOM

PATH

DISSOLVE

APPEAR

HIDE

CLOCKWISE

COUNTERCLOCKWISE

MOVE_FROM_LEFT

MOVE_FROM_TOP

MOVE_FROM_RIGHT

MOVE_FROM_BOTTOM

MOVE_FROM_UPPERLEFT

MOVE_FROM_UPPERRIGHT

MOVE_FROM_LOWERRIGHT

MOVE_FROM_LOWERLEFT

MOVE_TO_LEFT

MOVE_TO_TOP

MOVE_TO_RIGHT

MOVE_TO_BOTTOM

MOVE_TO_UPPERLEFT

MOVE_TO_UPPERRIGHT

MOVE_TO_LOWERRIGHT

MOVE_TO_LOWERLEFT

MOVE_SHORT_TO_LEFT

MOVE_SHORT_TO_TOP

MOVE_SHORT_TO_RIGHT

MOVE_SHORT_TO_BOTTOM

MOVE_SHORT_TO_UPPERLEFT

MOVE_SHORT_TO_UPPERRIGHT

MOVE_SHORT_TO_LOWERRIGHT

MOVE_SHORT_TO_LOWERLEFT

MOVE_SHORT_FROM_LEFT

MOVE_SHORT_FROM_TOP

MOVE_SHORT_FROM_RIGHT

MOVE_SHORT_FROM_BOTTOM

MOVE_SHORT_FROM_UPPERLEFT

MOVE_SHORT_FROM_LOWERRIGHT

MOVE_SHORT_FROM_LOWERLEFT

LASER_FROM_LEFT

LASER_FROM_TOP

LASER_FROM_RIGHT

LASER_FROM_BOTTOM

LASER_FROM_UPPERLEFT

LASER_FROM_UPPERRIGHT

LASER_FROM_LOWERLEFT

LASER_FROM_LOWERRIGHT

STRETCH_FROM_LEFT

STRETCH_FROM_UPPERLEFT

STRETCH_FROM_TOP

STRETCH_FROM_UPPERRIGHT

STRETCH_FROM_RIGHT

STRETCH_FROM_LOWERRIGHT

STRETCH_FROM_BOTTOM

STRETCH_FROM_LOWERLEFT

ZOOM_IN_FROM_LEFT

ZOOM_IN_FROM_TOP

ZOOM_IN_FROM_RIGHT

ZOOM_IN_FROM_BOTTOM

ZOOM_IN_FROM_CENTER

ZOOM_IN_FROM_UPPERLEFT

ZOOM_IN_FROM_UPPERRIGHT

ZOOM_IN_FROM_LOWERRIGHT

ZOOM_IN_FROM_LOWERLEFT

ZOOM_OUT_FROM_LEFT

ZOOM_OUT_FROM_TOP

ZOOM_OUT_FROM_RIGHT

ZOOM_OUT_FROM_BOTTOM

ZOOM_OUT_FROM_CENTER

ZOOM_OUT_FROM_UPPERLEFT

ZOOM_OUT_FROM_UPPERRIGHT

ZOOM_OUT_FROM_LOWERRIGHT

ZOOM_OUT_FROM_LOWERLEFT

FADE_FROM_LEFT

FADE_FROM_TOP

FADE_FROM_RIGHT

FADE_FROM_BOTTOM

FADE_FROM_CENTER

FADE_FROM_UPPERLEFT

FADE_FROM_UPPERRIGHT

FADE_FROM_LOWERLEFT

FADE_FROM_LOWERRIGHT

FADE_TO_CENTER

ZOOM_IN

ZOOM_IN_SMALL

ZOOM_IN_SPIRAL

ZOOM_OUT

ZOOM_OUT_SMALL

ZOOM_OUT_SPIRAL

VERTICAL_CHECKERBOARD

HORIZONTAL_CHECKERBOARD

HORIZONTAL_ROTATE

VERTICAL_ROTATE

HORIZONTAL_STRETCH

VERTICAL_STRETCH

VERTICAL_STRIPES

HORIZONTAL_STRIPES

VERTICAL_LINES

HORIZONTAL_LINES

WAVYLINE_FROM_LEFT

WAVYLINE_FROM_TOP

WAVYLINE_FROM_RIGHT

WAVYLINE_FROM_BOTTOM

SPIRALIN_LEFT

SPIRALIN_RIGHT

SPIRALOUT_LEFT

SPIRALOUT_RIGHT

CLOSE_VERTICAL

CLOSE_HORIZONTAL

OPEN_VERTICAL

OPEN_HORIZONTAL

Table 27: Values defined by the com.sun.star.presentation.ClickAction enumeration.

Property

Description

NONE

No action is performed.

PREVPAGE

Jump to the previous page.

NEXTPAGE

Jump to the next page.

FIRSTPAGE

Jump to the first page.

LASTPAGE

Jump to the last page.

BOOKMARK

Jump to a bookmark specified by the Bookmark property in Table 25.

DOCUMENT

Jump to another document specified by the Bookmark property in Table 25.

INVISIBLE

The object becomes invisible.

SOUND

Play a sound specified by the Bookmark property in Table 25.

VERB

An OLE verb is performed as specified by the Verb property in Table 25. An OLE object supports actions called verbs. An OLE object that displays a video clip might support the verb "play," for example.

VANISH

The object vanishes.

PROGRAM

Execute another program specified by the Bookmark property in Table 25.

MACRO

Execute a Star Basic macro specified by the Bookmark property in Table 25.

STOPPRESENTATION

Stop the presentation.

The animation effects supported by shapes (see Table 26 ) are similar to, but more plentiful than, the animation effects supported by draw pages (see Table 21).

Shapes contained in presentation documents support special actions (see Table 27 ) by setting the shape's OnClick property (see Table 25).




OpenOffice.org Macros Explained
OpenOffice.org Macros Explained
ISBN: 1930919514
EAN: 2147483647
Year: 2004
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net