1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_CONTENT_HXX
20 #define INCLUDED_UCB_SOURCE_UCP_GVFS_GVFS_CONTENT_HXX
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>
30 #include <libgnomevfs/gnome-vfs-ops.h>
31 #include <libgnomevfs/gnome-vfs-directory.h>
33 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{
38 namespace com
{ namespace sun
{ namespace star
{ namespace io
{
43 namespace com
{ namespace sun
{ namespace star
{ namespace sdbc
{
47 namespace com
{ namespace sun
{ namespace star
{ namespace ucb
{
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"
63 // Helper class to make exceptions pleasant
64 Authentication( const com::sun::star::uno::Reference
<
65 com::sun::star::ucb::XCommandEnvironment
> & xEnv
);
69 class Content
: public ::ucbhelper::ContentImplHelper
,
70 public com::sun::star::ucb::XContentCreator
76 typedef rtl::Reference
< Content
> ContentRef
;
77 typedef std::list
< ContentRef
> ContentRefList
;
80 ContentProvider
*m_pProvider
; // No need for a ref, base class holds object
81 sal_Bool m_bTransient
; // A non-existent (as yet) item
82 GnomeVFSFileInfo m_info
; // cached status information
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 OUString
makeNewURL ( const char *newName
);
98 // End Internal helpers
101 virtual OUString
getParentURL() SAL_OVERRIDE
;
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
) SAL_OVERRIDE
;
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
) SAL_OVERRIDE
;
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
);
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
);
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
);
142 void destroy( sal_Bool bDeletePhysical
)
143 throw( ::com::sun::star::uno::Exception
);
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
,
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
);
177 // Non-interface bits
180 OUString
getOUURI ();
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
,
199 throw ( ::com::sun::star::ucb::ContentCreationException
);
203 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
)
204 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
205 virtual void SAL_CALL
acquire()
206 throw() SAL_OVERRIDE
;
207 virtual void SAL_CALL
release()
208 throw() SAL_OVERRIDE
;
211 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
212 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
213 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes()
214 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
217 virtual OUString SAL_CALL
getImplementationName()
218 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
219 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
220 getSupportedServiceNames()
221 throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
224 virtual OUString SAL_CALL
226 throw( com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
229 virtual com::sun::star::uno::Any SAL_CALL
230 execute( const com::sun::star::ucb::Command
& aCommand
,
232 const com::sun::star::uno::Reference
<
233 com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
234 throw( com::sun::star::uno::Exception
,
235 com::sun::star::ucb::CommandAbortedException
,
236 com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
237 virtual void SAL_CALL
238 abort( sal_Int32 CommandId
)
239 throw( com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
242 // Additional interfaces
246 virtual com::sun::star::uno::Sequence
<
247 com::sun::star::ucb::ContentInfo
> SAL_CALL
248 queryCreatableContentsInfo()
249 throw( com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
250 virtual com::sun::star::uno::Reference
<
251 com::sun::star::ucb::XContent
> SAL_CALL
252 createNewContent( const com::sun::star::ucb::ContentInfo
& Info
)
253 throw( com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
256 com::sun::star::uno::Sequence
< com::sun::star::ucb::ContentInfo
>
257 queryCreatableContentsInfo(
258 const com::sun::star::uno::Reference
<
259 com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
260 throw( com::sun::star::uno::RuntimeException
);
266 extern GPrivate
*auth_queue
;
267 extern void auth_queue_destroy( gpointer data
);
272 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */