LCOV - code coverage report
Current view: top level - libreoffice/embeddedobj/source/general - xcreator.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 80 163 49.1 %
Date: 2012-12-27 Functions: 6 12 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/embed/ElementModes.hpp>
      21             : #include <com/sun/star/embed/EntryInitModes.hpp>
      22             : #include <com/sun/star/embed/XEmbedObjectFactory.hpp>
      23             : #include <com/sun/star/embed/XLinkFactory.hpp>
      24             : #include <com/sun/star/document/XTypeDetection.hpp>
      25             : #include <com/sun/star/beans/PropertyValue.hpp>
      26             : #include <com/sun/star/beans/XPropertySet.hpp>
      27             : #include <com/sun/star/container/XNameAccess.hpp>
      28             : #include <com/sun/star/lang/XComponent.hpp>
      29             : 
      30             : #include <rtl/logfile.hxx>
      31             : 
      32             : 
      33             : #include <xcreator.hxx>
      34             : #include <dummyobject.hxx>
      35             : 
      36             : 
      37             : using namespace ::com::sun::star;
      38             : 
      39             : 
      40             : //-------------------------------------------------------------------------
      41           6 : uno::Sequence< ::rtl::OUString > SAL_CALL UNOEmbeddedObjectCreator::impl_staticGetSupportedServiceNames()
      42             : {
      43           6 :     uno::Sequence< ::rtl::OUString > aRet(2);
      44           6 :     aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator"));
      45           6 :     aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.EmbeddedObjectCreator"));
      46           6 :     return aRet;
      47             : }
      48             : 
      49             : //-------------------------------------------------------------------------
      50          12 : ::rtl::OUString SAL_CALL UNOEmbeddedObjectCreator::impl_staticGetImplementationName()
      51             : {
      52          12 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.EmbeddedObjectCreator"));
      53             : }
      54             : 
      55             : //-------------------------------------------------------------------------
      56           6 : uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::impl_staticCreateSelfInstance(
      57             :             const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
      58             : {
      59           6 :     return uno::Reference< uno::XInterface >( *new UNOEmbeddedObjectCreator( xServiceManager ) );
      60             : }
      61             : 
      62             : //-------------------------------------------------------------------------
      63         184 : uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceInitNew(
      64             :                                             const uno::Sequence< sal_Int8 >& aClassID,
      65             :                                             const ::rtl::OUString& aClassName,
      66             :                                             const uno::Reference< embed::XStorage >& xStorage,
      67             :                                             const ::rtl::OUString& sEntName,
      68             :                                             const uno::Sequence< beans::PropertyValue >& lObjArgs )
      69             :     throw ( lang::IllegalArgumentException,
      70             :             io::IOException,
      71             :             uno::Exception,
      72             :             uno::RuntimeException)
      73             : {
      74             :     RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceInitNew" );
      75             : 
      76         184 :     uno::Reference< uno::XInterface > xResult;
      77             : 
      78         184 :     if ( !xStorage.is() )
      79             :         throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
      80             :                                             uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
      81           0 :                                             3 );
      82             : 
      83         184 :     if ( sEntName.isEmpty() )
      84             :         throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
      85             :                                             uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
      86           0 :                                             4 );
      87             : 
      88         184 :     ::rtl::OUString aEmbedFactory = m_aConfigHelper.GetFactoryNameByClassID( aClassID );
      89         184 :     if ( aEmbedFactory.isEmpty() )
      90             :     {
      91             :         // use system fallback
      92             :         // TODO: in future users factories can be tested
      93           0 :         aEmbedFactory = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ));
      94             :     }
      95             : 
      96         184 :     uno::Reference < uno::XInterface > xFact( m_xFactory->createInstance( aEmbedFactory ) );
      97         184 :     uno::Reference< embed::XEmbedObjectCreator > xEmbCreator( xFact, uno::UNO_QUERY );
      98         184 :     if ( xEmbCreator.is() )
      99         184 :         return xEmbCreator->createInstanceInitNew( aClassID, aClassName, xStorage, sEntName, lObjArgs );
     100             : 
     101           0 :     uno::Reference < embed::XEmbedObjectFactory > xEmbFact( xFact, uno::UNO_QUERY );
     102           0 :     if ( !xEmbFact.is() )
     103           0 :         throw uno::RuntimeException();
     104           0 :     return xEmbFact->createInstanceUserInit( aClassID, aClassName, xStorage, sEntName, embed::EntryInitModes::TRUNCATE_INIT, uno::Sequence < beans::PropertyValue >(), lObjArgs);
     105             : }
     106             : 
     107             : //-------------------------------------------------------------------------
     108           9 : uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceInitFromEntry(
     109             :                                                                     const uno::Reference< embed::XStorage >& xStorage,
     110             :                                                                     const ::rtl::OUString& sEntName,
     111             :                                                                     const uno::Sequence< beans::PropertyValue >& aMedDescr,
     112             :                                                                     const uno::Sequence< beans::PropertyValue >& lObjArgs )
     113             :     throw ( lang::IllegalArgumentException,
     114             :             container::NoSuchElementException,
     115             :             io::IOException,
     116             :             uno::Exception,
     117             :             uno::RuntimeException)
     118             : {
     119             :     RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceInitFromEntry" );
     120             : 
     121           9 :     if ( !xStorage.is() )
     122             :         throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
     123             :                                             uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
     124           0 :                                             1 );
     125             : 
     126           9 :     if ( sEntName.isEmpty() )
     127             :         throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
     128             :                                             uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
     129           0 :                                             2 );
     130             : 
     131           9 :     uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
     132           9 :     if ( !xNameAccess.is() )
     133           0 :         throw uno::RuntimeException(); //TODO
     134             : 
     135             :     // detect entry existence
     136           9 :     if ( !xNameAccess->hasByName( sEntName ) )
     137           0 :         throw container::NoSuchElementException();
     138             : 
     139           9 :     ::rtl::OUString aMediaType;
     140           9 :     ::rtl::OUString aEmbedFactory;
     141           9 :     if ( xStorage->isStorageElement( sEntName ) )
     142             :     {
     143             :         // the object must be based on storage
     144             :         uno::Reference< embed::XStorage > xSubStorage =
     145           5 :                 xStorage->openStorageElement( sEntName, embed::ElementModes::READ );
     146             : 
     147           5 :         uno::Reference< beans::XPropertySet > xPropSet( xSubStorage, uno::UNO_QUERY );
     148           5 :         if ( !xPropSet.is() )
     149           0 :             throw uno::RuntimeException();
     150             : 
     151             :         try {
     152           5 :             uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ));
     153           5 :             aAny >>= aMediaType;
     154             :         }
     155           0 :         catch ( const uno::Exception& )
     156             :         {
     157             :         }
     158             : 
     159             :         try {
     160           5 :             uno::Reference< lang::XComponent > xComp( xSubStorage, uno::UNO_QUERY );
     161           5 :             if ( xComp.is() )
     162           5 :                 xComp->dispose();
     163             :         }
     164           0 :         catch ( const uno::Exception& )
     165             :         {
     166           5 :         }
     167             :     }
     168             :     else
     169             :     {
     170             :         // the object must be based on stream
     171             :         // it means for now that this is an OLE object
     172             : 
     173             :         // the object will be created as embedded object
     174             :         // after it is loaded it can detect that it is a link
     175             : 
     176             :         uno::Reference< io::XStream > xSubStream =
     177           4 :                 xStorage->openStreamElement( sEntName, embed::ElementModes::READ );
     178             : 
     179           4 :         uno::Reference< beans::XPropertySet > xPropSet( xSubStream, uno::UNO_QUERY );
     180           4 :         if ( !xPropSet.is() )
     181           0 :             throw uno::RuntimeException();
     182             : 
     183             :         try {
     184           4 :             uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ));
     185           4 :             aAny >>= aMediaType;
     186           4 :             if ( aMediaType == "application/vnd.sun.star.oleobject" )
     187           4 :                 aEmbedFactory = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) );
     188             :         }
     189           0 :         catch ( const uno::Exception& )
     190             :         {
     191             :         }
     192             : 
     193             :         try {
     194           4 :             uno::Reference< lang::XComponent > xComp( xSubStream, uno::UNO_QUERY );
     195           4 :             if ( xComp.is() )
     196           4 :                 xComp->dispose();
     197             :         }
     198           0 :         catch ( const uno::Exception& )
     199             :         {
     200           4 :         }
     201             :     }
     202             : 
     203             :     OSL_ENSURE( !aMediaType.isEmpty(), "No media type is specified for the object!" );
     204           9 :     if ( !aMediaType.isEmpty() && aEmbedFactory.isEmpty() )
     205           4 :         aEmbedFactory = m_aConfigHelper.GetFactoryNameByMediaType( aMediaType );
     206             : 
     207           9 :     if ( !aEmbedFactory.isEmpty() )
     208             :     {
     209           8 :         uno::Reference< uno::XInterface > xFact = m_xFactory->createInstance( aEmbedFactory );
     210             : 
     211           8 :         uno::Reference< embed::XEmbedObjectCreator > xEmbCreator( xFact, uno::UNO_QUERY );
     212           8 :         if ( xEmbCreator.is() )
     213           4 :             return xEmbCreator->createInstanceInitFromEntry( xStorage, sEntName, aMedDescr, lObjArgs );
     214             : 
     215           4 :         uno::Reference < embed::XEmbedObjectFactory > xEmbFact( xFact, uno::UNO_QUERY );
     216           4 :         if ( xEmbFact.is() )
     217           0 :             return xEmbFact->createInstanceUserInit( uno::Sequence< sal_Int8 >(), ::rtl::OUString(), xStorage, sEntName, embed::EntryInitModes::DEFAULT_INIT, aMedDescr, lObjArgs);
     218             :     }
     219             : 
     220             :     // the default object should be created, it will allow to store the contents on the next saving
     221           5 :     uno::Reference< uno::XInterface > xResult( static_cast< cppu::OWeakObject* >( new ODummyEmbeddedObject() ) );
     222           5 :     uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
     223           5 :     xPersist->setPersistentEntry( xStorage, sEntName, embed::EntryInitModes::DEFAULT_INIT, aMedDescr, lObjArgs );
     224           5 :     return xResult;
     225             : }
     226             : 
     227             : //-------------------------------------------------------------------------
     228           6 : uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceInitFromMediaDescriptor(
     229             :         const uno::Reference< embed::XStorage >& xStorage,
     230             :         const ::rtl::OUString& sEntName,
     231             :         const uno::Sequence< beans::PropertyValue >& aMediaDescr,
     232             :         const uno::Sequence< beans::PropertyValue >& lObjArgs )
     233             :     throw ( lang::IllegalArgumentException,
     234             :             io::IOException,
     235             :             uno::Exception,
     236             :             uno::RuntimeException)
     237             : {
     238             :     RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceInitFromMediaDescriptor" );
     239             : 
     240             :     // TODO: use lObjArgs
     241             : 
     242           6 :     if ( !xStorage.is() )
     243             :         throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
     244             :                                             uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
     245           0 :                                             1 );
     246             : 
     247           6 :     if ( sEntName.isEmpty() )
     248             :         throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
     249             :                                             uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
     250           0 :                                             2 );
     251             : 
     252           6 :     uno::Reference< uno::XInterface > xResult;
     253           6 :     uno::Sequence< beans::PropertyValue > aTempMedDescr( aMediaDescr );
     254             : 
     255             :     // check if there is FilterName
     256           6 :     ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False );
     257             : 
     258           6 :     if ( !aFilterName.isEmpty() )
     259             :     {
     260             :         // the object can be loaded by one of the office application
     261             :         uno::Reference< embed::XEmbedObjectCreator > xOOoEmbCreator(
     262           3 :                             m_xFactory->createInstance(
     263           3 :                                     ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OOoEmbeddedObjectFactory" ) )),
     264           3 :                             uno::UNO_QUERY );
     265           3 :         if ( !xOOoEmbCreator.is() )
     266           0 :             throw uno::RuntimeException(); // TODO:
     267             : 
     268           3 :         xResult = xOOoEmbCreator->createInstanceInitFromMediaDescriptor( xStorage,
     269             :                                                                          sEntName,
     270             :                                                                          aTempMedDescr,
     271           3 :                                                                          lObjArgs );
     272             :     }
     273             :     else
     274             :     {
     275             :         // must be an OLE object
     276             : 
     277             :         // TODO: in future, when more object types are possible this place seems
     278             :         // to be a weak one, probably configuration must provide a type detection service
     279             :         // for every factory, so any file could go through services until it is recognized
     280             :         // or there is no more services
     281             :         // Or for example the typename can be used to detect object type if typedetection
     282             :         // was also extended.
     283             : 
     284             :         uno::Reference< embed::XEmbedObjectCreator > xOleEmbCreator(
     285           3 :                             m_xFactory->createInstance(
     286           3 :                                     ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) )),
     287           3 :                             uno::UNO_QUERY );
     288           3 :         if ( !xOleEmbCreator.is() )
     289           3 :             throw uno::RuntimeException(); // TODO:
     290             : 
     291           0 :         xResult = xOleEmbCreator->createInstanceInitFromMediaDescriptor( xStorage, sEntName, aTempMedDescr, lObjArgs );
     292             :     }
     293             : 
     294           6 :     return xResult;
     295             : }
     296             : 
     297             : //-------------------------------------------------------------------------
     298           0 : uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceUserInit(
     299             :         const uno::Sequence< sal_Int8 >& aClassID,
     300             :         const ::rtl::OUString& sClassName,
     301             :         const uno::Reference< embed::XStorage >& xStorage,
     302             :         const ::rtl::OUString& sEntName,
     303             :         sal_Int32 nEntryConnectionMode,
     304             :         const uno::Sequence< beans::PropertyValue >& aArgs,
     305             :         const uno::Sequence< beans::PropertyValue >& aObjectArgs )
     306             :     throw ( lang::IllegalArgumentException,
     307             :             io::IOException,
     308             :             uno::Exception,
     309             :             uno::RuntimeException)
     310             : {
     311             :     RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceUserInit" );
     312             : 
     313           0 :     uno::Reference< uno::XInterface > xResult;
     314             : 
     315           0 :     if ( !xStorage.is() )
     316             :         throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
     317             :                                             uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
     318           0 :                                             3 );
     319             : 
     320           0 :     if ( sEntName.isEmpty() )
     321             :         throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
     322             :                                             uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
     323           0 :                                             4 );
     324             : 
     325           0 :     ::rtl::OUString aEmbedFactory = m_aConfigHelper.GetFactoryNameByClassID( aClassID );
     326             :     uno::Reference< embed::XEmbedObjectFactory > xEmbFactory(
     327           0 :                         m_xFactory->createInstance( aEmbedFactory ),
     328           0 :                         uno::UNO_QUERY );
     329           0 :     if ( !xEmbFactory.is() )
     330           0 :         throw uno::RuntimeException(); // TODO:
     331             : 
     332           0 :     return xEmbFactory->createInstanceUserInit( aClassID,
     333             :                                                 sClassName,
     334             :                                                 xStorage,
     335             :                                                 sEntName,
     336             :                                                 nEntryConnectionMode,
     337             :                                                 aArgs,
     338           0 :                                                 aObjectArgs );
     339             : }
     340             : 
     341             : //-------------------------------------------------------------------------
     342           0 : uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceLink(
     343             :                                             const uno::Reference< embed::XStorage >& xStorage,
     344             :                                             const ::rtl::OUString& sEntName,
     345             :                                             const uno::Sequence< beans::PropertyValue >& aMediaDescr,
     346             :                                             const uno::Sequence< beans::PropertyValue >& lObjArgs )
     347             :         throw ( lang::IllegalArgumentException,
     348             :                 io::IOException,
     349             :                 uno::Exception,
     350             :                 uno::RuntimeException )
     351             : {
     352             :     RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceLink" );
     353             : 
     354           0 :     uno::Reference< uno::XInterface > xResult;
     355             : 
     356           0 :     uno::Sequence< beans::PropertyValue > aTempMedDescr( aMediaDescr );
     357             : 
     358             :     // check if there is URL, URL must exist
     359           0 :     ::rtl::OUString aURL;
     360           0 :     for ( sal_Int32 nInd = 0; nInd < aTempMedDescr.getLength(); nInd++ )
     361           0 :         if ( aTempMedDescr[nInd].Name == "URL" )
     362           0 :             aTempMedDescr[nInd].Value >>= aURL;
     363             : 
     364           0 :     if ( aURL.isEmpty() )
     365             :         throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No URL for the link is provided!\n" )),
     366             :                                         uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
     367           0 :                                         3 );
     368             : 
     369           0 :     ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False );
     370             : 
     371           0 :     if ( !aFilterName.isEmpty() )
     372             :     {
     373             :         // the object can be loaded by one of the office application
     374             :         uno::Reference< embed::XLinkCreator > xOOoLinkCreator(
     375           0 :                             m_xFactory->createInstance(
     376           0 :                                     ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OOoEmbeddedObjectFactory" ) )),
     377           0 :                             uno::UNO_QUERY );
     378           0 :         if ( !xOOoLinkCreator.is() )
     379           0 :             throw uno::RuntimeException(); // TODO:
     380             : 
     381           0 :         xResult = xOOoLinkCreator->createInstanceLink( xStorage,
     382             :                                                         sEntName,
     383             :                                                         aTempMedDescr,
     384           0 :                                                         lObjArgs );
     385             :     }
     386             :     else
     387             :     {
     388             :         // must be an OLE link
     389             : 
     390             :         // TODO: in future, when more object types are possible this place seems
     391             :         // to be a weak one, probably configuration must provide a type detection service
     392             :         // for every factory, so any file could go through services until it is recognized
     393             :         // or there is no more services
     394             :         // Or for example the typename can be used to detect object type if typedetection
     395             :         // was also extended.
     396             : 
     397           0 :         if ( !xStorage.is() )
     398             :             throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
     399             :                                                 uno::Reference< uno::XInterface >(
     400             :                                                     static_cast< ::cppu::OWeakObject* >(this) ),
     401           0 :                                                 3 );
     402             : 
     403           0 :         if ( sEntName.isEmpty() )
     404             :             throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
     405             :                                                 uno::Reference< uno::XInterface >(
     406             :                                                     static_cast< ::cppu::OWeakObject* >(this) ),
     407           0 :                                                 4 );
     408             : 
     409             :         uno::Reference< embed::XLinkCreator > xLinkCreator(
     410           0 :                             m_xFactory->createInstance(
     411           0 :                                 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) )),
     412           0 :                             uno::UNO_QUERY );
     413           0 :         if ( !xLinkCreator.is() )
     414           0 :             throw uno::RuntimeException(); // TODO:
     415             : 
     416           0 :         xResult = xLinkCreator->createInstanceLink( xStorage, sEntName, aTempMedDescr, lObjArgs );
     417             :     }
     418             : 
     419           0 :     return xResult;
     420             : }
     421             : 
     422             : //-------------------------------------------------------------------------
     423           0 : uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceLinkUserInit(
     424             :                                                 const uno::Sequence< sal_Int8 >& aClassID,
     425             :                                                 const ::rtl::OUString& aClassName,
     426             :                                                 const uno::Reference< embed::XStorage >& xStorage,
     427             :                                                 const ::rtl::OUString& sEntName,
     428             :                                                 const uno::Sequence< beans::PropertyValue >& lArguments,
     429             :                                                 const uno::Sequence< beans::PropertyValue >& lObjArgs )
     430             :         throw ( lang::IllegalArgumentException,
     431             :                 io::IOException,
     432             :                 uno::Exception,
     433             :                 uno::RuntimeException )
     434             : {
     435             :     RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceLinkUserInit" );
     436             : 
     437           0 :     uno::Reference< uno::XInterface > xResult;
     438             : 
     439           0 :     ::rtl::OUString aEmbedFactory = m_aConfigHelper.GetFactoryNameByClassID( aClassID );
     440             :     uno::Reference< embed::XLinkFactory > xLinkFactory(
     441           0 :                         m_xFactory->createInstance( aEmbedFactory ),
     442           0 :                         uno::UNO_QUERY );
     443           0 :     if ( !xLinkFactory.is() )
     444           0 :         throw uno::RuntimeException(); // TODO:
     445             : 
     446           0 :     return xLinkFactory->createInstanceLinkUserInit( aClassID,
     447             :                                                     aClassName,
     448             :                                                     xStorage,
     449             :                                                     sEntName,
     450             :                                                     lArguments,
     451           0 :                                                     lObjArgs );
     452             : 
     453             : }
     454             : 
     455             : //-------------------------------------------------------------------------
     456           0 : ::rtl::OUString SAL_CALL UNOEmbeddedObjectCreator::getImplementationName()
     457             :     throw ( uno::RuntimeException )
     458             : {
     459           0 :     return impl_staticGetImplementationName();
     460             : }
     461             : 
     462             : //-------------------------------------------------------------------------
     463           0 : sal_Bool SAL_CALL UNOEmbeddedObjectCreator::supportsService( const ::rtl::OUString& ServiceName )
     464             :     throw ( uno::RuntimeException )
     465             : {
     466           0 :     uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
     467             : 
     468           0 :     for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
     469           0 :         if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
     470           0 :             return sal_True;
     471             : 
     472           0 :     return sal_False;
     473             : }
     474             : 
     475             : //-------------------------------------------------------------------------
     476           0 : uno::Sequence< ::rtl::OUString > SAL_CALL UNOEmbeddedObjectCreator::getSupportedServiceNames()
     477             :     throw ( uno::RuntimeException )
     478             : {
     479           0 :     return impl_staticGetSupportedServiceNames();
     480             : }
     481             : 
     482             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10