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 /embeddedobj/source | |
parent | 64fc0ccde17bbe80fb25f9e07ba68f6aa304c3ef (diff) |
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
Diffstat (limited to 'embeddedobj/source')
-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 |
5 files changed, 28 insertions, 68 deletions
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; |