xref: /trunk/main/offapi/com/sun/star/document/TypeDetection.idl (revision 341b93848998051a4360ac5c6edba28fdeb619ef)
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#ifndef __com_sun_star_document_TypeDetection_idl__
23#define __com_sun_star_document_TypeDetection_idl__
24
25#ifndef __com_sun_star_document_XTypeDetection_idl__
26#include <com/sun/star/document/XTypeDetection.idl>
27#endif
28
29#ifndef __com_sun_star_container_XNameContainer_idl__
30#include <com/sun/star/container/XNameContainer.idl>
31#endif
32
33#ifndef __com_sun_star_container_XContainerQuery_idl__
34#include <com/sun/star/container/XContainerQuery.idl>
35#endif
36
37#ifndef __com_sun_star_util_XFlushable_idl__
38#include <com/sun/star/util/XFlushable.idl>
39#endif
40
41//=============================================================================
42
43module com { module sun { module star { module document {
44
45//=============================================================================
46/** capsulate a type detection service and provide read/write access on its configuration data.
47
48    <p>
49    It's possible to make a "flat" detection which may use internal configuration
50    data only - or a "deep" detection which use special <type>ExtendedTypeDetection</type>
51    services to look into the document stream. Last mode can be suppressed to perform the operation.
52    Of course the results can't be guaranteed then. (e.g. in case the extension was changed)
53    </p>
54 */
55published service TypeDetection
56{
57    //-------------------------------------------------------------------------
58    /** can be used to make a flat or deep type detection.
59
60        <p>
61        Use this interface to get information about the type of the given resource.
62        Return value will be always an internal name of a registered document type.
63        It can be used may on other services (e.g. <type scope="com::sun::star::frame">FrameLoaderFactory</type>)
64        to do further things, which base on it (e.g. to load it into a frame).
65        </p>
66     */
67    interface XTypeDetection;
68
69    //-------------------------------------------------------------------------
70    /** provides read access to the complete set of type configuration data.
71
72        <p>
73        Every container item is specified as a set of properties and will be
74        represented by a sequence< <type scope="com::sun::star::beans">PropertyValue</type> > structure.
75        Follow properties are supported:
76        (But note: not all of them must be present every time!)
77
78        <table border=1>
79            <tr>
80                <td><strong>Property Name</strong></td>
81                <td><strong>Value Type</strong></td>
82                <td><strong>Description</strong></td>
83            </tr>
84            <tr>
85                <td><em>Name</em></td>
86                <td>[string]</td>
87                <td>The internal name is the only value, which makes a container item unique.</td>
88            </tr>
89            <tr>
90                <td><em>UIName</em></td>
91                <td>[string]</td>
92                <td>It contains the localized name for this type for the current locale.</td>
93            </tr>
94            <tr>
95                <td><em>UINames</em></td>
96                <td>[sequence< string >]</td>
97                <td>It contains all available localized names for this type. The are organized
98                    in pairs and represented as a structure of sequence< <type scope="com::sun::star::beans">PropertyValue</type> >.
99                    The name of such property must be interpreted as locale; it's value as the localized
100                    type name corresponding to this locale.</td>
101            </tr>
102            <tr>
103                <td><em>MediaType</em></td>
104                <td>[string]</td>
105                <td>It contains the MIME or content type descriptor. The differences between a MIME type and
106                    an internal type name was made, to resolve existing ambiguities.</td>
107            </tr>
108            <tr>
109                <td><em>ClipboardFormat</em><strong>deprecated!</strong></td>
110                <td>[string]</td>
111                <td>It was interpreted as an identifier inside clipboard.
112                    Please use new property ContentFormat instead of this now.</td>
113            </tr>
114            <tr>
115                <td><em>ContentFormat</em></td>
116                <td>[string]</td>
117                <td>It's and identifier, which is used for a deep format detection.
118                    An <type>ExtendedTypeDetection</type> use this value to match
119                    a given content to this type. e.g. It's interpreted as the doc type
120                    of an XML stream or as an identifier inside a file header.
121                </td>
122            </tr>
123            <tr>
124                <td><em>URLPattern</em></td>
125                <td>[sequence< string >]</td>
126                <td>This list contains different URL patterns, which identify this type.
127                    E.g. data base contents can be described by an new defined protocol like "sql://select*".
128                    In combination with a suitable <type scope="com::sun::star::frame">FrameLoader</type> or
129                    <type>ImportFilter</type>/<type>ExportFilter</type> it woul be possible then, to
130                    layout a sql query output into an office frame.</td>
131            </tr>
132            <tr>
133                <td><em>Extensions</em></td>
134                <td>[sequence< string >]</td>
135                <td>It contains a list of file extensions, which match this type.
136                    They must be specified as pure extension, without any special signs.
137                    E.g.: "doc", "html" ... but not ".doc".
138                    Using of wildcards is allowed but not very useful. The may resulting
139                    ambiguities with other type registrations can't be resolved any time.</td>
140            </tr>
141            <tr>
142                <td><em>DocumentIconID</em></td>
143                <td>[integer]</td>
144                <td>It's an ID, which present the number of a corresponding icon.</td>
145            </tr>
146        </table>
147        </p>
148
149        <p>
150        Note:<br>
151        All elements of this container will be addressed by his internal name,
152        and it must be an unambiguous value.
153        </p>
154     */
155    interface com::sun::star::container::XNameAccess;
156
157    //-------------------------------------------------------------------------
158    /** provides a write access to the configuration data.
159     */
160    [optional] interface com::sun::star::container::XNameContainer;
161
162    //-------------------------------------------------------------------------
163    /** provides search on the configuration data set.
164
165        <p>
166        Against simple property search it provides some complex algorithms too.
167        For further information please read the SDK documentation.
168        </p>
169     */
170    [optional] interface com::sun::star::container::XContainerQuery;
171
172    //-------------------------------------------------------------------------
173    /** can be used to perform container changes.
174
175        <p>
176        Because the complexity of such configuration set can be very high,
177        it does not seem very useful to update the underlying configuration layer
178        on every container change request immediately. Another strategy can be to
179        make all changes (adding/changing/removing of items) and call flush at the end.
180        That will validate the whole container and reject inconsistent data sets.
181        Only in case all made changes was correct, they will be written back to the
182        configuration. Further this interface provides the possibility, that interested
183        changes listener can be registered too.
184        </p>
185     */
186    [optional] interface com::sun::star::util::XFlushable;
187};
188
189//=============================================================================
190
191}; }; }; };
192
193#endif
194