'************************************************************************* ' ' 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.datatransfer.XDataFormatTranslator '************************************************************************* On Error Goto ErrHndl Dim bOK As Boolean Dim dataFlavor As new com.sun.star.datatransfer.DataFlavor Dim oCoreRefl As Object Dim sysDataType As Variant Dim sysDataFlavour As Variant oCoreRefl = createUNOService("com.sun.star.reflection.CoreReflection") Test.StartMethod("getSystemDataTypeFromDataFlavor()") bOK = true dataFlavor.MimeType = "text/plain" dataFlavor.HumanPresentableName = "MyDataFlavor" sysDataType = oObj.getSystemDataTypeFromDataFlavor(dataFlavor) bOK = bOK AND NOT isNULL(sysDataType) bOK = bOK AND NOT isEmpty(sysDataType) if (bOK) then Out.Log("Type of SystemDataType is: " & oCoreRefl.getType(sysDataType).Name) else Out.Log("Can't get system data type.") end if Test.MethodTested("getSystemDataTypeFromDataFlavor()", bOK) Test.StartMethod("getDataFlavorFromSystemDataType()") if (NOT bOK) then Out.Log("Can't test getDataFlavorFromSystemDataType() without getSystemDataTypeFromDataFlavor()") else sysDataFlavour = oObj.getDataFlavorFromSystemDataType(sysDataType) bOK = bOK AND NOT isNULL(sysDataFlavour) bOK = bOK AND NOT isEmpty(sysDataFlavour) if (bOK) then Out.Log("Type of DataFlavor is: " & oCoreRefl.getType(sysDataFlavour).Name) bOK = bOK AND oCoreRefl.getType(sysDataFlavour).Name = "com.sun.star.datatransfer.DataFlavor" else Out.Log("Can't get data flavor.") end if Test.MethodTested("getDataFlavorFromSystemDataType()", bOK) end if Exit Sub ErrHndl: Test.Exception() bOK = false resume next End Sub