The Free and Open Productivity Suite
Follow us on Twitter: @ApacheOO

<<


>>



Realization

The generic approach, as was already shown in the configuration, continues in realization and implementation. Modularity and exchangeability are generally achieved by consistent use of the UNO service concept.


Service Description

The following services were specified:


com.sun.star.document.MediaDescriptor

This is not really a service. Rather, it is a structure that tries to unite all the document information. This is where e.g. URL, MediaType, FilterName, Referrer, Version and an InputStream are available. The point is to take the MediaDescriptor through all the processes of type detection (detect flat/deep, filter, load...). Resulting information should be added or corrected so that it is available for the next step in the process.
Some things to be aware of:

  1. The UNO feature that corresponds to this service is a sequence of elements of the com.sun.star.beans.PropertyValue type. It is thus not a real service in the sense of an object.
    e.g. in C++ "::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > lProperties"

  2. The elements may only be referenced or kept as a copy for the time necessary for direct processing.


com.sun.star.document.TypeDetection

  • interface com.sun.star.document.XTypeDetection
    Makes flat or deep detection of the type of contents, described by the URL or a MediaDescriptor. The result you receive is the internal name of the detected type. This can be used to get registered loaders or filters. The FrameLoaderFactory and FilterFactory services help you do this.

  • interface com.sun.star.container.XNameAccess
    Allows read-access to the configuration data of all types.


com.sun.star.frame.FrameLoaderFactory

  • interface com.sun.star.lang.XMultiServiceFactory
    Creates a loader service registered to one type. You enter the internal type name you received from a TypeDetection and get a reference to the object produced. The loader factory already initializes the object produced with its configuration data.
    See also FrameLoader/SynchronousFrameLoader for further information.

  • interface com.sun.star.container.XNameAccess Allows read-access to the configuration of all FrameLoaders.


com.sun.star.frame.FrameLoader
com.sun.star.frame.SynchronousFrameLoader

  • interface com.sun.star.frame.XFrameLoader | com.sun.star.frame.XSynchronousFrameLoader
    With the help of the methods load() and cancel(), you can start processing a document or also abort it. The various services differ only in the way results are returned. The FrameLoader returns immediately and allows the client to listen for the loading completion, whereas the SynchronousFrameLoader returns when finished loading with the result of the process. If an object implements both interfaces, the synchronous version is preferred.

  • interface com.sun.star.lang.XInitialization
    interface com.sun.star.beans.XPropertySet
    [property, readonly] sequence< string > Name
    [property, readonly] sequence< string > Types
    [property, readonly] string UIName
    These interfaces must be supported by a loader implementation, thus making configuration data available by asking the object instead of retrieving it from the FrameLoaderFactory. The properties are re defined as read-only because it does not make sense to make changes at run-time. The XInitialization interface is used by the FrameLoaderFactory to provide the Loader with its configuration data, clients can get them via XPropertySet.


com.sun.star.document.FilterFactory

  • interface com.sun.star.lang.XMultiServiceFactory
    Use this to create a registered filter suitable for a determined type. You transfer the internal type names and receive a reference to the filter object. The factory then initializes the object with its configuration data.
    See also import/export filters

  • interface com.sun.star.container.XNameAccess
    Allows read-access to the configuration of all filters.


com.sun.star.document.ImportFilter
com.sun.star.document.ExportFilter

  • interface com.sun.star.document.XFilter
    This interface is supported by both services. Use it to start or interrupt the actual filter process. The result is indicated synchronously. The interface only supports a synchronous loading.

  • interface com.sun.star.document.XImporter
    interface com.sun.star.document.XExporter

    A filter is identified as an import and/or export filter by appropriate flags in its configuration data (see also filter configuration). It can implement one or both interfaces. The purpose of these interfaces is to transfer an interface to the output or target document to the filter.
    The following algorithm is used:
         a) get suitable interface for respective process (XImporter/XExporter)
         b) set the document on it (setTargetDocument()/setSourceDocument())
         c) get XFilter interface for the same object and start the process with filter()
    Problems might be caused by simultaneous implementation of both interfaces. Then the implementation must detect the method called for setting the document, and, based on that, infer the type of filter process.

  • interface com.sun.star.lang.XInitialization
    interface com.sun.star.beans.XPropertySet
    [property, readonly] string Name;
    [property, readonly] string Type;
    [property, readonly] string UIName;
    [property, readonly] string DocumentService;
    [property, readonly] string FilterService;
    [property, readonly] string Flags;
    [property, readonly] string UserData;
    [property, readonly] string FileFormatVersion;
    [property, readonly] string TemplateName;
    A filter must also make its own configuration accessible to others by implementing these interfaces.
    See also the description
    FrameLoader/SynchronousFrameLoader!

<<


>>


author

   Andreas Schlüns

email

   andreas.schluens@germany.sun.com

last modification

   11.04.2001



Apache Software Foundation

Copyright & License | Privacy | Website Feedback | Contact Us | Donate | Thanks

Apache, the Apache feather logo, and OpenOffice are trademarks of The Apache Software Foundation. OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.