25#include <rtl/ustrbuf.hxx>
26#include <com/sun/star/ucb/OpenMode.hpp>
33#include <com/sun/star/ucb/IllegalIdentifierException.hpp>
34#include <com/sun/star/ucb/ResultSetException.hpp>
45auto DumpResources(std::vector<DAVResource>
const& rResources) -> OUString
48 for (
auto const& rResource : rResources)
50 buf.append(
"resource URL: <");
51 buf.append(rResource.uri);
53 CurlUri const uri(rResource.uri);
54 buf.append(
"> parsed URL: <");
55 buf.append(
DecodeURI(uri.GetRelativeReference()));
59 buf.append(
"> parsing URL failed! ");
61 buf.append(
"properties: ");
62 for (
auto const& it : rResource.properties)
71 return buf.makeStringAndClear();
82DataSupplier::DataSupplier(
83 const uno::Reference< uno::XComponentContext >& rxContext,
87 m_bCountFinal( false ), m_bThrowException( false )
93DataSupplier::~DataSupplier()
100 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
105 if ( aId.getLength() )
114 OUString aId =
m_xContent->getResourceAccess().getURL();
118 if ( ( aId.lastIndexOf(
'/' ) + 1 ) != aId.getLength() )
121 aId +=
props.getEscapedTitle();
123 if (
props.isTrailingSlash() )
134uno::Reference< ucb::XContentIdentifier >
137 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
141 uno::Reference< ucb::XContentIdentifier > xId
151 if ( aId.getLength() )
153 uno::Reference< ucb::XContentIdentifier > xId
154 = new ::ucbhelper::ContentIdentifier( aId );
158 return uno::Reference< ucb::XContentIdentifier >();
163uno::Reference< ucb::XContent >
166 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
170 uno::Reference< ucb::XContent > xContent
179 uno::Reference< ucb::XContentIdentifier > xId
185 uno::Reference< ucb::XContent > xContent
186 =
m_xContent->getProvider()->queryContent( xId );
191 catch ( ucb::IllegalIdentifierException& )
195 return uno::Reference< ucb::XContent >();
202 osl::ClearableGuard< osl::Mutex > aGuard(
m_aMutex );
252 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
266 uno::Reference< sdbc::XRow > xRow
277 return uno::Reference< sdbc::XRow >();
284 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
301 throw ucb::ResultSetException();
306 osl::ClearableGuard< osl::Mutex > aGuard(
m_aMutex );
310 std::vector< OUString > propertyNames;
318 bool isNoResourceType = std::none_of(propertyNames.begin(), propertyNames.end(),
319 [](
const OUString& rPropName) { return rPropName.equals(DAVProperties::RESOURCETYPE); });
321 if ( isNoResourceType )
324 std::vector< DAVResource > resources;
334 SAL_INFO(
"ucb.ucp.webdav",
"getData() - " << DumpResources(resources));
348 OUString aPath = aURI.
GetPath();
350 if ( aPath.endsWith(
"/") )
351 aPath = aPath.copy( 0, aPath.getLength() - 1 );
354 bool bFoundParent =
false;
356 for (
size_t n = 0;
n < resources.size(); ++
n )
367 OUString aCurrPath = aCurrURI.
GetPath();
368 if ( aCurrPath.endsWith(
"/") )
372 aCurrPath.getLength() - 1 );
375 if ( aPath == aCurrPath )
387 std::unique_ptr<ContentProperties> pContentProperties
388 = std::make_unique<ContentProperties>( rRes );
393 case ucb::OpenMode::FOLDERS:
395 bool bFolder =
false;
398 = pContentProperties->getValue(
"IsFolder" );
407 case ucb::OpenMode::DOCUMENTS:
409 bool bDocument =
false;
412 = pContentProperties->getValue(
"IsDocument" );
413 rValue >>= bDocument;
421 case ucb::OpenMode::ALL:
427 std::make_unique<ResultListEntry>(std::move(pContentProperties)));
uno::Reference< ucb::XContent > m_xContent
Reference< XComponentContext > m_xContext
static void UCBNamesToDAVNames(const css::uno::Sequence< css::beans::Property > &rProps, std::vector< OUString > &resources)
css::uno::Reference< css::sdbc::XRow > getPropertyValues(const css::uno::Sequence< css::beans::Property > &rProperties, const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv)
OUString const & GetPath() const
virtual css::uno::Reference< css::ucb::XContentIdentifier > queryContentIdentifier(sal_uInt32 nIndex) override
virtual css::uno::Reference< css::sdbc::XRow > queryPropertyValues(sal_uInt32 nIndex) override
virtual void validate() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual css::uno::Reference< css::ucb::XContent > queryContent(sal_uInt32 nIndex) override
virtual OUString queryContentIdentifierString(sal_uInt32 nIndex) override
virtual sal_uInt32 currentCount() override
virtual bool isCountFinal() override
virtual sal_uInt32 totalCount() override
virtual bool getResult(sal_uInt32 nIndex) override
virtual void close() override
rtl::Reference< Content > m_xContent
virtual void releasePropertyValues(sal_uInt32 nIndex) override
rtl::Reference< ResultSet > getResultSet() const
#define TOOLS_WARN_EXCEPTION(area, stream)
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
css::uno::Environment getEnvironment(OUString const &name, std::u16string_view implementation)
OUString DecodeURI(OUString const &rURI)
static constexpr OUStringLiteral RESOURCETYPE