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