22#include <com/sun/star/embed/ElementModes.hpp>
23#include <com/sun/star/io/IOException.hpp>
40 OUString aTempURL = ::utl::CreateTempURL(
nullptr,
true );
41 if ( aTempURL.isEmpty() )
42 throw uno::RuntimeException(
"Cannot create tempfile.");
45 aTempURL, uno::Reference< ucb::XCommandEnvironment >(),
48 return cppu::getXWeak(
50 embed::ElementModes::READWRITE,
61 const uno::Sequence< uno::Any >& aArguments )
64 OSL_ENSURE( nArgNum < 4,
"Wrong parameter number" );
71 sal_Int32 nStorageMode = embed::ElementModes::READ;
76 throw lang::IllegalArgumentException(
77 (
"second argument to css.embed.FileSystemStorageFactory."
78 "createInstanceWithArguments must be a"
79 " css.embed.ElementModes"),
83 nStorageMode |= embed::ElementModes::READ;
91 throw lang::IllegalArgumentException(
93 " css.embed.FileSystemStorageFactory.createInstanceWithArguments"
94 " must be a (non-empty) URL"),
100 if (
aURL.startsWithIgnoreAsciiCase(
"vnd.sun.star.pkg:")
101 ||
aURL.startsWithIgnoreAsciiCase(
"vnd.sun.star.zip:")
104 throw lang::IllegalArgumentException(
105 (
"URL \"" +
aURL +
"\" passed as first argument to"
106 " css.embed.FileSystemStorageFactory.createInstanceWithArguments"
107 " must be a file URL denoting a directory"),
111 if ( ( nStorageMode & embed::ElementModes::WRITE ) && !( nStorageMode & embed::ElementModes::NOCREATE ) )
114 throw io::IOException(
115 (
"URL \"" +
aURL +
"\" passed to"
116 " css.embed.FileSystemStorageFactory.createInstanceWithArguments"
117 " does not denote an existing directory"),
121 aURL, uno::Reference< ucb::XCommandEnvironment >(),
125 return cppu::getXWeak(
new FSStorage( aResultContent,
132 return "com.sun.star.comp.embed.FileSystemStorageFactory";
142 return {
"com.sun.star.embed.FileSystemStorageFactory",
143 "com.sun.star.comp.embed.FileSystemStorageFactory" };
148extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
150 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const css::uno::Sequence< css::uno::Any > &aArguments) override
The request for storage can be done with up to three arguments.
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
static bool MakeFolderNoUI(std::u16string_view rFolder)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * svl_FSStorageFactory_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Sequence< PropertyValue > aArguments
SVL_DLLPUBLIC bool IsFolder(const OUString &rURL)
Return if under the URL a folder exist.
SVL_DLLPUBLIC bool IsDocument(const OUString &rURL)
Return if under the URL a document exist.
Reference< XComponentContext > getProcessComponentContext()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)