Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / ucb / source / ucp / gvfs / gvfs_content.hxx
blob0357987eb4fdc3f9fc2be5ca1826d527f4966db6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _GVFS_UCP_CONTENT_HXX
20 #define _GVFS_UCP_CONTENT_HXX
22 #include <memory>
23 #include <list>
24 #include <rtl/ref.hxx>
25 #include <com/sun/star/ucb/ContentCreationException.hpp>
26 #include <com/sun/star/ucb/XContentCreator.hpp>
27 #include <ucbhelper/contenthelper.hxx>
29 #include <glib.h>
30 #include <libgnomevfs/gnome-vfs-ops.h>
31 #include <libgnomevfs/gnome-vfs-directory.h>
33 namespace com { namespace sun { namespace star { namespace beans {
34 struct Property;
35 struct PropertyValue;
36 } } } }
38 namespace com { namespace sun { namespace star { namespace io {
39 class XInputStream;
40 class XOutputStream;
41 } } } }
43 namespace com { namespace sun { namespace star { namespace sdbc {
44 class XRow;
45 } } } }
47 namespace com { namespace sun { namespace star { namespace ucb {
48 struct TransferInfo;
49 } } } }
51 namespace gvfs
54 class ContentProvider;
56 // Random made up names - AFAICS
57 #define GVFS_FILE_TYPE "application/vnd.sun.staroffice.gvfs-file"
58 #define GVFS_FOLDER_TYPE "application/vnd.sun.staroffice.gvfs-folder"
60 class Authentication
62 public:
63 // Helper class to make exceptions pleasant
64 Authentication( const com::sun::star::uno::Reference<
65 com::sun::star::ucb::XCommandEnvironment > & xEnv );
66 ~Authentication();
69 class Content : public ::ucbhelper::ContentImplHelper,
70 public com::sun::star::ucb::XContentCreator
72 //=========================================================================
73 // Internals
74 //=========================================================================
75 private:
76 typedef rtl::Reference< Content > ContentRef;
77 typedef std::list< ContentRef > ContentRefList;
79 // Instance data
80 ContentProvider *m_pProvider; // No need for a ref, base class holds object
81 sal_Bool m_bTransient; // A non-existant (as yet) item
82 GnomeVFSFileInfo m_info; // cached status information
84 // Internal helpers
85 void queryChildren ( ContentRefList& rChildren );
86 ::com::sun::star::uno::Any getBadArgExcept ();
87 GnomeVFSResult getInfo ( const ::com::sun::star::uno::Reference<
88 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
89 sal_Bool isFolder ( const ::com::sun::star::uno::Reference<
90 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
91 sal_Bool exchangeIdentity( const ::com::sun::star::uno::Reference<
92 ::com::sun::star::ucb::XContentIdentifier >& xNewId);
93 GnomeVFSResult doSetFileInfo ( const GnomeVFSFileInfo *newInfo,
94 GnomeVFSSetFileInfoMask setMask,
95 const ::com::sun::star::uno::Reference<
96 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
97 ::rtl::OUString makeNewURL ( const char *newName );
98 // End Internal helpers
100 // For ucbhelper
101 virtual ::rtl::OUString getParentURL();
102 // For ucbhelper
103 virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
104 getProperties( const com::sun::star::uno::Reference<
105 com::sun::star::ucb::XCommandEnvironment > & xEnv );
106 // For ucbhelper
107 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
108 getCommands( const com::sun::star::uno::Reference<
109 com::sun::star::ucb::XCommandEnvironment > & xEnv );
111 public:
112 // Command "getPropertyValues"
113 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
114 getPropertyValues( const ::com::sun::star::uno::Sequence<
115 ::com::sun::star::beans::Property >& rProperties,
116 const ::com::sun::star::uno::Reference<
117 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
119 private:
120 // Command "setPropertyValues"
121 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
122 setPropertyValues( const ::com::sun::star::uno::Sequence<
123 ::com::sun::star::beans::PropertyValue >& rValues,
124 const ::com::sun::star::uno::Reference<
125 ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
127 // Command "insert"
128 void insert( const ::com::sun::star::uno::Reference<
129 ::com::sun::star::io::XInputStream > & xInputStream,
130 sal_Bool bReplaceExisting,
131 const com::sun::star::uno::Reference<
132 com::sun::star::ucb::XCommandEnvironment >& xEnv )
133 throw( ::com::sun::star::uno::Exception );
135 // Command "transfer"
136 void transfer( const ::com::sun::star::ucb::TransferInfo & rArgs,
137 const com::sun::star::uno::Reference<
138 com::sun::star::ucb::XCommandEnvironment >& xEnv )
139 throw( ::com::sun::star::uno::Exception );
141 // Command "delete"
142 void destroy( sal_Bool bDeletePhysical )
143 throw( ::com::sun::star::uno::Exception );
145 // "open" helpers
146 void copyData( ::com::sun::star::uno::Reference<
147 ::com::sun::star::io::XInputStream > xIn,
148 ::com::sun::star::uno::Reference<
149 ::com::sun::star::io::XOutputStream > xOut );
151 ::com::sun::star::uno::Reference<
152 ::com::sun::star::io::XInputStream >
153 createTempStream( const ::com::sun::star::uno::Reference<
154 com::sun::star::ucb::XCommandEnvironment >& xEnv )
155 throw( ::com::sun::star::uno::Exception );
156 ::com::sun::star::uno::Reference<
157 ::com::sun::star::io::XInputStream >
158 createInputStream( const ::com::sun::star::uno::Reference<
159 com::sun::star::ucb::XCommandEnvironment >& xEnv )
160 throw( ::com::sun::star::uno::Exception );
161 sal_Bool feedSink( ::com::sun::star::uno::Reference<
162 ::com::sun::star::uno::XInterface> aSink,
163 const ::com::sun::star::uno::Reference<
164 com::sun::star::ucb::XCommandEnvironment >& xEnv );
166 ::com::sun::star::uno::Any mapVFSException( const GnomeVFSResult result,
167 sal_Bool bWrite );
169 void cancelCommandExecution(const GnomeVFSResult result,
170 const ::com::sun::star::uno::Reference<
171 com::sun::star::ucb::XCommandEnvironment > & xEnv,
172 sal_Bool bWrite = sal_False )
173 throw( ::com::sun::star::uno::Exception );
176 public:
177 // Non-interface bits
178 char *getURI ();
179 rtl::OString getOURI ();
180 rtl::OUString getOUURI ();
182 //=========================================================================
183 // Externals
184 //=========================================================================
185 public:
187 Content( const ::com::sun::star::uno::Reference<
188 ::com::sun::star::uno::XComponentContext >& rxContext,
189 ContentProvider *pProvider,
190 const ::com::sun::star::uno::Reference<
191 ::com::sun::star::ucb::XContentIdentifier >& Identifier)
192 throw ( ::com::sun::star::ucb::ContentCreationException );
193 Content( const ::com::sun::star::uno::Reference<
194 ::com::sun::star::uno::XComponentContext >& rxContext,
195 ContentProvider *pProvider,
196 const ::com::sun::star::uno::Reference<
197 ::com::sun::star::ucb::XContentIdentifier >& Identifier,
198 sal_Bool isFolder)
199 throw ( ::com::sun::star::ucb::ContentCreationException );
200 virtual ~Content();
202 // XInterface
203 XINTERFACE_DECL()
205 // XTypeProvider
206 XTYPEPROVIDER_DECL()
208 // XServiceInfo
209 virtual ::rtl::OUString SAL_CALL getImplementationName()
210 throw( ::com::sun::star::uno::RuntimeException );
211 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
212 getSupportedServiceNames()
213 throw( ::com::sun::star::uno::RuntimeException );
215 // XContent
216 virtual rtl::OUString SAL_CALL
217 getContentType()
218 throw( com::sun::star::uno::RuntimeException );
220 // XCommandProcessor
221 virtual com::sun::star::uno::Any SAL_CALL
222 execute( const com::sun::star::ucb::Command& aCommand,
223 sal_Int32 CommandId,
224 const com::sun::star::uno::Reference<
225 com::sun::star::ucb::XCommandEnvironment >& xEnv )
226 throw( com::sun::star::uno::Exception,
227 com::sun::star::ucb::CommandAbortedException,
228 com::sun::star::uno::RuntimeException );
229 virtual void SAL_CALL
230 abort( sal_Int32 CommandId )
231 throw( com::sun::star::uno::RuntimeException );
233 //////////////////////////////////////////////////////////////////////
234 // Additional interfaces
235 //////////////////////////////////////////////////////////////////////
237 // XContentCreator
238 virtual com::sun::star::uno::Sequence<
239 com::sun::star::ucb::ContentInfo > SAL_CALL
240 queryCreatableContentsInfo()
241 throw( com::sun::star::uno::RuntimeException );
242 virtual com::sun::star::uno::Reference<
243 com::sun::star::ucb::XContent > SAL_CALL
244 createNewContent( const com::sun::star::ucb::ContentInfo& Info )
245 throw( com::sun::star::uno::RuntimeException );
248 com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
249 queryCreatableContentsInfo(
250 const com::sun::star::uno::Reference<
251 com::sun::star::ucb::XCommandEnvironment >& xEnv)
252 throw( com::sun::star::uno::RuntimeException );
257 extern "C" {
258 extern GPrivate *auth_queue;
259 extern void auth_queue_destroy( gpointer data );
262 #endif
264 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */