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="text_XDefaultNumberingProvider" 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 32 33Sub RunTest() 34 35'************************************************************************* 36' INTERFACE: 37' com.sun.star.text.XDefaultNumberingProvider 38'************************************************************************* 39On Error Goto ErrHndl 40 Dim bOK As Boolean 41 Dim oLocale As New com.sun.star.lang.Locale 42 Dim aIndAcc As Object 43 Dim aPropVals As Object 44 Dim cr As Object 45 46 oLocale.Country = "US" 47 oLocale.Language = "en" 48 49 Test.StartMethod("getDefaultOutlineNumberings()") 50 bOK = true 51 aIndAcc = oObj.getDefaultOutlineNumberings(oLocale) 52 if (ubound(aIndAcc) >= 0) then 53 Out.Log("Returned sequence has " & ubound(aIndAcc) + 1 & " elements.") 54 bOK = bOK AND hasUNOInterfaces(aIndAcc(0), "com.sun.star.container.XIndexAccess") 55 else 56 Out.Log("Returned sequence is EMPTY.") 57 bOK = false 58 end if 59 Test.MethodTested("getDefaultOutlineNumberings()", bOK) 60 61 Test.StartMethod("getDefaultContinuousNumberingLevels()") 62 bOK = true 63 aPropVals = oObj.getDefaultContinuousNumberingLevels(oLocale) 64 if (ubound(aPropVals) >= 0) then 65 Out.Log("Returned sequence has " & ubound(aPropVals) + 1 & " elements.") 66 cr = createUNOService("com.sun.star.reflection.CoreReflection") 67 bOK = bOK AND (cr.getType(aPropVals(0)).Name = "[]com.sun.star.beans.PropertyValue") 68' OutDefaultContinuousNumberingLevels(aPropVals) 69 else 70 Out.Log("Returned sequence is EMPTY.") 71 bOK = false 72 end if 73 Test.MethodTested("getDefaultContinuousNumberingLevels()", bOK) 74 75Exit Sub 76ErrHndl: 77 Test.Exception() 78 bOK = false 79 resume next 80End Sub 81Sub OutDefaultOutlineNumberings(aIndAcc As Variant) 82 Dim i As Integer 83 Dim k As Integer 84 Dim l As Integer 85 Dim ia As Object 86 Dim props As Variant 87 88 for k = 0 to ubound(aIndAcc) 89 Out.Log("" & k & ")") 90 ia = aIndAcc(k) 91 for l = 0 to ia.Count() - 1 92 Out.Log(" " & l & ":") 93 props = ia.getByIndex(l) 94 for i = 0 to ubound(props) 95 Out.Log(" - " & props(i).Name & " = " & props(i).Value) 96 next i 97 next l 98 next k 99End Sub 100 101Sub OutDefaultContinuousNumberingLevels(aPropVals As Variant) 102 Dim i As Integer 103 Dim k As Integer 104 Dim props As Variant 105 106 for i = 0 to ubound(aPropVals) 107 Out.Log("" & i & ")") 108 props = aPropVals(i) 109 for k = 0 to ubound(props) 110 Out.Log(" - " & props(k).Name & " = " & props(k).Value) 111 next k 112 next i 113End Sub 114</script:module> 115