1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_embed_XOptimizedStorage_idl__
28#define __com_sun_star_embed_XOptimizedStorage_idl__
29
30#ifndef __com_sun_star_uno_XInterface_idl__
31#include <com/sun/star/uno/XInterface.idl>
32#endif
33
34#ifndef __com_sun_star_io_XStream_idl__
35#include <com/sun/star/io/XStream.idl>
36#endif
37
38#ifndef __com_sun_star_io_XInputStream_idl__
39#include <com/sun/star/io/XInputStream.idl>
40#endif
41
42#ifndef __com_sun_star_io_IOException_idl__
43#include <com/sun/star/io/IOException.idl>
44#endif
45
46#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
47#include <com/sun/star/lang/IllegalArgumentException.idl>
48#endif
49
50#ifndef __com_sun_star_embed_StorageWrappedTargetException_idl__
51#include <com/sun/star/embed/StorageWrappedTargetException.idl>
52#endif
53
54#ifndef __com_sun_star_embed_InvalidStorageException_idl__
55#include <com/sun/star/embed/InvalidStorageException.idl>
56#endif
57
58#ifndef __com_sun_star_container_NoSuchElementException_idl__
59#include <com/sun/star/container/NoSuchElementException.idl>
60#endif
61
62#ifndef __com_sun_star_container_ElementExistException_idl__
63#include <com/sun/star/container/ElementExistException.idl>
64#endif
65
66#ifndef __com_sun_star_packages_EncryptionNotAllowedException_idl__
67#include <com/sun/star/packages/EncryptionNotAllowedException.idl>
68#endif
69
70#ifndef __com_sun_star_packages_NoRawFormatException_idl__
71#include <com/sun/star/packages/NoRawFormatException.idl>
72#endif
73
74#ifndef __com_sun_star_packages_WrongPasswordException_idl__
75#include <com/sun/star/packages/WrongPasswordException.idl>
76#endif
77
78#ifndef __com_sun_star_beans_PropertyValue_idl__
79#include <com/sun/star/beans/PropertyValue.idl>
80#endif
81
82#ifndef __com_sun_star_beans_UnknownPropertyException_idl__
83#include <com/sun/star/beans/UnknownPropertyException.idl>
84#endif
85
86#ifndef __com_sun_star_beans_PropertyVetoException_idl__
87#include <com/sun/star/beans/PropertyVetoException.idl>
88#endif
89
90//============================================================================
91
92 module com {  module sun {  module star {  module embed {
93
94//============================================================================
95/** This is a temporary interface that is introduced to temporarily optimize
96	the document storing process. PLEASE DO NOT USE IT, it might change in any
97	time and will be depricated soon!
98	Another solution will be introduced as final one.
99 */
100published interface XOptimizedStorage
101{
102	// -----------------------------------------------------------------------
103	/** allows to insert a raw stream representing nonencrypted stream with
104		header.
105	 */
106    void insertRawNonEncrStreamElementDirect(
107			[in] string sStreamName,
108			[in] ::com::sun::star::io::XInputStream xInStream )
109		raises( ::com::sun::star::embed::InvalidStorageException,
110				::com::sun::star::lang::IllegalArgumentException,
111				::com::sun::star::packages::NoRawFormatException,
112				::com::sun::star::container::ElementExistException,
113				::com::sun::star::io::IOException,
114				::com::sun::star::embed::StorageWrappedTargetException );
115
116	// -----------------------------------------------------------------------
117	/** allows to insert a stream to the storage directly. The stream must
118		stay alive till the storage is commited.
119	 */
120    void insertStreamElementDirect(
121			[in] string sStreamName,
122			[in] ::com::sun::star::io::XInputStream xInStream,
123			[in] sequence < ::com::sun::star::beans::PropertyValue > aProperties )
124		raises( ::com::sun::star::embed::InvalidStorageException,
125				::com::sun::star::lang::IllegalArgumentException,
126				::com::sun::star::container::ElementExistException,
127				::com::sun::star::io::IOException,
128				::com::sun::star::embed::StorageWrappedTargetException );
129
130	// -----------------------------------------------------------------------
131	/** allows to copy storage element directly, not guarantied to work.
132	 */
133	void copyElementDirectlyTo(
134			[in] string sSourceName,
135			[in] ::com::sun::star::embed::XOptimizedStorage xTargetStorage,
136			[in] string sTargetName )
137		raises( ::com::sun::star::embed::InvalidStorageException,
138				::com::sun::star::lang::IllegalArgumentException,
139				::com::sun::star::container::NoSuchElementException,
140				::com::sun::star::container::ElementExistException,
141				::com::sun::star::io::IOException,
142				::com::sun::star::embed::StorageWrappedTargetException );
143
144	// -----------------------------------------------------------------------
145	/** allows to switch storage persistence to the provided stream. The stream
146		will be filled by the storage. If an empty reference is provided, the
147		storage will create a temporary stream to switch to itself.
148		It is applicable only for root storages.
149	 */
150	void writeAndAttachToStream(
151			[in] ::com::sun::star::io::XStream xStream )
152		raises( ::com::sun::star::embed::InvalidStorageException,
153				::com::sun::star::lang::IllegalArgumentException,
154				::com::sun::star::io::IOException,
155				::com::sun::star::embed::StorageWrappedTargetException );
156
157	// -----------------------------------------------------------------------
158	/** allows to switch storage persistence to the provided URL. The caller is
159		responsible to be sure that the file referenced by the URL contains the
160		same contents as the stream the storage is based currently. Thus using
161		of this method is very dangerous and should be avoided when possible.
162		It is applicable only for root storages.
163	 */
164	void attachToURL( [in] string sURL,
165					  [in] boolean bReadOnly )
166		raises( ::com::sun::star::embed::InvalidStorageException,
167				::com::sun::star::lang::IllegalArgumentException,
168				::com::sun::star::io::IOException,
169				::com::sun::star::embed::StorageWrappedTargetException );
170
171	// -----------------------------------------------------------------------
172	/** allows to get property of the child element with the specified name.
173		The implementation of the method might allow to access only subset
174		of the supported by element properties.
175	 */
176	any getElementPropertyValue( [in] string sElementName,
177								 [in] string sPropertyName )
178		raises( ::com::sun::star::embed::InvalidStorageException,
179				::com::sun::star::lang::IllegalArgumentException,
180				::com::sun::star::container::NoSuchElementException,
181				::com::sun::star::io::IOException,
182				::com::sun::star::beans::UnknownPropertyException,
183				::com::sun::star::beans::PropertyVetoException,
184				::com::sun::star::embed::StorageWrappedTargetException );
185
186	// -----------------------------------------------------------------------
187	/** fills the provided stream with the last flushed version of data from
188		the child stream of the storage.
189
190		@param sStreamName
191			the name of the substream that should be copied
192
193		@param xTargetStream
194			the target stream where the data must be copied to
195
196		@throws ::com::sun::star::embed::InvalidStorageException
197			this storage is in invalid state for any reason
198
199		@throws ::com::sun::star::lang::IllegalArgumentException
200			one of provided arguments is illegal
201
202		@throws ::com::sun::star::packages::WrongPasswordException
203			the provided password is wrong
204
205		@throws ::com::sun::star::io::IOException
206			in case of io errors during stream opening
207
208		@throws ::com::sun::star::embed::StorageWrappedTargetException
209			wraps other exceptions
210	 */
211    void copyStreamElementData( [in] string sStreamName,
212								[in] ::com::sun::star::io::XStream xTargetStream )
213		raises( ::com::sun::star::embed::InvalidStorageException,
214				::com::sun::star::lang::IllegalArgumentException,
215				::com::sun::star::packages::WrongPasswordException,
216				::com::sun::star::io::IOException,
217				::com::sun::star::embed::StorageWrappedTargetException );
218
219};
220
221//============================================================================
222
223}; }; }; };
224
225#endif
226
227