OO-Snippets: Alter Zoom

Commons

Keywordszoom, page zoom
LanguageooRexx
ApplicationWriter
AuthorsMatthias Prem (initial)
Supported Versions2.0.x  
Supported OSAll  
QuestionHow can I alter the zoom of a current page?
Answer

Code-Snippet-Listing (snippet-source)

/* AlterZoom.rex */
/* Macro */

/* get the script context and the desktop */
xScriptContext=uno.getScriptContext()
xDesktop=xScriptContext~getDesktop

/* get current component (Writer) and its xViewSettings */
xComponent = xDesktop~getCurrentComponent()
xModel = xComponent~xModel
xController = xModel~getCurrentController()
xSelectionSupplier = xController~XSelectionSupplier
xViewSettingsSupplier = xSelectionSupplier~XViewSettingsSupplier
xViewSettings=xViewSettingsSupplier~ViewSettings
xViewProperties = xViewSettings~XPropertySet

/* show different zooms with a 1 sec pause */
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("com.sun.star.view.DocumentZoomType", "PAGE_WIDTH")))
call syssleep 1
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("com.sun.star.view.DocumentZoomType", "ENTIRE_PAGE")))
call syssleep 1
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("com.sun.star.view.DocumentZoomType", "PAGE_WIDTH_EXACT")))
call syssleep 1
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("com.sun.star.view.DocumentZoomType", "BY_VALUE")))
xViewProperties~setPropertyValue("ZoomValue", box("Short", 200))
call syssleep 1
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("com.sun.star.view.DocumentZoomType", "BY_VALUE")))
xViewProperties~setPropertyValue("ZoomValue", box("Short", 10))
call syssleep 1
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("com.sun.star.view.DocumentZoomType", "OPTIMAL")))

::requires UNO.CLS

Changelog

DateUserModification
2006-07-09matthiaspremInitial version

and