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