merge the formfield patch from ooo-build
[ooovba.git] / ucb / source / ucp / gvfs / content.hxx
blob1ad838104565eae2088f3715489bdbaa9f611fbb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: content.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _GVFS_UCP_CONTENT_HXX
31 #define _GVFS_UCP_CONTENT_HXX
33 #include <memory>
34 #include <list>
35 #include <rtl/ref.hxx>
36 #include <com/sun/star/ucb/ContentCreationException.hpp>
37 #include <com/sun/star/ucb/XContentCreator.hpp>
38 #include <ucbhelper/contenthelper.hxx>
40 #include <glib/gthread.h>
41 #include <libgnomevfs/gnome-vfs-ops.h>
42 #include <libgnomevfs/gnome-vfs-directory.h>
44 namespace com { namespace sun { namespace star { namespace beans {
45 struct Property;
46 struct PropertyValue;
47 } } } }
49 namespace com { namespace sun { namespace star { namespace io {
50 class XInputStream;
51 class XOutputStream;
52 class XStream;
53 } } } }
55 namespace com { namespace sun { namespace star { namespace sdbc {
56 class XRow;
57 } } } }
59 namespace com { namespace sun { namespace star { namespace ucb {
60 struct TransferInfo;
61 } } } }
63 namespace gvfs
66 class ContentProvider;
67 class ContentProperties;
69 // Random made up names - AFAICS
70 #define GVFS_FILE_TYPE "application/vnd.sun.staroffice.gvfs-file"
71 #define GVFS_FOLDER_TYPE "application/vnd.sun.staroffice.gvfs-folder"
73 class Authentication
75 public:
76 // Helper class to make exceptions pleasant
77 Authentication( const com::sun::star::uno::Reference<
78 com::sun::star::ucb::XCommandEnvironment > & xEnv );
79 ~Authentication();
82 class Content : public ::ucbhelper::ContentImplHelper,
83 public com::sun::star::ucb::XContentCreator
85 //=========================================================================
86 // Internals
87 //=========================================================================
88 private:
89 typedef rtl::Reference< Content > ContentRef;
90 typedef std::list< ContentRef > ContentRefList;
92 // Instance data
93 ContentProvider *m_pProvider; // No need for a ref, base class holds object
94 sal_Bool m_bTransient; // A non-existant (as yet) item
95 GnomeVFSFileInfo m_info; // cached status information
96 sal_Bool m_bForceReadOnly; // behave as read-only
98 // Internal helpers
99 void queryChildren ( ContentRefList& rChildren );
100 ::com::sun::star::uno::Any getBadArgExcept ();
101 GnomeVFSResult getInfo ( const ::com::sun::star::uno::Reference<
102 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
103 sal_Bool isFolder ( const ::com::sun::star::uno::Reference<
104 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
105 sal_Bool exchangeIdentity( const ::com::sun::star::uno::Reference<
106 ::com::sun::star::ucb::XContentIdentifier >& xNewId);
107 GnomeVFSResult doSetFileInfo ( const GnomeVFSFileInfo *newInfo,
108 GnomeVFSSetFileInfoMask setMask,
109 const ::com::sun::star::uno::Reference<
110 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
111 ::rtl::OUString makeNewURL ( const char *newName );
112 // End Internal helpers
114 // For ucbhelper
115 virtual ::rtl::OUString getParentURL();
116 // For ucbhelper
117 virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
118 getProperties( const com::sun::star::uno::Reference<
119 com::sun::star::ucb::XCommandEnvironment > & xEnv );
120 // For ucbhelper
121 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
122 getCommands( const com::sun::star::uno::Reference<
123 com::sun::star::ucb::XCommandEnvironment > & xEnv );
125 public:
126 // Command "getPropertyValues"
127 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
128 getPropertyValues( const ::com::sun::star::uno::Sequence<
129 ::com::sun::star::beans::Property >& rProperties,
130 const ::com::sun::star::uno::Reference<
131 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
133 private:
134 // Command "setPropertyValues"
135 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
136 setPropertyValues( const ::com::sun::star::uno::Sequence<
137 ::com::sun::star::beans::PropertyValue >& rValues,
138 const ::com::sun::star::uno::Reference<
139 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
141 // Command "insert"
142 void insert( const ::com::sun::star::uno::Reference<
143 ::com::sun::star::io::XInputStream > & xInputStream,
144 sal_Bool bReplaceExisting,
145 const com::sun::star::uno::Reference<
146 com::sun::star::ucb::XCommandEnvironment >& xEnv )
147 throw( ::com::sun::star::uno::Exception );
149 // Command "transfer"
150 void transfer( const ::com::sun::star::ucb::TransferInfo & rArgs,
151 const com::sun::star::uno::Reference<
152 com::sun::star::ucb::XCommandEnvironment >& xEnv )
153 throw( ::com::sun::star::uno::Exception );
155 // Command "delete"
156 void destroy( sal_Bool bDeletePhysical )
157 throw( ::com::sun::star::uno::Exception );
159 // "open" helpers
160 void copyData( ::com::sun::star::uno::Reference<
161 ::com::sun::star::io::XInputStream > xIn,
162 ::com::sun::star::uno::Reference<
163 ::com::sun::star::io::XOutputStream > xOut );
165 ::com::sun::star::uno::Reference<
166 ::com::sun::star::io::XInputStream >
167 createTempStream( const ::com::sun::star::uno::Reference<
168 com::sun::star::ucb::XCommandEnvironment >& xEnv )
169 throw( ::com::sun::star::uno::Exception );
170 ::com::sun::star::uno::Reference<
171 ::com::sun::star::io::XStream >
172 createStream( const ::com::sun::star::uno::Reference<
173 com::sun::star::ucb::XCommandEnvironment >& xEnv,
174 bool bReadWrite )
175 throw( ::com::sun::star::uno::Exception );
176 sal_Bool feedSink( ::com::sun::star::uno::Reference<
177 ::com::sun::star::uno::XInterface> aSink,
178 const ::com::sun::star::uno::Reference<
179 com::sun::star::ucb::XCommandEnvironment >& xEnv );
181 ::com::sun::star::uno::Any mapVFSException( const GnomeVFSResult result,
182 sal_Bool bWrite );
184 void cancelCommandExecution(const GnomeVFSResult result,
185 const ::com::sun::star::uno::Reference<
186 com::sun::star::ucb::XCommandEnvironment > & xEnv,
187 sal_Bool bWrite = sal_False )
188 throw( ::com::sun::star::uno::Exception );
190 void throwLocked(const ::com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv)
191 throw( ::com::sun::star::uno::Exception );
194 public:
195 // Non-interface bits
196 char *getURI ();
197 rtl::OString getOURI ();
198 rtl::OUString getOUURI ();
200 //=========================================================================
201 // Externals
202 //=========================================================================
203 public:
205 Content( const ::com::sun::star::uno::Reference<
206 ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
207 ContentProvider *pProvider,
208 const ::com::sun::star::uno::Reference<
209 ::com::sun::star::ucb::XContentIdentifier >& Identifier)
210 throw ( ::com::sun::star::ucb::ContentCreationException );
211 Content( const ::com::sun::star::uno::Reference<
212 ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
213 ContentProvider *pProvider,
214 const ::com::sun::star::uno::Reference<
215 ::com::sun::star::ucb::XContentIdentifier >& Identifier,
216 sal_Bool isFolder)
217 throw ( ::com::sun::star::ucb::ContentCreationException );
218 virtual ~Content();
220 // XInterface
221 XINTERFACE_DECL()
223 // XTypeProvider
224 XTYPEPROVIDER_DECL()
226 // XServiceInfo
227 virtual ::rtl::OUString SAL_CALL getImplementationName()
228 throw( ::com::sun::star::uno::RuntimeException );
229 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
230 getSupportedServiceNames()
231 throw( ::com::sun::star::uno::RuntimeException );
233 // XContent
234 virtual rtl::OUString SAL_CALL
235 getContentType()
236 throw( com::sun::star::uno::RuntimeException );
238 // XCommandProcessor
239 virtual com::sun::star::uno::Any SAL_CALL
240 execute( const com::sun::star::ucb::Command& aCommand,
241 sal_Int32 CommandId,
242 const com::sun::star::uno::Reference<
243 com::sun::star::ucb::XCommandEnvironment >& xEnv )
244 throw( com::sun::star::uno::Exception,
245 com::sun::star::ucb::CommandAbortedException,
246 com::sun::star::uno::RuntimeException );
247 virtual void SAL_CALL
248 abort( sal_Int32 CommandId )
249 throw( com::sun::star::uno::RuntimeException );
251 //////////////////////////////////////////////////////////////////////
252 // Additional interfaces
253 //////////////////////////////////////////////////////////////////////
255 // XContentCreator
256 virtual com::sun::star::uno::Sequence<
257 com::sun::star::ucb::ContentInfo > SAL_CALL
258 queryCreatableContentsInfo()
259 throw( com::sun::star::uno::RuntimeException );
260 virtual com::sun::star::uno::Reference<
261 com::sun::star::ucb::XContent > SAL_CALL
262 createNewContent( const com::sun::star::ucb::ContentInfo& Info )
263 throw( com::sun::star::uno::RuntimeException );
268 extern "C" {
269 extern GPrivate *auth_queue;
270 extern void auth_queue_destroy( gpointer data );
273 #endif