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 _WEBDAV_UCP_CONTENT_HXX
30 #define _WEBDAV_UCP_CONTENT_HXX
34 #include <rtl/ref.hxx>
35 #include <com/sun/star/ucb/ContentCreationException.hpp>
36 #include <com/sun/star/ucb/XContentCreator.hpp>
37 #include <ucbhelper/contenthelper.hxx>
38 #include "DAVResourceAccess.hxx"
39 #include "PropertyMap.hxx"
41 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{
46 namespace com
{ namespace sun
{ namespace star
{ namespace io
{
50 namespace com
{ namespace sun
{ namespace star
{ namespace sdbc
{
54 namespace com
{ namespace sun
{ namespace star
{ namespace ucb
{
55 struct OpenCommandArgument3
;
56 struct PostCommandArgument2
;
63 //=========================================================================
65 // UNO service name for the content.
66 #define WEBDAV_CONTENT_SERVICE_NAME "com.sun.star.ucb.WebDAVContent"
68 //=========================================================================
70 class ContentProvider
;
71 class ContentProperties
;
72 class CachableContentProperties
;
74 class Content
: public ::ucbhelper::ContentImplHelper
,
75 public com::sun::star::ucb::XContentCreator
85 std::auto_ptr
< DAVResourceAccess
> m_xResAccess
;
86 std::auto_ptr
< CachableContentProperties
>
87 m_xCachedProps
; // locally cached props
88 rtl::OUString m_aEscapedTitle
;
89 ResourceType m_eResourceType
;
90 ContentProvider
* m_pProvider
; // No need for a ref, base class holds object
94 std::vector
< rtl::OUString
> m_aFailedPropNames
;
97 virtual com::sun::star::uno::Sequence
< com::sun::star::beans::Property
>
98 getProperties( const com::sun::star::uno::Reference
<
99 com::sun::star::ucb::XCommandEnvironment
> & xEnv
);
100 virtual com::sun::star::uno::Sequence
< com::sun::star::ucb::CommandInfo
>
101 getCommands( const com::sun::star::uno::Reference
<
102 com::sun::star::ucb::XCommandEnvironment
> & xEnv
);
103 virtual ::rtl::OUString
getParentURL();
105 sal_Bool
isFolder( const ::com::sun::star::uno::Reference
<
106 ::com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
107 throw ( ::com::sun::star::uno::Exception
);
109 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRow
>
110 getPropertyValues( const ::com::sun::star::uno::Sequence
<
111 ::com::sun::star::beans::Property
>& rProperties
,
112 const ::com::sun::star::uno::Reference
<
113 ::com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
114 throw ( ::com::sun::star::uno::Exception
);
116 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>
117 setPropertyValues( const ::com::sun::star::uno::Sequence
<
118 ::com::sun::star::beans::PropertyValue
>& rValues
,
119 const ::com::sun::star::uno::Reference
<
120 ::com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
121 throw ( ::com::sun::star::uno::Exception
);
123 typedef rtl::Reference
< Content
> ContentRef
;
124 typedef std::list
< ContentRef
> ContentRefList
;
125 void queryChildren( ContentRefList
& rChildren
);
128 exchangeIdentity( const ::com::sun::star::uno::Reference
<
129 ::com::sun::star::ucb::XContentIdentifier
>& xNewId
);
131 SAL_WNODEPRECATED_DECLARATIONS_PUSH
133 getBaseURI( const std::auto_ptr
< DAVResourceAccess
> & rResAccess
);
134 SAL_WNODEPRECATED_DECLARATIONS_POP
137 getResourceType( const ::com::sun::star::uno::Reference
<
138 ::com::sun::star::ucb::XCommandEnvironment
>& xEnv
)
139 throw ( ::com::sun::star::uno::Exception
);
141 SAL_WNODEPRECATED_DECLARATIONS_PUSH
143 getResourceType( const ::com::sun::star::uno::Reference
<
144 ::com::sun::star::ucb::XCommandEnvironment
>& xEnv
,
145 const std::auto_ptr
< DAVResourceAccess
> & rResAccess
)
146 throw ( ::com::sun::star::uno::Exception
);
147 SAL_WNODEPRECATED_DECLARATIONS_POP
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( ::com::sun::star::uno::Exception
);
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
);
163 void insert( const ::com::sun::star::uno::Reference
<
164 ::com::sun::star::io::XInputStream
> & xInputStream
,
165 sal_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
);
177 void destroy( sal_Bool bDeletePhysical
)
178 throw( ::com::sun::star::uno::Exception
);
181 void lock( const com::sun::star::uno::Reference
<
182 com::sun::star::ucb::XCommandEnvironment
>& Environment
)
183 throw( ::com::sun::star::uno::Exception
);
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
,
192 void cancelCommandExecution(
193 const DAVException
& e
,
194 const ::com::sun::star::uno::Reference
<
195 com::sun::star::ucb::XCommandEnvironment
> & xEnv
,
196 sal_Bool bWrite
= sal_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
);
206 Content( const ::com::sun::star::uno::Reference
<
207 ::com::sun::star::lang::XMultiServiceFactory
>& rxSMgr
,
208 ContentProvider
* pProvider
,
209 const ::com::sun::star::uno::Reference
<
210 ::com::sun::star::ucb::XContentIdentifier
>& Identifier
,
211 rtl::Reference
< DAVSessionFactory
> const & rSessionFactory
)
212 throw ( ::com::sun::star::ucb::ContentCreationException
);
213 Content( const ::com::sun::star::uno::Reference
<
214 ::com::sun::star::lang::XMultiServiceFactory
>& rxSMgr
,
215 ContentProvider
* pProvider
,
216 const ::com::sun::star::uno::Reference
<
217 ::com::sun::star::ucb::XContentIdentifier
>& Identifier
,
218 rtl::Reference
< DAVSessionFactory
> const & rSessionFactory
,
219 sal_Bool isCollection
)
220 throw ( ::com::sun::star::ucb::ContentCreationException
);
230 virtual ::rtl::OUString SAL_CALL
231 getImplementationName()
232 throw( ::com::sun::star::uno::RuntimeException
);
234 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
235 getSupportedServiceNames()
236 throw( ::com::sun::star::uno::RuntimeException
);
239 virtual rtl::OUString SAL_CALL
241 throw( com::sun::star::uno::RuntimeException
);
244 virtual com::sun::star::uno::Any SAL_CALL
245 execute( const com::sun::star::ucb::Command
& aCommand
,
247 const com::sun::star::uno::Reference
<
248 com::sun::star::ucb::XCommandEnvironment
>& Environment
)
249 throw( com::sun::star::uno::Exception
,
250 com::sun::star::ucb::CommandAbortedException
,
251 com::sun::star::uno::RuntimeException
);
252 virtual void SAL_CALL
253 abort( sal_Int32 CommandId
)
254 throw( com::sun::star::uno::RuntimeException
);
256 // XPropertyContainer
257 virtual void SAL_CALL
258 addProperty( const rtl::OUString
& Name
,
259 sal_Int16 Attributes
,
260 const com::sun::star::uno::Any
& DefaultValue
)
261 throw( com::sun::star::beans::PropertyExistException
,
262 com::sun::star::beans::IllegalTypeException
,
263 com::sun::star::lang::IllegalArgumentException
,
264 com::sun::star::uno::RuntimeException
);
266 virtual void SAL_CALL
267 removeProperty( const rtl::OUString
& Name
)
268 throw( com::sun::star::beans::UnknownPropertyException
,
269 com::sun::star::beans::NotRemoveableException
,
270 com::sun::star::uno::RuntimeException
);
272 //////////////////////////////////////////////////////////////////////
273 // Additional interfaces
274 //////////////////////////////////////////////////////////////////////
277 virtual com::sun::star::uno::Sequence
<
278 com::sun::star::ucb::ContentInfo
> SAL_CALL
279 queryCreatableContentsInfo()
280 throw( com::sun::star::uno::RuntimeException
);
281 virtual com::sun::star::uno::Reference
<
282 com::sun::star::ucb::XContent
> SAL_CALL
283 createNewContent( const com::sun::star::ucb::ContentInfo
& Info
)
284 throw( com::sun::star::uno::RuntimeException
);
286 //////////////////////////////////////////////////////////////////////
287 // Non-interface methods.
288 //////////////////////////////////////////////////////////////////////
290 DAVResourceAccess
& getResourceAccess() { return *m_xResAccess
; }
292 // Called from resultset data supplier.
293 static ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XRow
>
294 getPropertyValues( const ::com::sun::star::uno::Reference
<
295 ::com::sun::star::lang::XMultiServiceFactory
>& rSMgr
,
296 const ::com::sun::star::uno::Sequence
<
297 ::com::sun::star::beans::Property
>& rProperties
,
298 const ContentProperties
& rData
,
299 const rtl::Reference
<
300 ::ucbhelper::ContentProviderImplHelper
>& rProvider
,
301 const ::rtl::OUString
& rContentId
);
308 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */