summaryrefslogtreecommitdiff
path: root/offapi/com/sun/star/rdf/XDocumentMetadataAccess.idl
blob: 4a657b2441c1f63a5ff4bc6f9f9bd60ab9fc79ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef __com_sun_star_rdf_XDocumentMetadataAccess_idl__
#define __com_sun_star_rdf_XDocumentMetadataAccess_idl__

#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
#include <com/sun/star/lang/IllegalArgumentException.idl>
#endif

#ifndef __com_sun_star_lang_WrappedTargetException_idl__
#include <com/sun/star/lang/WrappedTargetException.idl>
#endif

#ifndef __com_sun_star_beans_PropertyValue_idl__
#include <com/sun/star/beans/PropertyValue.idl>
#endif

#ifndef __com_sun_star_container_ElementExistException_idl__
#include <com/sun/star/container/ElementExistException.idl>
#endif

#ifndef __com_sun_star_container_NoSuchElementException_idl__
#include <com/sun/star/container/NoSuchElementException.idl>
#endif

#ifndef __com_sun_star_io_IOException_idl__
#include <com/sun/star/io/IOException.idl>
#endif

#ifndef __com_sun_star_io_XInputStream_idl__
#include <com/sun/star/io/XInputStream.idl>
#endif

#ifndef __com_sun_star_datatransfer_UnsupportedFlavorException_idl__
#include <com/sun/star/datatransfer/UnsupportedFlavorException.idl>
#endif

#ifndef __com_sun_star_embed_XStorage_idl__
#include <com/sun/star/embed/XStorage.idl>
#endif

#ifndef __com_sun_star_task_XInteractionHandler_idl__
#include <com/sun/star/task/XInteractionHandler.idl>
#endif

#ifndef __com_sun_star_rdf_FileFormat_idl__
#include <com/sun/star/rdf/FileFormat.idl>
#endif

#ifndef __com_sun_star_rdf_ParseException_idl__
#include <com/sun/star/rdf/ParseException.idl>
#endif

#ifndef __com_sun_star_rdf_XURI_idl__
#include <com/sun/star/rdf/XURI.idl>
#endif

#ifndef __com_sun_star_rdf_XMetadatable_idl__
#include <com/sun/star/rdf/XMetadatable.idl>
#endif

#ifndef __com_sun_star_rdf_XRepositorySupplier_idl__
#include <com/sun/star/rdf/XRepositorySupplier.idl>
#endif


//=============================================================================

module com {   module sun {   module star {   module rdf {

//=============================================================================
/** document metadata functionality related to the "manifest.rdf".

    <p>
    This interface contains some methods that create connections between
    the content and the RDF metadata of an ODF document.
    The main idea is to make querying and manipulating the
    data in the metadata manifest easier.
    </p>

    <p>
    Note that this interface inherits from <type>XURI</type>: the
    base URI of the document is the string value of the RDF node.
    This is so that you can easily make RDF statements about the document.
    </p>

    @since OOo 3.2

    @see XDocumentRepository
 */
interface XDocumentMetadataAccess
{
    interface XURI;
    interface XRepositorySupplier;

    //-------------------------------------------------------------------------
    /** get the unique ODF element with the given metadata reference.

        @param MetadataReference 
            a metadata reference, comprising the stream name and the XML ID
            For example: Pair("content.xml", "foo-element-1")

        @returns
            the ODF element with the given metadata references if it exists,
            else <NULL/>
     */
    XMetadatable getElementByMetadataReference(
        [in] com::sun::star::beans::StringPair MetadataReference);

    //-------------------------------------------------------------------------
    /** get the ODF element that corresponds to an URI.

        @param URI
            an URI that may identify an ODF element

        @returns
            the ODF element that corresponds to the given URI, or <NULL/>

        @throws com::sun::star::lang::IllegalArgumentException
            if the given URI is <NULL/>
     */
    XMetadatable getElementByURI([in] XURI URI)
        raises( com::sun::star::lang::IllegalArgumentException );

    //-------------------------------------------------------------------------
    /** get the names of all metadata files with a given type.

        @param Type
            the <code>rdf:type</code> property of the requested named graphs

        @returns
            the names of all metadata graphs that have a <code>rdf:type</code>
            property with the given Type as object

        @throws com::sun::star::lang::IllegalArgumentException
            if the given Type is <NULL/>
     */
    sequence<XURI> getMetadataGraphsWithType([in] XURI Type)
        raises( com::sun::star::lang::IllegalArgumentException );

    //-------------------------------------------------------------------------
    /** add a metadata file to the manifest.

        <p>
        This convenience method does the following:
        <ul>
        <li>create a new graph with the given name in the repository</li>
        <li>insert statements declaring the new graph to be a
            metadata file into the manifest graph</li>
        <li>insert statements declaring <code>rdf:type</code> properties
            for the new graph into the manifest graph</li>
        </ul>
        </p>

        @param FileName
            the name of the stream in the ODF storage where the graph will
            be stored

        @param Types
            a list of types that will be inserted as <code>rdf:type</code>
            properties for the graph

        @returns
            the name of the new graph

        @throws com::sun::star::lang::IllegalArgumentException
            if the FileName is invalid

        @throws com::sun::star::container::ElementExistException
            if a stream with the given FileName already exists
     */
    XURI addMetadataFile([in] string FileName,
            [in] sequence<XURI> Types )
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::container::ElementExistException );

    //-------------------------------------------------------------------------
    /** import a metadata file into the document repository, and add it to the
        manifest.

        <p>
        This convenience method does the following:
        <li>import the given file into a graph with the given name
            in the repository</li>
        <li>insert statements declaring the new graph to be a
            metadata file into the manifest graph</li>
        <li>insert statements declaring <code>rdf:type</code> properties
            for the new graph into the manifest graph</li>
        </p>

        @param FileName
            the name of the stream in the ODF storage where the graph will
            be stored

        @param BaseURI
            a base URI to resolve relative URI references

        @param Types
            a list of types that will be inserted as <code>rdf:type</code>
            properties for the graph

        @returns
            the name of the new graph

        @throws com::sun::star::lang::IllegalArgumentException
            if the given stream is <NULL/>,
            or BaseURI is <NULL/> and the format requires use of a base URI,
            or the FileName is invalid

        @throws com::sun::star::datatransfer::UnsupportedFlavorException
            if the format requested is unknown or not supported

        @throws com::sun::star::container::ElementExistException
            if a stream with the given FileName already exists

        @throws ParseException
            if the input does not conform to the specified file format.

        @throws com::sun::star::io::IOException
            if an I/O error occurs.

        @see FileFormat
     */
    XURI importMetadataFile( [in] /*FileFormat*/ short Format,
            [in] com::sun::star::io::XInputStream InStream,
            [in] string FileName, [in] XURI BaseURI,
            [in] sequence<XURI> Types )
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::datatransfer::UnsupportedFlavorException,
                com::sun::star::container::ElementExistException,
                ParseException,
                com::sun::star::io::IOException );

    //-------------------------------------------------------------------------
    /** remove a metadata file from the manifest and the repository.

        <p>
        This convenience method does the following:
        <li>delete the graph with the given GraphName in the repository</li>
        <li>remove the statements declaring the graph to be a
            metadata file from the manifest graph</li>
        </p>

        @param GraphName
            the name of the graph that is to be removed

        @throws com::sun::star::lang::IllegalArgumentException
            if the given GraphName is <NULL/>

        @throws com::sun::star::container::NoSuchElementException
            if a graph with the given GraphName does not exist
     */
    void removeMetadataFile([in] XURI GraphName)
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::container::NoSuchElementException );

    //-------------------------------------------------------------------------
    /** add a content or styles file to the manifest.

        <p>
        This convenience method adds the required statements declaring a
        content or styles file to the manifest graph.
        <ul>
        <li>If the FileName ends in "content.xml",
            an <code>odf:ContentFile</code> is added.</li>
        <li>If the FileName ends in "styles.xml" ,
            an <code>odf:StylesFile</code>  is added.</li>
        <li>Other FileNames are invalid.</li>
        </ul>
        </p>

        @param FileName
            the name of the stream in the ODF storage

        @throws com::sun::star::lang::IllegalArgumentException
            if the FileName is invalid

        @throws com::sun::star::container::ElementExistException
            if a stream with the given FileName already exists
     */
    void addContentOrStylesFile([in] string FileName)
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::container::ElementExistException );

    //-------------------------------------------------------------------------
    /** remove a content or styles file from the manifest.

        <p>
        This convenience method removes the statements declaring a
        content or styles file from the manifest graph.
        </p>

        @param FileName
            the name of the stream in the ODF storage

        @throws com::sun::star::lang::IllegalArgumentException
            if the FileName is invalid

        @throws com::sun::star::container::NoSuchElementException
            if a graph with the given GraphName does not exist
     */
    void removeContentOrStylesFile([in] string FileName)
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::container::NoSuchElementException );

    //-------------------------------------------------------------------------
    /** initialize document metadata from a storage.

        <p>
        This method re-initializes the document metadata,
        loads the stream named "manifest.rdf" from the storage, and then
        loads all metadata streams mentioned in the manifest.
        </p>

        <p>
        Note that it is not an error if the storage does not contain
        a manifest.
        In this case, the document metadata will be default initialized.
        </p>

        <p>
        If an InteractionHandler argument is given, it will be used for
        error reporting. Otherwise, errors will be reported as exceptions.
        </p>

        @param Storage
            a storage, representing e.g. an ODF package file, or sub-document

        @param BaseURI
            a base URI to resolve relative URI references
            <p>N.B.: when loading from an ODF package, the base URI is not the
               URI of the package, but the URI of the directory in the package
               that contains the metadata.rdf</p>

        @param InteractionHandler
            an InteractionHandler, used for error reporting

        @throws com::sun::star::lang::IllegalArgumentException
            if any argument is <NULL/>

        @throws com::sun::star::lang::WrappedTargetException
            if an error occurs while loading and no InteractionHandler given
     */
    void loadMetadataFromStorage(
            [in] com::sun::star::embed::XStorage Storage,
            [in] XURI BaseURI,
            [in] com::sun::star::task::XInteractionHandler InteractionHandler )
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::lang::WrappedTargetException );

    //-------------------------------------------------------------------------
    /** store document metadata to a storage.

        <p>
        This method stores all the graphs in the document metadata repository
        to the given storage.
        </p>

        <p>
        Note that to be stored correctly, a named graph must have a complete
        entry in the manifest graph.
        </p>

        @param Storage
            a storage, representing e.g. an ODF package file, or sub-document

        @throws com::sun::star::lang::IllegalArgumentException
            if Storage argument is <NULL/>

        @throws com::sun::star::lang::WrappedTargetException
            if an error occurs while loading
     */
    void storeMetadataToStorage(
            [in] com::sun::star::embed::XStorage Storage )
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::lang::WrappedTargetException );

    //-------------------------------------------------------------------------
    /** loads document metadata from a medium.

        <p>If the Medium contains an InteractionHandler, it will be used for
        error reporting.</p>

        @param Medium
            the <type>com::sun::star::document::MediaDescriptor</type>
            representing the source

        @throws com::sun::star::lang::IllegalArgumentException
            if the argument does not contain a URL or Stream property

        @throws com::sun::star::lang::WrappedTargetException
            if an error occurs while loading

        @see com::sun::star::document::MediaDescriptor
     */
    void loadMetadataFromMedium(
            [in] sequence < com::sun::star::beans::PropertyValue > Medium )
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::lang::WrappedTargetException );

    //-------------------------------------------------------------------------
    /** stores document metadata to a medium.

        @param Medium
            the <type>com::sun::star::document::MediaDescriptor</type>
            representing the target

        @throws com::sun::star::lang::IllegalArgumentException
            if the argument does not contain a URL or Stream property

        @throws com::sun::star::lang::WrappedTargetException
            if an error occurs while storing

        @see com::sun::star::document::MediaDescriptor
     */
    void storeMetadataToMedium(
            [in] sequence < com::sun::star::beans::PropertyValue > Medium )
        raises( com::sun::star::lang::IllegalArgumentException,
                com::sun::star::lang::WrappedTargetException );

};

//=============================================================================

}; }; }; };

#endif