I recently wanted to get the list of all file types handled by
OpenOffice.org using the API. Of course I wanted to get their
internationalized names. I discovered a very interesting service while
browsing the API reference: com.sun.star.document.TypeDetection
.
Here is a sample of StarBasic code getting the names of the file types.
Sub TestTypes
oTypeDetection = createUnoService( "com.sun.star.document.TypeDetection" )
aNames = oTypeDetection.ElementNames
sTypes = ""
For i = 0 To UBound( aNames )
oType = oTypeDetection.getByName( aNames( i ) )
sTypes = sTypes & getUIName( oType ) & chr( 10 )
Next i
MsgBox sTypes
End Sub
Function getUIName( oType As Variant )
sName = ""
i = 0
While ( sName = "" And i <= UBound( oType ) )
If ( oType( i ).Name = "UIName" ) Then
sName = oType( i ).Value
End If
i = i + 1
Wend
getUIName( ) = sName
End Function
I hope that this could help you.