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