xref: /aoo41x/main/offapi/com/sun/star/embed/Storage.idl (revision cdf0e10c)
1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir
28*cdf0e10cSrcweir#ifndef __com_sun_star_embed_Storage_idl__
29*cdf0e10cSrcweir#define __com_sun_star_embed_Storage_idl__
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir#ifndef __com_sun_star_embed_BaseStorage_idl__
32*cdf0e10cSrcweir#include <com/sun/star/embed/BaseStorage.idl>
33*cdf0e10cSrcweir#endif
34*cdf0e10cSrcweir
35*cdf0e10cSrcweir#ifndef __com_sun_star_embed_XEncryptionProtectedSource_idl__
36*cdf0e10cSrcweir#include <com/sun/star/embed/XEncryptionProtectedSource.idl>
37*cdf0e10cSrcweir#endif
38*cdf0e10cSrcweir
39*cdf0e10cSrcweir#ifndef __com_sun_star_embed_XTransactedObject_idl__
40*cdf0e10cSrcweir#include <com/sun/star/embed/XTransactedObject.idl>
41*cdf0e10cSrcweir#endif
42*cdf0e10cSrcweir
43*cdf0e10cSrcweir#ifndef __com_sun_star_embed_XTransactionBroadcaster_idl__
44*cdf0e10cSrcweir#include <com/sun/star/embed/XTransactionBroadcaster.idl>
45*cdf0e10cSrcweir#endif
46*cdf0e10cSrcweir
47*cdf0e10cSrcweir#ifndef __com_sun_star_util_XModifiable_idl__
48*cdf0e10cSrcweir#include <com/sun/star/util/XModifiable.idl>
49*cdf0e10cSrcweir#endif
50*cdf0e10cSrcweir
51*cdf0e10cSrcweir#ifndef __com_sun_star_container_XNameAccess_idl__
52*cdf0e10cSrcweir#include <com/sun/star/container/XNameAccess.idl>
53*cdf0e10cSrcweir#endif
54*cdf0e10cSrcweir
55*cdf0e10cSrcweir#ifndef __com_sun_star_lang_XComponent_idl__
56*cdf0e10cSrcweir#include <com/sun/star/lang/XComponent.idl>
57*cdf0e10cSrcweir#endif
58*cdf0e10cSrcweir
59*cdf0e10cSrcweir#ifndef __com_sun_star_beans_XPropertySet_idl__
60*cdf0e10cSrcweir#include <com/sun/star/beans/XPropertySet.idl>
61*cdf0e10cSrcweir#endif
62*cdf0e10cSrcweir
63*cdf0e10cSrcweir
64*cdf0e10cSrcweir//============================================================================
65*cdf0e10cSrcweir
66*cdf0e10cSrcweir module com {  module sun {  module star {  module embed {
67*cdf0e10cSrcweir
68*cdf0e10cSrcweir//============================================================================
69*cdf0e10cSrcweir/** This is a service that allows to get access to a package using storage
70*cdf0e10cSrcweir	hierarchy.
71*cdf0e10cSrcweir
72*cdf0e10cSrcweir	<p>
73*cdf0e10cSrcweir	A root storage should be retrieved by using <type>StorageFactory</type>
74*cdf0e10cSrcweir	service. Substorages are created through <type>XStorage</type> interface
75*cdf0e10cSrcweir	of a parent storage.
76*cdf0e10cSrcweir	</p>
77*cdf0e10cSrcweir */
78*cdf0e10cSrcweirpublished service Storage
79*cdf0e10cSrcweir{
80*cdf0e10cSrcweir	// -----------------------------------------------------------------------
81*cdf0e10cSrcweir	/** This service describes the base functionality of storages.
82*cdf0e10cSrcweir
83*cdf0e10cSrcweir		<p>
84*cdf0e10cSrcweir		Please see below the description of additional requirements for the
85*cdf0e10cSrcweir		package storage implementation.
86*cdf0e10cSrcweir		</p>
87*cdf0e10cSrcweir
88*cdf0e10cSrcweir		<dl>
89*cdf0e10cSrcweir			<dt>interface <type scope="com::sun::star::lang">XComponent</type>
90*cdf0e10cSrcweir			</dt>
91*cdf0e10cSrcweir			<dd>
92*cdf0e10cSrcweir				<p>
93*cdf0e10cSrcweir				A root storage is created by <type>StorageFactory</type>
94*cdf0e10cSrcweir				and is controlled by refcounting. In case refcounting
95*cdf0e10cSrcweir				is decreased to zero the storage will be disposed
96*cdf0e10cSrcweir				automatically. It is still strongly recommended that
97*cdf0e10cSrcweir				a root storage is disposed explicitly since in garbage
98*cdf0e10cSrcweir				collector based languages the refcounting can be
99*cdf0e10cSrcweir				decreased too late and resources locked by the storage
100*cdf0e10cSrcweir				will not be freed until then.
101*cdf0e10cSrcweir				</p>
102*cdf0e10cSrcweir
103*cdf0e10cSrcweir				<p>
104*cdf0e10cSrcweir				A substorage is created by <type>XStorage</type>
105*cdf0e10cSrcweir				interface of storage. Each time a substorage is opened
106*cdf0e10cSrcweir				it is locked ( in case it is opened in readonly mode
107*cdf0e10cSrcweir				it is locked for writing, in case it is opened in
108*cdf0e10cSrcweir				read-write mode it is locked for reading and writing )
109*cdf0e10cSrcweir				until it is disposed.  The lifetime of substorage is
110*cdf0e10cSrcweir				also controlled by refcounting but because of mentioned
111*cdf0e10cSrcweir				garbage collection specific it is strongly recommended
112*cdf0e10cSrcweir				to dispose substorages explicitly.
113*cdf0e10cSrcweir				</p>
114*cdf0e10cSrcweir
115*cdf0e10cSrcweir				<p>
116*cdf0e10cSrcweir				In case a storage object is disposed all the elements
117*cdf0e10cSrcweir				( substorages and substreams ) retrieved from the
118*cdf0e10cSrcweir				object are disposed. If the storage was opened in
119*cdf0e10cSrcweir				read-write mode all noncommited changes will be lost.
120*cdf0e10cSrcweir				</p>
121*cdf0e10cSrcweir			</dd>
122*cdf0e10cSrcweir			<dt>interface <type>XStorage</type></dt>
123*cdf0e10cSrcweir			<dd>
124*cdf0e10cSrcweir				<dl>
125*cdf0e10cSrcweir					<dt><method>XStorage::openStreamElement</method></dt>
126*cdf0e10cSrcweir					<dd>
127*cdf0e10cSrcweir						<p>
128*cdf0e10cSrcweir						This method returns <type>StorageStream</type>
129*cdf0e10cSrcweir						service implementation.
130*cdf0e10cSrcweir						</p>
131*cdf0e10cSrcweir
132*cdf0e10cSrcweir						<p>
133*cdf0e10cSrcweir						If the child stream is an encrypted one a corect
134*cdf0e10cSrcweir						common storage password should be set through
135*cdf0e10cSrcweir						<type>XEncryptionProtectedSource</type> interface to
136*cdf0e10cSrcweir						this storage or to a one of storages in parent
137*cdf0e10cSrcweir						hierarchy. In case the password is not set or is a
138*cdf0e10cSrcweir						wrong one an exception will be thrown.
139*cdf0e10cSrcweir						</p>
140*cdf0e10cSrcweir					</dd>
141*cdf0e10cSrcweir
142*cdf0e10cSrcweir					<dt><method>XStorage::openEncryptedStreamElement</method></dt>
143*cdf0e10cSrcweir					<dd>
144*cdf0e10cSrcweir						This method allows to specify reading password for the
145*cdf0e10cSrcweir						stream explicitly. The password will be used to read
146*cdf0e10cSrcweir						the stream. It is possible to specify a new password
147*cdf0e10cSrcweir						for stream storing through
148*cdf0e10cSrcweir						<type>XEncryptionProtectedSource</type> interface. In
149*cdf0e10cSrcweir						case a new password is not specified an old one will
150*cdf0e10cSrcweir						be used for storing.
151*cdf0e10cSrcweir					</dd>
152*cdf0e10cSrcweir
153*cdf0e10cSrcweir					<dt><method>XStorage::openStorageElement</method></dt>
154*cdf0e10cSrcweir					<dd>
155*cdf0e10cSrcweir						This method returns <type>Storage</type> service
156*cdf0e10cSrcweir						implementation.
157*cdf0e10cSrcweir					</dd>
158*cdf0e10cSrcweir
159*cdf0e10cSrcweir					<dt><method>XStorage::cloneStreamElement</method></dt>
160*cdf0e10cSrcweir					<dd>
161*cdf0e10cSrcweir						<p>
162*cdf0e10cSrcweir						This method returns <type>StorageStream</type> service
163*cdf0e10cSrcweir						implementation.
164*cdf0e10cSrcweir						</p>
165*cdf0e10cSrcweir
166*cdf0e10cSrcweir						<p>
167*cdf0e10cSrcweir						The latest flashed version of the stream will be used.
168*cdf0e10cSrcweir						The stream can be flashed explicitly by
169*cdf0e10cSrcweir						<method scope="com::sun::star::io">XOutputStream::flush</method>
170*cdf0e10cSrcweir						call.
171*cdf0e10cSrcweir						</p>
172*cdf0e10cSrcweir
173*cdf0e10cSrcweir						<p>
174*cdf0e10cSrcweir						A storage flashes on commit all the child streams it
175*cdf0e10cSrcweir						owns. So in case after the stream is changed neither
176*cdf0e10cSrcweir						the storage was commited nor the stream was flushed
177*cdf0e10cSrcweir						explicitly, the changes will not appear in the new
178*cdf0e10cSrcweir						created stream. This method allows to retrieve copy of
179*cdf0e10cSrcweir						a child stream even in case it is already opened for
180*cdf0e10cSrcweir						writing.
181*cdf0e10cSrcweir						</p>
182*cdf0e10cSrcweir
183*cdf0e10cSrcweir						<p>
184*cdf0e10cSrcweir						If the child stream is an encrypted one a corect
185*cdf0e10cSrcweir						common storage password should be set through
186*cdf0e10cSrcweir						<type>XEncryptionProtectedSource</type> interface to
187*cdf0e10cSrcweir						this storage or to a one of storages in parent
188*cdf0e10cSrcweir						hierarchy. In case the password is not set or is a
189*cdf0e10cSrcweir						wrong one an exception will be thrown.
190*cdf0e10cSrcweir						</p>
191*cdf0e10cSrcweir					</dd>
192*cdf0e10cSrcweir
193*cdf0e10cSrcweir					<dt><method>XStorage::cloneEncryptedStreamElement</method></dt>
194*cdf0e10cSrcweir					<dd>
195*cdf0e10cSrcweir						<p>
196*cdf0e10cSrcweir						This method returns <type>StorageStream</type> service
197*cdf0e10cSrcweir						implementation.
198*cdf0e10cSrcweir						</p>
199*cdf0e10cSrcweir
200*cdf0e10cSrcweir						<p>
201*cdf0e10cSrcweir						The latest flashed version of the stream will be used.
202*cdf0e10cSrcweir						The stream can be flashed explicitly by
203*cdf0e10cSrcweir						<method scope="com::sun::star::io">XOutputStream::flush</method>
204*cdf0e10cSrcweir						call.
205*cdf0e10cSrcweir						</p>
206*cdf0e10cSrcweir
207*cdf0e10cSrcweir						<p>
208*cdf0e10cSrcweir						A storage flashes on commit all the child streams it
209*cdf0e10cSrcweir						owns. So in case after the stream is changed neither
210*cdf0e10cSrcweir						the storage was commited nor the stream was flushed
211*cdf0e10cSrcweir						explicitly, the changes will not appear in the new
212*cdf0e10cSrcweir						created stream. This method allows to retrieve copy of
213*cdf0e10cSrcweir						a child stream even in case it is already opened for
214*cdf0e10cSrcweir						writing.
215*cdf0e10cSrcweir						</p>
216*cdf0e10cSrcweir					</dd>
217*cdf0e10cSrcweir
218*cdf0e10cSrcweir					<dt><method>XStorage::copyLastCommitTo</method></dt>
219*cdf0e10cSrcweir					<dd>
220*cdf0e10cSrcweir						This method gets <type>Storage</type> service
221*cdf0e10cSrcweir						implementation and fills it in with the latest
222*cdf0e10cSrcweir						commited version of this storage. So in case the
223*cdf0e10cSrcweir						storage was not commited after it was changed, the
224*cdf0e10cSrcweir						changes will not appear in the new created storage.
225*cdf0e10cSrcweir					</dd>
226*cdf0e10cSrcweir
227*cdf0e10cSrcweir					<dt><method>XStorage::copyStorageElementLastCommitTo</method></dt>
228*cdf0e10cSrcweir					<dd>
229*cdf0e10cSrcweir						<p>
230*cdf0e10cSrcweir						This method gets <type>Storage</type> service
231*cdf0e10cSrcweir						implementation and fills it in with the contents of
232*cdf0e10cSrcweir						the requested substorage. The latest commited version
233*cdf0e10cSrcweir						of child storage will be used. So in case the child
234*cdf0e10cSrcweir						storage was not commited after it was changed, the
235*cdf0e10cSrcweir						changes will not appear in the new created storage.
236*cdf0e10cSrcweir						</p>
237*cdf0e10cSrcweir
238*cdf0e10cSrcweir						<p>
239*cdf0e10cSrcweir						This method allows to retrieve copy of a child storage
240*cdf0e10cSrcweir						even in case it is already opened for writing.
241*cdf0e10cSrcweir						</p>
242*cdf0e10cSrcweir					</dd>
243*cdf0e10cSrcweir
244*cdf0e10cSrcweir					<dt><method>XStorage::removeStorageElement</method></dt>
245*cdf0e10cSrcweir					<dd>
246*cdf0e10cSrcweir						If the element is opened the removing will fail.
247*cdf0e10cSrcweir					</dd>
248*cdf0e10cSrcweir				</dl>
249*cdf0e10cSrcweir			</dd>
250*cdf0e10cSrcweir			<dt>property URL</dt>
251*cdf0e10cSrcweir			<dd>
252*cdf0e10cSrcweir				If the storage is created based on url this property allows
253*cdf0e10cSrcweir				to retrieve it.
254*cdf0e10cSrcweir			</dd>
255*cdf0e10cSrcweir		</dl>
256*cdf0e10cSrcweir
257*cdf0e10cSrcweir	 */
258*cdf0e10cSrcweir	service BaseStorage;
259*cdf0e10cSrcweir
260*cdf0e10cSrcweir	// -----------------------------------------------------------------------
261*cdf0e10cSrcweir	/** allows to commit or revert changes that were done for the storage.
262*cdf0e10cSrcweir
263*cdf0e10cSrcweir		<p>
264*cdf0e10cSrcweir		If a storage is commited all changes made to it will be integrated to
265*cdf0e10cSrcweir		it's parent storage. This is recursive process, so the last commited
266*cdf0e10cSrcweir		storage should be the root one. For the package based storages commit
267*cdf0e10cSrcweir		of a root storage also means flashing to the related medium. If
268*cdf0e10cSrcweir		a storage is not commited, no changes for it or it's child elements
269*cdf0e10cSrcweir		will be stored.
270*cdf0e10cSrcweir		</p>
271*cdf0e10cSrcweir	 */
272*cdf0e10cSrcweir	interface ::com::sun::star::embed::XTransactedObject;
273*cdf0e10cSrcweir
274*cdf0e10cSrcweir	// -----------------------------------------------------------------------
275*cdf0e10cSrcweir	/** allows to track storage's transaction state.
276*cdf0e10cSrcweir	 */
277*cdf0e10cSrcweir	interface ::com::sun::star::embed::XTransactionBroadcaster;
278*cdf0e10cSrcweir
279*cdf0e10cSrcweir	// -----------------------------------------------------------------------
280*cdf0e10cSrcweir	/** allows to set password to a root storage.
281*cdf0e10cSrcweir
282*cdf0e10cSrcweir		<p>
283*cdf0e10cSrcweir		This interface can be supported by a storage to allow to set
284*cdf0e10cSrcweir		a common storage password. This password is used as default password
285*cdf0e10cSrcweir		to decrypt all encrypted streams and to encrypt streams that are
286*cdf0e10cSrcweir		marked to use common storage password on storing.
287*cdf0e10cSrcweir		Specifying of the password for a storage allows to use it for the
288*cdf0e10cSrcweir		whole subtree. Of course substorage can allow to overwrite the common
289*cdf0e10cSrcweir		storage password for own subtree.
290*cdf0e10cSrcweir		</p>
291*cdf0e10cSrcweir	 */
292*cdf0e10cSrcweir	[optional]
293*cdf0e10cSrcweir	interface ::com::sun::star::embed::XEncryptionProtectedSource;
294*cdf0e10cSrcweir
295*cdf0e10cSrcweir	// -----------------------------------------------------------------------
296*cdf0e10cSrcweir	/** allows to get and set the media type of the storage.
297*cdf0e10cSrcweir	 */
298*cdf0e10cSrcweir	[property] string MediaType;
299*cdf0e10cSrcweir
300*cdf0e10cSrcweir	// -----------------------------------------------------------------------
301*cdf0e10cSrcweir	/** allows to get and set the version of the format related to the
302*cdf0e10cSrcweir        MediaType.
303*cdf0e10cSrcweir	 */
304*cdf0e10cSrcweir	[property,optional] string Version;
305*cdf0e10cSrcweir
306*cdf0e10cSrcweir	// -----------------------------------------------------------------------
307*cdf0e10cSrcweir	/** allows to detect whether mediatype is detected by using fallback
308*cdf0e10cSrcweir		approach.
309*cdf0e10cSrcweir
310*cdf0e10cSrcweir		<p>
311*cdf0e10cSrcweir		Can be set to true if the mediatype can not be detected in standard
312*cdf0e10cSrcweir		way, but there is a fallback solution allows to do it.
313*cdf0e10cSrcweir		</p>
314*cdf0e10cSrcweir
315*cdf0e10cSrcweir		<p>
316*cdf0e10cSrcweir		Usually means that the document validity is questionable, although
317*cdf0e10cSrcweir		the package itself is not corrupted. The decision about document
318*cdf0e10cSrcweir		validity in this case is in application hands. It is up to user of
319*cdf0e10cSrcweir		the storage to deside whether he accepts the fallback approach for
320*cdf0e10cSrcweir		an implementation of this service, outputs a warning or an error.
321*cdf0e10cSrcweir		</p>
322*cdf0e10cSrcweir	 */
323*cdf0e10cSrcweir	[property, readonly] boolean MediaTypeFallbackIsUsed;
324*cdf0e10cSrcweir
325*cdf0e10cSrcweir	// -----------------------------------------------------------------------
326*cdf0e10cSrcweir	/** allows to detect whether the storage is a root one.
327*cdf0e10cSrcweir	 */
328*cdf0e10cSrcweir	[property, readonly] boolean IsRoot;
329*cdf0e10cSrcweir
330*cdf0e10cSrcweir	// -----------------------------------------------------------------------
331*cdf0e10cSrcweir	/** allows to detect whether storage is open in "repair package" mode or
332*cdf0e10cSrcweir		not.
333*cdf0e10cSrcweir	 */
334*cdf0e10cSrcweir	[property, optional, readonly] boolean RepairPackage;
335*cdf0e10cSrcweir
336*cdf0e10cSrcweir	// -----------------------------------------------------------------------
337*cdf0e10cSrcweir	/** allows to detect if the storage contains encrypted entries.
338*cdf0e10cSrcweir
339*cdf0e10cSrcweir		<p>
340*cdf0e10cSrcweir		In case it is set to <TRUE/> the storage itself and/or a tree of
341*cdf0e10cSrcweir		substorages contain encrypted streams. Usually in case this property
342*cdf0e10cSrcweir		is supported the implementation supports
343*cdf0e10cSrcweir		<type>XEncryptionProtectedSource</type> interface.
344*cdf0e10cSrcweir		</p>
345*cdf0e10cSrcweir	 */
346*cdf0e10cSrcweir	[property, optional, readonly] boolean HasEncryptedEntries;
347*cdf0e10cSrcweir
348*cdf0e10cSrcweir	// -----------------------------------------------------------------------
349*cdf0e10cSrcweir	/** allows to detect if the storage contains nonencrypted entries.
350*cdf0e10cSrcweir
351*cdf0e10cSrcweir		<p>
352*cdf0e10cSrcweir		In case it is set to <TRUE/> the storage itself and/or a tree of
353*cdf0e10cSrcweir		substorages contains nonencrypted streams. Usually in case this
354*cdf0e10cSrcweir		property is supported the implementation supports
355*cdf0e10cSrcweir		<type>XEncryptionProtectedSource</type> interface.
356*cdf0e10cSrcweir		</p>
357*cdf0e10cSrcweir	 */
358*cdf0e10cSrcweir	[property, optional, readonly] boolean HasNonEncryptedEntries;
359*cdf0e10cSrcweir};
360*cdf0e10cSrcweir
361*cdf0e10cSrcweir//============================================================================
362*cdf0e10cSrcweir
363*cdf0e10cSrcweir}; }; }; };
364*cdf0e10cSrcweir
365*cdf0e10cSrcweir#endif
366*cdf0e10cSrcweir
367