1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="form_XApproveActionBroadcaster" script:language="StarBasic"> 4 5 6'************************************************************************* 7' 8' Licensed to the Apache Software Foundation (ASF) under one 9' or more contributor license agreements. See the NOTICE file 10' distributed with this work for additional information 11' regarding copyright ownership. The ASF licenses this file 12' to you under the Apache License, Version 2.0 (the 13' "License"); you may not use this file except in compliance 14' with the License. You may obtain a copy of the License at 15' 16' http://www.apache.org/licenses/LICENSE-2.0 17' 18' Unless required by applicable law or agreed to in writing, 19' software distributed under the License is distributed on an 20' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21' KIND, either express or implied. See the License for the 22' specific language governing permissions and limitations 23' under the License. 24' 25'************************************************************************* 26 27 28 29 30 31' Be sure that all variables are dimensioned: 32option explicit 33 34Dim L1called as Boolean 35Dim L2called as Boolean 36 37 38Sub RunTest() 39 40'************************************************************************* 41' INTERFACE: 42' com.sun.star.form.XApproveActionBroadcaster 43'************************************************************************* 44On Error Goto ErrHndl 45 Dim bOK As Boolean 46 Dim list1 As Object, list2 As Object 47 48 Test.StartMethod("addApproveActionListener()") 49 bOK = true 50 51 list1 = createUnoListener("L1_", "com.sun.star.form.XApproveActionListener") 52 list2 = createUnoListener("L2_", "com.sun.star.form.XApproveActionListener") 53 54 oObj.addApproveActionListener(list1) 55 oObj.addApproveActionListener(list2) 56 57 Test.StartMethod("removeApproveActionListener()") 58 59 oObj.removeApproveActionListener(list1) 60 61 L1called = false 62 L2called = false 63 64 Out.Log("The action for listener calling must be perfomed interactively") 65 bOK = bOK AND L2called 66 Test.MethodTested("addApproveActionListener()", TRUE) 67 68 bOK = bOK AND NOT L1called 69 Test.MethodTested("removeApproveActionListener()", TRUE) 70 71 oObj.removeApproveActionListener(list2) 72 73 Out.Log("Skipping all XApproveActionBroadcaster methods, since they need user interaction") 74 75Exit Sub 76ErrHndl: 77 Test.Exception() 78 bOK = false 79 resume next 80End Sub 81 82 83Function L1_approveAction() As Boolean 84 L1called = true 85 Out.Log("Listener 1 is called") 86 L1_approveAction = true 87End Function 88 89Function L2_approveAction() As Boolean 90 L2called = true 91 Out.Log("Listener 2 is called") 92 L2_approveAction = true 93End Function 94</script:module> 95