LibreOffice: FilterFactory Service Reference

LibreOffice LibreOffice 7.4 SDK API Reference

Loading...
Searching...
No Matches
Exported Interfaces | List of all members
FilterFactory Service Referencepublished

factory to create filter components. More...

Inheritance diagram for FilterFactory:

## Exported Interfaces
interface | com::sun::star::lang::XMultiServiceFactory
| factory interface to create and initialize filter components.
interface | com::sun::star::container::XNameAccess
| provides read access to the complete set of configuration data.
interface | com::sun::star::container::XNameContainer
| provides a write access to the configuration data.
interface | com::sun::star::container::XContainerQuery
| provides search on the configuration data set.
interface | com::sun::star::util::XFlushable
| can be used to perform container changes.

## Additional Inherited Members
Public Member Functions inherited from XMultiServiceFactory
com::sun::star::uno::XInterface | createInstance ([in] string aServiceSpecifier) raises ( com::sun::star::uno::Exception )
| Creates an instance classified by the specified name.
com::sun::star::uno::XInterface | createInstanceWithArguments ([in] string ServiceSpecifier, [in] sequence< any > Arguments) raises ( com::sun::star::uno::Exception )
| Creates an instance classified by the specified name and passes the arguments to that instance.
sequence< string > | getAvailableServiceNames ()
| Provides the available names of the factory to be used to create instances.
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object.
void | acquire ()
| increases the reference counter by one.
void | release ()
| decreases the reference counter by one.
Public Member Functions inherited from XNameAccess
any | getByName ([in] string aName) raises ( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
sequence< string > | getElementNames ()
boolean | hasByName ([in] string aName)
Public Member Functions inherited from XElementAccess
type | getElementType ()
boolean | hasElements ()
Public Member Functions inherited from XContainerQuery
XEnumeration | createSubSetEnumerationByQuery ([in] string Query)
| creates a sub set of container items which match given query command
XEnumeration | createSubSetEnumerationByProperties ([in] sequence< com::sun::star::beans::NamedValue > Properties)
| creates a sub set of container items which supports searched properties as minimum
Protected Member Functions inherited from XNameContainer
void | insertByName ([in] string aName, [in] any aElement) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException )
| inserts the given element at the specified name.
void | removeByName ([in] string Name) raises ( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
| removes the element with the specified name.
Protected Member Functions inherited from XNameReplace
void | replaceByName ([in] string aName, [in] any aElement) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
| replaces the element with the specified name with the given element.
Protected Member Functions inherited from XContainerQuery
XEnumeration | createSubSetEnumerationByQuery ([in] string Query)
| creates a sub set of container items which match given query command
XEnumeration | createSubSetEnumerationByProperties ([in] sequence< com::sun::star::beans::NamedValue > Properties)
| creates a sub set of container items which supports searched properties as minimum
Protected Member Functions inherited from XFlushable
void | flush ()
| flushes the data of the object to the connected data source.
void | addFlushListener ([in] com::sun::star::util::XFlushListener l)
| adds the specified listener to receive event "flushed."
void | removeFlushListener ([in] com::sun::star::util::XFlushListener l)
| removes the specified listener.

## Detailed Description

factory to create filter components.

After a generic TypeDetection an internal type name will be known. Further a generic com::sun::star::frame::FrameLoader can use this information, to search a suitable filter (may the default filter) at this factory and use it for loading the document into a specified frame.

This factory implements read/write access on the underlying configuration set. and further a validate and flush mechanism for more performance and a special query mode can be used here too.

Developers Guide
  Office Development - Integrating Import and Export Filters

## Exported Interfaces

## ◆ com::sun::star::container::XContainerQuery

interface com::sun::star::container::XContainerQuery

provides search on the configuration data set.

Against simple property search it provides some complex algorithms too. For further information please read the SDK documentation.

## ◆ com::sun::star::container::XNameAccess

interface com::sun::star::container::XNameAccess

provides read access to the complete set of configuration data.

Every container item is specified as a set of properties and will be represented by a sequence< com::sun::star::beans::PropertyValue > structure. Follow properties are supported: (But note: not all of them must be present every time!)

Property Name | Value Type | Description
Name | [string] | The internal name is the only value, which makes a container item unique.
UIName | [string] | It contains the localized name for this filter for the current locale.
UINames | [sequence< string >] | It contains all available localized names for this filter. The are organized in pairs and represented as a structure of sequence< com::sun::star::beans::PropertyValue >. The name of such property must be interpreted as locale; its value as the localized filter name corresponding to this locale.
Type | [string] | Every filter is registered for a type. This value contains the internal name of it. (see service TypeDetection for further information)
DocumentService | [string] | It's the UNO service name of the document type, which can be handled by this filter. (e.g. com::sun::star::text::TextDocument)
FilterService | [string] | It means the UNO implementation name of the filter component. Note: It really means the implementation instead of the UNO service name. Because it's not possible to distinguish between more than one filters; if all of them uses a generic identifier!
Flags | [integer] | They describe the filter more specific. (e.g. they mark it as IMPORT/EXPORT or DEFAULT filter.)
UserData | [string] | This field contains filter specific configuration data.
FileFormatVersion | [integer] | It specifies the supported file format version if there exist more than ones.
TemplateName | [string] | It's the name of a suitable default template.

Note:
All elements of this container will be addressed by his internal name, and it must be an unambiguous value.

## ◆ com::sun::star::container::XNameContainer

interface com::sun::star::container::XNameContainer
| optional

provides a write access to the configuration data.

## ◆ com::sun::star::lang::XMultiServiceFactory

interface com::sun::star::lang::XMultiServiceFactory

factory interface to create and initialize filter components.

Current behavior

The methods createInstance() or createInstanceWithArguments() of this interface must be called with an internal type name!. This name is used internally to search a suitable (mostly the default) filter for this type then. The found filter will be created, initialized and returned then. Creation of a filter by using its internal filter name directly can be reached by using createInstanceWithArguments() with an optional property "FilterName" only. See the following example:

private com.sun.star.uno.XInterface createFilterDirect( com.sun.star.lang.XMultiServiceFactory xFilterFactory ,
java.lang.String sInternalFilterName )
{
com.sun.star.beans.PropertyValue aFilterProp = new com.sun.star.beans.PropertyValue();
aFilterProp.Name = "FilterName";
aFilterProp.Value = sInternalFilterName;
com.sun.star.uno.Any[] lProps = new com.sun.star.uno.Any[1];
lProps[0] = aFilterProp;
java.lang.Object aFilter = xFilterFactory.createInstanceWithArguments("", lProps);
return (com.sun.star.uno.XInterface)UnoRuntime.queryInterface(com.sun.star.uno.XInterface.class, aFilter);
}
com::sun::star::lang::XMultiServiceFactory
Allows creating instances specified by a string name.
Definition: XMultiServiceFactory.idl:40
com::sun::star::uno::XInterface
base interface of all UNO interfaces
Definition: XInterface.idl:48
com::sun::star::beans
Java beans-like property access and introspection.
Definition: Ambiguous.idl:22
com::sun::star::lang
General UNO concepts like factories etc.
Definition: ArrayIndexOutOfBoundsException.idl:26
com::sun::star::uno
Basic UNO interfaces.
Definition: modules.idl:74
com::sun::star
the module com::sun::star is the root module of the UNO API.
Definition: Ambiguous.idl:22
com::sun
Definition: Ambiguous.idl:22
com
Definition: Ambiguous.idl:22
com::sun::star::beans::PropertyValue
specifies a property value.
Definition: PropertyValue.idl:34

Proposed behavior

Searching of a suitable filter for a given internal type name, must be done by the new interface com::sun::star::container::XContainerQuery, available on this factory too. The factory interface can be used to create filter components by its internal filter name only.

How it can be distinguished?

The new proposed implementation will throw a com::sun::star::container::NoSuchElementException if the first parameter of createInstance() or createInstanceWithArguments() does not match to a valid container (means filter) item. Further it will throw a com::sun::star::lang::IllegalArgumentException if the optional parameter "FilterName" could not be detected inside the argument list of call createInstanceWithArguments().

Initialization of a filter component

Every filter, which was created by this factory can(!) be initialized with its own configuration data and may given optional arguments of the corresponding createInstanceWithArguments() request. To do so the filter instance must support the optional interface com::sun::star::lang::XInitialization. The arguments parameter will have the following structure:

- sequence< Any >[0] contains a sequence< com::sun::star::beans::PropertyValue >, which represent the configuration data set of this filter. The used properties are the same, as they are available at the container interface of this factory service. (see below)
- Every following item of the argument list sequence< Any >[1..n] contains the copied argument of the corresponding createInstanceWithArguments() call. That means: Item 0 or the original list was copied as item 1 of the destination list ... etc.

## ◆ com::sun::star::util::XFlushable

interface com::sun::star::util::XFlushable
| optional

can be used to perform container changes.

Because the complexness of such configuration set can be very high, it seems not very useful to update the underlying configuration layer on every container change request immediately. Another strategy can be to make all changes (adding/changing/removing of items) and call flush at the end. That will validate the whole container and reject inconsistent data sets. Only in case all made changes was correct, they will be written back to the configuration. Further this interface provides the possibility, that interested changes listener can be registered too.

The documentation for this service was generated from the following file:

- com/sun/star/document/FilterFactory.idl