1*08421ca6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*08421ca6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*08421ca6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*08421ca6SAndrew Rist  * distributed with this work for additional information
6*08421ca6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*08421ca6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*08421ca6SAndrew Rist  * "License"); you may not use this file except in compliance
9*08421ca6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*08421ca6SAndrew Rist  *
11*08421ca6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*08421ca6SAndrew Rist  *
13*08421ca6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*08421ca6SAndrew Rist  * software distributed under the License is distributed on an
15*08421ca6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*08421ca6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*08421ca6SAndrew Rist  * specific language governing permissions and limitations
18*08421ca6SAndrew Rist  * under the License.
19*08421ca6SAndrew Rist  *
20*08421ca6SAndrew Rist  *************************************************************/
21*08421ca6SAndrew Rist 
22*08421ca6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __XFACTORY_HXX_
25cdf0e10cSrcweir #define __XFACTORY_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/embed/XEmbedObjectCreator.hpp>
28cdf0e10cSrcweir #include <com/sun/star/embed/XEmbedObjectFactory.hpp>
29cdf0e10cSrcweir #include <com/sun/star/embed/XLinkCreator.hpp>
30cdf0e10cSrcweir #include <com/sun/star/embed/XLinkFactory.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
32cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
33cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx>
34cdf0e10cSrcweir #include <comphelper/mimeconfighelper.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class OOoEmbeddedObjectFactory : public ::cppu::WeakImplHelper5<
37cdf0e10cSrcweir 												::com::sun::star::embed::XEmbedObjectCreator,
38cdf0e10cSrcweir 												::com::sun::star::embed::XEmbedObjectFactory,
39cdf0e10cSrcweir 												::com::sun::star::embed::XLinkCreator,
40cdf0e10cSrcweir 												::com::sun::star::embed::XLinkFactory,
41cdf0e10cSrcweir 												::com::sun::star::lang::XServiceInfo >
42cdf0e10cSrcweir {
43cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 	::comphelper::MimeConfigurationHelper m_aConfigHelper;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir public:
OOoEmbeddedObjectFactory(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> & xFactory)48cdf0e10cSrcweir 	OOoEmbeddedObjectFactory(
49cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
50cdf0e10cSrcweir 	: m_xFactory( xFactory )
51cdf0e10cSrcweir 	, m_aConfigHelper( xFactory )
52cdf0e10cSrcweir 	{
53cdf0e10cSrcweir 		OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
54cdf0e10cSrcweir 	}
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames();
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
61cdf0e10cSrcweir 		impl_staticCreateSelfInstance(
62cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	// XEmbedObjectCreator
66cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitNew( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
67cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitFromEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
68cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitFromMediaDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	// XEmbedObjectFactory
71cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceUserInit( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, sal_Int32 nEntryConnectionMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	// XLinkCreator
74cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceLink( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	// XLinkFactory
77cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceLinkUserInit( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	// XServiceInfo
80cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
81cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
82cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir 
84cdf0e10cSrcweir };
85cdf0e10cSrcweir 
86cdf0e10cSrcweir class OOoSpecialEmbeddedObjectFactory : public ::cppu::WeakImplHelper2<
87cdf0e10cSrcweir 												::com::sun::star::embed::XEmbedObjectFactory,
88cdf0e10cSrcweir 												::com::sun::star::lang::XServiceInfo >
89cdf0e10cSrcweir {
90cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	::comphelper::MimeConfigurationHelper m_aConfigHelper;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir public:
OOoSpecialEmbeddedObjectFactory(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> & xFactory)95cdf0e10cSrcweir     OOoSpecialEmbeddedObjectFactory(
96cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
97cdf0e10cSrcweir 	: m_xFactory( xFactory )
98cdf0e10cSrcweir 	, m_aConfigHelper( xFactory )
99cdf0e10cSrcweir 	{
100cdf0e10cSrcweir 		OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
101cdf0e10cSrcweir 	}
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
108cdf0e10cSrcweir 		impl_staticCreateSelfInstance(
109cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	// XEmbedObjectFactory
112cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceUserInit( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, sal_Int32 nEntryConnectionMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	// XServiceInfo
115cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
116cdf0e10cSrcweir     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
117cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir };
119cdf0e10cSrcweir 
120cdf0e10cSrcweir #endif
121cdf0e10cSrcweir 
122