20#include <com/sun/star/embed/ElementModes.hpp>
21#include <com/sun/star/embed/EntryInitModes.hpp>
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/beans/NamedValue.hpp>
24#include <com/sun/star/container/XNameAccess.hpp>
25#include <com/sun/star/io/IOException.hpp>
39 const uno::Reference< embed::XStorage >& xStorage,
40 const OUString& sEntName,
41 const uno::Sequence< beans::PropertyValue >& aMediaDescr,
42 const uno::Sequence< beans::PropertyValue >& lObjArgs )
45 throw lang::IllegalArgumentException(
"No parent storage is provided!",
49 if ( sEntName.isEmpty() )
50 throw lang::IllegalArgumentException(
"Empty element name is provided!",
54 uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY_THROW );
57 if ( !xNameAccess->hasByName( sEntName ) )
58 throw container::NoSuchElementException();
60 uno::Reference< uno::XInterface > xResult;
61 if ( !xStorage->isStorageElement( sEntName ) )
64 throw io::IOException();
67 uno::Reference< embed::XStorage > xSubStorage =
68 xStorage->openStorageElement( sEntName, embed::ElementModes::READ );
70 uno::Reference< beans::XPropertySet > xPropSet( xSubStorage, uno::UNO_QUERY_THROW );
74 uno::Any aAny = xPropSet->getPropertyValue(
"MediaType");
77 catch (
const uno::Exception& )
82 if ( xSubStorage.is() )
83 xSubStorage->dispose();
85 catch (
const uno::Exception& )
96 if ( !aObject.hasElements() )
97 throw io::IOException();
104 uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
106 xPersist->setPersistentEntry( xStorage,
108 embed::EntryInitModes::DEFAULT_INIT,
116 const uno::Reference< embed::XStorage >& xStorage,
117 const OUString& sEntName,
118 const uno::Sequence< beans::PropertyValue >& aMediaDescr,
119 const uno::Sequence< beans::PropertyValue >& lObjArgs )
121 if ( !xStorage.is() )
122 throw lang::IllegalArgumentException(
"No parent storage is provided!",
126 if ( sEntName.isEmpty() )
127 throw lang::IllegalArgumentException(
"Empty element name is provided!",
131 uno::Sequence< beans::PropertyValue > aTempMedDescr( aMediaDescr );
136 uno::Reference< uno::XInterface > xResult;
139 if ( aFilterName.isEmpty() )
142 throw io::IOException();
145 if ( !aObject.hasElements() )
146 throw io::IOException();
154 uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
156 xPersist->setPersistentEntry( xStorage,
158 embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT,
166 const uno::Sequence< sal_Int8 >& aClassID,
168 const uno::Reference< embed::XStorage >& xStorage,
169 const OUString& sEntName,
170 const uno::Sequence< beans::PropertyValue >& lObjArgs )
172 uno::Reference< uno::XInterface > xResult;
174 if ( !xStorage.is() )
175 throw lang::IllegalArgumentException(
"No parent storage is provided!",
179 if ( sEntName.isEmpty() )
180 throw lang::IllegalArgumentException(
"Empty element name is provided!",
185 if ( !aObject.hasElements() )
186 throw io::IOException();
194 uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
196 xPersist->setPersistentEntry( xStorage,
198 embed::EntryInitModes::TRUNCATE_INIT,
199 uno::Sequence< beans::PropertyValue >(),
206 const uno::Sequence< sal_Int8 >& aClassID,
208 const uno::Reference< embed::XStorage >& xStorage,
209 const OUString& sEntName,
210 sal_Int32 nEntryConnectionMode,
211 const uno::Sequence< beans::PropertyValue >& lArguments,
212 const uno::Sequence< beans::PropertyValue >& lObjArgs )
215 if ( !xStorage.is() )
216 throw lang::IllegalArgumentException(
"No parent storage is provided!",
220 if ( sEntName.isEmpty() )
221 throw lang::IllegalArgumentException(
"Empty element name is provided!",
226 if ( !aObject.hasElements() )
227 throw io::IOException();
229 uno::Sequence< beans::PropertyValue > aTempMedDescr( lArguments );
230 if ( nEntryConnectionMode == embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT )
233 if ( aFilterName.isEmpty() )
235 throw io::IOException();
238 uno::Reference< uno::XInterface > xResult(
244 uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
245 xPersist->setPersistentEntry( xStorage,
247 nEntryConnectionMode,
255 const uno::Reference< embed::XStorage >& ,
257 const uno::Sequence< beans::PropertyValue >& aMediaDescr,
258 const uno::Sequence< beans::PropertyValue >& lObjArgs )
260 uno::Reference< uno::XInterface > xResult;
262 uno::Sequence< beans::PropertyValue > aTempMedDescr( aMediaDescr );
266 for ( beans::PropertyValue
const & prop : std::as_const(aTempMedDescr) )
267 if ( prop.Name ==
"URL" )
270 if (
aURL.isEmpty() )
271 throw lang::IllegalArgumentException(
"No URL for the link is provided!",
277 if ( aFilterName.isEmpty() )
280 throw io::IOException();
283 if ( !aObject.hasElements() )
284 throw io::IOException();
298 const uno::Sequence< sal_Int8 >& aClassID,
300 const uno::Reference< embed::XStorage >& xStorage,
301 const OUString& sEntName,
302 const uno::Sequence< beans::PropertyValue >& lArguments,
303 const uno::Sequence< beans::PropertyValue >& lObjArgs )
305 uno::Reference< uno::XInterface > xResult;
308 if ( !xStorage.is() )
309 throw lang::IllegalArgumentException(
"No parent storage is provided!",
313 if ( sEntName.isEmpty() )
314 throw lang::IllegalArgumentException(
"Empty element name is provided!",
318 uno::Sequence< beans::PropertyValue > aTempMedDescr( lArguments );
321 for ( beans::PropertyValue
const & prop : std::as_const(aTempMedDescr) )
322 if ( prop.Name ==
"URL" )
325 if (
aURL.isEmpty() )
326 throw lang::IllegalArgumentException(
"No URL for the link is provided!",
331 if ( !aObject.hasElements() )
332 throw io::IOException();
336 if ( aFilterName.isEmpty() )
339 throw io::IOException();
354 return "com.sun.star.comp.embed.OOoEmbeddedObjectFactory";
364 return {
"com.sun.star.embed.OOoEmbeddedObjectFactory",
"com.sun.star.comp.embed.OOoEmbeddedObjectFactory" };
367extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
369 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
376 const uno::Sequence< sal_Int8 >& aClassID,
378 const uno::Reference< embed::XStorage >& ,
381 const uno::Sequence< beans::PropertyValue >& ,
382 const uno::Sequence< beans::PropertyValue >& )
385 if ( !aObject.hasElements() )
386 throw io::IOException();
388 uno::Reference< uno::XInterface > xResult(
398 return "com.sun.star.comp.embed.OOoSpecialEmbeddedObjectFactory";
408 return {
"com.sun.star.embed.OOoSpecialEmbeddedObjectFactory",
"com.sun.star.comp.embed.OOoSpecialEmbeddedObjectFactory" };
411extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
413 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
Represents an OLE object that has native data and we loaded that data into a document model successfu...
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceUserInit(const css::uno::Sequence< sal_Int8 > &aClassID, const OUString &aClassName, const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &sEntName, sal_Int32 nEntryConnectionMode, const css::uno::Sequence< css::beans::PropertyValue > &lArguments, const css::uno::Sequence< css::beans::PropertyValue > &lObjArgs) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceInitNew(const css::uno::Sequence< sal_Int8 > &aClassID, const OUString &aClassName, const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &sEntName, const css::uno::Sequence< css::beans::PropertyValue > &lObjArgs) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
::comphelper::MimeConfigurationHelper m_aConfigHelper
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceLinkUserInit(const css::uno::Sequence< sal_Int8 > &aClassID, const OUString &aClassName, const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &sEntName, const css::uno::Sequence< css::beans::PropertyValue > &lArguments, const css::uno::Sequence< css::beans::PropertyValue > &lObjArgs) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceInitFromMediaDescriptor(const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &sEntName, const css::uno::Sequence< css::beans::PropertyValue > &aMediaDescr, const css::uno::Sequence< css::beans::PropertyValue > &lObjArgs) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceLink(const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &sEntName, const css::uno::Sequence< css::beans::PropertyValue > &aMediaDescr, const css::uno::Sequence< css::beans::PropertyValue > &lObjArgs) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceInitFromEntry(const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &sEntName, const css::uno::Sequence< css::beans::PropertyValue > &aMediaDescr, const css::uno::Sequence< css::beans::PropertyValue > &lObjArgs) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
::comphelper::MimeConfigurationHelper m_aConfigHelper
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceUserInit(const css::uno::Sequence< sal_Int8 > &aClassID, const OUString &aClassName, const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &sEntName, sal_Int32 nEntryConnectionMode, const css::uno::Sequence< css::beans::PropertyValue > &lArguments, const css::uno::Sequence< css::beans::PropertyValue > &lObjArgs) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByClassID(const css::uno::Sequence< sal_Int8 > &aClassID)
OUString UpdateMediaDescriptorWithFilterName(css::uno::Sequence< css::beans::PropertyValue > &aMediaDescr, bool bIgnoreType)
css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByMediaType(const OUString &aMediaType)
css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByFilter(const OUString &aFilterName)
constexpr OUStringLiteral MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII
constexpr OUStringLiteral MIMETYPE_VND_SUN_XML_BASE_ASCII
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
const char *const aClassID
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * embeddedobj_OOoSpecialEmbeddedObjectFactory_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * embeddedobj_OOoEmbeddedObjectFactory_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)