37 #include <com/sun/star/beans/Property.hpp>
38 #include <com/sun/star/beans/PropertyAttribute.hpp>
39 #include <com/sun/star/beans/PropertyValue.hpp>
40 #include <com/sun/star/ucb/CommandInfo.hpp>
41 #include <com/sun/star/ucb/ContentInfo.hpp>
42 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
43 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
44 #include <com/sun/star/ucb/PostCommandArgument2.hpp>
45 #include <com/sun/star/ucb/PropertyCommandArgument.hpp>
46 #include <com/sun/star/ucb/TransferInfo.hpp>
47 #include <com/sun/star/uno/Sequence.hxx>
48 #include <com/sun/star/util/DateTime.hpp>
49 #include <com/sun/star/ucb/Link.hpp>
50 #include <com/sun/star/ucb/Lock.hpp>
51 #include <com/sun/star/ucb/LockEntry.hpp>
64 void ContentProvider::getProperty(
65 const OUString & rPropName, beans::Property & rProp )
84 beans::PropertyAttribute::BOUND
85 | beans::PropertyAttribute::READONLY ) );
92 beans::PropertyAttribute::BOUND
93 | beans::PropertyAttribute::READONLY ) );
100 beans::PropertyAttribute::BOUND
101 | beans::PropertyAttribute::READONLY ) );
108 beans::PropertyAttribute::BOUND ) );
117 beans::PropertyAttribute::BOUND
118 | beans::PropertyAttribute::READONLY ) );
125 beans::PropertyAttribute::BOUND
126 | beans::PropertyAttribute::READONLY ) );
133 beans::PropertyAttribute::BOUND
134 | beans::PropertyAttribute::READONLY ) );
141 beans::PropertyAttribute::BOUND
142 | beans::PropertyAttribute::READONLY ) );
149 beans::PropertyAttribute::BOUND
150 | beans::PropertyAttribute::READONLY ) );
154 "CreatableContentsInfo",
157 uno::Sequence< ucb::ContentInfo >>::
get(),
158 beans::PropertyAttribute::BOUND
159 | beans::PropertyAttribute::READONLY ) );
165 DAVProperties::CREATIONDATE,
168 beans::PropertyAttribute::BOUND
169 | beans::PropertyAttribute::READONLY ) );
173 DAVProperties::DISPLAYNAME,
176 beans::PropertyAttribute::BOUND ) );
180 DAVProperties::GETCONTENTLANGUAGE,
183 beans::PropertyAttribute::BOUND
184 | beans::PropertyAttribute::READONLY ) );
188 DAVProperties::GETCONTENTLENGTH,
191 beans::PropertyAttribute::BOUND
192 | beans::PropertyAttribute::READONLY ) );
196 DAVProperties::GETCONTENTTYPE ,
199 beans::PropertyAttribute::BOUND
200 | beans::PropertyAttribute::READONLY ) );
204 DAVProperties::GETETAG,
207 beans::PropertyAttribute::BOUND
208 | beans::PropertyAttribute::READONLY ) );
212 DAVProperties::GETLASTMODIFIED,
215 beans::PropertyAttribute::BOUND
216 | beans::PropertyAttribute::READONLY ) );
220 DAVProperties::LOCKDISCOVERY,
223 uno::Sequence< ucb::Lock >>::
get(),
224 beans::PropertyAttribute::BOUND
225 | beans::PropertyAttribute::READONLY ) );
229 DAVProperties::RESOURCETYPE,
232 beans::PropertyAttribute::BOUND
233 | beans::PropertyAttribute::READONLY ) );
237 DAVProperties::SOURCE,
240 beans::PropertyAttribute::BOUND ) );
244 DAVProperties::SUPPORTEDLOCK,
247 beans::PropertyAttribute::BOUND
248 | beans::PropertyAttribute::READONLY ) );
252 DAVProperties::EXECUTABLE,
255 beans::PropertyAttribute::BOUND ) );
263 beans::Property aProp;
264 aProp.Name = rPropName;
265 const PropertyMap::const_iterator it =
m_pProps->find( aProp );
273 rProp = beans::Property(
277 beans::PropertyAttribute::BOUND );
285 void Content::removeCachedPropertyNames(
const OUString & rURL )
294 uno::Sequence< beans::Property > Content::getProperties(
295 const uno::Reference< ucb::XCommandEnvironment > & xEnv )
298 std::unique_ptr< DAVResourceAccess > xResAccess;
299 std::unique_ptr< ContentProperties > xCachedProps;
303 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
305 bTransient = m_bTransient;
309 xProvider.set( m_pProvider );
312 std::set< OUString > aPropSet;
320 getResourceOptions( xEnv, aDAVOptions, xResAccess );
326 std::vector< DAVResourceInfo >
props;
327 OUString aTheURL( xResAccess->getURL() );
333 xResAccess->PROPFIND(
DAVZERO, props, xEnv );
334 aPropsNames.setPropertiesNames( props );
340 props = aPropsNames.getPropertiesNames();
345 if (props.size() == 1)
347 aPropSet.insert( (*props.begin()).
properties.begin(),
358 bool bHasCreationDate =
false;
359 bool bHasGetLastModified =
false;
360 bool bHasGetContentType =
false;
361 bool bHasGetContentLength =
false;
363 bool bHasContentType =
false;
364 bool bHasIsDocument =
false;
365 bool bHasIsFolder =
false;
366 bool bHasTitle =
false;
367 bool bHasBaseURI =
false;
368 bool bHasDateCreated =
false;
369 bool bHasDateModified =
false;
370 bool bHasMediaType =
false;
371 bool bHasSize =
false;
372 bool bHasCreatableInfos =
false;
375 for (
const auto& rProp : aPropSet )
377 if ( !bHasCreationDate &&
378 ( rProp == DAVProperties::CREATIONDATE ) )
380 bHasCreationDate =
true;
382 else if ( !bHasGetLastModified &&
383 ( rProp == DAVProperties::GETLASTMODIFIED ) )
385 bHasGetLastModified =
true;
387 else if ( !bHasGetContentType &&
388 ( rProp == DAVProperties::GETCONTENTTYPE ) )
390 bHasGetContentType =
true;
392 else if ( !bHasGetContentLength &&
393 ( rProp == DAVProperties::GETCONTENTLENGTH ) )
395 bHasGetContentLength =
true;
397 else if ( !bHasContentType && rProp ==
"ContentType" )
399 bHasContentType =
true;
401 else if ( !bHasIsDocument && rProp ==
"IsDocument" )
403 bHasIsDocument =
true;
405 else if ( !bHasIsFolder && rProp ==
"IsFolder" )
409 else if ( !bHasTitle && rProp ==
"Title" )
413 else if ( !bHasBaseURI && rProp ==
"BaseURI" )
417 else if ( !bHasDateCreated && rProp ==
"DateCreated" )
419 bHasDateCreated =
true;
421 else if ( !bHasDateModified && rProp ==
"DateModified" )
423 bHasDateModified =
true;
425 else if ( !bHasMediaType && rProp ==
"MediaType" )
427 bHasMediaType =
true;
429 else if ( !bHasSize && rProp ==
"Size" )
433 else if ( !bHasCreatableInfos && rProp ==
"CreatableContentsInfo" )
435 bHasCreatableInfos =
true;
441 if ( !bHasContentType )
443 OUString(
"ContentType" ) );
445 if ( !bHasIsDocument )
447 OUString(
"IsDocument" ) );
451 OUString(
"IsFolder" ) );
457 OUString(
"Title" ) );
466 OUString(
"BaseURI" ) );
469 if ( !bHasDateCreated && bHasCreationDate )
471 OUString(
"DateCreated" ) );
473 if ( !bHasDateModified && bHasGetLastModified )
475 OUString(
"DateModified" ) );
477 if ( !bHasMediaType && bHasGetContentType )
479 OUString(
"MediaType" ) );
481 if ( !bHasSize && bHasGetContentLength )
483 OUString(
"Size" ) );
485 if ( !bHasCreatableInfos )
488 "CreatableContentsInfo" ) );
493 const std::unique_ptr< PropertyValueMap > & xProps
494 = xCachedProps->getProperties();
496 for (
const auto& rEntry : *xProps )
497 aPropSet.insert( rEntry.first );
501 sal_Int32
nCount = aPropSet.size();
502 uno::Sequence< beans::Property >
aProperties( nCount );
505 beans::Property aProp;
507 for (
const auto& rProp : aPropSet )
509 xProvider->getProperty( rProp, aProp );
518 uno::Sequence< ucb::CommandInfo > Content::getCommands(
519 const uno::Reference< ucb::XCommandEnvironment > & xEnv )
521 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
523 uno::Sequence< ucb::CommandInfo > aCmdInfo( 10 );
536 "getPropertySetInfo",
548 cppu::UnoType<uno::Sequence< beans::PropertyValue >>::
get() );
590 bool bFolder =
false;
594 bFolder = isFolder( xEnv );
596 catch ( uno::Exception
const & )
602 bool bSupportsLocking = ( eType ==
NOT_FOUND || eType == DAV );
604 sal_Int32
nPos = aCmdInfo.getLength();
605 sal_Int32 nMoreCmds = ( bFolder ? 2 : 0 ) + ( bSupportsLocking ? 2 : 0 );
607 aCmdInfo.realloc( nPos + nMoreCmds );
635 if ( bSupportsLocking )
std::unique_ptr< uno::Sequence< beans::Property > > m_pProps
PropertiesInfo aProperties
void addCachePropertyNames(PropertyNames &rCacheElement)
std::map< sal_Int32, STLPropertyMapEntry > PropertyMap
void removeCachedPropertyNames(const OUString &URL)
static PropertyNamesCache aStaticPropertyNamesCache
bool getCachedPropertyNames(const OUString &URL, PropertyNames &rCacheElement)