1<?xml version="1.0" encoding="UTF-8"?>
2<script:module xmlns:script="http://openoffice.org/2000/script" script:name="toolkit_AccessibleStatusBarItem" 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::XAccessibleText"
34 ' needs the following Global variables:
35   Global accText as String
36   Global readOnly as Boolean
37
38
39Sub CreateObj()
40
41'*************************************************************************
42' COMPONENT:
43' com.sun.star.toolkit.AccessibleStatusBarItem
44'*************************************************************************
45On Error Goto ErrHndl
46
47    oDoc = utils.createDocument("swriter", cObjectName)
48
49    Dim xController As Object
50    xController = oDoc.getCurrentController()
51
52    Dim xRoot As Object
53    Dim oWin as Object
54    oWin = utils.at_getCurrentWindow(oDoc)
55    xRoot = utils.at_getAccessibleObject(oWin)
56    Dim oStatusBar as Object
57    oStatusBar = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.STATUS_BAR)
58    oObj = oStatusBar.getAccessibleChild(0)
59
60    readOnly = true
61    accText = oObj.getText()
62
63Exit Sub
64ErrHndl:
65    Test.Exception()
66End Sub
67
68Sub fireEvent()
69    Dim oText as Object
70    oText = oDoc.getText()
71
72    Dim oEnum as Object
73    Dim oParagraph as Object
74    oEnum = oText.createEnumeration() ' get all paragraphs
75    while oEnum.hasMoreElements()
76        oParagraph = oEnum.nextElement() ' get the last paragraph
77    wend
78    oParagraph.BreakType = com.sun.star.style.BreakType.PAGE_AFTER
79
80    Dim oCursor as Object
81    oCursor = oText.createTextCursor()
82    oCursor.gotoEnd(false) 'Goto to the end of document
83    oText.insertControlCharacter(oCursor, 0, false) ' insert a new paragraph
84    oCursor.setString("AccessibleStatusBarItem") ' insert text
85end Sub
86</script:module>
87