xref: /aoo42x/main/dtrans/source/win32/dnd/dndentry.cxx (revision e8183b3f)
148123e16SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
348123e16SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
448123e16SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
548123e16SAndrew Rist  * distributed with this work for additional information
648123e16SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
748123e16SAndrew Rist  * to you under the Apache License, Version 2.0 (the
848123e16SAndrew Rist  * "License"); you may not use this file except in compliance
948123e16SAndrew Rist  * with the License.  You may obtain a copy of the License at
1048123e16SAndrew Rist  *
1148123e16SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1248123e16SAndrew Rist  *
1348123e16SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1448123e16SAndrew Rist  * software distributed under the License is distributed on an
1548123e16SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1648123e16SAndrew Rist  * KIND, either express or implied.  See the License for the
1748123e16SAndrew Rist  * specific language governing permissions and limitations
1848123e16SAndrew Rist  * under the License.
1948123e16SAndrew Rist  *
2048123e16SAndrew Rist  *************************************************************/
2148123e16SAndrew Rist 
2248123e16SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dtrans.hxx"
26cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
27cdf0e10cSrcweir #include <com/sun/star/container/XSet.hpp>
28cdf0e10cSrcweir #include <osl/diagnose.h>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include "source.hxx"
31cdf0e10cSrcweir #include "target.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir using namespace ::rtl						;
34cdf0e10cSrcweir using namespace ::com::sun::star::uno		;
35cdf0e10cSrcweir using namespace ::com::sun::star::registry	;
36cdf0e10cSrcweir using namespace ::cppu					    ;
37cdf0e10cSrcweir using namespace ::com::sun::star::lang;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
40cdf0e10cSrcweir 
createDragSource(const Reference<XMultiServiceFactory> & rServiceManager)41cdf0e10cSrcweir Reference< XInterface > SAL_CALL createDragSource( const Reference< XMultiServiceFactory >& rServiceManager )
42cdf0e10cSrcweir {
43cdf0e10cSrcweir 	DragSource* pSource= new DragSource( rServiceManager );
44cdf0e10cSrcweir 	return Reference<XInterface>( static_cast<XInitialization*>(pSource), UNO_QUERY);
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
createDropTarget(const Reference<XMultiServiceFactory> & rServiceManager)47cdf0e10cSrcweir Reference< XInterface > SAL_CALL createDropTarget( const Reference< XMultiServiceFactory >& rServiceManager )
48cdf0e10cSrcweir {
49cdf0e10cSrcweir 	DropTarget* pTarget= new DropTarget( rServiceManager );
50cdf0e10cSrcweir 	return Reference<XInterface>( static_cast<XInitialization*>(pTarget), UNO_QUERY);
51cdf0e10cSrcweir }
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 
54cdf0e10cSrcweir extern "C"
55cdf0e10cSrcweir {
component_canUnload(TimeValue * pTime)56*e8183b3fSdamjan SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_canUnload( TimeValue *pTime )
57cdf0e10cSrcweir {
58cdf0e10cSrcweir 	return g_moduleCount.canUnload( &g_moduleCount , pTime );
59cdf0e10cSrcweir }
60cdf0e10cSrcweir 
61cdf0e10cSrcweir //----------------------------------------------------------------------
62cdf0e10cSrcweir // component_getImplementationEnvironment
63cdf0e10cSrcweir //----------------------------------------------------------------------
64cdf0e10cSrcweir 
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)65*e8183b3fSdamjan SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
66cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
67cdf0e10cSrcweir {
68cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
69cdf0e10cSrcweir }
70cdf0e10cSrcweir 
71cdf0e10cSrcweir //----------------------------------------------------------------------
72cdf0e10cSrcweir // component_getFactory
73cdf0e10cSrcweir // returns a factory to create XFilePicker-Services
74cdf0e10cSrcweir //----------------------------------------------------------------------
75cdf0e10cSrcweir 
component_getFactory(const sal_Char * pImplName,uno_Interface * pSrvManager,uno_Interface *)76*e8183b3fSdamjan SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ )
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	void* pRet = 0;
79cdf0e10cSrcweir 	Reference< XSingleServiceFactory > xFactory;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDSOURCE_IMPL_NAME ) ) )
82cdf0e10cSrcweir 	{
83cdf0e10cSrcweir 		Sequence< OUString > aSNS( 1 );
84cdf0e10cSrcweir 		aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( DNDSOURCE_SERVICE_NAME ) );
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 		xFactory= createSingleFactory(
87cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
88cdf0e10cSrcweir 			OUString::createFromAscii( pImplName ),
89cdf0e10cSrcweir 			createDragSource,
90cdf0e10cSrcweir 			aSNS,
91cdf0e10cSrcweir 			&g_moduleCount.modCnt);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	}
94cdf0e10cSrcweir 	else if( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDTARGET_IMPL_NAME ) ) )
95cdf0e10cSrcweir 	{
96cdf0e10cSrcweir 		Sequence< OUString > aSNS( 1 );
97cdf0e10cSrcweir 		aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( DNDTARGET_SERVICE_NAME ) );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 		xFactory= createSingleFactory(
100cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
101cdf0e10cSrcweir 			OUString::createFromAscii( pImplName ),
102cdf0e10cSrcweir 			createDropTarget,
103cdf0e10cSrcweir 			aSNS);
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	}
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	if ( xFactory.is() )
108cdf0e10cSrcweir 	{
109cdf0e10cSrcweir 		xFactory->acquire();
110cdf0e10cSrcweir 		pRet = xFactory.get();
111cdf0e10cSrcweir 	}
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	return pRet;
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir } // extern "C"
117