Does anyone know if there are any issues using static variables with OpenOffice macros?

The following macro does not work, but should (at least, in VBA it would). COUNT is never remembered; it's always zero.

The purpose of this macro is to allow a user to hit a hotkey and cycle the display through all of the standard zoom factors.

sub ViewZoomCycle
        rem 
----------------------------------------------------------------------
        rem define variables
        static count   as integer
        dim document   as object
        dim dispatcher as object
        rem 
----------------------------------------------------------------------
        rem get access to the document
        count      = count + 1
        document   = ThisComponent.CurrentController.Frame
        dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
        rem 
----------------------------------------------------------------------
        dim args1(2) as new com.sun.star.beans.PropertyValue
        args1(0).Name = "Zoom.Value"
        args1(1).Name = "Zoom.ValueSet"
        args1(1).Value = 28703
        args1(2).Name = "Zoom.Type"
        select case count
                case 1
                        args1(0).Value = 0
                        args1(2).Value = 2
                case 2
                        args1(0).Value = 0
                        args1(2).Value = 3
                case 3
                        args1(0).Value = 0
                        args1(2).Value = 1
                case 4
                        args1(0).Value = 200
                        args1(2).Value = 0
                case 5                  
                        args1(0).Value = 150
                        args1(2).Value = 0
                case 6
                        args1(0).Value = 100
                        args1(2).Value = 0
                case 7          
                        args1(0).Value = 75
                        args1(2).Value = 0                      
                case 8
                        args1(0).Value = 50
                        args1(2).Value = 0
                case else
                        count = 0
        end select
        if count then
                dispatcher.executeDispatch(document, ".uno:Zoom", "", 0, 
args1())
        end if
end sub

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

Reply via email to