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 _GVFS_UCP_CONTENT_HXX
20 #define _GVFS_UCP_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
72 //=========================================================================
74 //=========================================================================
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-existant (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 ::rtl::OUString
makeNewURL ( const char *newName
);
98 // End Internal helpers
101 virtual ::rtl::OUString
getParentURL();
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
);
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
);
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
179 rtl::OString
getOURI ();
180 rtl::OUString
getOUURI ();
182 //=========================================================================
184 //=========================================================================
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
);
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
);
216 virtual rtl::OUString SAL_CALL
218 throw( com::sun::star::uno::RuntimeException
);
221 virtual com::sun::star::uno::Any SAL_CALL
222 execute( const com::sun::star::ucb::Command
& aCommand
,
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 //////////////////////////////////////////////////////////////////////
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
);
258 extern GPrivate
*auth_queue
;
259 extern void auth_queue_destroy( gpointer data
);
264 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */