1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_embeddedobj.hxx"
26 #include <com/sun/star/embed/ElementModes.hpp>
27 #include <com/sun/star/embed/EntryInitModes.hpp>
28 #include <com/sun/star/document/XTypeDetection.hpp>
29 #include <com/sun/star/beans/PropertyValue.hpp>
30 #include <com/sun/star/beans/XPropertySet.hpp>
31 #include <com/sun/star/container/XNameAccess.hpp>
32
33 #include <rtl/logfile.hxx>
34
35
36 #include "xfactory.hxx"
37 #include "commonembobj.hxx"
38 #include "specialobject.hxx"
39 #include "oleembobj.hxx"
40
41
42 using namespace ::com::sun::star;
43
44 //-------------------------------------------------------------------------
impl_staticGetSupportedServiceNames()45 uno::Sequence< ::rtl::OUString > SAL_CALL OOoEmbeddedObjectFactory::impl_staticGetSupportedServiceNames()
46 {
47 uno::Sequence< ::rtl::OUString > aRet(2);
48 aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.embed.OOoEmbeddedObjectFactory");
49 aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.OOoEmbeddedObjectFactory");
50 return aRet;
51 }
52
53 //-------------------------------------------------------------------------
impl_staticGetImplementationName()54 ::rtl::OUString SAL_CALL OOoEmbeddedObjectFactory::impl_staticGetImplementationName()
55 {
56 return ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.OOoEmbeddedObjectFactory");
57 }
58
59 //-------------------------------------------------------------------------
impl_staticCreateSelfInstance(const uno::Reference<lang::XMultiServiceFactory> & xServiceManager)60 uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::impl_staticCreateSelfInstance(
61 const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
62 {
63 return uno::Reference< uno::XInterface >( *new OOoEmbeddedObjectFactory( xServiceManager ) );
64 }
65
66 //-------------------------------------------------------------------------
createInstanceInitFromEntry(const uno::Reference<embed::XStorage> & xStorage,const::rtl::OUString & sEntName,const uno::Sequence<beans::PropertyValue> & aMediaDescr,const uno::Sequence<beans::PropertyValue> & lObjArgs)67 uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceInitFromEntry(
68 const uno::Reference< embed::XStorage >& xStorage,
69 const ::rtl::OUString& sEntName,
70 const uno::Sequence< beans::PropertyValue >& aMediaDescr,
71 const uno::Sequence< beans::PropertyValue >& lObjArgs )
72 throw ( lang::IllegalArgumentException,
73 container::NoSuchElementException,
74 io::IOException,
75 uno::Exception,
76 uno::RuntimeException)
77 {
78 RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceInitFromEntry" );
79
80 if ( !xStorage.is() )
81 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "No parent storage is provided!\n" ),
82 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
83 1 );
84
85 if ( !sEntName.getLength() )
86 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Empty element name is provided!\n" ),
87 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
88 2 );
89
90 uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
91 if ( !xNameAccess.is() )
92 throw uno::RuntimeException(); //TODO
93
94 // detect entry existence
95 if ( !xNameAccess->hasByName( sEntName ) )
96 throw container::NoSuchElementException();
97
98 uno::Reference< uno::XInterface > xResult;
99 if ( xStorage->isStorageElement( sEntName ) )
100 {
101 // the object must be based on storage
102 uno::Reference< embed::XStorage > xSubStorage =
103 xStorage->openStorageElement( sEntName, embed::ElementModes::READ );
104
105 uno::Reference< beans::XPropertySet > xPropSet( xSubStorage, uno::UNO_QUERY );
106 if ( !xPropSet.is() )
107 throw uno::RuntimeException();
108
109 ::rtl::OUString aMediaType;
110 try {
111 uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) );
112 aAny >>= aMediaType;
113 }
114 catch ( uno::Exception& )
115 {
116 }
117
118 try {
119 uno::Reference< lang::XComponent > xComp( xSubStorage, uno::UNO_QUERY );
120 if ( xComp.is() )
121 xComp->dispose();
122 }
123 catch ( uno::Exception& )
124 {
125 }
126 xSubStorage = uno::Reference< embed::XStorage >();
127
128 #if 0
129 ::rtl::OUString aDocServiceName = m_aConfigHelper.GetDocumentServiceFromMediaType( aMediaType );
130 if ( !aDocServiceName.getLength() )
131 {
132 // only own document can be based on storage
133 // in case it is not possible to find related
134 // document service name the storage entry is invalid
135
136 throw io::IOException(); // unexpected mimetype of the storage
137 }
138 #endif
139
140 uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByMediaType( aMediaType );
141 if ( !aObject.getLength() )
142 throw io::IOException(); // unexpected mimetype of the storage
143
144 xResult = uno::Reference< uno::XInterface >(
145 static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
146 m_xFactory,
147 aObject ) ),
148 #if 0
149 GetClassIDFromServName( aDocServiceName ),
150 GetClassNameFromServName( aDocServiceName ),
151 aDocServiceName ) ),
152 #endif
153 uno::UNO_QUERY );
154 }
155 else
156 {
157 // the object must be OOo embedded object, if it is not an exception must be thrown
158 throw io::IOException(); // TODO:
159 }
160
161 uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
162
163 if ( !xPersist.is() )
164 throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
165
166 xPersist->setPersistentEntry( xStorage,
167 sEntName,
168 embed::EntryInitModes::DEFAULT_INIT,
169 aMediaDescr,
170 lObjArgs );
171
172 return xResult;
173 }
174
175 //-------------------------------------------------------------------------
createInstanceInitFromMediaDescriptor(const uno::Reference<embed::XStorage> & xStorage,const::rtl::OUString & sEntName,const uno::Sequence<beans::PropertyValue> & aMediaDescr,const uno::Sequence<beans::PropertyValue> & lObjArgs)176 uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceInitFromMediaDescriptor(
177 const uno::Reference< embed::XStorage >& xStorage,
178 const ::rtl::OUString& sEntName,
179 const uno::Sequence< beans::PropertyValue >& aMediaDescr,
180 const uno::Sequence< beans::PropertyValue >& lObjArgs )
181 throw ( lang::IllegalArgumentException,
182 io::IOException,
183 uno::Exception,
184 uno::RuntimeException)
185 {
186 RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceInitFromMediaDescriptor" );
187
188 if ( !xStorage.is() )
189 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "No parent storage is provided!\n" ),
190 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
191 1 );
192
193 if ( !sEntName.getLength() )
194 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Empty element name is provided!\n" ),
195 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
196 2 );
197
198 uno::Sequence< beans::PropertyValue > aTempMedDescr( aMediaDescr );
199
200 // check if there is FilterName
201 ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False );
202
203 uno::Reference< uno::XInterface > xResult;
204
205 // find document service name
206 if ( aFilterName.getLength() )
207 {
208 uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByFilter( aFilterName );
209 if ( !aObject.getLength() )
210 throw io::IOException(); // unexpected mimetype of the storage
211
212
213 xResult = uno::Reference< uno::XInterface >(
214 static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
215 m_xFactory,
216 aObject ) ),
217 uno::UNO_QUERY );
218 }
219 else
220 {
221 // the object must be OOo embedded object, if it is not an exception must be thrown
222 throw io::IOException(); // TODO:
223 }
224
225 uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
226
227 if ( !xPersist.is() )
228 throw uno::RuntimeException(); // TODO: the interface must be supported ( what about applets? )
229
230 xPersist->setPersistentEntry( xStorage,
231 sEntName,
232 embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT,
233 aTempMedDescr,
234 lObjArgs );
235
236 return xResult;
237 }
238
239 //-------------------------------------------------------------------------
createInstanceInitNew(const uno::Sequence<sal_Int8> & aClassID,const::rtl::OUString &,const uno::Reference<embed::XStorage> & xStorage,const::rtl::OUString & sEntName,const uno::Sequence<beans::PropertyValue> & lObjArgs)240 uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceInitNew(
241 const uno::Sequence< sal_Int8 >& aClassID,
242 const ::rtl::OUString& /*aClassName*/,
243 const uno::Reference< embed::XStorage >& xStorage,
244 const ::rtl::OUString& sEntName,
245 const uno::Sequence< beans::PropertyValue >& lObjArgs )
246 throw ( lang::IllegalArgumentException,
247 io::IOException,
248 uno::Exception,
249 uno::RuntimeException)
250 {
251 RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceInitNew" );
252
253 uno::Reference< uno::XInterface > xResult;
254
255 if ( !xStorage.is() )
256 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "No parent storage is provided!\n" ),
257 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
258 3 );
259
260 if ( !sEntName.getLength() )
261 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Empty element name is provided!\n" ),
262 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
263 4 );
264
265 uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID );
266 if ( !aObject.getLength() )
267 throw io::IOException(); // unexpected mimetype of the storage
268
269 xResult = uno::Reference< uno::XInterface >(
270 static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
271 m_xFactory,
272 aObject ) ),
273 uno::UNO_QUERY );
274
275
276 uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
277
278 if ( !xPersist.is() )
279 throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
280
281 xPersist->setPersistentEntry( xStorage,
282 sEntName,
283 embed::EntryInitModes::TRUNCATE_INIT,
284 uno::Sequence< beans::PropertyValue >(),
285 lObjArgs );
286
287 return xResult;
288 }
289
290 //-------------------------------------------------------------------------
createInstanceUserInit(const uno::Sequence<sal_Int8> & aClassID,const::rtl::OUString &,const uno::Reference<embed::XStorage> & xStorage,const::rtl::OUString & sEntName,sal_Int32 nEntryConnectionMode,const uno::Sequence<beans::PropertyValue> & lArguments,const uno::Sequence<beans::PropertyValue> & lObjArgs)291 uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceUserInit(
292 const uno::Sequence< sal_Int8 >& aClassID,
293 const ::rtl::OUString& /*aClassName*/,
294 const uno::Reference< embed::XStorage >& xStorage,
295 const ::rtl::OUString& sEntName,
296 sal_Int32 nEntryConnectionMode,
297 const uno::Sequence< beans::PropertyValue >& lArguments,
298 const uno::Sequence< beans::PropertyValue >& lObjArgs )
299 throw ( lang::IllegalArgumentException,
300 io::IOException,
301 uno::Exception,
302 uno::RuntimeException )
303 {
304 RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceUserInit" );
305
306 // the initialization is completelly controlled by user
307 if ( !xStorage.is() )
308 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "No parent storage is provided!\n" ),
309 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
310 1 );
311
312 if ( !sEntName.getLength() )
313 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Empty element name is provided!\n" ),
314 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
315 2 );
316
317 uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID );
318 if ( !aObject.getLength() )
319 throw io::IOException(); // unexpected mimetype of the storage
320
321 uno::Sequence< beans::PropertyValue > aTempMedDescr( lArguments );
322 if ( nEntryConnectionMode == embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT )
323 {
324 ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, aObject );
325 if ( !aFilterName.getLength() )
326 // the object must be OOo embedded object, if it is not an exception must be thrown
327 throw io::IOException(); // TODO:
328 }
329
330 uno::Reference< uno::XInterface > xResult = uno::Reference< uno::XInterface > (
331 static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
332 m_xFactory,
333 aObject ) ),
334 uno::UNO_QUERY );
335
336 uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
337 if ( xPersist.is() )
338 {
339 xPersist->setPersistentEntry( xStorage,
340 sEntName,
341 nEntryConnectionMode,
342 aTempMedDescr,
343 lObjArgs );
344
345 }
346 else
347 throw uno::RuntimeException(); // TODO:
348
349 return xResult;
350 }
351
352
353 //-------------------------------------------------------------------------
createInstanceLink(const uno::Reference<embed::XStorage> &,const::rtl::OUString &,const uno::Sequence<beans::PropertyValue> & aMediaDescr,const uno::Sequence<beans::PropertyValue> & lObjArgs)354 uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceLink(
355 const uno::Reference< embed::XStorage >& /*xStorage*/,
356 const ::rtl::OUString& /*sEntName*/,
357 const uno::Sequence< beans::PropertyValue >& aMediaDescr,
358 const uno::Sequence< beans::PropertyValue >& lObjArgs )
359 throw ( lang::IllegalArgumentException,
360 io::IOException,
361 uno::Exception,
362 uno::RuntimeException )
363 {
364 RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceLink" );
365
366 uno::Reference< uno::XInterface > xResult;
367
368 uno::Sequence< beans::PropertyValue > aTempMedDescr( aMediaDescr );
369
370 // check if there is URL, URL must exist
371 ::rtl::OUString aURL;
372 for ( sal_Int32 nInd = 0; nInd < aTempMedDescr.getLength(); nInd++ )
373 if ( aTempMedDescr[nInd].Name.equalsAscii( "URL" ) )
374 aTempMedDescr[nInd].Value >>= aURL;
375
376 if ( !aURL.getLength() )
377 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "No URL for the link is provided!\n" ),
378 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
379 3 );
380
381 ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False );
382
383 if ( aFilterName.getLength() )
384 {
385 uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByFilter( aFilterName );
386 if ( !aObject.getLength() )
387 throw io::IOException(); // unexpected mimetype of the storage
388
389
390 xResult = uno::Reference< uno::XInterface >(
391 static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
392 m_xFactory,
393 aObject,
394 aTempMedDescr,
395 lObjArgs ) ),
396 uno::UNO_QUERY );
397 }
398 else
399 {
400 // the object must be OOo embedded object, if it is not an exception must be thrown
401 throw io::IOException(); // TODO:
402 }
403
404 return xResult;
405 }
406
407 //-------------------------------------------------------------------------
createInstanceLinkUserInit(const uno::Sequence<sal_Int8> & aClassID,const::rtl::OUString &,const uno::Reference<embed::XStorage> & xStorage,const::rtl::OUString & sEntName,const uno::Sequence<beans::PropertyValue> & lArguments,const uno::Sequence<beans::PropertyValue> & lObjArgs)408 uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceLinkUserInit(
409 const uno::Sequence< sal_Int8 >& aClassID,
410 const ::rtl::OUString& /*aClassName*/,
411 const uno::Reference< embed::XStorage >& xStorage,
412 const ::rtl::OUString& sEntName,
413 const uno::Sequence< beans::PropertyValue >& lArguments,
414 const uno::Sequence< beans::PropertyValue >& lObjArgs )
415 throw ( lang::IllegalArgumentException,
416 io::IOException,
417 uno::Exception,
418 uno::RuntimeException )
419 {
420 RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceLinkUserInit" );
421
422 uno::Reference< uno::XInterface > xResult;
423
424 // the initialization is completelly controlled by user
425 if ( !xStorage.is() )
426 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "No parent storage is provided!\n" ),
427 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
428 1 );
429
430 if ( !sEntName.getLength() )
431 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Empty element name is provided!\n" ),
432 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
433 2 );
434
435 uno::Sequence< beans::PropertyValue > aTempMedDescr( lArguments );
436
437 ::rtl::OUString aURL;
438 for ( sal_Int32 nInd = 0; nInd < aTempMedDescr.getLength(); nInd++ )
439 if ( aTempMedDescr[nInd].Name.equalsAscii( "URL" ) )
440 aTempMedDescr[nInd].Value >>= aURL;
441
442 if ( !aURL.getLength() )
443 throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "No URL for the link is provided!\n" ),
444 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
445 3 );
446
447 uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID );
448 if ( !aObject.getLength() )
449 throw io::IOException(); // unexpected mimetype of the storage
450
451 ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, aObject );
452
453 if ( aFilterName.getLength() )
454 {
455
456 xResult = uno::Reference< uno::XInterface >(
457 static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
458 m_xFactory,
459 aObject,
460 aTempMedDescr,
461 lObjArgs ) ),
462 uno::UNO_QUERY );
463 }
464 else
465 {
466 // the object must be OOo embedded object, if it is not an exception must be thrown
467 throw io::IOException(); // TODO:
468 }
469
470 return xResult;
471 }
472
473 //-------------------------------------------------------------------------
getImplementationName()474 ::rtl::OUString SAL_CALL OOoEmbeddedObjectFactory::getImplementationName()
475 throw ( uno::RuntimeException )
476 {
477 return impl_staticGetImplementationName();
478 }
479
480 //-------------------------------------------------------------------------
supportsService(const::rtl::OUString & ServiceName)481 sal_Bool SAL_CALL OOoEmbeddedObjectFactory::supportsService( const ::rtl::OUString& ServiceName )
482 throw ( uno::RuntimeException )
483 {
484 uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
485
486 for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
487 if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
488 return sal_True;
489
490 return sal_False;
491 }
492
493 //-------------------------------------------------------------------------
getSupportedServiceNames()494 uno::Sequence< ::rtl::OUString > SAL_CALL OOoEmbeddedObjectFactory::getSupportedServiceNames()
495 throw ( uno::RuntimeException )
496 {
497 return impl_staticGetSupportedServiceNames();
498 }
499
500 //-------------------------------------------------------------------------
impl_staticGetSupportedServiceNames()501 uno::Sequence< ::rtl::OUString > SAL_CALL OOoSpecialEmbeddedObjectFactory::impl_staticGetSupportedServiceNames()
502 {
503 uno::Sequence< ::rtl::OUString > aRet(2);
504 aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.embed.OOoSpecialEmbeddedObjectFactory");
505 aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.OOoSpecialEmbeddedObjectFactory");
506 return aRet;
507 }
508
509 //-------------------------------------------------------------------------
impl_staticGetImplementationName()510 ::rtl::OUString SAL_CALL OOoSpecialEmbeddedObjectFactory::impl_staticGetImplementationName()
511 {
512 return ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.OOoSpecialEmbeddedObjectFactory");
513 }
514
515 //-------------------------------------------------------------------------
impl_staticCreateSelfInstance(const uno::Reference<lang::XMultiServiceFactory> & xServiceManager)516 uno::Reference< uno::XInterface > SAL_CALL OOoSpecialEmbeddedObjectFactory::impl_staticCreateSelfInstance(
517 const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
518 {
519 return uno::Reference< uno::XInterface >( *new OOoSpecialEmbeddedObjectFactory( xServiceManager ) );
520 }
521
522 //-------------------------------------------------------------------------
createInstanceUserInit(const uno::Sequence<sal_Int8> & aClassID,const::rtl::OUString &,const uno::Reference<embed::XStorage> &,const::rtl::OUString &,sal_Int32,const uno::Sequence<beans::PropertyValue> &,const uno::Sequence<beans::PropertyValue> &)523 uno::Reference< uno::XInterface > SAL_CALL OOoSpecialEmbeddedObjectFactory::createInstanceUserInit(
524 const uno::Sequence< sal_Int8 >& aClassID,
525 const ::rtl::OUString& /*aClassName*/,
526 const uno::Reference< embed::XStorage >& /*xStorage*/,
527 const ::rtl::OUString& /*sEntName*/,
528 sal_Int32 /*nEntryConnectionMode*/,
529 const uno::Sequence< beans::PropertyValue >& /*lArguments*/,
530 const uno::Sequence< beans::PropertyValue >& /*lObjArgs*/ )
531 throw ( lang::IllegalArgumentException,
532 io::IOException,
533 uno::Exception,
534 uno::RuntimeException )
535 {
536 uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID );
537 if ( !aObject.getLength() )
538 throw io::IOException(); // unexpected mimetype of the storage
539
540 uno::Reference< uno::XInterface > xResult(
541 static_cast< ::cppu::OWeakObject* > ( new OSpecialEmbeddedObject(
542 m_xFactory,
543 aObject ) ),
544 uno::UNO_QUERY );
545 return xResult;
546 }
547
548 //-------------------------------------------------------------------------
getImplementationName()549 ::rtl::OUString SAL_CALL OOoSpecialEmbeddedObjectFactory::getImplementationName()
550 throw ( uno::RuntimeException )
551 {
552 return impl_staticGetImplementationName();
553 }
554
555 //-------------------------------------------------------------------------
supportsService(const::rtl::OUString & ServiceName)556 sal_Bool SAL_CALL OOoSpecialEmbeddedObjectFactory::supportsService( const ::rtl::OUString& ServiceName )
557 throw ( uno::RuntimeException )
558 {
559 uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
560
561 for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
562 if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
563 return sal_True;
564
565 return sal_False;
566 }
567
568 //-------------------------------------------------------------------------
getSupportedServiceNames()569 uno::Sequence< ::rtl::OUString > SAL_CALL OOoSpecialEmbeddedObjectFactory::getSupportedServiceNames()
570 throw ( uno::RuntimeException )
571 {
572 return impl_staticGetSupportedServiceNames();
573 }
574
575
576