1<?xml version="1.0" encoding="UTF-8"?> 2<script:module xmlns:script="http://openoffice.org/2000/script" script:name="AccessibleEditableTextPara" 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::XAccessibleEditableText#optional" 40 ' needs the following object relation: 41 global hasChangeableAttrs as boolean 42 43' "com::sun::star::accessibility::XAccessibleSelection#optional" 44 ' needs the following object relation: 45' Global multiSelection As Boolean 46 47' "com::sun::star::accessibility::XAccessibleText" 48 ' needs the following object relation: 49 Global accText as String 50 Global readOnly as Boolean 51 52 53Sub CreateObj() 54 55'************************************************************************* 56' COMPONENT: 57' com.sun.star.AccessibleEditableTextPara 58'************************************************************************* 59On Error Goto ErrHndl 60 61 oDoc = utils.createDocument("sdraw", cObjectName) 62 63 Dim oShape As Object 64 oShape = oDoc.createInstance("com.sun.star.drawing.TextShape") 65 66 oDoc.DrawPages(0).add(oShape) 67 68 Dim oSize As new com.sun.star.awt.Size 69 Dim oPos As new com.sun.star.awt.Point 70 oSize.Width = 7500 71 oSize.Height = 5000 72 oPos.X = 5000 73 oPos.Y = 3500 74 oShape.Size = oSize 75 oShape.Position = oPos 76 77 Dim cursor As Object 78 cursor = oShape.createTextCursor() 79 80 oShape.insertString(cursor, "Paragraph 1", false) 81 oShape.insertControlCharacter(cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false) 82 83 Dim oWin as Object 84 Dim xRoot as Object 85 86 oWin = utils.at_getCurrentWindow(oDoc) 87 xRoot = utils.at_getAccessibleObject(oWin) 88 oObj = utils.at_getAccessibleObjectForRole(xRoot, _ 89 com.sun.star.accessibility.AccessibleRole.PARAGRAPH,"Paragraph 0") 90 Out.Log("Implementation Name: "+oObj.getImplementationName()) 91 accText = "My AccessibleEditableTextPara text" 92 oObj.setText(accText) 93 readOnly = false 94 hasChangeableAttrs = false 95 96Exit Sub 97ErrHndl: 98 Test.Exception() 99End Sub 100 101Sub fireEvent() 102 Dim myText as String 103 myText = oObj.getText() 104 oObj.setText(myText + "dummy") 105 wait(1000) 106 oObj.setText(myText) 107 wait(1000) 108End Sub 109</script:module> 110