1*48123e16SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*48123e16SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*48123e16SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*48123e16SAndrew Rist  * distributed with this work for additional information
6*48123e16SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*48123e16SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*48123e16SAndrew Rist  * "License"); you may not use this file except in compliance
9*48123e16SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*48123e16SAndrew Rist  *
11*48123e16SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*48123e16SAndrew Rist  *
13*48123e16SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*48123e16SAndrew Rist  * software distributed under the License is distributed on an
15*48123e16SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*48123e16SAndrew Rist  * KIND, either express or implied.  See the License for the
17*48123e16SAndrew Rist  * specific language governing permissions and limitations
18*48123e16SAndrew Rist  * under the License.
19*48123e16SAndrew Rist  *
20*48123e16SAndrew Rist  *************************************************************/
21*48123e16SAndrew Rist 
22*48123e16SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dtrans.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //-----------------------------------------------------------------
28cdf0e10cSrcweir //	includes of other projects
29cdf0e10cSrcweir //-----------------------------------------------------------------
30cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
31cdf0e10cSrcweir #include <com/sun/star/container/XSet.hpp>
32cdf0e10cSrcweir #include <osl/diagnose.h>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #ifndef _COM_SUN_STAR_DATATRANSFER_XDATAFLAVORCONTAINER_HPP_
35cdf0e10cSrcweir #include <com/sun/star/datatransfer/XDataFormatTranslator.hpp>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #include "ftransl.hxx"
38cdf0e10cSrcweir 
39cdf0e10cSrcweir //-----------------------------------------------------------------
40cdf0e10cSrcweir // some defines
41cdf0e10cSrcweir //-----------------------------------------------------------------
42cdf0e10cSrcweir 
43cdf0e10cSrcweir // the service names
44cdf0e10cSrcweir #define SERVICE_NAME  "com.sun.star.datatransfer.DataFormatTranslator"
45cdf0e10cSrcweir 
46cdf0e10cSrcweir // the implementation names
47cdf0e10cSrcweir #define IMPL_NAME  "com.sun.star.datatransfer.DataFormatTranslator"
48cdf0e10cSrcweir 
49cdf0e10cSrcweir // the registry key names
50cdf0e10cSrcweir // a key under which this service will be registered, Format: -> "/ImplName/UNO/SERVICES/ServiceName"
51cdf0e10cSrcweir //                        <     Implementation-Name    ></UNO/SERVICES/><    Service-Name           >
52cdf0e10cSrcweir #define REGKEY_NAME  "/com.sun.star.datatransfer.DataFormatTranslator/UNO/SERVICES/com.sun.star.datatransfer.DataFormatTranslator"
53cdf0e10cSrcweir 
54cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------
55cdf0e10cSrcweir // namespace directives
56cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------
57cdf0e10cSrcweir 
58cdf0e10cSrcweir using namespace ::rtl						;
59cdf0e10cSrcweir using namespace ::cppu					    ;
60cdf0e10cSrcweir using namespace ::com::sun::star::uno		;
61cdf0e10cSrcweir using namespace ::com::sun::star::registry	;
62cdf0e10cSrcweir using namespace ::com::sun::star::lang;
63cdf0e10cSrcweir using namespace ::com::sun::star::datatransfer;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir //-----------------------------------------------------------------
66cdf0e10cSrcweir // create a static object to initialize the shell9x library
67cdf0e10cSrcweir //-----------------------------------------------------------------
68cdf0e10cSrcweir 
69cdf0e10cSrcweir namespace
70cdf0e10cSrcweir {
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	//-----------------------------------------------------------------------------------------------------------
73cdf0e10cSrcweir     // functions to create a new Clipboad instance; is needed by factory helper implementation
74cdf0e10cSrcweir     // @param rServiceManager - service manager, useful if the component needs other uno services
75cdf0e10cSrcweir     // so we should give it to every UNO-Implementation component
76cdf0e10cSrcweir     //-----------------------------------------------------------------------------------------------------------
77cdf0e10cSrcweir 
createInstance(const Reference<XMultiServiceFactory> & rServiceManager)78cdf0e10cSrcweir 	Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
79cdf0e10cSrcweir 	{
80cdf0e10cSrcweir 		return Reference< XInterface >( static_cast< XDataFormatTranslator* >( new CDataFormatTranslator( rServiceManager ) ) );
81cdf0e10cSrcweir 	}
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------
85cdf0e10cSrcweir // the 3 important functions which will be exported
86cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------
87cdf0e10cSrcweir 
88cdf0e10cSrcweir extern "C"
89cdf0e10cSrcweir {
90cdf0e10cSrcweir 
91cdf0e10cSrcweir //----------------------------------------------------------------------
92cdf0e10cSrcweir // component_getImplementationEnvironment
93cdf0e10cSrcweir //----------------------------------------------------------------------
94cdf0e10cSrcweir 
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)95cdf0e10cSrcweir void SAL_CALL component_getImplementationEnvironment(
96cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
97cdf0e10cSrcweir {
98cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
99cdf0e10cSrcweir }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir //----------------------------------------------------------------------
102cdf0e10cSrcweir // component_getFactory
103cdf0e10cSrcweir // returns a factory to create XFilePicker-Services
104cdf0e10cSrcweir //----------------------------------------------------------------------
105cdf0e10cSrcweir 
component_getFactory(const sal_Char * pImplName,uno_Interface * pSrvManager,uno_Interface *)106cdf0e10cSrcweir void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ )
107cdf0e10cSrcweir {
108cdf0e10cSrcweir 	void* pRet = 0;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, IMPL_NAME ) ) )
111cdf0e10cSrcweir 	{
112cdf0e10cSrcweir 		Sequence< OUString > aSNS( 1 );
113cdf0e10cSrcweir 		aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory(
116cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
117cdf0e10cSrcweir 			OUString::createFromAscii( pImplName ),
118cdf0e10cSrcweir 			createInstance,
119cdf0e10cSrcweir 			aSNS ) );
120cdf0e10cSrcweir 		if ( xFactory.is() )
121cdf0e10cSrcweir 		{
122cdf0e10cSrcweir 			xFactory->acquire();
123cdf0e10cSrcweir 			pRet = xFactory.get();
124cdf0e10cSrcweir 		}
125cdf0e10cSrcweir 	}
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	return pRet;
128cdf0e10cSrcweir }
129cdf0e10cSrcweir 
130cdf0e10cSrcweir } // extern "C"
131