blob: 76489c802345c75aea9486af8ff9f10d7d90eef0 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="text_XDefaultNumberingProvider" script:language="StarBasic">
'*************************************************************************
'
' Licensed to the Apache Software Foundation (ASF) under one
' or more contributor license agreements. See the NOTICE file
' distributed with this work for additional information
' regarding copyright ownership. The ASF licenses this file
' to you under the Apache License, Version 2.0 (the
' "License"); you may not use this file except in compliance
' with the License. You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing,
' software distributed under the License is distributed on an
' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
' KIND, either express or implied. See the License for the
' specific language governing permissions and limitations
' under the License.
'
'*************************************************************************
Sub RunTest()
'*************************************************************************
' INTERFACE:
' com.sun.star.text.XDefaultNumberingProvider
'*************************************************************************
On Error Goto ErrHndl
Dim bOK As Boolean
Dim oLocale As New com.sun.star.lang.Locale
Dim aIndAcc As Object
Dim aPropVals As Object
Dim cr As Object
oLocale.Country = "US"
oLocale.Language = "en"
Test.StartMethod("getDefaultOutlineNumberings()")
bOK = true
aIndAcc = oObj.getDefaultOutlineNumberings(oLocale)
if (ubound(aIndAcc) &gt;= 0) then
Out.Log("Returned sequence has " &amp; ubound(aIndAcc) + 1 &amp; " elements.")
bOK = bOK AND hasUNOInterfaces(aIndAcc(0), "com.sun.star.container.XIndexAccess")
else
Out.Log("Returned sequence is EMPTY.")
bOK = false
end if
Test.MethodTested("getDefaultOutlineNumberings()", bOK)
Test.StartMethod("getDefaultContinuousNumberingLevels()")
bOK = true
aPropVals = oObj.getDefaultContinuousNumberingLevels(oLocale)
if (ubound(aPropVals) &gt;= 0) then
Out.Log("Returned sequence has " &amp; ubound(aPropVals) + 1 &amp; " elements.")
cr = createUNOService("com.sun.star.reflection.CoreReflection")
bOK = bOK AND (cr.getType(aPropVals(0)).Name = "[]com.sun.star.beans.PropertyValue")
' OutDefaultContinuousNumberingLevels(aPropVals)
else
Out.Log("Returned sequence is EMPTY.")
bOK = false
end if
Test.MethodTested("getDefaultContinuousNumberingLevels()", bOK)
Exit Sub
ErrHndl:
Test.Exception()
bOK = false
resume next
End Sub
Sub OutDefaultOutlineNumberings(aIndAcc As Variant)
Dim i As Integer
Dim k As Integer
Dim l As Integer
Dim ia As Object
Dim props As Variant
for k = 0 to ubound(aIndAcc)
Out.Log("" &amp; k &amp; ")")
ia = aIndAcc(k)
for l = 0 to ia.Count() - 1
Out.Log(" " &amp; l &amp; ":")
props = ia.getByIndex(l)
for i = 0 to ubound(props)
Out.Log(" - " &amp; props(i).Name &amp; " = " &amp; props(i).Value)
next i
next l
next k
End Sub
Sub OutDefaultContinuousNumberingLevels(aPropVals As Variant)
Dim i As Integer
Dim k As Integer
Dim props As Variant
for i = 0 to ubound(aPropVals)
Out.Log("" &amp; i &amp; ")")
props = aPropVals(i)
for k = 0 to ubound(props)
Out.Log(" - " &amp; props(k).Name &amp; " = " &amp; props(k).Value)
next k
next i
End Sub
</script:module>