1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23#ifndef __com_sun_star_document_ExtendedTypeDetection_idl__
24#define __com_sun_star_document_ExtendedTypeDetection_idl__
25
26#ifndef __com_sun_star_document_XExtendedFilterDetection_idl__
27#include <com/sun/star/document/XExtendedFilterDetection.idl>
28#endif
29
30//=============================================================================
31
32module com { module sun { module star { module document {
33
34//=============================================================================
35/** describes a class of service which will be used for deep <type>TypeDetection</type>
36    in a generic way
37
38    <p>
39    Due to the registered types, flat <type>TypeDetection</type> is already possible, i.e.
40    the assignment of types (e.g. to a URL) only on the basis of configuration data.
41    If, however, you imagine special cases (e.g. modifying the file extension of a
42    Writer file from .sdw to .doc), it quickly becomes clear that you cannot always
43    get a correct result with flat detection. To be certain to get correct results,
44    you need deep detection, i.e. the file itself has to be examined.
45    And that is exactly the function of DetectServices. They get all the information
46    collected so far on a document and then decide which type to assign it to.
47    In the new modular model, such a detector is meant as UNO service which registers
48    itself in the office and is requested by the generic type detection if necessary.
49    <br>
50    Therefore you need two pieces of information:
51    <ul>
52        <li>
53        The <strong>ServiceName</strong> - This must be a valid UNO service name.
54        It is also an entry in the corresponding configuration list.
55        <br>
56        Example: "com.company.devision.DetectService"
57        <br>
58        Note that this realy means the implementation name of the service.
59        Because it's not possible otherwise to distinguish between more then one
60        registered detect services in same office installation! But it's possible for
61        the generic type detection to create an uno service by his implementation name too.
62        </li>
63        <li>
64        A list of <strong>Types</strong> able to be recognized by this service -
65        You can also implement and register detectors for groups of types.
66        </li>
67    </ul>
68    See service <type>TypeDetection</type> and his configuration for further informations.
69    </p>
70
71    @see TypeDetection
72 */
73published service ExtendedTypeDetection
74{
75	//-------------------------------------------------------------------------
76    /** makes the deep detection
77
78        <p>
79        Generic type detection searchs for a registered DetectService for an
80        already flat detected type. If any could be found it will be created and
81        used by calling methods of this interface. It gets a <type>MediaDescriptor</type>
82        which contains information about the document which should be detected and must return
83        <ul>
84            <li>an internal type name for detected format</li>
85            <li>or <NULL/> if format is unknown nor supported.</li>
86        </ul>
87        May be that given descriptor already includes the opened document stream as parameter
88        <member>MediaDescriptor::InputStream</member>. Then this one should be used everytime.
89        If it's not included in descriptor the value of <member>MediaDescriptor::URL</member>
90        must be used to open requested ressource by this service.
91        <br>
92        Note: The stream should be added to the descriptor if it wasn't a part of them before.
93        So further steps on the whole detection process can use it and will perform her work.
94        It's further not allowed to hold a reference to this stream any longer. Only copies
95        will be valid then. Otherwise nobody can close this stream then.
96        </p>
97	 */
98    interface XExtendedFilterDetection;
99};
100
101//=============================================================================
102
103}; }; }; };
104
105#endif
106