1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: content.hxx,v $
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
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
{
49 namespace com
{ namespace sun
{ namespace star
{ namespace io
{
55 namespace com
{ namespace sun
{ namespace star
{ namespace sdbc
{
59 namespace com
{ namespace sun
{ namespace star
{ namespace ucb
{
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"
76 // Helper class to make exceptions pleasant
77 Authentication( const com::sun::star::uno::Reference
<
78 com::sun::star::ucb::XCommandEnvironment
> & xEnv
);
82 class Content
: public ::ucbhelper::ContentImplHelper
,
83 public com::sun::star::ucb::XContentCreator
85 //=========================================================================
87 //=========================================================================
89 typedef rtl::Reference
< Content
> ContentRef
;
90 typedef std::list
< ContentRef
> ContentRefList
;
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
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
115 virtual ::rtl::OUString
getParentURL();
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
);
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
);
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
);
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
);
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
);
156 void destroy( sal_Bool bDeletePhysical
)
157 throw( ::com::sun::star::uno::Exception
);
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
,
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
,
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
);
195 // Non-interface bits
197 rtl::OString
getOURI ();
198 rtl::OUString
getOUURI ();
200 //=========================================================================
202 //=========================================================================
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
,
217 throw ( ::com::sun::star::ucb::ContentCreationException
);
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
);
234 virtual rtl::OUString SAL_CALL
236 throw( com::sun::star::uno::RuntimeException
);
239 virtual com::sun::star::uno::Any SAL_CALL
240 execute( const com::sun::star::ucb::Command
& aCommand
,
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 //////////////////////////////////////////////////////////////////////
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
);
269 extern GPrivate
*auth_queue
;
270 extern void auth_queue_destroy( gpointer data
);