Page 1 of 1

Print properties of TypeDetection and FilterFactory

PostPosted: Sun Feb 24, 2019 8:53 pm
by Villeroy
The attached text document contains the source code of a Python macro and an installation routine in StarBasic. If the document is allowed to run its embedded StarBasic macro, the Python code will be installed by a push on a button. Then it can be called via Tools>Macros>Run... "My Macros">reportFileTypes>Main or via Tools>Macros>Organize>Python>"My Macros">reportFileTypes>Main
The Python macro generates a spreadsheet document with sheets "TypeDetection" and "FilterFactory".
Then it prints all elements of the respective service and the property values of these elements into the respective sheet.
The printed information includes all filter names, user interface names, the service names of filter dialogs, file name extensions, clipboard formats and many things I don't understand neither. You may run it after you installed either a new version of your office suite or some extension package providing new file filters. The resulting tables should help you to write your own macros/extensions.
Unless the property values are plain numbers or strings, Python's string representation of the property value will be printed into the respective cell. For instance, (u'docx',u'docm') is the representation of an array with two unicode strings docx and docm in Python2 (OpenOffice). In Python3 (LibreOffice) all strings are unicode anyway and the same string array is shown without "u": ('docx','docm').
The following is Python's string representation of an UNO object, namely a c.s.s.beans.PropertyValue describing a UI name in UI language "en-US":
Code: Select all   Expand viewCollapse view
(({ Name = (string)"en-US", Handle = (long)0x0, Value = (any){ (string)" 1.0 Presentation Template" }, State = ( },)