public final class Info extends Object
Inspired by the work of Dr. Andrew Davison from the website Java LibreOffice Programming.
| Modifier and Type | Method and Description |
|---|---|
static int |
compareVersions(String version1,
String version2,
int length)
Compares two versions strings (ex.
|
static Optional<String> |
getConfig(XComponentContext context,
String propName)
Gets the configuration value of the specified property.
|
static Optional<Object> |
getConfig(XComponentContext context,
String nodePath,
String propName)
Gets the configuration value of the specified property for the specified path.
|
static Optional<com.sun.star.beans.XPropertySet> |
getConfigProperties(XComponentContext context,
String nodePath)
Gets the configuration properties for the specified path.
|
static String |
getOfficeName(XComponentContext context)
Gets the office product name for the given context.
|
static String |
getOfficeVersionLong(XComponentContext context)
Gets the office product version (long representation) for the given context, e.g 6.1.0.3
|
static String |
getOfficeVersionShort(XComponentContext context)
Gets the office product version (short representation) for the given context, e.g 6.1
|
static boolean |
isDocumentType(com.sun.star.lang.XComponent document,
String documentType)
Gets whether the given document is of the given document type.
|
static boolean |
isLibreOffice(XComponentContext context)
Gets whether the specified context is for a LibreOffice installation.
|
static boolean |
isOpenOffice(XComponentContext context)
Gets whether the specified context is for an OpenOffice installation.
|
public static boolean isOpenOffice(XComponentContext context)
context - The context.true if the specified context is for an OpenOffice installation, false
otherwise.WrappedUnoException - If an UNO exception occurs. The UNO exception will be the cause of
the WrappedUnoException.public static boolean isLibreOffice(XComponentContext context)
context - The context.true if the specified context is for an LibreOffice installation, false
otherwise.WrappedUnoException - If an UNO exception occurs. The UNO exception will be the cause of
the WrappedUnoException.public static String getOfficeName(XComponentContext context)
context - The context.WrappedUnoException - If an UNO exception occurs. The UNO exception will be the cause of
the WrappedUnoException.public static String getOfficeVersionLong(XComponentContext context)
context - The context.WrappedUnoException - If an UNO exception occurs. The UNO exception will be the cause of
the WrappedUnoException.public static String getOfficeVersionShort(XComponentContext context)
context - The context.WrappedUnoException - If an UNO exception occurs. The UNO exception will be the cause of
the WrappedUnoException.public static int compareVersions(String version1, String version2, int length)
version1 - The first version to compare.version2 - The second version to compare.length - The version length for normalization.public static Optional<String> getConfig(XComponentContext context, String propName)
context - The main context.propName - The property name of the property value to get.WrappedUnoException - If an UNO exception occurs. The UNO exception will be the cause of
the WrappedUnoException.public static Optional<Object> getConfig(XComponentContext context, String nodePath, String propName)
context - The main context.nodePath - The path for which the properties are get.propName - The property name of the property value to get.WrappedUnoException - If an UNO exception occurs. The UNO exception will be the cause of
the WrappedUnoException.public static Optional<com.sun.star.beans.XPropertySet> getConfigProperties(XComponentContext context, String nodePath)
context - The main context.nodePath - The path for which the properties are get.XPropertySet containing the configuration properties for the
specified path.public static boolean isDocumentType(com.sun.star.lang.XComponent document,
String documentType)
document - The document.documentType - The document type to check.true if the document is of the specified type, true otherwise.