30 #include <osl/mutex.hxx>
31 #include <rtl/strbuf.hxx>
53 OString stripDavNamespace(
const OString & in )
55 const OString inXML( in.toAsciiLowerCase() );
59 sal_Int32
end = inXML.indexOf(
"dav:" );
62 if ( inXML[ end - 1 ] ==
'<' ||
63 inXML[ end - 1 ] ==
'/' )
66 buf.append( in.subView( start, end - start ) );
71 buf.append( in.subView( start, end - start + 4 ) );
74 end = inXML.indexOf(
"dav:", start );
76 buf.append( inXML.subView( start ) );
78 return buf.makeStringAndClear();
107 if ( status->klass > 2 )
114 SAL_WARN_IF( !pname->nspace,
"ucb.ucp.webdav",
"NPFR_propfind_iter - No XML namespace!" );
116 DAVProperties::createUCBPropName( pname->nspace,
118 thePropertyValue.
Name );
119 bool bHasValue =
false;
120 if ( DAVProperties::isUCBDeadProperty( *pname ) )
123 if ( UCBDeadPropertyValue::createFromXML(
124 value, thePropertyValue.
Value ) )
127 "ucb.ucp.webdav",
"NPFR_propfind_iter - No value for UCBDeadProperty!" );
134 if ( rtl_str_compareIgnoreAsciiCase(
135 pname->name,
"resourcetype" ) == 0 )
137 OString aValue( value );
138 aValue = aValue.trim();
139 if ( !aValue.isEmpty() )
141 aValue = stripDavNamespace( aValue ).toAsciiLowerCase();
142 if ( aValue.startsWith(
"<collection") )
144 thePropertyValue.
Value
145 <<= OUString(
"collection");
149 if ( !thePropertyValue.
Value.hasValue() )
152 thePropertyValue.
Value <<= OUString::createFromAscii( value );
155 else if ( rtl_str_compareIgnoreAsciiCase(
156 pname->name,
"supportedlock" ) == 0 )
159 LockEntrySequence::createFromXML(
160 stripDavNamespace( value ), aEntries );
161 thePropertyValue.
Value <<= aEntries;
163 else if ( rtl_str_compareIgnoreAsciiCase(
164 pname->name,
"lockdiscovery" ) == 0 )
167 LockSequence::createFromXML(
168 stripDavNamespace( value ), aLocks );
169 thePropertyValue.
Value <<= aLocks;
171 else if ( rtl_str_compareIgnoreAsciiCase( pname->name,
"source" ) == 0 )
174 LinkSequence::createFromXML(
175 stripDavNamespace( value ), aLinks );
176 thePropertyValue.
Value <<= aLinks;
180 thePropertyValue.
Value
181 <<= OStringToOUString( value, RTL_TEXTENCODING_UTF8 );
187 theResource->
properties.push_back( thePropertyValue );
199 OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) );
204 vector< DAVResource > * theResources
205 =
static_cast< vector< DAVResource > *
>( userdata );
206 theResources->push_back( theResource );
215 DAVProperties::createUCBPropName( pname->nspace,
220 theResource->
properties.push_back( aFullName );
236 vector< DAVResourceInfo > * theResources
237 =
static_cast< vector< DAVResourceInfo > *
>( userdata );
238 theResources->push_back( theResource );
243 NeonPropFindRequest::NeonPropFindRequest(
HttpSession* inSession,
246 const vector< OUString >& inPropNames,
247 vector< DAVResource >& ioResources,
251 int thePropCount = inPropNames.size();
252 if ( thePropCount > 0 )
254 std::unique_ptr<NeonPropName[]> thePropNames(
new NeonPropName[ thePropCount + 1 ]);
257 for ( theIndex = 0; theIndex < thePropCount; theIndex ++ )
260 DAVProperties::createNeonPropName(
261 inPropNames[ theIndex ], thePropNames[ theIndex ] );
263 thePropNames[ theIndex ].nspace =
nullptr;
264 thePropNames[ theIndex ].name =
nullptr;
268 nError = ne_simple_propfind( inSession,
276 for ( theIndex = 0; theIndex < thePropCount; theIndex ++ )
277 free( const_cast<char *>(thePropNames[ theIndex ].name) );
283 nError = ne_simple_propfind( inSession,
292 if ( ( nError == NE_OK ) && ioResources.empty() )
296 NeonPropFindRequest::NeonPropFindRequest(
300 std::vector< DAVResourceInfo > & ioResInfo,
305 nError = ne_propnames( inSession,
313 if ( ( nError == NE_OK ) && ioResInfo.empty() )
317 NeonPropFindRequest::~NeonPropFindRequest( )
static void NPFR_propfind_results(void *userdata, const ne_uri *uri, const NeonPropFindResultSet *set)
std::vector< OUString > properties
osl::Mutex & getGlobalNeonMutex()
ne_prop_result_set NeonPropFindResultSet
enumrange< T >::Iterator end(enumrange< T >)
std::vector< DAVPropertyValue > properties
#define SAL_WARN_IF(condition, area, stream)
static int NPFR_propfind_iter(void *userdata, const NeonPropName *pname, const char *value, const HttpStatus *status)
static void NPFR_propnames_results(void *userdata, const ne_uri *, const NeonPropFindResultSet *results)
ScXMLEditAttributeMap::Entry const aEntries[]
static int NPFR_propnames_iter(void *userdata, const NeonPropName *pname, const char *, const HttpStatus *)