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