1<?xml version="1.0" encoding="UTF-8"?> 2<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sc_AccessibleEditableTextPara_PreviewCell" script:language="StarBasic"> 3 4'************************************************************************* 5' 6' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7' 8' Copyright 2000, 2010 Oracle and/or its affiliates. 9' 10' OpenOffice.org - a multi-platform office productivity suite 11' 12' This file is part of OpenOffice.org. 13' 14' OpenOffice.org is free software: you can redistribute it and/or modify 15' it under the terms of the GNU Lesser General Public License version 3 16' only, as published by the Free Software Foundation. 17' 18' OpenOffice.org is distributed in the hope that it will be useful, 19' but WITHOUT ANY WARRANTY; without even the implied warranty of 20' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21' GNU Lesser General Public License version 3 for more details 22' (a copy is included in the LICENSE file that accompanied this code). 23' 24' You should have received a copy of the GNU Lesser General Public License 25' version 3 along with OpenOffice.org. If not, see 26' <http://www.openoffice.org/license.html> 27' for a copy of the LGPLv3 License. 28' 29'************************************************************************* 30***** 31'************************************************************************* 32 33' Be sure that all variables are dimensioned: 34option explicit 35 36 37' REQUIRED VARIABLES for interface/service tests: 38 39' "com::sun::star::accessibility::XAccessibleEventBroadcaster" 40 ' needs the following Global variables: 41 42' "com::sun::star::accessibility::XAccessibleEditableText#optional" 43 ' needs the following Global variables: 44 ' global hasChangeableAttrs as boolean 45 46' "com::sun::star::accessibility::XAccessibleSelection#optional" 47 ' needs the following Global variables: 48 ' Global multiSelection As Boolean 49 50' "com::sun::star::accessibility::XAccessibleText" 51 ' needs the following Global variables: 52Global accText as String 53Global readOnly as Boolean 54 55Sub CreateObj() 56 57'************************************************************************* 58' COMPONENT: 59' com.sun.star.sc.AccessibleEditableTextPara_PreviewCell 60'************************************************************************* 61On Error Goto ErrHndl 62 Dim xRoot As Object, xDispatcher As Object 63 Dim xController As Object, xCell As Object 64 Dim url As New com.sun.star.util.URL 65 Dim urlTransformer As Object, oWin As Object 66 Dim noProps() 67 68 accText = "ScAccessibleEditableTextPara_PreviewCell" 69 oDoc = utils.createDocument("scalc",cObjectName) 70 xCell = oDoc.getSheets().getByIndex(0).getCellByPosition(0,0) 71 xCell.setFormula(accText) 72 73 xController = oDoc.getCurrentController() 74 urlTransformer = createUNOService("com.sun.star.util.URLTransformer") 75 url.Complete = ".uno:PrintPreview" 76 urlTransformer.parseStrict(url) 77 xDispatcher = xController.queryDispatch(url,"",0) 78 if (NOT isNull(xDispatcher)) then 79 xDispatcher.dispatch(url, noProps()) 80 wait(500) 81 oWin = utils.at_getCurrentWindow(oDoc) 82 xRoot = utils.at_getAccessibleObject(oWin) 83 ' get the first cell 84 xRoot = utils.at_getAccessibleObjectForRole(xRoot, _ 85 com.sun.star.accessibility.AccessibleRole.TABLE_CELL,"Cell A1") 86 ' the the Paragraph 87 oObj = utils.at_getAccessibleObjectForRole(xRoot, _ 88 com.sun.star.accessibility.AccessibleRole.PARAGRAPH,"Paragraph 0") 89 utils.at_printAccessibleTree(xRoot) 90 readOnly = true 91 else 92 Out.Log("QueryDispatch FAILED. Cannot switch to Preview mode...") 93 Exit Sub 94 End If 95 96Exit Sub 97ErrHndl: 98 Test.Exception() 99End Sub 100Sub fireEvent() 101 Dim dispatcher as Object 102 dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") 103 104 rem ---------------------------------------------------------------------- 105 dispatcher.executeDispatch(oDoc.CurrentController.Frame, ".uno:ZoomIn", "", 0, Array()) 106 wait(500) 107 rem ---------------------------------------------------------------------- 108 dispatcher.executeDispatch(oDoc.CurrentController.Frame, ".uno:ZoomOut", "", 0, Array()) 109end Sub 110</script:module> 111