Frank Schönheit - Sun Microsystems Germany wrote:

> Hi Laurent,
> 
>>>how to switch Design Mode on/off via macro in Calc?
>> 
>> did you try
>> thisComponent.ApplyFormDesignMode = true|false
> 
> This changes the initial form design mode, which is used when opening
> the document.
> 
> For switching the current design mode, you need to dispatch the URL
> .uno:SwitchControlDesignMode to the document's frame. I don't have a
> code snippet at hand for this currently, anybody else?

Switching off the design mode with the dispatch API is done in the
following way: (quote signs to avoid line breaks)

> sub designmodeoff
>
>   document   = ThisComponent.CurrentController.Frame
>   dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
>   dim args(0) as new com.sun.star.beans.PropertyValue
>   args(0).Name = "SwitchControlDesignMode"
>   args(0).Value = false
>   dispatcher.executeDispatch(document, ".uno:SwitchControlDesignMode", "", 0, 
> args1())
> 
> end sub

For switching it on you must change one line:

>    args(0).Value = true

If you want to toggle the design mode you execute the command without
any parameters:

>   dim emptyargs()
>   dispatcher.executeDispatch(document, ".uno:SwitchControlDesignMode", "", 0, 
> emptyargs())

The rest as above.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

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

Reply via email to