1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2cdf0e10cSrcweir<script:module xmlns:script="http://openoffice.org/2000/script" script:name="toolkit_AccessibleStatusBarItem" script:language="StarBasic"> 3cdf0e10cSrcweir 4cdf0e10cSrcweir'************************************************************************* 5cdf0e10cSrcweir' 6*1cbee2cdSAndrew Rist' Licensed to the Apache Software Foundation (ASF) under one 7*1cbee2cdSAndrew Rist' or more contributor license agreements. See the NOTICE file 8*1cbee2cdSAndrew Rist' distributed with this work for additional information 9*1cbee2cdSAndrew Rist' regarding copyright ownership. The ASF licenses this file 10*1cbee2cdSAndrew Rist' to you under the Apache License, Version 2.0 (the 11*1cbee2cdSAndrew Rist' "License"); you may not use this file except in compliance 12*1cbee2cdSAndrew Rist' with the License. You may obtain a copy of the License at 13*1cbee2cdSAndrew Rist' 14*1cbee2cdSAndrew Rist' http://www.apache.org/licenses/LICENSE-2.0 15*1cbee2cdSAndrew Rist' 16*1cbee2cdSAndrew Rist' Unless required by applicable law or agreed to in writing, 17*1cbee2cdSAndrew Rist' software distributed under the License is distributed on an 18*1cbee2cdSAndrew Rist' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 19*1cbee2cdSAndrew Rist' KIND, either express or implied. See the License for the 20*1cbee2cdSAndrew Rist' specific language governing permissions and limitations 21*1cbee2cdSAndrew Rist' under the License. 22cdf0e10cSrcweir' 23cdf0e10cSrcweir'************************************************************************* 24cdf0e10cSrcweir 25*1cbee2cdSAndrew Rist 26*1cbee2cdSAndrew Rist 27cdf0e10cSrcweir' Be sure that all variables are dimensioned: 28cdf0e10cSrcweiroption explicit 29cdf0e10cSrcweir 30cdf0e10cSrcweir 31cdf0e10cSrcweir' REQUIRED VARIABLES for interface/service tests: 32cdf0e10cSrcweir 33cdf0e10cSrcweir' "com::sun::star::accessibility::XAccessibleText" 34cdf0e10cSrcweir ' needs the following Global variables: 35cdf0e10cSrcweir Global accText as String 36cdf0e10cSrcweir Global readOnly as Boolean 37cdf0e10cSrcweir 38cdf0e10cSrcweir 39cdf0e10cSrcweirSub CreateObj() 40cdf0e10cSrcweir 41cdf0e10cSrcweir'************************************************************************* 42cdf0e10cSrcweir' COMPONENT: 43cdf0e10cSrcweir' com.sun.star.toolkit.AccessibleStatusBarItem 44cdf0e10cSrcweir'************************************************************************* 45cdf0e10cSrcweirOn Error Goto ErrHndl 46cdf0e10cSrcweir 47cdf0e10cSrcweir oDoc = utils.createDocument("swriter", cObjectName) 48cdf0e10cSrcweir 49cdf0e10cSrcweir Dim xController As Object 50cdf0e10cSrcweir xController = oDoc.getCurrentController() 51cdf0e10cSrcweir 52cdf0e10cSrcweir Dim xRoot As Object 53cdf0e10cSrcweir Dim oWin as Object 54cdf0e10cSrcweir oWin = utils.at_getCurrentWindow(oDoc) 55cdf0e10cSrcweir xRoot = utils.at_getAccessibleObject(oWin) 56cdf0e10cSrcweir Dim oStatusBar as Object 57cdf0e10cSrcweir oStatusBar = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.STATUS_BAR) 58cdf0e10cSrcweir oObj = oStatusBar.getAccessibleChild(0) 59cdf0e10cSrcweir 60cdf0e10cSrcweir readOnly = true 61cdf0e10cSrcweir accText = oObj.getText() 62cdf0e10cSrcweir 63cdf0e10cSrcweirExit Sub 64cdf0e10cSrcweirErrHndl: 65cdf0e10cSrcweir Test.Exception() 66cdf0e10cSrcweirEnd Sub 67cdf0e10cSrcweir 68cdf0e10cSrcweirSub fireEvent() 69cdf0e10cSrcweir Dim oText as Object 70cdf0e10cSrcweir oText = oDoc.getText() 71cdf0e10cSrcweir 72cdf0e10cSrcweir Dim oEnum as Object 73cdf0e10cSrcweir Dim oParagraph as Object 74cdf0e10cSrcweir oEnum = oText.createEnumeration() ' get all paragraphs 75cdf0e10cSrcweir while oEnum.hasMoreElements() 76cdf0e10cSrcweir oParagraph = oEnum.nextElement() ' get the last paragraph 77cdf0e10cSrcweir wend 78cdf0e10cSrcweir oParagraph.BreakType = com.sun.star.style.BreakType.PAGE_AFTER 79cdf0e10cSrcweir 80cdf0e10cSrcweir Dim oCursor as Object 81cdf0e10cSrcweir oCursor = oText.createTextCursor() 82cdf0e10cSrcweir oCursor.gotoEnd(false) 'Goto to the end of document 83cdf0e10cSrcweir oText.insertControlCharacter(oCursor, 0, false) ' insert a new paragraph 84cdf0e10cSrcweir oCursor.setString("AccessibleStatusBarItem") ' insert text 85cdf0e10cSrcweirend Sub 86cdf0e10cSrcweir</script:module> 87