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 |
CALC_SERVICE |
static String |
DRAW_SERVICE |
static String |
IMPRESS_SERVICE |
static String |
WRITER_SERVICE |
Modifier and Type | Method and Description |
---|---|
static <T> T |
createInstanceMCF(@NonNull XComponentContext context,
@NonNull Class<T> type,
@NonNull 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(@NonNull com.sun.star.lang.XComponent component,
@NonNull Class<T> type,
@NonNull 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(@NonNull com.sun.star.lang.XMultiServiceFactory factory,
@NonNull Class<T> type,
@NonNull 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 @NonNull com.sun.star.lang.XMultiServiceFactory |
getServiceFactory(@NonNull com.sun.star.lang.XComponent component)
Gets the XMultiServiceFactory for the given component.
|
static <T> T |
qi(@NonNull Class<T> type,
@NonNull Object object)
Queries the given UNO object for the given Java class (which must represent a UNO interface
type).
|
static <T> @NonNull Optional<T> |
qiOptional(@NonNull Class<T> type,
@NonNull Object object)
Queries the given UNO object for the given Java class (which must represent a UNO interface
type).
|
public static final String WRITER_SERVICE
public static final String CALC_SERVICE
public static final String DRAW_SERVICE
public static final String IMPRESS_SERVICE
public static <T> T qi(@NonNull Class<T> type, @NonNull Object object)
T
- The requested UNO interface type.type
- A Java class representing a UNO interface type; cannot be null
.object
- A reference to any Java object representing (a facet of) a UNO object; cannot be
null
.UnoRuntime.queryInterface(Class, Object)
public static <T> @NonNull Optional<T> qiOptional(@NonNull Class<T> type, @NonNull Object object)
T
- the requested UNO interface type.type
- A Java class representing a UNO interface type; may be null
.object
- A reference to any Java object representing (a facet of) a UNO object; may be
null
.null
.UnoRuntime.queryInterface(Class, Object)
public static @NonNull com.sun.star.lang.XMultiServiceFactory getServiceFactory(@NonNull com.sun.star.lang.XComponent component)
component
- The component.public static <T> T createInstanceMSF(@NonNull com.sun.star.lang.XComponent component, @NonNull Class<T> type, @NonNull 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(@NonNull com.sun.star.lang.XMultiServiceFactory factory, @NonNull Class<T> type, @NonNull 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(@NonNull XComponentContext context, @NonNull Class<T> type, @NonNull String serviceName)
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
.Copyright © 2016 - present; JODConverter.org. All rights reserved.