LibreOffice 24.2 SDK API Reference
Exported Interfaces | List of all members
ExtendedTypeDetection Service Referencepublished

describes a class of service which will be used for deep TypeDetection in a generic way More...


Inheritance diagram for ExtendedTypeDetection:
XExtendedFilterDetection XInterface

Exported Interfaces

interface XExtendedFilterDetection
 makes the deep detection More...

Additional Inherited Members

- Public Member Functions inherited from XExtendedFilterDetection
string detect ([inout] sequence< com::sun::star::beans::PropertyValue > Descriptor)
 controls agreement of a "flat" TypeDetection with given URL or arguments More...
- Public Member Functions inherited from XInterface
any queryInterface ([in] type aType)
 queries for a new interface to an existing UNO object. More...
void acquire ()
 increases the reference counter by one. More...
void release ()
 decreases the reference counter by one. More...

Detailed Description

describes a class of service which will be used for deep TypeDetection in a generic way

Due to the registered types, flat TypeDetection is already possible, i.e. the assignment of types (e.g. to a URL) only on the basis of configuration data. If, however, you imagine special cases (e.g. modifying the file extension of a Writer file from .sdw to .doc), it quickly becomes clear that you cannot always get a correct result with flat detection. To be certain to get correct results, you need deep detection, i.e. the file itself has to be examined. And that is exactly the function of DetectServices. They get all the information collected so far on a document and then decide which type to assign it to. In the new modular model, such a detector is meant as UNO service which registers itself in the office and is requested by the generic type detection if necessary.
Therefore you need two pieces of information:

See service TypeDetection and his configuration for further information.

See also
Developers Guide
Office Development - Integrating Import and Export Filters
Office Development - XML Filter Detection

Exported Interfaces

◆ XExtendedFilterDetection

makes the deep detection

Generic type detection searches for a registered DetectService for an already flat detected type. If any could be found it will be created and used by calling methods of this interface. It gets a MediaDescriptor which contains information about the document which should be detected and must return

  • an internal type name for detected format
  • or NULL if format is unknown nor supported.

May be that given descriptor already includes the opened document stream as parameter MediaDescriptor::InputStream. Then this one should be used every time. If it's not included in descriptor the value of MediaDescriptor::URL must be used to open requested resource by this service.
Note: The stream should be added to the descriptor if it wasn't a part of them before. So further steps on the whole detection process can use it and will perform her work. It's further not allowed to hold a reference to this stream any longer. Only copies will be valid then. Otherwise nobody can close this stream then.

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