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