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'  Licensed to the Apache Software Foundation (ASF) under one
7'  or more contributor license agreements.  See the NOTICE file
8'  distributed with this work for additional information
9'  regarding copyright ownership.  The ASF licenses this file
10'  to you under the Apache License, Version 2.0 (the
11'  "License"); you may not use this file except in compliance
12'  with the License.  You may obtain a copy of the License at
13'
14'    http://www.apache.org/licenses/LICENSE-2.0
15'
16'  Unless required by applicable law or agreed to in writing,
17'  software distributed under the License is distributed on an
18'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19'  KIND, either express or implied.  See the License for the
20'  specific language governing permissions and limitations
21'  under the License.
22'
23'*************************************************************************
24
25
26
27' Be sure that all variables are dimensioned:
28option explicit
29
30
31' REQUIRED VARIABLES for interface/service tests:
32
33' "com::sun::star::accessibility::XAccessibleEditableText#optional"
34 ' needs the following object relation:
35	global hasChangeableAttrs as boolean
36
37' "com::sun::star::accessibility::XAccessibleSelection#optional"
38 ' needs the following object relation:
39'	Global multiSelection As Boolean
40
41' "com::sun::star::accessibility::XAccessibleText"
42 ' needs the following object relation:
43   Global accText as String
44   Global readOnly as Boolean
45
46
47Sub CreateObj()
48
49'*************************************************************************
50' COMPONENT:
51' com.sun.star.AccessibleEditableTextPara
52'*************************************************************************
53On Error Goto ErrHndl
54
55    oDoc = utils.createDocument("sdraw", cObjectName)
56
57    Dim oShape As Object
58    oShape = oDoc.createInstance("com.sun.star.drawing.TextShape")
59
60    oDoc.DrawPages(0).add(oShape)
61
62    Dim oSize As new com.sun.star.awt.Size
63    Dim oPos As new com.sun.star.awt.Point
64    oSize.Width = 7500
65    oSize.Height = 5000
66    oPos.X = 5000
67    oPos.Y = 3500
68    oShape.Size = oSize
69    oShape.Position = oPos
70
71    Dim cursor As Object
72    cursor = oShape.createTextCursor()
73
74    oShape.insertString(cursor, "Paragraph 1", false)
75    oShape.insertControlCharacter(cursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false)
76
77    Dim oWin as Object
78    Dim xRoot as Object
79
80    oWin = utils.at_getCurrentWindow(oDoc)
81    xRoot = utils.at_getAccessibleObject(oWin)
82    oObj = utils.at_getAccessibleObjectForRole(xRoot, _
83             com.sun.star.accessibility.AccessibleRole.PARAGRAPH,"Paragraph 0")
84    Out.Log("Implementation Name: "+oObj.getImplementationName())
85    accText = "My AccessibleEditableTextPara text"
86    oObj.setText(accText)
87    readOnly = false
88    hasChangeableAttrs = false
89
90Exit Sub
91ErrHndl:
92    Test.Exception()
93End Sub
94
95Sub fireEvent()
96    Dim myText as String
97    myText = oObj.getText()
98    oObj.setText(myText + "dummy")
99    wait(1000)
100    oObj.setText(myText)
101    wait(1000)
102End Sub
103</script:module>
104