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_ucb_XSimpleFileAccess_idl__
24#define __com_sun_star_ucb_XSimpleFileAccess_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_uno_RuntimeException_idl__
31#include <com/sun/star/uno/RuntimeException.idl>
32#endif
33
34#ifndef __com_sun_star_uno_Exception_idl__
35#include <com/sun/star/uno/Exception.idl>
36#endif
37
38#ifndef __com_sun_star_ucb_CommandAbortedException_idl__
39#include <com/sun/star/ucb/CommandAbortedException.idl>
40#endif
41
42#ifndef __com_sun_star_task_XInteractionHandler_idl__
43#include <com/sun/star/task/XInteractionHandler.idl>
44#endif
45
46#ifndef __com_sun_star_util_DateTime_idl__
47#include <com/sun/star/util/DateTime.idl>
48#endif
49
50#ifndef __com_sun_star_io_XOutputStream_idl__
51#include <com/sun/star/io/XOutputStream.idl>
52#endif
53
54#ifndef __com_sun_star_io_XInputStream_idl__
55#include <com/sun/star/io/XInputStream.idl>
56#endif
57
58#ifndef __com_sun_star_io_XStream_idl__
59#include <com/sun/star/io/XStream.idl>
60#endif
61
62
63
64//=============================================================================
65
66module com { module sun { module star { module ucb {
67
68//=============================================================================
69/** This is the basic interface to read data from a stream.
70*/
71published interface XSimpleFileAccess: com::sun::star::uno::XInterface
72{
73
74	//-------------------------------------------------------------------------
75	/** Copies a file
76
77		@param SourceURL
78		URL of the file to be copied
79		@param DestURL
80		URL of the location the file should be copied to
81
82		@see move
83	*/
84	void copy( [in] string SourceURL, [in] string DestURL )
85		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
86
87	//-------------------------------------------------------------------------
88	/** Moves a file
89
90		@param SourceURL
91		URL of the file to be moved
92		@param DestURL
93		URL of the location the file should be moved to
94
95		@see move
96	*/
97	void move( [in] string SourceURL, [in] string DestURL )
98		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
99
100	//-------------------------------------------------------------------------
101	/** Removes a file. If the URL represents a folder, the folder will be
102		removed, even if it's not empty.
103
104		@param FileURL
105		File/folder to be removed
106
107		@see move
108	*/
109	void kill( [in] string FileURL )
110		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
111
112	//-------------------------------------------------------------------------
113	/** Checks if an URL represents a folder
114
115		@param FileURL
116		URL to be checked
117
118		@return
119		true, if the given URL represents a folder, otherwise false
120	*/
121	boolean isFolder( [in] string FileURL )
122		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
123
124	//-------------------------------------------------------------------------
125	/** Checks if a file is "read only"
126
127		@param FileURL
128		URL to be checked
129
130		@return
131		true, if the given File is "read only", false otherwise
132	*/
133	boolean isReadOnly( [in] string FileURL )
134		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
135
136	//-------------------------------------------------------------------------
137	/** Sets the "read only" of a file according to the boolean parameter,
138		if the actual process has the right to do so.
139
140		@param bReadOnly
141		true; "read only" flag will be set, false; "read only" flag will be reset
142	*/
143	void setReadOnly( [in] string FileURL, [in] boolean bReadOnly )
144		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
145
146	//-------------------------------------------------------------------------
147	/** Creates a new Folder
148
149		@param NewFolderURL
150		URL describing the location of the new folder
151	*/
152	void createFolder( [in] string NewFolderURL )
153		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
154
155	//-------------------------------------------------------------------------
156	/** Returns the size of a file.
157
158		@param FileURL
159		URL of the file
160
161		@return Size of the file in bytes
162	*/
163	long getSize( [in] string FileURL )
164		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
165
166	//-------------------------------------------------------------------------
167	/** Returns the content type of a file.
168
169		@see XContent::getContentType
170
171		@param FileURL
172		URL of the file
173
174		@return Content type of the file
175	*/
176	string getContentType( [in] string FileURL )
177		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
178
179	//-------------------------------------------------------------------------
180	/** Returns the last modified date for the file
181
182		@param FileURL
183		URL of the file
184
185		@return Last modified date for the file
186	*/
187	::com::sun::star::util::DateTime getDateTimeModified( [in] string FileURL )
188		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
189
190	//-------------------------------------------------------------------------
191	/** Returns the contents of a folder
192
193		@param FolderURL
194		URL of the folder
195		@param bIncludeFolders
196		true: Subfolders are included, false: No subfolders
197
198		@return The content of a folder, each file as one string
199				in a string sequence
200	*/
201	sequence<string> getFolderContents( [in] string FolderURL, [in] boolean bIncludeFolders )
202		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
203
204	//-------------------------------------------------------------------------
205	/** Checks if a file exists
206
207		@param FileURL
208		URL to be checked
209
210		@return
211		true, if the File exists, false otherwise
212	*/
213	boolean exists( [in] string FileURL )
214		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
215
216
217	//-------------------------------------------------------------------------
218	/** Opens file to read
219
220		@param FileURL
221		File to open
222
223		@return
224		An XInputStream, if the file can be opened for reading
225	*/
226	com::sun::star::io::XInputStream openFileRead( [in] string FileURL )
227		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
228
229	//-------------------------------------------------------------------------
230    /** Opens file to write.
231
232		@param FileURL
233		File to open
234
235		@return
236		An XOutputStream, if the file can be opened for writing
237
238        @throws
239        <type>UnsupportedDataSinkException</type>, if the file cannot be
240        opened for random write access. Some resources do not allow random
241        write access. To write data for those resources
242        <member>XSimpleFileAccess2::writeFile</member> may be used.
243	*/
244	com::sun::star::io::XOutputStream openFileWrite( [in] string FileURL )
245		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
246
247	//-------------------------------------------------------------------------
248	/** Opens file to read and write
249
250		@param FileURL
251		File to open
252
253		@return
254		An XStream, if the file can be opened for reading and writing
255
256        @throws
257        <type>UnsupportedDataSinkException</type>, if the file cannot be
258        opened for random write access. Some resources do not allow random
259        write access. To write data for those resources
260        <member>XSimpleFileAccess2::writeFile</member> may be used.
261	*/
262	com::sun::star::io::XStream openFileReadWrite( [in] string FileURL )
263		raises( com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::Exception );
264
265	//-------------------------------------------------------------------------
266	/** Sets an interaction handler to be used for further operations.
267
268        <p>
269        A default interaction handler is available as service
270		<type scope="com::sun::star::task">InteractionHandler</type>.
271		The documentation of this service also contains further
272		information about the interaction handler concept.
273        </p>
274
275	    @see com::sun::star::task::InteractionHandler
276
277		@param Handler
278		The interaction handler to be set
279	*/
280	void setInteractionHandler( [in] com::sun::star::task::XInteractionHandler Handler );
281
282};
283
284//=============================================================================
285
286}; }; }; };
287
288#endif
289