1859212d1SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3859212d1SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4859212d1SAndrew Rist * or more contributor license agreements. See the NOTICE file
5859212d1SAndrew Rist * distributed with this work for additional information
6859212d1SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7859212d1SAndrew Rist * to you under the Apache License, Version 2.0 (the
8859212d1SAndrew Rist * "License"); you may not use this file except in compliance
9859212d1SAndrew Rist * with the License. You may obtain a copy of the License at
10859212d1SAndrew Rist *
11859212d1SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12859212d1SAndrew Rist *
13859212d1SAndrew Rist * Unless required by applicable law or agreed to in writing,
14859212d1SAndrew Rist * software distributed under the License is distributed on an
15859212d1SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16859212d1SAndrew Rist * KIND, either express or implied. See the License for the
17859212d1SAndrew Rist * specific language governing permissions and limitations
18859212d1SAndrew Rist * under the License.
19859212d1SAndrew Rist *
20859212d1SAndrew Rist *************************************************************/
21859212d1SAndrew Rist
22859212d1SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
25cdf0e10cSrcweir #include <cppu/macros.hxx>
26cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
27cdf0e10cSrcweir #include <rtl/ustring.hxx>
28cdf0e10cSrcweir #include <sal/types.h>
29cdf0e10cSrcweir #include <uno/environment.h>
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include "interactionhandler.hxx"
32cdf0e10cSrcweir #include "requeststringresolver.hxx"
33cdf0e10cSrcweir #include "passwordcontainer.hxx"
34cdf0e10cSrcweir
35cdf0e10cSrcweir using namespace rtl;
36cdf0e10cSrcweir using namespace com::sun::star::uno;
37cdf0e10cSrcweir using namespace com::sun::star::lang;
38cdf0e10cSrcweir using namespace com::sun::star::registry;
39cdf0e10cSrcweir
40cdf0e10cSrcweir //============================================================================
41cdf0e10cSrcweir //
42cdf0e10cSrcweir // component_getImplementationEnvironment
43cdf0e10cSrcweir //
44cdf0e10cSrcweir //============================================================================
45cdf0e10cSrcweir
46*ab743807Sdamjan extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
component_getImplementationEnvironment(sal_Char const ** pEnvTypeName,uno_Environment **)47cdf0e10cSrcweir component_getImplementationEnvironment(sal_Char const ** pEnvTypeName,
48cdf0e10cSrcweir uno_Environment **)
49cdf0e10cSrcweir {
50cdf0e10cSrcweir *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
51cdf0e10cSrcweir }
52cdf0e10cSrcweir
53cdf0e10cSrcweir //============================================================================
54cdf0e10cSrcweir //
55cdf0e10cSrcweir // component_getFactory
56cdf0e10cSrcweir //
57cdf0e10cSrcweir //============================================================================
58cdf0e10cSrcweir
59*ab743807Sdamjan extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
component_getFactory(sal_Char const * pImplName,void * pServiceManager,void *)60*ab743807Sdamjan component_getFactory(sal_Char const * pImplName,
61cdf0e10cSrcweir void * pServiceManager,
62cdf0e10cSrcweir void *)
63cdf0e10cSrcweir {
64cdf0e10cSrcweir if (!pImplName)
65cdf0e10cSrcweir return 0;
66cdf0e10cSrcweir
67cdf0e10cSrcweir void * pRet = 0;
68cdf0e10cSrcweir
69cdf0e10cSrcweir Reference< XMultiServiceFactory > xSMgr(
70cdf0e10cSrcweir reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
71cdf0e10cSrcweir Reference< XSingleServiceFactory > xFactory;
72cdf0e10cSrcweir
73cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
74cdf0e10cSrcweir // UUI Interaction Handler.
75cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
76cdf0e10cSrcweir
77cdf0e10cSrcweir if ( rtl_str_compare(pImplName,
78cdf0e10cSrcweir UUIInteractionHandler::m_aImplementationName)
79cdf0e10cSrcweir == 0)
80cdf0e10cSrcweir {
81cdf0e10cSrcweir xFactory =
82cdf0e10cSrcweir cppu::createSingleFactory(
83cdf0e10cSrcweir static_cast< XMultiServiceFactory * >(pServiceManager),
84cdf0e10cSrcweir OUString::createFromAscii(
85cdf0e10cSrcweir UUIInteractionHandler::m_aImplementationName),
86cdf0e10cSrcweir &UUIInteractionHandler::createInstance,
87cdf0e10cSrcweir UUIInteractionHandler::getSupportedServiceNames_static());
88cdf0e10cSrcweir }
89cdf0e10cSrcweir
90cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
91cdf0e10cSrcweir // UUI Interaction Request String Resolver.
92cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
93cdf0e10cSrcweir
94cdf0e10cSrcweir else if ( rtl_str_compare(pImplName,
95cdf0e10cSrcweir UUIInteractionRequestStringResolver::m_aImplementationName)
96cdf0e10cSrcweir == 0)
97cdf0e10cSrcweir {
98cdf0e10cSrcweir xFactory =
99cdf0e10cSrcweir cppu::createSingleFactory(
100cdf0e10cSrcweir static_cast< XMultiServiceFactory * >(pServiceManager),
101cdf0e10cSrcweir OUString::createFromAscii(
102cdf0e10cSrcweir UUIInteractionRequestStringResolver::m_aImplementationName),
103cdf0e10cSrcweir &UUIInteractionRequestStringResolver::createInstance,
104cdf0e10cSrcweir UUIInteractionRequestStringResolver::getSupportedServiceNames_static());
105cdf0e10cSrcweir }
106cdf0e10cSrcweir
107cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
108cdf0e10cSrcweir // UUI Password Container Interaction Handler.
109cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
110cdf0e10cSrcweir
111cdf0e10cSrcweir else if ( uui::PasswordContainerInteractionHandler::getImplementationName_Static().
112cdf0e10cSrcweir compareToAscii( pImplName ) == 0 )
113cdf0e10cSrcweir {
114cdf0e10cSrcweir xFactory =
115cdf0e10cSrcweir uui::PasswordContainerInteractionHandler::createServiceFactory( xSMgr );
116cdf0e10cSrcweir }
117cdf0e10cSrcweir
118cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
119cdf0e10cSrcweir
120cdf0e10cSrcweir if ( xFactory.is() )
121cdf0e10cSrcweir {
122cdf0e10cSrcweir xFactory->acquire();
123cdf0e10cSrcweir pRet = xFactory.get();
124cdf0e10cSrcweir }
125cdf0e10cSrcweir
126cdf0e10cSrcweir return pRet;
127cdf0e10cSrcweir }
128