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: <" + rResource.uri);
52 CurlUri const uri(rResource.uri);
53 buf.append(
"> parsed URL: <"
58 buf.append(
"> parsing URL failed! ");
60 buf.append(
"properties: ");
61 for (
auto const& it : rResource.properties)
63 buf.append(
"\"" + it.Name +
"\" ");
68 return buf.makeStringAndClear();
79DataSupplier::DataSupplier(
80 const uno::Reference< uno::XComponentContext >& rxContext,
84 m_bCountFinal( false ), m_bThrowException( false )
90DataSupplier::~DataSupplier()
97 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
102 if ( aId.getLength() )
111 OUString aId =
m_xContent->getResourceAccess().getURL();
115 if ( ( aId.lastIndexOf(
'/' ) + 1 ) != aId.getLength() )
118 aId +=
props.getEscapedTitle();
120 if (
props.isTrailingSlash() )
131uno::Reference< ucb::XContentIdentifier >
134 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
138 uno::Reference< ucb::XContentIdentifier > xId
148 if ( aId.getLength() )
150 uno::Reference< ucb::XContentIdentifier > xId
151 = new ::ucbhelper::ContentIdentifier( aId );
155 return uno::Reference< ucb::XContentIdentifier >();
160uno::Reference< ucb::XContent >
163 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
167 uno::Reference< ucb::XContent > xContent
176 uno::Reference< ucb::XContentIdentifier > xId
182 uno::Reference< ucb::XContent > xContent
183 =
m_xContent->getProvider()->queryContent( xId );
188 catch ( ucb::IllegalIdentifierException& )
192 return uno::Reference< ucb::XContent >();
199 osl::ClearableGuard< osl::Mutex > aGuard(
m_aMutex );
249 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
263 uno::Reference< sdbc::XRow > xRow
274 return uno::Reference< sdbc::XRow >();
281 osl::Guard< osl::Mutex > aGuard(
m_aMutex );
298 throw ucb::ResultSetException();
303 osl::ClearableGuard< osl::Mutex > aGuard(
m_aMutex );
307 std::vector< OUString > propertyNames;
315 bool isNoResourceType = std::none_of(propertyNames.begin(), propertyNames.end(),
316 [](
const OUString& rPropName) { return rPropName.equals(DAVProperties::RESOURCETYPE); });
318 if ( isNoResourceType )
321 std::vector< DAVResource > resources;
331 SAL_INFO(
"ucb.ucp.webdav",
"getData() - " << DumpResources(resources));
345 OUString aPath = aURI.
GetPath();
347 if ( aPath.endsWith(
"/") )
348 aPath = aPath.copy( 0, aPath.getLength() - 1 );
351 bool bFoundParent =
false;
353 for (
size_t n = 0;
n < resources.size(); ++
n )
364 OUString aCurrPath = aCurrURI.
GetPath();
365 if ( aCurrPath.endsWith(
"/") )
369 aCurrPath.getLength() - 1 );
372 if ( aPath == aCurrPath )
384 std::unique_ptr<ContentProperties> pContentProperties
385 = std::make_unique<ContentProperties>( rRes );
390 case ucb::OpenMode::FOLDERS:
392 bool bFolder =
false;
395 = pContentProperties->getValue(
"IsFolder" );
404 case ucb::OpenMode::DOCUMENTS:
406 bool bDocument =
false;
409 = pContentProperties->getValue(
"IsDocument" );
410 rValue >>= bDocument;
418 case ucb::OpenMode::ALL:
424 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