28#include <osl/diagnose.h>
29#include <com/sun/star/beans/PropertyValue.hpp>
30#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
31#include <com/sun/star/ucb/IllegalIdentifierException.hpp>
32#include <com/sun/star/util/theOfficeInstallationDirectories.hpp>
41#include "../inc/urihelper.hxx"
50HierarchyContentProvider::HierarchyContentProvider(
51 const uno::Reference< uno::XComponentContext >& rxContext )
66 return "com.sun.star.comp.ucb.HierarchyContentProvider";
74 return {
"com.sun.star.ucb.HierarchyContentProvider" };
79extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
81 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any>
const&)
90uno::Reference< ucb::XContent > SAL_CALL
92 const uno::Reference< ucb::XContentIdentifier >& Identifier )
96 throw ucb::IllegalIdentifierException();
99 uno::Reference< ucb::XContentIdentifier > xCanonicId
104 uno::Reference< ucb::XContent > xContent
105 = queryExistingContent( xCanonicId );
111 registerNewContent( xContent );
113 if ( xContent.is() && !xContent->getIdentifier().is() )
114 throw ucb::IllegalIdentifierException();
125 const uno::Sequence< uno::Any >& aArguments )
128 OSL_FAIL(
"HierarchyContentProvider::initialize : not supported!" );
135uno::Reference< lang::XMultiServiceFactory >
137 const OUString & rServiceSpecifier )
157 catch ( uno::Exception
const & )
163 OSL_FAIL(
"HierarchyContentProvider::getConfigProvider - "
164 "No config provider!" );
166 return uno::Reference< lang::XMultiServiceFactory >();
169 return (*it).second.xConfigProvider;
172uno::Reference< container::XHierarchicalNameAccess >
174 const OUString & rServiceSpecifier )
180 return uno::Reference< container::XHierarchicalNameAccess >();
182 if ( !( (*it).second.xRootReadAccess.is() ) )
184 if ( (*it).second.bTriedToGetRootReadAccess )
186 OSL_FAIL(
"HierarchyContentProvider::getRootConfigReadNameAccess - "
187 "Unable to read any config data! -> #82494#" );
188 return uno::Reference< container::XHierarchicalNameAccess >();
193 uno::Reference< lang::XMultiServiceFactory > xConfigProv
196 if ( xConfigProv.is() )
198 beans::PropertyValue aProperty;
199 aProperty.Name =
"nodepath" ;
200 aProperty.Value <<= OUString();
203 (*it).second.bTriedToGetRootReadAccess =
true;
205 (*it).second.xRootReadAccess.set(
206 xConfigProv->createInstanceWithArguments(
207 "com.sun.star.ucb.HierarchyDataReadAccess",
212 catch ( uno::RuntimeException
const & )
216 catch ( uno::Exception
const & )
220 OSL_FAIL(
"HierarchyContentProvider::getRootConfigReadNameAccess - "
221 "caught Exception!" );
225 return (*it).second.xRootReadAccess;
228uno::Reference< util::XOfficeInstallationDirectories >
236 OSL_ENSURE(
m_xContext.is(),
"No service manager!" );
Reference< XComponentContext > m_xContext
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
virtual ~HierarchyContentProvider() override
css::uno::Reference< css::lang::XMultiServiceFactory > getConfigProvider(const OUString &rServiceSpecifier)
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
css::uno::Reference< css::util::XOfficeInstallationDirectories > m_xOfficeInstDirs
ConfigProviderMap m_aConfigProviderMap
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::container::XHierarchicalNameAccess > getRootConfigReadNameAccess(const OUString &rServiceSpecifier)
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::util::XOfficeInstallationDirectories > getOfficeInstallationDirectories()
static rtl::Reference< HierarchyContent > create(const css::uno::Reference< css::uno::XComponentContext > &rxContext, HierarchyContentProvider *pProvider, const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier)
const OUString & getUri() const
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ucb_HierarchyContentProvider_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Sequence< PropertyValue > aArguments
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
cppu::ImplInheritanceHelper< ::ucbhelper::ContentProviderImplHelper, css::lang::XInitialization > HierarchyContentProvider_Base
OUString encodeURI(const OUString &rURI)
css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider