blob: 1d1a455f04750b0947a864ec13cdc387ba9d78f7 [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="fwl_FilterFactory" 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.
'
'*************************************************************************
' Be sure that all variables are dimensioned:
option explicit
' REQUIRED VARIABLES for interface/service tests:
'Required for lang.XMultiServiceFactory
Global cServiceName As String
Global bCreateInstanceWithoutArguments As Boolean
Global aArguments() As Variant
Sub CreateObj()
'*************************************************************************
' COMPONENT:
' fwl.FilterFactory
'*************************************************************************
On Error Goto ErrHndl
oObj = createUnoService("com.sun.star.comp.framework.FilterFactory")
Dim filterNames() As Variant
filterNames = oObj.getElementNames()
Dim i As Integer
Dim filterType As String
Dim filterProps As Object
Dim filterImpl As String
Dim filName As String
for i = 0 to ubound(filterNames)
filterProps = oObj.getByName(filterNames(i))
filterImpl = getPropertyValue(filterProps, "FilterService")
if Not isNULL(filterImpl) and len(filterImpl) > 0 then
filterType = getPropertyValue(filterProps, "Type")
Out.log("Found filter '" + filterNames(i) + "', type: " + _
filterType + ", service name: '" + filterImpl + "'")
cServiceName = filterType
bCreateInstanceWithoutArguments = false
Dim args(0) As new com.sun.star.beans.PropertyValue
args(0).Name = "FilterName"
args(0).Value = filterNames(i)
endif
next i
Exit Sub
ErrHndl:
Test.Exception()
End Sub
Function getPropertyValue(byVal props As Variant, propName As String) As String
Dim i As Integer
for i = 0 to ubound(props)
if props(i).Name = propName then
getPropertyValue = props(i).Value
exit function
endif
next i
End Function
</script:module>