[Open Office] Some little information about typedetection

Fridrich Strba fridrich.strba at bluewin.ch
Fri Jun 15 03:56:58 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello, good people!

I have an information concerning OOo type detection that, although being
in the DeveloperGuide, might be useful to be summarized in human
language for some of us.

There is one service doing the "deep" type detection inside OOo:
com.sun.star.document.ExtendedTypeDetection.

A component that supports it must have a
rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence<
com::sun::star::beans::PropertyValue >& Descriptor ) throw(
com::sun::star::uno::RuntimeException )
method implemented. This method should take the MediaDescriptor
<http://api.openoffice.org/docs/common/ref/com/sun/star/document/MediaDescriptor.html>
and output the type-name if the document was detected and an empty
::rtl::OUString, if not. It should also add any collected information
about the document into the MediaDescriptor (From experience, OOo will
not crash if it does not :-) ).
The type-name returning by this method should correspond to the
corresponding oor:name given in the
filter/source/config/fragments/types/*.xcu corresponding to the detected
type.

This component will be considered:
1) for confirming the "flat" type detection results. "Flat" type
detection is a type detection based on document extension and/or
mime-type. For a component to be called for this type of detection, it
has to be declared as <DetectService> in the same xcu file and is fired
for <Extension>s and/or <MediaType>s mentioned in the same xcu file.
This assures that a filter capable to handle a format will not have to
handle a garbage that accidentally is declared with wrong mime-type
and/or has a wrong extension.
2) if this the type's <DetectService> does not confirm the result of
"flat" detection, the detect method of all components' supporting the
com.sun.star.document.ExtendedTypeDetection will be called, component
after component, until there is one that detects it.
The filter that will be used is the component mentioned as
<FilterService> of the filter node
(filter/source/config/fragments/filters/*.xcu) that is <PreferedFilter>
for the detected type.

If none of the components recognizes the document, one will be presented
with the filter-selection dialogue or with the encoded-text dialogue (in
some cases, because the writer filter is over-keen).

Ok, this is some technical information that I deemed good to keep
somewhere where Google crawler can find it. Everything is documented in
the DeveloperGuide, but it is >1000 pages, so...

Cheers

Fridrich
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFGckZKu9a1imXPdA8RAh2NAJ93Uql+I+r8rBtUSTRzq9yMmKxbAgCghexK
VxH/g6jzhmxUlXtVQWEVQr0=
=Hame
-----END PGP SIGNATURE-----



More information about the Openoffice mailing list