merge the formfield patch from ooo-build
[ooovba.git] / offapi / com / sun / star / rdf / XDocumentMetadataAccess.idl
blob7196a3ac59d6a60a5823471b2f5f8d4f82d1e073
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XDocumentMetadataAccess.idl,v $
10 * $Revision: 1.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __com_sun_star_rdf_XDocumentMetadataAccess_idl__
32 #define __com_sun_star_rdf_XDocumentMetadataAccess_idl__
34 #ifndef __com_sun_star_lang_IllegalArgumentException_idl__
35 #include <com/sun/star/lang/IllegalArgumentException.idl>
36 #endif
38 #ifndef __com_sun_star_lang_WrappedTargetException_idl__
39 #include <com/sun/star/lang/WrappedTargetException.idl>
40 #endif
42 #ifndef __com_sun_star_beans_PropertyValue_idl__
43 #include <com/sun/star/beans/PropertyValue.idl>
44 #endif
46 #ifndef __com_sun_star_container_ElementExistException_idl__
47 #include <com/sun/star/container/ElementExistException.idl>
48 #endif
50 #ifndef __com_sun_star_container_NoSuchElementException_idl__
51 #include <com/sun/star/container/NoSuchElementException.idl>
52 #endif
54 #ifndef __com_sun_star_io_IOException_idl__
55 #include <com/sun/star/io/IOException.idl>
56 #endif
58 #ifndef __com_sun_star_io_XInputStream_idl__
59 #include <com/sun/star/io/XInputStream.idl>
60 #endif
62 #ifndef __com_sun_star_datatransfer_UnsupportedFlavorException_idl__
63 #include <com/sun/star/datatransfer/UnsupportedFlavorException.idl>
64 #endif
66 #ifndef __com_sun_star_embed_XStorage_idl__
67 #include <com/sun/star/embed/XStorage.idl>
68 #endif
70 #ifndef __com_sun_star_task_XInteractionHandler_idl__
71 #include <com/sun/star/task/XInteractionHandler.idl>
72 #endif
74 #ifndef __com_sun_star_rdf_FileFormat_idl__
75 #include <com/sun/star/rdf/FileFormat.idl>
76 #endif
78 #ifndef __com_sun_star_rdf_ParseException_idl__
79 #include <com/sun/star/rdf/ParseException.idl>
80 #endif
82 #ifndef __com_sun_star_rdf_XURI_idl__
83 #include <com/sun/star/rdf/XURI.idl>
84 #endif
86 #ifndef __com_sun_star_rdf_XMetadatable_idl__
87 #include <com/sun/star/rdf/XMetadatable.idl>
88 #endif
90 #ifndef __com_sun_star_rdf_XRepositorySupplier_idl__
91 #include <com/sun/star/rdf/XRepositorySupplier.idl>
92 #endif
95 //=============================================================================
97 module com { module sun { module star { module rdf {
99 //=============================================================================
100 /** document metadata functionality related to the "manifest.rdf".
103 This interface contains some methods that create connections between
104 the content and the RDF metadata of an ODF document.
105 The main idea is to make querying and manipulating the
106 data in the metadata manifest easier.
107 </p>
110 Note that this interface inherits from <type>XURI</type>: the
111 base URI of the document is the string value of the RDF node.
112 This is so that you can easily make RDF statements about the document.
113 </p>
115 @since OOo 3.2
117 @see XDocumentRepository
119 interface XDocumentMetadataAccess
121 interface XURI;
122 interface XRepositorySupplier;
124 //-------------------------------------------------------------------------
125 /** get the unique ODF element with the given metadata reference.
127 @param MetadataReference
128 a metadata reference, comprising the stream name and the XML ID
129 For example: Pair("content.xml", "foo-element-1")
131 @returns
132 the ODF element with the given metadata references if it exists,
133 else <NULL/>
135 XMetadatable getElementByMetadataReference(
136 [in] com::sun::star::beans::StringPair MetadataReference);
138 //-------------------------------------------------------------------------
139 /** get the ODF element that corresponds to an URI.
141 @param URI
142 an URI that may identify an ODF element
144 @returns
145 the ODF element that corresponds to the given URI, or <NULL/>
147 @throws com::sun::star::lang::IllegalArgumentException
148 if the given URI is <NULL/>
150 XMetadatable getElementByURI([in] XURI URI)
151 raises( com::sun::star::lang::IllegalArgumentException );
153 //-------------------------------------------------------------------------
154 /** get the names of all metadata files with a given type.
156 @param Type
157 the <code>rdf:type</code> property of the requested named graphs
159 @returns
160 the names of all metadata graphs that have a <code>rdf:type</code>
161 property with the given Type as object
163 @throws com::sun::star::lang::IllegalArgumentException
164 if the given Type is <NULL/>
166 sequence<XURI> getMetadataGraphsWithType([in] XURI Type)
167 raises( com::sun::star::lang::IllegalArgumentException );
169 //-------------------------------------------------------------------------
170 /** add a metadata file to the manifest.
173 This convenience method does the following:
174 <ul>
175 <li>create a new graph with the given name in the repository</li>
176 <li>insert statements declaring the new graph to be a
177 metadata file into the manifest graph</li>
178 <li>insert statements declaring <code>rdf:type</code> properties
179 for the new graph into the manifest graph</li>
180 </ul>
181 </p>
183 @param FileName
184 the name of the stream in the ODF storage where the graph will
185 be stored
187 @param Types
188 a list of types that will be inserted as <code>rdf:type</code>
189 properties for the graph
191 @returns
192 the name of the new graph
194 @throws com::sun::star::lang::IllegalArgumentException
195 if the FileName is invalid
197 @throws com::sun::star::container::ElementExistException
198 if a stream with the given FileName already exists
200 XURI addMetadataFile([in] string FileName,
201 [in] sequence<XURI> Types )
202 raises( com::sun::star::lang::IllegalArgumentException,
203 com::sun::star::container::ElementExistException );
205 //-------------------------------------------------------------------------
206 /** import a metadata file into the document repository, and add it to the
207 manifest.
210 This convenience method does the following:
211 <li>import the given file into a graph with the given name
212 in the repository</li>
213 <li>insert statements declaring the new graph to be a
214 metadata file into the manifest graph</li>
215 <li>insert statements declaring <code>rdf:type</code> properties
216 for the new graph into the manifest graph</li>
217 </p>
219 @param FileName
220 the name of the stream in the ODF storage where the graph will
221 be stored
223 @param BaseURI
224 a base URI to resolve relative URI references
226 @param Types
227 a list of types that will be inserted as <code>rdf:type</code>
228 properties for the graph
230 @returns
231 the name of the new graph
233 @throws com::sun::star::lang::IllegalArgumentException
234 if the given stream is <NULL/>,
235 or BaseURI is <NULL/> and the format requires use of a base URI,
236 or the FileName is invalid
238 @throws com::sun::star::datatransfer::UnsupportedFlavorException
239 if the format requested is unknown or not supported
241 @throws com::sun::star::container::ElementExistException
242 if a stream with the given FileName already exists
244 @throws ParseException
245 if the input does not conform to the specified file format.
247 @throws com::sun::star::io::IOException
248 if an I/O error occurs.
250 @see FileFormat
252 XURI importMetadataFile( [in] /*FileFormat*/ short Format,
253 [in] com::sun::star::io::XInputStream InStream,
254 [in] string FileName, [in] XURI BaseURI,
255 [in] sequence<XURI> Types )
256 raises( com::sun::star::lang::IllegalArgumentException,
257 com::sun::star::datatransfer::UnsupportedFlavorException,
258 com::sun::star::container::ElementExistException,
259 ParseException,
260 com::sun::star::io::IOException );
262 //-------------------------------------------------------------------------
263 /** remove a metadata file from the manifest and the repository.
266 This convenience method does the following:
267 <li>delete the graph with the given GraphName in the repository</li>
268 <li>remove the statements declaring the graph to be a
269 metadata file from the manifest graph</li>
270 </p>
272 @param GraphName
273 the name of the graph that is to be removed
275 @throws com::sun::star::lang::IllegalArgumentException
276 if the given GraphName is <NULL/>
278 @throws com::sun::star::container::NoSuchElementException
279 if a graph with the given GraphName does not exist
281 void removeMetadataFile([in] XURI GraphName)
282 raises( com::sun::star::lang::IllegalArgumentException,
283 com::sun::star::container::NoSuchElementException );
285 //-------------------------------------------------------------------------
286 /** add a content or styles file to the manifest.
289 This convenience method adds the required statements declaring a
290 content or styles file to the manifest graph.
291 <ul>
292 <li>If the FileName ends in "content.xml",
293 an <code>odf:ContentFile</code> is added.</li>
294 <li>If the FileName ends in "styles.xml" ,
295 an <code>odf:StylesFile</code> is added.</li>
296 <li>Other FileNames are invalid.</li>
297 </ul>
298 </p>
300 @param FileName
301 the name of the stream in the ODF storage
303 @throws com::sun::star::lang::IllegalArgumentException
304 if the FileName is invalid
306 @throws com::sun::star::container::ElementExistException
307 if a stream with the given FileName already exists
309 void addContentOrStylesFile([in] string FileName)
310 raises( com::sun::star::lang::IllegalArgumentException,
311 com::sun::star::container::ElementExistException );
313 //-------------------------------------------------------------------------
314 /** remove a content or styles file from the manifest.
317 This convenience method removes the statements declaring a
318 content or styles file from the manifest graph.
319 </p>
321 @param FileName
322 the name of the stream in the ODF storage
324 @throws com::sun::star::lang::IllegalArgumentException
325 if the FileName is invalid
327 @throws com::sun::star::container::NoSuchElementException
328 if a graph with the given GraphName does not exist
330 void removeContentOrStylesFile([in] string FileName)
331 raises( com::sun::star::lang::IllegalArgumentException,
332 com::sun::star::container::NoSuchElementException );
334 //-------------------------------------------------------------------------
335 /** initialize document metadata from a storage.
338 This method re-initializes the document metadata,
339 loads the stream named "manifest.rdf" from the storage, and then
340 loads all metadata streams mentioned in the manifest.
341 </p>
344 Note that it is not an error if the storage does not contain
345 a manifest.
346 In this case, the document metadata will be default initialized.
347 </p>
350 If an InteractionHandler argument is given, it will be used for
351 error reporting. Otherwise, errors will be reported as exceptions.
352 </p>
354 @param Storage
355 a storage, representing e.g. an ODF package file, or sub-document
357 @param BaseURI
358 a base URI to resolve relative URI references
359 <p>N.B.: when loading from an ODF package, the base URI is not the
360 URI of the package, but the URI of the directory in the package
361 that contains the metadata.rdf</p>
363 @param InteractionHandler
364 an InteractionHandler, used for error reporting
366 @throws com::sun::star::lang::IllegalArgumentException
367 if any argument is <NULL/>
369 @throws com::sun::star::lang::WrappedTargetException
370 if an error occurs while loading and no InteractionHandler given
372 void loadMetadataFromStorage(
373 [in] com::sun::star::embed::XStorage Storage,
374 [in] XURI BaseURI,
375 [in] com::sun::star::task::XInteractionHandler InteractionHandler )
376 raises( com::sun::star::lang::IllegalArgumentException,
377 com::sun::star::lang::WrappedTargetException );
379 //-------------------------------------------------------------------------
380 /** store document metadata to a storage.
383 This method stores all the graphs in the document metadata repository
384 to the given storage.
385 </p>
388 Note that to be stored correctly, a named graph must have a complete
389 entry in the manifest graph.
390 </p>
392 @param Storage
393 a storage, representing e.g. an ODF package file, or sub-document
395 @throws com::sun::star::lang::IllegalArgumentException
396 if Storage argument is <NULL/>
398 @throws com::sun::star::lang::WrappedTargetException
399 if an error occurs while loading
401 void storeMetadataToStorage(
402 [in] com::sun::star::embed::XStorage Storage )
403 raises( com::sun::star::lang::IllegalArgumentException,
404 com::sun::star::lang::WrappedTargetException );
406 //-------------------------------------------------------------------------
407 /** loads document metadata from a medium.
409 <p>If the Medium contains an InteractionHandler, it will be used for
410 error reporting.</p>
412 @param Medium
413 the <type>com::sun::star::document::MediaDescriptor</type>
414 representing the source
416 @throws com::sun::star::lang::IllegalArgumentException
417 if the argument does not contain a URL or Stream property
419 @throws com::sun::star::lang::WrappedTargetException
420 if an error occurs while loading
422 @see com::sun::star::document::MediaDescriptor
424 void loadMetadataFromMedium(
425 [in] sequence < com::sun::star::beans::PropertyValue > Medium )
426 raises( com::sun::star::lang::IllegalArgumentException,
427 com::sun::star::lang::WrappedTargetException );
429 //-------------------------------------------------------------------------
430 /** stores document metadata to a medium.
432 @param Medium
433 the <type>com::sun::star::document::MediaDescriptor</type>
434 representing the target
436 @throws com::sun::star::lang::IllegalArgumentException
437 if the argument does not contain a URL or Stream property
439 @throws com::sun::star::lang::WrappedTargetException
440 if an error occurs while storing
442 @see com::sun::star::document::MediaDescriptor
444 void storeMetadataToMedium(
445 [in] sequence < com::sun::star::beans::PropertyValue > Medium )
446 raises( com::sun::star::lang::IllegalArgumentException,
447 com::sun::star::lang::WrappedTargetException );
451 //=============================================================================
453 }; }; }; };
455 #endif