1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10d1766043SAndrew Rist *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d1766043SAndrew Rist *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19d1766043SAndrew Rist *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_embed_XEmbedPersist_idl__
24cdf0e10cSrcweir#define __com_sun_star_embed_XEmbedPersist_idl__
25cdf0e10cSrcweir
26cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
27cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
28cdf0e10cSrcweir#endif
29cdf0e10cSrcweir
30cdf0e10cSrcweir#ifndef __com_sun_star_embed_XStorage_idl__
31cdf0e10cSrcweir#include <com/sun/star/embed/XStorage.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir#ifndef __com_sun_star_embed_XCommonEmbedPersist_idl__
35cdf0e10cSrcweir#include <com/sun/star/embed/XCommonEmbedPersist.idl>
36cdf0e10cSrcweir#endif
37cdf0e10cSrcweir
38cdf0e10cSrcweir#ifndef __com_sun_star_io_IOException_idl__
39cdf0e10cSrcweir#include <com/sun/star/io/IOException.idl>
40cdf0e10cSrcweir#endif
41cdf0e10cSrcweir
42cdf0e10cSrcweir#ifndef __com_sun_star_embed_WrongStateException_idl__
43cdf0e10cSrcweir#include <com/sun/star/embed/WrongStateException.idl>
44cdf0e10cSrcweir#endif
45cdf0e10cSrcweir
46cdf0e10cSrcweir#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
47cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
48cdf0e10cSrcweir#endif
49cdf0e10cSrcweir
50cdf0e10cSrcweir#ifndef __com_sun_star_beans_PropertyValue_idl__
51cdf0e10cSrcweir#include <com/sun/star/beans/PropertyValue.idl>
52cdf0e10cSrcweir#endif
53cdf0e10cSrcweir
54cdf0e10cSrcweir//============================================================================
55cdf0e10cSrcweir
56cdf0e10cSrcweir module com {  module sun {  module star {  module embed {
57cdf0e10cSrcweir
58cdf0e10cSrcweir//============================================================================
59cdf0e10cSrcweir/** specifies an implementation for embedded object persistence.
60cdf0e10cSrcweir	<p>
61cdf0e10cSrcweir	The idea is that any usable embedded object should be initialized
62cdf0e10cSrcweir	with an entry in the parent storage that will be used as persistent
63cdf0e10cSrcweir	representation.
64cdf0e10cSrcweir	</p>
65cdf0e10cSrcweir */
66cdf0e10cSrcweirpublished interface XEmbedPersist: XCommonEmbedPersist
67cdf0e10cSrcweir{
68cdf0e10cSrcweir	//------------------------------------------------------------------------
69cdf0e10cSrcweir    /** provides object with a parent storage and a name for object's entry.
70cdf0e10cSrcweir
71cdf0e10cSrcweir		<p>
72cdf0e10cSrcweir		An entry with the specified name should be created/opened inside
73cdf0e10cSrcweir		provided storage. It can be a storage or a stream. For example,
74cdf0e10cSrcweir		OOo API will refer to ole storages only by streams, but the object
75cdf0e10cSrcweir		implementation will use storage based on this stream.
76cdf0e10cSrcweir		</p>
77cdf0e10cSrcweir
78cdf0e10cSrcweir		<p>
79cdf0e10cSrcweir		Factory does this call to initialize the embedded object.
80cdf0e10cSrcweir		The linked object can be initialized by factory in different way
81cdf0e10cSrcweir		( internally ).
82cdf0e10cSrcweir		</p>
83cdf0e10cSrcweir
84cdf0e10cSrcweir		<p>
85cdf0e10cSrcweir		It is also possible to switch object persistent representation through
86cdf0e10cSrcweir		this call. Actually this is the way, this call can be used by user
87cdf0e10cSrcweir		( since initialization is done by factory ).
88cdf0e10cSrcweir		</p>
89cdf0e10cSrcweir
90cdf0e10cSrcweir		@param xStorage
91cdf0e10cSrcweir			a parent storage the entry should be created in
92cdf0e10cSrcweir
93cdf0e10cSrcweir		@param sEntName
94cdf0e10cSrcweir			a name for the entry
95cdf0e10cSrcweir
96cdf0e10cSrcweir		@param nEntryConnectionMode
97cdf0e10cSrcweir			a mode in which the object should be initialized from entry
98cdf0e10cSrcweir			can take values from EntryInitModes constant set
99cdf0e10cSrcweir
100cdf0e10cSrcweir        @param aMediaArgs
101cdf0e10cSrcweir            optional parameters for the embedded document persistence
102cdf0e10cSrcweir			initialization, see also
103cdf0e10cSrcweir			<type scope="com::sun::star::document">MediaDescriptor</type>
104cdf0e10cSrcweir
105cdf0e10cSrcweir        @param aObjectArgs
106cdf0e10cSrcweir            optional parameters for the object persistence initialization,
107cdf0e10cSrcweir            see also
108cdf0e10cSrcweir			<type scope="com::sun::star::embed">EmbeddedObjectDescriptor</type>
109cdf0e10cSrcweir
110*8e0daafcSTsutomu Uchino		@throws ::com::sun::star::lang::IllegalArgumentException
111cdf0e10cSrcweir			one of arguments is illegal
112cdf0e10cSrcweir
113cdf0e10cSrcweir        @throws com::sun::star::embed::WrongStateException
114cdf0e10cSrcweir			the object is in wrong state
115cdf0e10cSrcweir
116cdf0e10cSrcweir        @throws com::sun::star::io::IOException
117cdf0e10cSrcweir			in case of io problems during opening\creation
118cdf0e10cSrcweir
119cdf0e10cSrcweir        @throws com::sun::star::uno::Exception
120cdf0e10cSrcweir			in case of other problems
121cdf0e10cSrcweir	 */
122cdf0e10cSrcweir	void setPersistentEntry(
123cdf0e10cSrcweir			[in] ::com::sun::star::embed::XStorage xStorage,
124cdf0e10cSrcweir			[in] string sEntName,
125cdf0e10cSrcweir			[in] long nEntryConnectionMode,
126cdf0e10cSrcweir			[in] sequence< ::com::sun::star::beans::PropertyValue > aMediaArgs,
127cdf0e10cSrcweir			[in] sequence< ::com::sun::star::beans::PropertyValue > aObjectArgs )
128cdf0e10cSrcweir		raises( ::com::sun::star::lang::IllegalArgumentException,
129cdf0e10cSrcweir				::com::sun::star::embed::WrongStateException,
130cdf0e10cSrcweir				::com::sun::star::io::IOException,
131cdf0e10cSrcweir				::com::sun::star::uno::Exception );
132cdf0e10cSrcweir
133cdf0e10cSrcweir	//------------------------------------------------------------------------
134cdf0e10cSrcweir    /** lets the object store itself to an entry in destination storage,
135cdf0e10cSrcweir		the own persistence entry is not changed.
136cdf0e10cSrcweir
137cdf0e10cSrcweir		@param xStorage
138cdf0e10cSrcweir			a parent storage the entry should be created inside
139cdf0e10cSrcweir
140cdf0e10cSrcweir		@param sEntName
141cdf0e10cSrcweir			a name for the entry
142cdf0e10cSrcweir
143cdf0e10cSrcweir        @param aMediaArgs
144cdf0e10cSrcweir            optional parameters for document saving, see also
145cdf0e10cSrcweir			<type scope="com::sun::star::document">MediaDescriptor</type>
146cdf0e10cSrcweir
147cdf0e10cSrcweir        @param aObjectArgs
148cdf0e10cSrcweir            optional parameters for the object saving, see also
149cdf0e10cSrcweir			<type scope="com::sun::star::embed">EmbeddedObjectDescriptor</type>
150cdf0e10cSrcweir
151*8e0daafcSTsutomu Uchino		@throws ::com::sun::star::lang::IllegalArgumentException
152cdf0e10cSrcweir			one of arguments is illegal
153cdf0e10cSrcweir
154cdf0e10cSrcweir        @throws com::sun::star::embed::WrongStateException
155cdf0e10cSrcweir			the object is in wrong state
156cdf0e10cSrcweir
157cdf0e10cSrcweir        @throws com::sun::star::io::IOException
158cdf0e10cSrcweir			in case of io problems during storing
159cdf0e10cSrcweir
160cdf0e10cSrcweir        @throws com::sun::star::uno::Exception
161cdf0e10cSrcweir			in case of other problems
162cdf0e10cSrcweir	 */
163cdf0e10cSrcweir	void storeToEntry(
164cdf0e10cSrcweir			[in] ::com::sun::star::embed::XStorage xStorage,
165cdf0e10cSrcweir			[in] string sEntName,
166cdf0e10cSrcweir			[in] sequence< ::com::sun::star::beans::PropertyValue > aMediaArgs,
167cdf0e10cSrcweir			[in] sequence< ::com::sun::star::beans::PropertyValue > aObjectArgs )
168cdf0e10cSrcweir		raises( ::com::sun::star::lang::IllegalArgumentException,
169cdf0e10cSrcweir				::com::sun::star::embed::WrongStateException,
170cdf0e10cSrcweir				::com::sun::star::io::IOException,
171cdf0e10cSrcweir				::com::sun::star::uno::Exception );
172cdf0e10cSrcweir
173cdf0e10cSrcweir	//------------------------------------------------------------------------
174cdf0e10cSrcweir    /** lets the object store itself to an entry in destination storage and
175cdf0e10cSrcweir		prepare to use the new entry for own persistence.
176cdf0e10cSrcweir
177cdf0e10cSrcweir		<p>
178cdf0e10cSrcweir		The object should be stored to the new entry, after that the entry
179cdf0e10cSrcweir		should be remembered by the object. After the storing process is
180cdf0e10cSrcweir		finished the <method>XEmbedPersist::saveCompleted</method> method
181cdf0e10cSrcweir		can be used to specify whether the object should use the new entry or
182cdf0e10cSrcweir		the old one. The object persistence can not be used until
183cdf0e10cSrcweir		<method>XEmbedPersist::saveCompleted</method> is called.
184cdf0e10cSrcweir		So this state can be treated as "HandsOff" state.
185cdf0e10cSrcweir		<p>
186cdf0e10cSrcweir
187cdf0e10cSrcweir		@param xStorage
188cdf0e10cSrcweir			a parent storage the entry should be created in
189cdf0e10cSrcweir
190cdf0e10cSrcweir		@param sEntName
191cdf0e10cSrcweir			a name for the entry
192cdf0e10cSrcweir
193cdf0e10cSrcweir        @param aMediaArgs
194cdf0e10cSrcweir            optional parameters for document saving, see also
195cdf0e10cSrcweir			<type scope="com::sun::star::document">MediaDescriptor</type>
196cdf0e10cSrcweir
197cdf0e10cSrcweir        @param aObjectArgs
198cdf0e10cSrcweir            optional parameters for the object saving, see also
199cdf0e10cSrcweir			<type scope="com::sun::star::embed">EmbeddedObjectDescriptor</type>
200cdf0e10cSrcweir
201*8e0daafcSTsutomu Uchino		@throws ::com::sun::star::lang::IllegalArgumentException
202cdf0e10cSrcweir			one of arguments is illegal
203cdf0e10cSrcweir
204cdf0e10cSrcweir        @throws com::sun::star::embed::WrongStateException
205cdf0e10cSrcweir			the object is in wrong state
206cdf0e10cSrcweir
207cdf0e10cSrcweir        @throws com::sun::star::io::IOException
208cdf0e10cSrcweir			in case of io problems during storing
209cdf0e10cSrcweir
210cdf0e10cSrcweir        @throws com::sun::star::uno::Exception
211cdf0e10cSrcweir			in case of other problems
212cdf0e10cSrcweir	 */
213cdf0e10cSrcweir	void storeAsEntry(
214cdf0e10cSrcweir			[in] ::com::sun::star::embed::XStorage xStorage,
215cdf0e10cSrcweir			[in] string sEntName,
216cdf0e10cSrcweir			[in] sequence< ::com::sun::star::beans::PropertyValue > aMediaArgs,
217cdf0e10cSrcweir			[in] sequence< ::com::sun::star::beans::PropertyValue > aObjectArgs )
218cdf0e10cSrcweir		raises( ::com::sun::star::lang::IllegalArgumentException,
219cdf0e10cSrcweir				::com::sun::star::embed::WrongStateException,
220cdf0e10cSrcweir				::com::sun::star::io::IOException,
221cdf0e10cSrcweir				::com::sun::star::uno::Exception );
222cdf0e10cSrcweir
223cdf0e10cSrcweir
224cdf0e10cSrcweir	//------------------------------------------------------------------------
225cdf0e10cSrcweir    /** specifies whether the object should use an old storage or a new one
226cdf0e10cSrcweir		after "save as" operation.
227cdf0e10cSrcweir
228cdf0e10cSrcweir		@param bUseNew
229cdf0e10cSrcweir			<TRUE/> the new storage should be used
230cdf0e10cSrcweir			<FALSE/> the old one
231cdf0e10cSrcweir
232cdf0e10cSrcweir        @throws com::sun::star::embed::WrongStateException
233cdf0e10cSrcweir			the object is in wrong state
234cdf0e10cSrcweir
235cdf0e10cSrcweir        @throws com::sun::star::uno::Exception
236cdf0e10cSrcweir			in case of other problems
237cdf0e10cSrcweir	 */
238cdf0e10cSrcweir
239cdf0e10cSrcweir	void saveCompleted( [in] boolean bUseNew )
240cdf0e10cSrcweir		raises( ::com::sun::star::embed::WrongStateException,
241cdf0e10cSrcweir				::com::sun::star::uno::Exception );
242cdf0e10cSrcweir
243cdf0e10cSrcweir	//------------------------------------------------------------------------
244cdf0e10cSrcweir    /** allows to detect if the object has entry.
245cdf0e10cSrcweir
246cdf0e10cSrcweir        @returns
247cdf0e10cSrcweir            <TRUE/> if the object has own entry set
248cdf0e10cSrcweir            <FALSE/> otherwise
249cdf0e10cSrcweir	 */
250cdf0e10cSrcweir	boolean hasEntry()
251cdf0e10cSrcweir		raises( ::com::sun::star::embed::WrongStateException );
252cdf0e10cSrcweir
253cdf0e10cSrcweir	//------------------------------------------------------------------------
254cdf0e10cSrcweir    /** allows to retrieve the current object entry name.
255cdf0e10cSrcweir
256cdf0e10cSrcweir        @returns
257cdf0e10cSrcweir			the object entry name if any
258cdf0e10cSrcweir
259cdf0e10cSrcweir        @throws com::sun::star::embed::WrongStateException
260cdf0e10cSrcweir			the object is in wrong state ( has no entry )
261cdf0e10cSrcweir	 */
262cdf0e10cSrcweir	string getEntryName()
263cdf0e10cSrcweir		raises( ::com::sun::star::embed::WrongStateException );
264cdf0e10cSrcweir};
265cdf0e10cSrcweir
266cdf0e10cSrcweir//============================================================================
267cdf0e10cSrcweir
268cdf0e10cSrcweir}; }; }; };
269cdf0e10cSrcweir
270cdf0e10cSrcweir#endif
271cdf0e10cSrcweir
272