public final class Lo extends Object
Inspired by the work of Dr. Andrew Davison from the website Java LibreOffice Programming.
| Modifier and Type | Field and Description |
|---|---|
static String |
BASE_SERVICE |
static String |
CALC_SERVICE |
static String |
DRAW_SERVICE |
static String |
IMPRESS_SERVICE |
static String |
MATH_SERVICE |
static String |
UNKNOWN_SERVICE |
static String |
WRITER_SERVICE |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
createInstanceMCF(XComponentContext context,
Class<T> type,
String serviceName)
Create an interface object of the given class from the given named service; uses given
XComponentContext and 'new' XMultiComponentFactory so only a bridge to office is needed.
|
static <T> T |
createInstanceMSF(com.sun.star.lang.XComponent component,
Class<T> type,
String serviceName)
Create an interface object of the given class from the given named service; uses given
XComponent and 'old' XMultiServiceFactory, so a document must have been already loaded/created.
|
static <T> T |
createInstanceMSF(com.sun.star.lang.XMultiServiceFactory factory,
Class<T> type,
String serviceName)
Create an interface object of the given class from the given named service; uses given 'old'
XMultiServiceFactory, so a document must have been already loaded/created.
|
static com.sun.star.lang.XMultiServiceFactory |
getServiceFactory(com.sun.star.lang.XComponent component)
Gets the XMultiServiceFactory for the given component.
|
static <T> T |
qi(Class<T> type,
Object object)
Queries the given UNO object for the given Java class (which must represent a UNO interface
type).
|
static <T> Optional<T> |
qiOptional(Class<T> type,
Object object)
Queries the given UNO object for the given Java class (which must represent a UNO interface
type).
|
public static final String UNKNOWN_SERVICE
public static final String WRITER_SERVICE
public static final String BASE_SERVICE
public static final String CALC_SERVICE
public static final String DRAW_SERVICE
public static final String IMPRESS_SERVICE
public static final String MATH_SERVICE
public static <T> T qi(Class<T> type, Object object)
T - The requested UNO interface type.type - A Java class representing a UNO interface type.object - A reference to any Java object representing (a facet of) a UNO object; may be
null.null
.UnoRuntime.queryInterface(Class, Object)public static <T> Optional<T> qiOptional(Class<T> type, Object object)
T - the requested UNO interface type.type - A Java class representing a UNO interface type.object - A reference to any Java object representing (a facet of) a UNO object; may be
null.null
.UnoRuntime.queryInterface(Class, Object)public static com.sun.star.lang.XMultiServiceFactory getServiceFactory(com.sun.star.lang.XComponent component)
component - The component.public static <T> T createInstanceMSF(com.sun.star.lang.XComponent component,
Class<T> type,
String serviceName)
T - The requested UNO interface type.component - The component.type - A Java class representing a UNO interface type.serviceName - The service name.null
.WrappedUnoException - If an UNO exception occurs. The UNO exception will be the cause of
the WrappedUnoException.public static <T> T createInstanceMSF(com.sun.star.lang.XMultiServiceFactory factory,
Class<T> type,
String serviceName)
T - The requested UNO interface type.factory - The service factory.type - A Java class representing a UNO interface type.serviceName - The service name.null
.WrappedUnoException - If an UNO exception occurs. The UNO exception will be the cause of
the WrappedUnoException.public static <T> T createInstanceMCF(XComponentContext context, Class<T> type, String serviceName) throws WrappedUnoException
T - The requested UNO interface type.context - The component context.type - A Java class representing a UNO interface type.serviceName - The service name.null
.WrappedUnoException - If an UNO exception occurs. The UNO exception will be the cause of
the WrappedUnoException.