20#include <com/sun/star/lang/XServiceInfo.hpp>
21#include <com/sun/star/uno/Reference.hxx>
22#include <com/sun/star/uno/RuntimeException.hpp>
23#include <com/sun/star/uno/Sequence.hxx>
24#include <com/sun/star/uri/UriReferenceFactory.hpp>
25#include <com/sun/star/uri/XUriReference.hpp>
26#include <com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.hpp>
30#include <rtl/textenc.h>
33#include <rtl/ustring.hxx>
43 public cppu::WeakImplHelper<
44 css::lang::XServiceInfo, css::uri::XVndSunStarPkgUrlReferenceFactory>
48 css::uno::Reference< css::uno::XComponentContext > context):
49 m_context(
std::move(context)) {}
51 Factory(
const Factory&) =
delete;
52 Factory& operator=(
const Factory&) =
delete;
58 virtual css::uno::Sequence< OUString > SAL_CALL
61 virtual css::uno::Reference< css::uri::XUriReference > SAL_CALL
62 createVndSunStarPkgUrlReference(
63 css::uno::Reference< css::uri::XUriReference >
const & authority)
override;
66 virtual ~Factory()
override {}
68 css::uno::Reference< css::uno::XComponentContext > m_context;
71OUString Factory::getImplementationName()
73 return "com.sun.star.comp.uri.VndSunStarPkgUrlReferenceFactory";
76sal_Bool Factory::supportsService(OUString
const & serviceName)
81css::uno::Sequence< OUString > Factory::getSupportedServiceNames()
83 css::uno::Sequence< OUString > s {
"com.sun.star.uri.VndSunStarPkgUrlReferenceFactory" };
87css::uno::Reference< css::uri::XUriReference >
88Factory::createVndSunStarPkgUrlReference(
89 css::uno::Reference< css::uri::XUriReference >
const & authority)
91 if (!authority.is()) {
92 throw css::uno::RuntimeException(
93 "null authority passed to"
94 " XVndSunStarPkgUrlReferenceFactory.createVndSunStarPkgUrlReference");
96 if (authority->isAbsolute() && !authority->hasFragment()) {
98 "vnd.sun.star.pkg://" +
100 authority->getUriReference(), rtl_UriCharClassRegName,
101 rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8);
102 css::uno::Reference< css::uri::XUriReference > uriRef(
103 css::uri::UriReferenceFactory::create(m_context)->
parse(
107 return css::uno::Reference< css::uri::XUriReference >();
113extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
115 css::uno::Sequence<css::uno::Any>
const &)
117 return ::cppu::acquire(
new Factory(rxContext));
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_uri_VndSunStarPkgUrlReferenceFactory_get_implementation(css::uno::XComponentContext *rxContext, css::uno::Sequence< css::uno::Any > const &)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
bool parse(OUString const &uri, SourceProviderScannerData *data)