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: XStorage.idl,v $
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 ************************************************************************/
30 #ifndef __com_sun_star_embed_XStorage_idl__
31 #define __com_sun_star_embed_XStorage_idl__
33 #ifndef __com_sun_star_uno_XInterface_idl__
34 #include
<com
/sun
/star
/uno
/XInterface.idl
>
37 #ifndef __com_sun_star_io_XStream_idl__
38 #include
<com
/sun
/star
/io
/XStream.idl
>
41 #ifndef __com_sun_star_io_XInputStream_idl__
42 #include
<com
/sun
/star
/io
/XInputStream.idl
>
45 #ifndef __com_sun_star_io_IOException_idl__
46 #include
<com
/sun
/star
/io
/IOException.idl
>
49 #ifndef __com_sun_star_lang_XComponent_idl__
50 #include
<com
/sun
/star
/lang
/XComponent.idl
>
53 #ifndef __com_sun_star_lang_IllegalArgumentException_idl__
54 #include
<com
/sun
/star
/lang
/IllegalArgumentException.idl
>
57 #ifndef __com_sun_star_embed_StorageWrappedTargetException_idl__
58 #include
<com
/sun
/star
/embed
/StorageWrappedTargetException.idl
>
61 #ifndef __com_sun_star_embed_InvalidStorageException_idl__
62 #include
<com
/sun
/star
/embed
/InvalidStorageException.idl
>
65 #ifndef __com_sun_star_packages_WrongPasswordException_idl__
66 #include
<com
/sun
/star
/packages
/WrongPasswordException.idl
>
69 #ifndef __com_sun_star_container_XNameAccess_idl__
70 #include
<com
/sun
/star
/container
/XNameAccess.idl
>
73 #ifndef __com_sun_star_container_NoSuchElementException_idl__
74 #include
<com
/sun
/star
/container
/NoSuchElementException.idl
>
77 #ifndef __com_sun_star_container_ElementExistException_idl__
78 #include
<com
/sun
/star
/container
/ElementExistException.idl
>
81 #ifndef __com_sun_star_packages_NoEncryptionException_idl__
82 #include
<com
/sun
/star
/packages
/NoEncryptionException.idl
>
85 #ifndef __com_sun_star_packages_NoRawFormatException_idl__
86 #include
<com
/sun
/star
/packages
/NoRawFormatException.idl
>
90 //============================================================================
92 module com
{ module sun
{ module star
{ module embed
{
94 //============================================================================
95 /** This interface represents main storage functionality.
101 // -----------------------------------------------------------------------
102 /** allows to get list of child elements and to check if an element with a
103 specified name exists in a storage.
106 It is also possible to use this interface to get read access to
108 <method scope="com::sun::star::container">XNameAccess::getByName</method>
109 call. But the recommended way is to use <type>XStorage</type>
110 interface for this purpose.
113 interface ::com
::sun
::star
::container
::XNameAccess
;
115 // -----------------------------------------------------------------------
116 /** allows to controll and track lifetime of the storage.
119 In case a storage is disposed any call to it's methods should result
120 in <type scope="com::sun::star::lang">DisposedException</type>.
123 interface ::com
::sun
::star
::lang
::XComponent
;
128 // -----------------------------------------------------------------------
129 /** allows to copy current storage to another one
132 The destination storage contents are overwritten.
133 After the successful copying the target storage is automatically
134 commited if it implements transacted access.
138 a destination storage this storage must be copied to.
140 @throws ::com::sun::star::embed::InvalidStorageException
141 this storage is in invalid state for any reason
143 @throws ::com::sun::star::lang::IllegalArgumentException
144 an illegal argument is provided
146 @throws ::com::sun::star::io::IOException
147 in case of io errors during copying
149 @throws ::com::sun::star::embed::StorageWrappedTargetException
150 wraps other exception acquired during copying
152 void copyToStorage
( [in] XStorage xDest
)
153 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
154 ::com
::sun
::star
::lang
::IllegalArgumentException
,
155 ::com
::sun
::star
::io
::IOException
,
156 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
158 // -----------------------------------------------------------------------
159 /** allows to get access to a child stream of the storage.
162 In case the stream is open in readonly mode the
163 <method scope="com::sun::star::io">XStream::getOutputStream</method>
164 method will return an empty reference.
168 the name of the substream that should be open
171 a mode the stream should be open in,
172 can be a combination of <type>ElementModes</type> values
174 @throws ::com::sun::star::embed::InvalidStorageException
175 this storage is in invalid state for any reason
177 @throws ::com::sun::star::lang::IllegalArgumentException
178 one of provided arguments is illegal
180 @throws ::com::sun::star::packages::WrongPasswordException
181 the provided password is wrong
183 @throws ::com::sun::star::io::IOException
184 in case of io errors during stream opening
186 @throws ::com::sun::star::embed::StorageWrappedTargetException
187 wraps other exceptions
189 ::com
::sun
::star
::io
::XStream openStreamElement
(
190 [in] string sStreamName
,
191 [in] long nOpenMode
)
192 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
193 ::com
::sun
::star
::lang
::IllegalArgumentException
,
194 ::com
::sun
::star
::packages
::WrongPasswordException
,
195 ::com
::sun
::star
::io
::IOException
,
196 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
198 // -----------------------------------------------------------------------
199 /** allows to get access to a child encrypted stream with password.
202 If storage does not allow any encryption this method will always throw
203 <type scope="com::sun::star::packages">NoEncryptionException</type>.
207 In case the stream is open in readonly mode the
208 <method scope="com::sun::star::io">XStream::getOutputStream</method>
209 method will return an empty reference.
213 the name of the substream that should be open
216 a mode the stream should be open in,
217 can be a combination of <type>ElementModes</type> values
220 this parameter allowes to specify a reading password for the
221 stream, the password must be a correct one, otherwise an
222 exception will be thrown
224 @throws ::com::sun::star::embed::InvalidStorageException
225 this storage is in invalid state for any reason
227 @throws ::com::sun::star::lang::IllegalArgumentException
228 one of provided arguments is illegal
230 @throws ::com::sun::star::packages::NoEncryptionException
231 the stream is not encrypted
233 @throws ::com::sun::star::packages::WrongPasswordException
234 the provided password is wrong
236 @throws ::com::sun::star::io::IOException
237 in case of io errors during stream opening
239 @throws ::com::sun::star::embed::StorageWrappedTargetException
240 wraps other exceptions
242 ::com
::sun
::star
::io
::XStream openEncryptedStreamElement
(
243 [in] string sStreamName
,
245 [in] string sPassword
)
246 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
247 ::com
::sun
::star
::lang
::IllegalArgumentException
,
248 ::com
::sun
::star
::packages
::NoEncryptionException
,
249 ::com
::sun
::star
::packages
::WrongPasswordException
,
250 ::com
::sun
::star
::io
::IOException
,
251 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
253 // -----------------------------------------------------------------------
254 /** allows to get access to a child storage.
257 The opened substorage must support specified in 'nOpenMode' access
258 modes. It can support 'read' mode in addition. But any child element
259 can support one of those modes only in case this mode is supported by
264 the name of the storage that should be open
267 a mode the storage should be open in
269 @throws ::com::sun::star::embed::InvalidStorageException
270 this storage is in invalid state for any reason
272 @throws ::com::sun::star::lang::IllegalArgumentException
273 one of provided arguments is illegal
275 @throws ::com::sun::star::io::IOException
276 in case of io errors during stream opening
278 @throws ::com::sun::star::embed::StorageWrappedTargetException
279 wraps other exceptions
282 XStorage openStorageElement
( [in] string sStorName
,
283 [in] long nOpenMode
)
284 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
285 ::com
::sun
::star
::lang
::IllegalArgumentException
,
286 ::com
::sun
::star
::io
::IOException
,
287 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
289 // -----------------------------------------------------------------------
290 /** allows to get readonly copy of a child stream of the storage.
293 The stream is open in readonly mode so the
294 <method scope="com::sun::star::io">XStream::getOutputStream</method>
295 method will return an empty reference.
299 the name of the substream that should be copied
301 @throws ::com::sun::star::embed::InvalidStorageException
302 this storage is in invalid state for any reason
304 @throws ::com::sun::star::lang::IllegalArgumentException
305 one of provided arguments is illegal
307 @throws ::com::sun::star::packages::WrongPasswordException
308 the provided password is wrong
310 @throws ::com::sun::star::io::IOException
311 in case of io errors during stream opening
313 @throws ::com::sun::star::embed::StorageWrappedTargetException
314 wraps other exceptions
316 ::com
::sun
::star
::io
::XStream cloneStreamElement
( [in] string sStreamName
)
317 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
318 ::com
::sun
::star
::lang
::IllegalArgumentException
,
319 ::com
::sun
::star
::packages
::WrongPasswordException
,
320 ::com
::sun
::star
::io
::IOException
,
321 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
323 // -----------------------------------------------------------------------
324 /** allows to get readonly copy of a child encrypted stream with password.
327 If storage does not allow any encryption this method will always throw
328 <type scope="com::sun::star::packages">NoEncryptionException</type>.
332 The stream is open in readonly mode so the
333 <method scope="com::sun::star::io">XStream::getOutputStream</method>
334 method will return an empty reference.
338 This method allows to specify reading password for the child stream
343 the name of the substream that should be copied
346 this parameter allowes to specify a reading password for the
347 stream, the password must be a correct one, otherwise an
348 exception will be thrown
350 @throws ::com::sun::star::embed::InvalidStorageException
351 this storage is in invalid state for any reason
353 @throws ::com::sun::star::lang::IllegalArgumentException
354 one of provided arguments is illegal
356 @throws ::com::sun::star::packages::NoEncryptionException
357 the stream is not encrypted
359 @throws ::com::sun::star::packages::WrongPasswordException
360 the provided password is wrong
362 @throws ::com::sun::star::io::IOException
363 in case of io errors during stream opening
365 @throws ::com::sun::star::embed::StorageWrappedTargetException
366 wraps other exceptions
368 ::com
::sun
::star
::io
::XStream cloneEncryptedStreamElement
(
369 [in] string sStreamName
,
370 [in] string sPassword
)
371 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
372 ::com
::sun
::star
::lang
::IllegalArgumentException
,
373 ::com
::sun
::star
::packages
::NoEncryptionException
,
374 ::com
::sun
::star
::packages
::WrongPasswordException
,
375 ::com
::sun
::star
::io
::IOException
,
376 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
378 // -----------------------------------------------------------------------
379 /** allows to get copy of this storage at the state of it's last commit.
382 This method makes sence only for services implementations that allow
383 transaction in the storage.
387 the target storage that will be filled in with copy.
389 @throws ::com::sun::star::embed::InvalidStorageException
390 this storage is in invalid state for any reason
392 @throws ::com::sun::star::lang::IllegalArgumentException
393 one of provided arguments is illegal
395 @throws ::com::sun::star::io::IOException
396 in case of io errors during copying
398 @throws ::com::sun::star::embed::StorageWrappedTargetException
399 wraps other exceptions
402 void copyLastCommitTo
( [in] XStorage xTargetStorage
)
403 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
404 ::com
::sun
::star
::lang
::IllegalArgumentException
,
405 ::com
::sun
::star
::io
::IOException
,
406 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
408 // -----------------------------------------------------------------------
409 /** allows to get copy of a child storage at the state of it's last commit.
412 This method makes sence only for services implementations that allow
413 transaction in the storage.
417 the name of the storage that should be copied
420 the target storage that will be filled in with copy
422 @throws ::com::sun::star::embed::InvalidStorageException
423 this storage is in invalid state for any reason
425 @throws ::com::sun::star::lang::IllegalArgumentException
426 one of provided arguments is illegal
428 @throws ::com::sun::star::io::IOException
429 in case of io errors during copying
431 @throws ::com::sun::star::embed::StorageWrappedTargetException
432 wraps other exceptions
435 void copyStorageElementLastCommitTo
(
436 [in] string sStorName
,
437 [in] XStorage xTargetStorage
)
438 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
439 ::com
::sun
::star
::lang
::IllegalArgumentException
,
440 ::com
::sun
::star
::io
::IOException
,
441 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
443 // -----------------------------------------------------------------------
444 /** allows to check if an element is a child stream with specified name.
447 In case there is no child element with such name an exception will be
452 the name of the element to check
455 <TRUE/> in case the element is a stream
456 <FALSE/> - the element is a storage
458 @throws ::com::sun::star::container::NoSuchElementException
459 there is no element with such name
461 @throws ::com::sun::star::lang::IllegalArgumentException
462 an illegal argument is provided
464 @throws ::com::sun::star::embed::InvalidStorageException
465 this storage is in invalid state for any reason
468 boolean isStreamElement
( [in] string sElementName
)
469 raises
( ::com
::sun
::star
::container
::NoSuchElementException
,
470 ::com
::sun
::star
::lang
::IllegalArgumentException
,
471 ::com
::sun
::star
::embed
::InvalidStorageException
);
474 // -----------------------------------------------------------------------
475 /** allows to check if an element is a child storage with specified name.
478 In case there is no child element with such name an exception will be
483 the name of the element to check
486 <TRUE/> in case the element is a storage
487 <FALSE/> - the element is a stream
489 @throws ::com::sun::star::container::NoSuchElementException
490 there is no element with such name
492 @throws ::com::sun::star::lang::IllegalArgumentException
493 an illegal argument is provided
495 @throws ::com::sun::star::embed::InvalidStorageException
496 this storage is in invalid state for any reason
499 boolean isStorageElement
( [in] string sElementName
)
500 raises
( ::com
::sun
::star
::container
::NoSuchElementException
,
501 ::com
::sun
::star
::lang
::IllegalArgumentException
,
502 ::com
::sun
::star
::embed
::InvalidStorageException
);
504 // -----------------------------------------------------------------------
505 /** removes an element from a storage.
508 the name of the element to remove
510 @throws ::com::sun::star::embed::InvalidStorageException
511 this storage is in invalid state for eny reason
513 @throws ::com::sun::star::lang::IllegalArgumentException
514 an illegal argument is provided
516 @throws ::com::sun::star::container::NoSuchElementException
517 there is no element with such name
519 @throws ::com::sun::star::io::IOException
520 in case of io errors during removing
522 @throws ::com::sun::star::embed::StorageWrappedTargetException
523 wraps other exceptions
526 void removeElement
( [in] string sElementName
)
527 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
528 ::com
::sun
::star
::lang
::IllegalArgumentException
,
529 ::com
::sun
::star
::container
::NoSuchElementException
,
530 ::com
::sun
::star
::io
::IOException
,
531 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
533 // -----------------------------------------------------------------------
534 /** renames an element in a storage.
537 the old name of the element to rename
540 the new name of the element to rename
542 @throws ::com::sun::star::embed::InvalidStorageException
543 this storage is in invalid state for eny reason
545 @throws ::com::sun::star::lang::IllegalArgumentException
546 an illegal argument is provided
548 @throws ::com::sun::star::container::NoSuchElementException
549 there is no element with old name in this storage
551 @throws ::com::sun::star::container::ElementExistException
552 an element with new name already exists in this storage
554 @throws ::com::sun::star::io::IOException
555 in case of io errors during renaming
557 @throws ::com::sun::star::embed::StorageWrappedTargetException
558 wraps other exceptions
561 void renameElement
( [in] string sElementName
, [in] string sNewName
)
562 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
563 ::com
::sun
::star
::lang
::IllegalArgumentException
,
564 ::com
::sun
::star
::container
::NoSuchElementException
,
565 ::com
::sun
::star
::container
::ElementExistException
,
566 ::com
::sun
::star
::io
::IOException
,
567 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
569 // -----------------------------------------------------------------------
570 /** allows to copy an entry from one storage to another.
573 If target element supports transacted mode it must be commited by this
574 method after successful copying.
578 the name of the element in this storage
581 a destination storage
584 the name of the result element in destination storage
586 @throws ::com::sun::star::embed::InvalidStorageException
587 this storage is in invalid state for eny reason
589 @throws ::com::sun::star::container::NoSuchElementException
590 there is no specified source element in this storage
592 @throws ::com::sun::star::container::ElementExistException
593 an element with specified destination name already exists in destination storage
595 @throws ::com::sun::star::io::IOException
596 in case of io errors during copying
598 @throws ::com::sun::star::embed::StorageWrappedTargetException
599 wraps other exceptions
603 [in] string sElementName
,
605 [in] string sNewName
)
606 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
607 ::com
::sun
::star
::lang
::IllegalArgumentException
,
608 ::com
::sun
::star
::container
::NoSuchElementException
,
609 ::com
::sun
::star
::container
::ElementExistException
,
610 ::com
::sun
::star
::io
::IOException
,
611 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
613 // -----------------------------------------------------------------------
614 /** allows to move an entry from one storage to another.
617 If target element supports transacted mode it must be commited by this
618 method after successful moving.
622 the name of the element in this storage
625 a destination storage
628 the name of the result element in destination storage
630 @throws ::com::sun::star::embed::InvalidStorageException
631 this storage is in invalid state for eny reason
633 @throws ::com::sun::star::container::NoSuchElementException
634 there is no specified source element in this storage
636 @throws ::com::sun::star::container::ElementExistException
637 an element with specified destination name already exists in destination storage
639 @throws ::com::sun::star::io::IOException
640 in case of io errors during moving
642 @throws ::com::sun::star::embed::StorageWrappedTargetException
643 wraps other exceptions
647 [in] string sElementName
,
649 [in] string sNewName
)
650 raises
( ::com
::sun
::star
::embed
::InvalidStorageException
,
651 ::com
::sun
::star
::lang
::IllegalArgumentException
,
652 ::com
::sun
::star
::container
::NoSuchElementException
,
653 ::com
::sun
::star
::container
::ElementExistException
,
654 ::com
::sun
::star
::io
::IOException
,
655 ::com
::sun
::star
::embed
::StorageWrappedTargetException
);
659 //============================================================================