diff options
author | Noel Grandin <noel@peralex.com> | 2013-01-08 14:29:06 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-01-15 09:56:03 +0200 |
commit | 251f1b0b38be7d1267339898e44e320f05849e22 (patch) | |
tree | bb6568b4a42879743fb91c5b03c54654ffb53cac | |
parent | fdo#46808, Convert starmath/mathmlimport to XComponentContext (diff) | |
download | core-251f1b0b38be7d1267339898e44e320f05849e22.tar.gz core-251f1b0b38be7d1267339898e44e320f05849e22.zip |
fdo#46808, Adapt embed::*EmbeddedObjectCreator UNO services to new style
The services already existed, it just did not have an IDL file.
Adapts
com.sun.star.embed.OOoEmbeddedObjectFactory
com.sun.star.embed.OLEEmbeddedObjectFactory
com.sun.star.embed.EmbeddedObjectCreator
Change-Id: I8ba01c7fd956a46c87d02dc7d61bdd5fcdf21ab8
-rw-r--r-- | comphelper/source/container/embeddedobjectcontainer.cxx | 26 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/documentdefinition.cxx | 177 | ||||
-rw-r--r-- | embeddedobj/source/commonembedding/xfactory.hxx | 13 | ||||
-rw-r--r-- | embeddedobj/source/general/xcreator.cxx | 35 | ||||
-rw-r--r-- | embeddedobj/source/inc/xcreator.hxx | 14 | ||||
-rw-r--r-- | embeddedobj/source/msole/xdialogcreator.cxx | 22 | ||||
-rw-r--r-- | embeddedobj/source/msole/xolefactory.hxx | 12 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 4 | ||||
-rw-r--r-- | offapi/com/sun/star/embed/EmbeddedObjectCreator.idl | 37 | ||||
-rw-r--r-- | offapi/com/sun/star/embed/OLEEmbeddedObjectFactory.idl | 37 | ||||
-rw-r--r-- | offapi/com/sun/star/embed/OOoEmbeddedObjectFactory.idl | 37 | ||||
-rw-r--r-- | offapi/com/sun/star/embed/XEmbeddedObjectCreator.idl | 46 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltexti.cxx | 17 |
13 files changed, 291 insertions, 186 deletions
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index 1ec18a1b704a..f4b8b99fdb56 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -19,7 +19,7 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/embed/XEmbedObjectCreator.hpp> +#include <com/sun/star/embed/EmbeddedObjectCreator.hpp> #include <com/sun/star/embed/XLinkCreator.hpp> #include <com/sun/star/embed/XEmbedPersist.hpp> #include <com/sun/star/embed/XLinkageSupport.hpp> @@ -360,8 +360,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::Get_Impl( con // object was not added until now - should happen only by calling this method from "inside" //TODO/LATER: it would be good to detect an error when an object should be created already, but isn't (not an "inside" call) - uno::Reference < embed::XEmbedObjectCreator > xFactory( ::comphelper::getProcessServiceFactory()->createInstance( - OUString("com.sun.star.embed.EmbeddedObjectCreator") ), uno::UNO_QUERY_THROW ); + uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Sequence< beans::PropertyValue > aObjDescr( xCopy.is() ? 2 : 1 ); aObjDescr[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Parent" ) ); aObjDescr[0].Value <<= pImpl->m_xModel.get(); @@ -402,8 +401,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CreateEmbedde uno::Reference < embed::XEmbeddedObject > xObj; try { - uno::Reference < embed::XEmbedObjectCreator > xFactory( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator")) ), uno::UNO_QUERY ); + uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Sequence< beans::PropertyValue > aObjDescr( rArgs.getLength() + 1 ); aObjDescr[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Parent" ) ); @@ -620,8 +618,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::InsertEmbedde uno::Reference < embed::XEmbeddedObject > xObj; try { - uno::Reference < embed::XEmbedObjectCreator > xFactory( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator")) ), uno::UNO_QUERY ); + uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Sequence< beans::PropertyValue > aObjDescr( 1 ); aObjDescr[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Parent" ) ); aObjDescr[0].Value <<= pImpl->m_xModel.get(); @@ -655,8 +652,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::InsertEmbedde uno::Reference < embed::XEmbeddedObject > xObj; try { - uno::Reference < embed::XLinkCreator > xFactory( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator")) ), uno::UNO_QUERY ); + uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create(::comphelper::getProcessComponentContext()); uno::Sequence< beans::PropertyValue > aObjDescr( 1 ); aObjDescr[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Parent" ) ); aObjDescr[0].Value <<= pImpl->m_xModel.get(); @@ -740,10 +736,8 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb throw uno::RuntimeException(); // create new linked object from the URL the link is based on - uno::Reference < embed::XLinkCreator > xCreator( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator") ) ), - uno::UNO_QUERY_THROW ); + uno::Reference < embed::XEmbeddedObjectCreator > xCreator = + embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Sequence< beans::PropertyValue > aMediaDescr( 1 ); aMediaDescr[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); @@ -769,10 +763,8 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb uno::Reference< beans::XPropertySet > xOrigProps( xObj->getComponent(), uno::UNO_QUERY_THROW ); // use object class ID to create a new one and tranfer all the properties - uno::Reference < embed::XEmbedObjectCreator > xCreator( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator") ) ), - uno::UNO_QUERY_THROW ); + uno::Reference < embed::XEmbeddedObjectCreator > xCreator = + embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Sequence< beans::PropertyValue > aObjDescr( 1 ); aObjDescr[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Parent" ) ); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 0e2b410d0e64..75737630278f 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -46,8 +46,9 @@ #include <com/sun/star/report/XReportEngine.hpp> #include <com/sun/star/ucb/OpenMode.hpp> #include <com/sun/star/embed/XEmbedObjectFactory.hpp> -#include <com/sun/star/embed/XEmbedObjectCreator.hpp> +#include <com/sun/star/embed/EmbeddedObjectCreator.hpp> #include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/embed/OOoEmbeddedObjectFactory.hpp> #include <ucbhelper/cancelcommandexecution.hxx> #include <com/sun/star/ucb/UnsupportedDataSinkException.hpp> #include <com/sun/star/ucb/UnsupportedOpenModeException.hpp> @@ -1215,36 +1216,33 @@ void ODocumentDefinition::onCommandInsert( const ::rtl::OUString& _sURL, const R Reference< XStorage> xStorage = getContainerStorage(); if ( xStorage.is() ) { - Reference< XEmbedObjectCreator> xEmbedFactory( m_aContext.createComponent( "com.sun.star.embed.EmbeddedObjectCreator" ), UNO_QUERY ); - if ( xEmbedFactory.is() ) + Reference< XEmbeddedObjectCreator> xEmbedFactory = EmbeddedObjectCreator::create(m_aContext.getUNOContext()); + Sequence<PropertyValue> aEmpty,aMediaDesc(1); + aMediaDesc[0].Name = PROPERTY_URL; + aMediaDesc[0].Value <<= _sURL; + m_xEmbeddedObject.set(xEmbedFactory->createInstanceInitFromMediaDescriptor( xStorage + ,m_pImpl->m_aProps.sPersistentName + ,aMediaDesc + ,aEmpty),UNO_QUERY); + + lcl_resetFormsToEmptyDataSource( m_xEmbeddedObject ); + // #i57669# + + Reference<XEmbedPersist> xPersist(m_xEmbeddedObject,UNO_QUERY); + if ( xPersist.is() ) { - Sequence<PropertyValue> aEmpty,aMediaDesc(1); - aMediaDesc[0].Name = PROPERTY_URL; - aMediaDesc[0].Value <<= _sURL; - m_xEmbeddedObject.set(xEmbedFactory->createInstanceInitFromMediaDescriptor( xStorage - ,m_pImpl->m_aProps.sPersistentName - ,aMediaDesc - ,aEmpty),UNO_QUERY); - - lcl_resetFormsToEmptyDataSource( m_xEmbeddedObject ); - // #i57669# - - Reference<XEmbedPersist> xPersist(m_xEmbeddedObject,UNO_QUERY); - if ( xPersist.is() ) - { - xPersist->storeOwn(); - } - try - { - Reference< com::sun::star::util::XCloseable> xCloseable(m_xEmbeddedObject,UNO_QUERY); - if ( xCloseable.is() ) - xCloseable->close(sal_True); - } - catch(const Exception&) - { - } - m_xEmbeddedObject = NULL; - } + xPersist->storeOwn(); + } + try + { + Reference< com::sun::star::util::XCloseable> xCloseable(m_xEmbeddedObject,UNO_QUERY); + if ( xCloseable.is() ) + xCloseable->close(sal_True); + } + catch(const Exception&) + { + } + m_xEmbeddedObject = NULL; } } @@ -1617,80 +1615,77 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_ Reference< XStorage> xStorage = getContainerStorage(); if ( xStorage.is() ) { - Reference< XEmbedObjectFactory> xEmbedFactory( m_aContext.createComponent( "com.sun.star.embed.OOoEmbeddedObjectFactory" ), UNO_QUERY ); - if ( xEmbedFactory.is() ) + Reference< XEmbeddedObjectCreator> xEmbedFactory = OOoEmbeddedObjectFactory::create(m_aContext.getUNOContext()); + ::rtl::OUString sDocumentService; + sal_Bool bSetSize = sal_False; + sal_Int32 nEntryConnectionMode = EntryInitModes::DEFAULT_INIT; + Sequence< sal_Int8 > aClassID = _aClassID; + if ( aClassID.getLength() ) { - ::rtl::OUString sDocumentService; - sal_Bool bSetSize = sal_False; - sal_Int32 nEntryConnectionMode = EntryInitModes::DEFAULT_INIT; - Sequence< sal_Int8 > aClassID = _aClassID; - if ( aClassID.getLength() ) - { - nEntryConnectionMode = EntryInitModes::TRUNCATE_INIT; - bSetSize = sal_True; - } - else + nEntryConnectionMode = EntryInitModes::TRUNCATE_INIT; + bSetSize = sal_True; + } + else + { + sDocumentService = GetDocumentServiceFromMediaType( getContentType(), m_aContext, aClassID ); + // check if we are not a form and + // the com.sun.star.report.pentaho.SOReportJobFactory is not present. + if ( !m_bForm && !sDocumentService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument"))) { - sDocumentService = GetDocumentServiceFromMediaType( getContentType(), m_aContext, aClassID ); - // check if we are not a form and - // the com.sun.star.report.pentaho.SOReportJobFactory is not present. - if ( !m_bForm && !sDocumentService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument"))) + // we seem to be a "new style" report, check if report extension is present. + Reference< XContentEnumerationAccess > xEnumAccess( m_aContext.getLegacyServiceFactory(), UNO_QUERY ); + const ::rtl::OUString sReportEngineServiceName = ::dbtools::getDefaultReportEngineServiceName(m_aContext.getUNOContext()); + Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(sReportEngineServiceName); + if ( !xEnumDrivers.is() || !xEnumDrivers->hasMoreElements() ) { - // we seem to be a "new style" report, check if report extension is present. - Reference< XContentEnumerationAccess > xEnumAccess( m_aContext.getLegacyServiceFactory(), UNO_QUERY ); - const ::rtl::OUString sReportEngineServiceName = ::dbtools::getDefaultReportEngineServiceName(m_aContext.getUNOContext()); - Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(sReportEngineServiceName); - if ( !xEnumDrivers.is() || !xEnumDrivers->hasMoreElements() ) - { - com::sun::star::io::WrongFormatException aWFE; - aWFE.Message = DBACORE_RESSTRING( RID_STR_MISSING_EXTENSION ); - throw aWFE; - } + com::sun::star::io::WrongFormatException aWFE; + aWFE.Message = DBACORE_RESSTRING( RID_STR_MISSING_EXTENSION ); + throw aWFE; } - if ( !aClassID.getLength() ) + } + if ( !aClassID.getLength() ) + { + if ( m_bForm ) + aClassID = MimeConfigurationHelper::GetSequenceClassID(SO3_SW_CLASSID); + else { - if ( m_bForm ) - aClassID = MimeConfigurationHelper::GetSequenceClassID(SO3_SW_CLASSID); - else - { - aClassID = MimeConfigurationHelper::GetSequenceClassID(SO3_RPT_CLASSID_90); - } + aClassID = MimeConfigurationHelper::GetSequenceClassID(SO3_RPT_CLASSID_90); } } + } - OSL_ENSURE( aClassID.getLength(),"No Class ID" ); + OSL_ENSURE( aClassID.getLength(),"No Class ID" ); - Sequence< PropertyValue > aEmbeddedObjectDescriptor; - Sequence< PropertyValue > aLoadArgs( fillLoadArgs( - i_rConnection, _bSuppressMacros, _bReadOnly, i_rOpenCommandArguments, aEmbeddedObjectDescriptor ) ); + Sequence< PropertyValue > aEmbeddedObjectDescriptor; + Sequence< PropertyValue > aLoadArgs( fillLoadArgs( + i_rConnection, _bSuppressMacros, _bReadOnly, i_rOpenCommandArguments, aEmbeddedObjectDescriptor ) ); - m_xEmbeddedObject.set(xEmbedFactory->createInstanceUserInit(aClassID - ,sDocumentService - ,xStorage - ,m_pImpl->m_aProps.sPersistentName - ,nEntryConnectionMode - ,aLoadArgs - ,aEmbeddedObjectDescriptor - ),UNO_QUERY); - if ( m_xEmbeddedObject.is() ) + m_xEmbeddedObject.set(xEmbedFactory->createInstanceUserInit(aClassID + ,sDocumentService + ,xStorage + ,m_pImpl->m_aProps.sPersistentName + ,nEntryConnectionMode + ,aLoadArgs + ,aEmbeddedObjectDescriptor + ),UNO_QUERY); + if ( m_xEmbeddedObject.is() ) + { + if ( !m_pClientHelper ) { - if ( !m_pClientHelper ) - { - m_pClientHelper = new OEmbeddedClientHelper(this); - m_pClientHelper->acquire(); - } - Reference<XEmbeddedClient> xClient = m_pClientHelper; - m_xEmbeddedObject->setClientSite(xClient); - m_xEmbeddedObject->changeState(EmbedStates::RUNNING); - if ( bSetSize ) - { - LockModifiable aLockModify( impl_getComponent_throw( false ) ); + m_pClientHelper = new OEmbeddedClientHelper(this); + m_pClientHelper->acquire(); + } + Reference<XEmbeddedClient> xClient = m_pClientHelper; + m_xEmbeddedObject->setClientSite(xClient); + m_xEmbeddedObject->changeState(EmbedStates::RUNNING); + if ( bSetSize ) + { + LockModifiable aLockModify( impl_getComponent_throw( false ) ); - awt::Size aSize( DEFAULT_WIDTH, DEFAULT_HEIGHT ); - m_xEmbeddedObject->setVisualAreaSize(Aspects::MSOLE_CONTENT,aSize); - } + awt::Size aSize( DEFAULT_WIDTH, DEFAULT_HEIGHT ); + m_xEmbeddedObject->setVisualAreaSize(Aspects::MSOLE_CONTENT,aSize); } - } + } } } else diff --git a/embeddedobj/source/commonembedding/xfactory.hxx b/embeddedobj/source/commonembedding/xfactory.hxx index eee46022e209..b7cf0226749a 100644 --- a/embeddedobj/source/commonembedding/xfactory.hxx +++ b/embeddedobj/source/commonembedding/xfactory.hxx @@ -20,20 +20,13 @@ #ifndef __XFACTORY_HXX_ #define __XFACTORY_HXX_ -#include <com/sun/star/embed/XEmbedObjectCreator.hpp> -#include <com/sun/star/embed/XEmbedObjectFactory.hpp> -#include <com/sun/star/embed/XLinkCreator.hpp> -#include <com/sun/star/embed/XLinkFactory.hpp> +#include <com/sun/star/embed/XEmbeddedObjectCreator.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase5.hxx> #include <comphelper/mimeconfighelper.hxx> -class OOoEmbeddedObjectFactory : public ::cppu::WeakImplHelper5< - ::com::sun::star::embed::XEmbedObjectCreator, - ::com::sun::star::embed::XEmbedObjectFactory, - ::com::sun::star::embed::XLinkCreator, - ::com::sun::star::embed::XLinkFactory, +class OOoEmbeddedObjectFactory : public ::cppu::WeakImplHelper2< + ::com::sun::star::embed::XEmbeddedObjectCreator, ::com::sun::star::lang::XServiceInfo > { ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; diff --git a/embeddedobj/source/general/xcreator.cxx b/embeddedobj/source/general/xcreator.cxx index 599fc7ce2df2..83d9b3e527ec 100644 --- a/embeddedobj/source/general/xcreator.cxx +++ b/embeddedobj/source/general/xcreator.cxx @@ -20,6 +20,8 @@ #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/EntryInitModes.hpp> #include <com/sun/star/embed/XEmbedObjectFactory.hpp> +#include <com/sun/star/embed/OOoEmbeddedObjectFactory.hpp> +#include <com/sun/star/embed/OLEEmbeddedObjectFactory.hpp> #include <com/sun/star/embed/XLinkFactory.hpp> #include <com/sun/star/document/XTypeDetection.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -28,6 +30,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <rtl/logfile.hxx> +#include <comphelper/processfactory.hxx> #include <xcreator.hxx> @@ -258,12 +261,8 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta if ( !aFilterName.isEmpty() ) { // the object can be loaded by one of the office application - uno::Reference< embed::XEmbedObjectCreator > xOOoEmbCreator( - m_xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OOoEmbeddedObjectFactory" ) )), - uno::UNO_QUERY ); - if ( !xOOoEmbCreator.is() ) - throw uno::RuntimeException(); // TODO: + uno::Reference< embed::XEmbeddedObjectCreator > xOOoEmbCreator = + embed::OOoEmbeddedObjectFactory::create( comphelper::getComponentContext(m_xFactory) ); xResult = xOOoEmbCreator->createInstanceInitFromMediaDescriptor( xStorage, sEntName, @@ -281,12 +280,8 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta // Or for example the typename can be used to detect object type if typedetection // was also extended. - uno::Reference< embed::XEmbedObjectCreator > xOleEmbCreator( - m_xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) )), - uno::UNO_QUERY ); - if ( !xOleEmbCreator.is() ) - throw uno::RuntimeException(); // TODO: + uno::Reference< embed::XEmbeddedObjectCreator > xOleEmbCreator = + embed::OLEEmbeddedObjectFactory::create( comphelper::getComponentContext(m_xFactory) ); xResult = xOleEmbCreator->createInstanceInitFromMediaDescriptor( xStorage, sEntName, aTempMedDescr, lObjArgs ); } @@ -371,12 +366,8 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta if ( !aFilterName.isEmpty() ) { // the object can be loaded by one of the office application - uno::Reference< embed::XLinkCreator > xOOoLinkCreator( - m_xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OOoEmbeddedObjectFactory" ) )), - uno::UNO_QUERY ); - if ( !xOOoLinkCreator.is() ) - throw uno::RuntimeException(); // TODO: + uno::Reference< embed::XEmbeddedObjectCreator > xOOoLinkCreator = + embed::OOoEmbeddedObjectFactory::create( comphelper::getComponentContext(m_xFactory) ); xResult = xOOoLinkCreator->createInstanceLink( xStorage, sEntName, @@ -406,12 +397,8 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta static_cast< ::cppu::OWeakObject* >(this) ), 4 ); - uno::Reference< embed::XLinkCreator > xLinkCreator( - m_xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) )), - uno::UNO_QUERY ); - if ( !xLinkCreator.is() ) - throw uno::RuntimeException(); // TODO: + uno::Reference< embed::XEmbeddedObjectCreator > xLinkCreator = + embed::OLEEmbeddedObjectFactory::create( comphelper::getComponentContext(m_xFactory)); xResult = xLinkCreator->createInstanceLink( xStorage, sEntName, aTempMedDescr, lObjArgs ); } diff --git a/embeddedobj/source/inc/xcreator.hxx b/embeddedobj/source/inc/xcreator.hxx index e79f1da6ae52..6e63b8bbed28 100644 --- a/embeddedobj/source/inc/xcreator.hxx +++ b/embeddedobj/source/inc/xcreator.hxx @@ -20,21 +20,15 @@ #ifndef __XCREATOR_HXX_ #define __XCREATOR_HXX_ -#include <com/sun/star/embed/XEmbedObjectCreator.hpp> -#include <com/sun/star/embed/XEmbedObjectFactory.hpp> -#include <com/sun/star/embed/XLinkCreator.hpp> -#include <com/sun/star/embed/XLinkFactory.hpp> +#include <com/sun/star/embed/XEmbeddedObjectCreator.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/implbase2.hxx> #include <comphelper/mimeconfighelper.hxx> -class UNOEmbeddedObjectCreator : public ::cppu::WeakImplHelper5< - ::com::sun::star::embed::XEmbedObjectCreator, - ::com::sun::star::embed::XEmbedObjectFactory, - ::com::sun::star::embed::XLinkCreator, - ::com::sun::star::embed::XLinkFactory, +class UNOEmbeddedObjectCreator : public ::cppu::WeakImplHelper2< + ::com::sun::star::embed::XEmbeddedObjectCreator, ::com::sun::star::lang::XServiceInfo > { ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx index 5cd43ac71f68..9b825609d79b 100644 --- a/embeddedobj/source/msole/xdialogcreator.cxx +++ b/embeddedobj/source/msole/xdialogcreator.cxx @@ -17,9 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <com/sun/star/embed/XEmbedObjectCreator.hpp> +#include <com/sun/star/embed/EmbeddedObjectCreator.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/embed/EntryInitModes.hpp> +#include <com/sun/star/embed/OLEEmbeddedObjectFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/datatransfer/DataFlavor.hpp> #include <com/sun/star/ucb/CommandAbortedException.hpp> @@ -182,12 +183,7 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia { if (io.dwFlags & IOF_SELECTCREATENEW) { - uno::Reference< embed::XEmbedObjectCreator > xEmbCreator( - m_xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.EmbeddedObjectCreator" ) )), - uno::UNO_QUERY ); - if ( !xEmbCreator.is() ) - throw uno::RuntimeException(); + uno::Reference< embed::XEmbeddedObjectCreator > xEmbCreator = embed::EmbeddedObjectCreator::create( comphelper::getComponentContext(m_xFactory) ); uno::Sequence< sal_Int8 > aClassID = MimeConfigurationHelper::GetSequenceClassID( io.clsid.Data1, io.clsid.Data2, @@ -221,19 +217,13 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia aMediaDescr[0].Value <<= aFileURL; // TODO: use config helper for type detection - uno::Reference< embed::XEmbedObjectCreator > xEmbCreator; + uno::Reference< embed::XEmbeddedObjectCreator > xEmbCreator; ::comphelper::MimeConfigurationHelper aHelper( m_xFactory ); if ( aHelper.AddFilterNameCheckOwnFile( aMediaDescr ) ) - xEmbCreator = uno::Reference< embed::XEmbedObjectCreator >( - m_xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.EmbeddedObjectCreator" ) )), - uno::UNO_QUERY ); + xEmbCreator = embed::EmbeddedObjectCreator::create( comphelper::getComponentContext(m_xFactory) ); else - xEmbCreator = uno::Reference< embed::XEmbedObjectCreator >( - m_xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) )), - uno::UNO_QUERY ); + xEmbCreator = embed::OLEEmbeddedObjectFactory::create( comphelper::getComponentContext(m_xFactory) ); if ( !xEmbCreator.is() ) throw uno::RuntimeException(); diff --git a/embeddedobj/source/msole/xolefactory.hxx b/embeddedobj/source/msole/xolefactory.hxx index e5fbad4e92b3..b1d780b5363c 100644 --- a/embeddedobj/source/msole/xolefactory.hxx +++ b/embeddedobj/source/msole/xolefactory.hxx @@ -20,19 +20,15 @@ #ifndef __XFACTORY_HXX_ #define __XFACTORY_HXX_ -#include <com/sun/star/embed/XEmbedObjectCreator.hpp> -#include <com/sun/star/embed/XEmbedObjectFactory.hpp> -#include <com/sun/star/embed/XLinkCreator.hpp> +#include <com/sun/star/embed/XEmbeddedObjectCreator.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase2.hxx> -class OleEmbeddedObjectFactory : public ::cppu::WeakImplHelper4< - ::com::sun::star::embed::XEmbedObjectCreator, - ::com::sun::star::embed::XEmbedObjectFactory, - ::com::sun::star::embed::XLinkCreator, +class OleEmbeddedObjectFactory : public ::cppu::WeakImplHelper2< + ::com::sun::star::embed::XEmbeddedObjectCreator, ::com::sun::star::lang::XServiceInfo > { ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index a8d540a6879a..47bec3c6fe19 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -114,10 +114,13 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/drawing/fr )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/embed,\ DocumentCloser \ + EmbeddedObjectCreator \ FileSystemStorageFactory \ HatchWindowFactory \ InstanceLocker \ OLESimpleStorage \ + OLEEmbeddedObjectFactory \ + OOoEmbeddedObjectFactory \ StorageFactory \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/form/inspection,\ @@ -2336,6 +2339,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/embed,\ XComponentSupplier \ XEmbedObjectClipboardCreator \ XEmbedObjectCreator \ + XEmbeddedObjectCreator \ XEmbedObjectFactory \ XEmbedPersist \ XEmbeddedClient \ diff --git a/offapi/com/sun/star/embed/EmbeddedObjectCreator.idl b/offapi/com/sun/star/embed/EmbeddedObjectCreator.idl new file mode 100644 index 000000000000..19ef22b49b69 --- /dev/null +++ b/offapi/com/sun/star/embed/EmbeddedObjectCreator.idl @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_embed_EmbeddedObjectCreator_idl__ +#define __com_sun_star_embed_EmbeddedObjectCreator_idl__ + +#include <com/sun/star/embed/XEmbeddedObjectCreator.idl> + + + module com { module sun { module star { module embed { + +/** + @since LibreOffice 4.1 + */ +service EmbeddedObjectCreator : XEmbeddedObjectCreator; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/embed/OLEEmbeddedObjectFactory.idl b/offapi/com/sun/star/embed/OLEEmbeddedObjectFactory.idl new file mode 100644 index 000000000000..f4f6188de45d --- /dev/null +++ b/offapi/com/sun/star/embed/OLEEmbeddedObjectFactory.idl @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_embed_OLEEmbeddedObjectFactory_idl__ +#define __com_sun_star_embed_OLEEmbeddedObjectFactory_idl__ + +#include <com/sun/star/embed/XEmbeddedObjectCreator.idl> + + + module com { module sun { module star { module embed { + +/** + @since LibreOffice 4.1 + */ +service OLEEmbeddedObjectFactory : XEmbeddedObjectCreator; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/embed/OOoEmbeddedObjectFactory.idl b/offapi/com/sun/star/embed/OOoEmbeddedObjectFactory.idl new file mode 100644 index 000000000000..c5568a328c3e --- /dev/null +++ b/offapi/com/sun/star/embed/OOoEmbeddedObjectFactory.idl @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_embed_OOoEmbeddedObjectFactory_idl__ +#define __com_sun_star_embed_OOoEmbeddedObjectFactory_idl__ + +#include <com/sun/star/embed/XEmbeddedObjectCreator.idl> + + + module com { module sun { module star { module embed { + +/** + @since LibreOffice 4.1 + */ +service OOoEmbeddedObjectFactory : XEmbeddedObjectCreator; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/embed/XEmbeddedObjectCreator.idl b/offapi/com/sun/star/embed/XEmbeddedObjectCreator.idl new file mode 100644 index 000000000000..b886865cd166 --- /dev/null +++ b/offapi/com/sun/star/embed/XEmbeddedObjectCreator.idl @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_embed_XEmbeddedObjectCreator_idl__ +#define __com_sun_star_embed_XEmbeddedObjectCreator_idl__ + +#include <com/sun/star/embed/XEmbedObjectCreator.idl> +#include <com/sun/star/embed/XEmbedObjectFactory.idl> +#include <com/sun/star/embed/XLinkCreator.idl> +#include <com/sun/star/embed/XLinkFactory.idl> + + module com { module sun { module star { module embed { + +/** + @since LibreOffice 4.1 + */ +interface XEmbeddedObjectCreator +{ + interface XEmbedObjectCreator; + interface XEmbedObjectFactory; + interface XLinkCreator; + [optional] interface XLinkFactory; +}; + + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index 11e8e6e4f296..7f59deb0a96a 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -20,7 +20,8 @@ #include <comphelper/storagehelper.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/embed/EmbedStates.hpp> -#include <com/sun/star/embed/XEmbedObjectCreator.hpp> +#include <com/sun/star/embed/EmbeddedObjectCreator.hpp> +#include <com/sun/star/embed/OOoEmbeddedObjectFactory.hpp> #include <com/sun/star/embed/XLinkCreator.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/embed/XVisualObject.hpp> @@ -279,8 +280,7 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; ::rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("DummyName")); uno::Sequence < sal_Int8 > aClass( aClassName.GetByteSequence() ); - uno::Reference < embed::XEmbedObjectCreator > xFactory( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator")) ), uno::UNO_QUERY ); + uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Reference < embed::XEmbeddedObject > xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceInitNew( aClass, ::rtl::OUString(), xStorage, aName, @@ -568,9 +568,8 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink( { // create object with desired ClassId ::rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("DummyName")); - uno::Reference < embed::XLinkCreator > xFactory( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.OOoEmbeddedObjectFactory")) ), - uno::UNO_QUERY_THROW ); + uno::Reference < embed::XEmbeddedObjectCreator > xFactory = + embed::OOoEmbeddedObjectFactory::create(::comphelper::getProcessComponentContext()); uno::Sequence< beans::PropertyValue > aMediaDescriptor( 1 ); aMediaDescriptor[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")); @@ -701,8 +700,7 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertPlugin( // create object with desired ClassId ::rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("DummyName")); uno::Sequence < sal_Int8 > aClass( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence() ); - uno::Reference < embed::XEmbedObjectCreator > xFactory( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator")) ), uno::UNO_QUERY ); + uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Reference < embed::XEmbeddedObject > xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceInitNew( aClass, ::rtl::OUString(), xStorage, aName, @@ -833,8 +831,7 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra // create object with desired ClassId ::rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("DummyName")); uno::Sequence < sal_Int8 > aClass( SvGlobalName( SO3_IFRAME_CLASSID ).GetByteSequence() ); - uno::Reference < embed::XEmbedObjectCreator > xFactory( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator")) ), uno::UNO_QUERY ); + uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Reference < embed::XEmbeddedObject > xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceInitNew( aClass, ::rtl::OUString(), xStorage, aName, |