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