zoom
page zoom
Matthias Prem
How can I alter the zoom of a current page?
/* 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~{%see com.sun.star.frame.XModel%xModel}
xController = xModel~getCurrentController()
xSelectionSupplier = xController~{%see com.sun.star.view.XSelectionSupplier%XSelectionSupplier}
xViewSettingsSupplier = xSelectionSupplier~{%see com.sun.star.view.XViewSettingsSupplier%XViewSettingsSupplier}
xViewSettings=xViewSettingsSupplier~ViewSettings
xViewProperties = xViewSettings~{%see com.sun.star.beans.XPropertySet%XPropertySet}
/* show different zooms with a 1 sec pause */
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("{%see com.sun.star.view.DocumentZoomType}", "PAGE_WIDTH")))
call syssleep 1
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("{%see com.sun.star.view.DocumentZoomType}", "ENTIRE_PAGE")))
call syssleep 1
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("{%see com.sun.star.view.DocumentZoomType}", "PAGE_WIDTH_EXACT")))
call syssleep 1
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("{%see com.sun.star.view.DocumentZoomType}", "BY_VALUE")))
xViewProperties~setPropertyValue("ZoomValue", box("Short", 200))
call syssleep 1
xViewProperties~setPropertyValue("ZoomType", box("Short", bsf.getConstant("{%see 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
Initial version