fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / ucp / webdav-neon / webdavcontent.hxx
blob6e9540704c784c6989391190048d295ffd0f8623
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_WEBDAVCONTENT_HXX
30 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_WEBDAVCONTENT_HXX
32 #include <config_lgpl.h>
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>
39 #include "DAVResourceAccess.hxx"
40 #include "PropertyMap.hxx"
42 namespace com { namespace sun { namespace star { namespace beans {
43 struct Property;
44 struct PropertyValue;
45 } } } }
47 namespace com { namespace sun { namespace star { namespace io {
48 class XInputStream;
49 } } } }
51 namespace com { namespace sun { namespace star { namespace sdbc {
52 class XRow;
53 } } } }
55 namespace com { namespace sun { namespace star { namespace ucb {
56 struct OpenCommandArgument3;
57 struct PostCommandArgument2;
58 struct PropertyCommandArgument;
59 struct TransferInfo;
60 } } } }
62 namespace webdav_ucp
67 // UNO service name for the content.
68 #define WEBDAV_CONTENT_SERVICE_NAME "com.sun.star.ucb.WebDAVContent"
72 class ContentProvider;
73 class ContentProperties;
74 class CachableContentProperties;
76 class Content : public ::ucbhelper::ContentImplHelper,
77 public com::sun::star::ucb::XContentCreator
79 enum ResourceType
81 UNKNOWN,
82 FTP,
83 NON_DAV,
84 DAV
87 std::unique_ptr< DAVResourceAccess > m_xResAccess;
88 std::unique_ptr< CachableContentProperties >
89 m_xCachedProps; // locally cached props
90 OUString m_aEscapedTitle;
91 ResourceType m_eResourceType;
92 ContentProvider* m_pProvider; // No need for a ref, base class holds object
93 bool m_bTransient;
94 bool m_bLocked;
95 bool m_bCollection;
96 bool m_bDidGetOrHead;
97 std::vector< OUString > m_aFailedPropNames;
99 private:
100 virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
101 getProperties( const com::sun::star::uno::Reference<
102 com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
103 virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
104 getCommands( const com::sun::star::uno::Reference<
105 com::sun::star::ucb::XCommandEnvironment > & xEnv ) SAL_OVERRIDE;
106 virtual OUString getParentURL() SAL_OVERRIDE;
108 bool isFolder( const ::com::sun::star::uno::Reference<
109 ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
110 throw ( ::com::sun::star::uno::Exception, std::exception );
112 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
113 getPropertyValues( const ::com::sun::star::uno::Sequence<
114 ::com::sun::star::beans::Property >& rProperties,
115 const ::com::sun::star::uno::Reference<
116 ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
117 throw ( ::com::sun::star::uno::Exception, std::exception );
119 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
120 setPropertyValues( const ::com::sun::star::uno::Sequence<
121 ::com::sun::star::beans::PropertyValue >& rValues,
122 const ::com::sun::star::uno::Reference<
123 ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
124 throw ( ::com::sun::star::uno::Exception, std::exception );
126 typedef rtl::Reference< Content > ContentRef;
127 typedef std::list< ContentRef > ContentRefList;
128 void queryChildren( ContentRefList& rChildren);
130 bool
131 exchangeIdentity( const ::com::sun::star::uno::Reference<
132 ::com::sun::star::ucb::XContentIdentifier >& xNewId );
134 const OUString
135 getBaseURI( const std::unique_ptr< DAVResourceAccess > & rResAccess );
137 ResourceType
138 getResourceType( const ::com::sun::star::uno::Reference<
139 ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
140 throw ( ::com::sun::star::uno::Exception, std::exception );
142 ResourceType
143 getResourceType( const ::com::sun::star::uno::Reference<
144 ::com::sun::star::ucb::XCommandEnvironment >& xEnv,
145 const std::unique_ptr< DAVResourceAccess > & rResAccess,
146 bool * networkAccessAllowed = 0)
147 throw ( ::com::sun::star::uno::Exception, std::exception );
149 // Command "open"
150 com::sun::star::uno::Any open(
151 const com::sun::star::ucb::OpenCommandArgument3 & rArg,
152 const com::sun::star::uno::Reference<
153 com::sun::star::ucb::XCommandEnvironment > & xEnv )
154 throw (css::uno::Exception, std::exception);
156 // Command "post"
157 void post( const com::sun::star::ucb::PostCommandArgument2 & rArg,
158 const com::sun::star::uno::Reference<
159 com::sun::star::ucb::XCommandEnvironment > & xEnv )
160 throw( ::com::sun::star::uno::Exception );
162 // Command "insert"
163 void insert( const ::com::sun::star::uno::Reference<
164 ::com::sun::star::io::XInputStream > & xInputStream,
165 bool bReplaceExisting,
166 const com::sun::star::uno::Reference<
167 com::sun::star::ucb::XCommandEnvironment >& Environment )
168 throw( ::com::sun::star::uno::Exception );
170 // Command "transfer"
171 void transfer( const ::com::sun::star::ucb::TransferInfo & rArgs,
172 const com::sun::star::uno::Reference<
173 com::sun::star::ucb::XCommandEnvironment >& Environment )
174 throw( ::com::sun::star::uno::Exception );
176 // Command "delete"
177 void destroy( bool bDeletePhysical )
178 throw( ::com::sun::star::uno::Exception );
180 // Command "lock"
181 void lock( const com::sun::star::uno::Reference<
182 com::sun::star::ucb::XCommandEnvironment >& Environment )
183 throw( ::com::sun::star::uno::Exception );
185 // Command "unlock"
186 void unlock( const com::sun::star::uno::Reference<
187 com::sun::star::ucb::XCommandEnvironment >& Environment )
188 throw( ::com::sun::star::uno::Exception );
190 ::com::sun::star::uno::Any MapDAVException( const DAVException & e,
191 bool bWrite );
192 void cancelCommandExecution(
193 const DAVException & e,
194 const ::com::sun::star::uno::Reference<
195 com::sun::star::ucb::XCommandEnvironment > & xEnv,
196 bool bWrite = false )
197 throw( ::com::sun::star::uno::Exception );
199 static bool shouldAccessNetworkAfterException( const DAVException & e );
201 bool supportsExclusiveWriteLock(
202 const com::sun::star::uno::Reference<
203 com::sun::star::ucb::XCommandEnvironment >& Environment );
205 void addProperty( const com::sun::star::ucb::PropertyCommandArgument &aCmdArg,
206 const com::sun::star::uno::Reference<
207 com::sun::star::ucb::XCommandEnvironment >& Environment )
208 throw( com::sun::star::beans::PropertyExistException,
209 com::sun::star::beans::IllegalTypeException,
210 com::sun::star::lang::IllegalArgumentException,
211 com::sun::star::uno::RuntimeException,
212 std::exception );
214 void removeProperty( const OUString& Name,
215 const com::sun::star::uno::Reference<
216 com::sun::star::ucb::XCommandEnvironment >& Environment )
217 throw( com::sun::star::beans::UnknownPropertyException,
218 com::sun::star::beans::NotRemoveableException,
219 com::sun::star::uno::RuntimeException,
220 std::exception );
222 public:
223 Content( const ::com::sun::star::uno::Reference<
224 ::com::sun::star::uno::XComponentContext >& rxContext,
225 ContentProvider* pProvider,
226 const ::com::sun::star::uno::Reference<
227 ::com::sun::star::ucb::XContentIdentifier >& Identifier,
228 rtl::Reference< DAVSessionFactory > const & rSessionFactory )
229 throw ( ::com::sun::star::ucb::ContentCreationException );
230 Content( const ::com::sun::star::uno::Reference<
231 ::com::sun::star::uno::XComponentContext >& rxContext,
232 ContentProvider* pProvider,
233 const ::com::sun::star::uno::Reference<
234 ::com::sun::star::ucb::XContentIdentifier >& Identifier,
235 rtl::Reference< DAVSessionFactory > const & rSessionFactory,
236 bool isCollection )
237 throw ( ::com::sun::star::ucb::ContentCreationException );
238 virtual ~Content();
240 // XInterface
241 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
242 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
243 virtual void SAL_CALL acquire()
244 throw() SAL_OVERRIDE;
245 virtual void SAL_CALL release()
246 throw() SAL_OVERRIDE;
248 // XTypeProvider
249 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
250 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
251 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
252 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
254 // XServiceInfo
255 virtual OUString SAL_CALL
256 getImplementationName()
257 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
259 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
260 getSupportedServiceNames()
261 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
263 // XContent
264 virtual OUString SAL_CALL
265 getContentType()
266 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
268 // XCommandProcessor
269 virtual com::sun::star::uno::Any SAL_CALL
270 execute( const com::sun::star::ucb::Command& aCommand,
271 sal_Int32 CommandId,
272 const com::sun::star::uno::Reference<
273 com::sun::star::ucb::XCommandEnvironment >& Environment )
274 throw( com::sun::star::uno::Exception,
275 com::sun::star::ucb::CommandAbortedException,
276 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
277 virtual void SAL_CALL
278 abort( sal_Int32 CommandId )
279 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
281 // XPropertyContainer
282 virtual void SAL_CALL
283 addProperty( const OUString& Name,
284 sal_Int16 Attributes,
285 const com::sun::star::uno::Any& DefaultValue )
286 throw( com::sun::star::beans::PropertyExistException,
287 com::sun::star::beans::IllegalTypeException,
288 com::sun::star::lang::IllegalArgumentException,
289 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
291 virtual void SAL_CALL
292 removeProperty( const OUString& Name )
293 throw( com::sun::star::beans::UnknownPropertyException,
294 com::sun::star::beans::NotRemoveableException,
295 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
298 // Additional interfaces
301 // XContentCreator
302 virtual com::sun::star::uno::Sequence<
303 com::sun::star::ucb::ContentInfo > SAL_CALL
304 queryCreatableContentsInfo()
305 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
306 virtual com::sun::star::uno::Reference<
307 com::sun::star::ucb::XContent > SAL_CALL
308 createNewContent( const com::sun::star::ucb::ContentInfo& Info )
309 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
312 // Non-interface methods.
315 DAVResourceAccess & getResourceAccess() { return *m_xResAccess; }
317 // Called from resultset data supplier.
318 static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
319 getPropertyValues( const ::com::sun::star::uno::Reference<
320 ::com::sun::star::uno::XComponentContext >& rxContext,
321 const ::com::sun::star::uno::Sequence<
322 ::com::sun::star::beans::Property >& rProperties,
323 const ContentProperties& rData,
324 const rtl::Reference<
325 ::ucbhelper::ContentProviderImplHelper >& rProvider,
326 const OUString& rContentId );
331 #endif
333 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */