Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / uui / source / services.cxx
bloba25af9158c53d429f1aebeb1355d46bc15cd7625
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <com/sun/star/registry/XRegistryKey.hpp>
30 #include <cppu/macros.hxx>
31 #include <cppuhelper/factory.hxx>
32 #include <rtl/ustring.hxx>
33 #include <sal/types.h>
34 #include <uno/environment.h>
36 #include "interactionhandler.hxx"
37 #include "requeststringresolver.hxx"
38 #include "passwordcontainer.hxx"
40 using namespace com::sun::star::uno;
41 using namespace com::sun::star::lang;
42 using namespace com::sun::star::registry;
44 using ::rtl::OUString;
47 extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL uui_component_getFactory(sal_Char const * pImplName,
48 void * pServiceManager,
49 void *)
51 if (!pImplName)
52 return 0;
54 void * pRet = 0;
56 Reference< XMultiServiceFactory > xSMgr(
57 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
58 Reference< XSingleServiceFactory > xFactory;
60 //////////////////////////////////////////////////////////////////////
61 // UUI Interaction Handler.
62 //////////////////////////////////////////////////////////////////////
64 if ( rtl_str_compare(pImplName,
65 UUIInteractionHandler::m_aImplementationName)
66 == 0)
68 xFactory =
69 cppu::createSingleFactory(
70 static_cast< XMultiServiceFactory * >(pServiceManager),
71 OUString::createFromAscii(
72 UUIInteractionHandler::m_aImplementationName),
73 &UUIInteractionHandler::createInstance,
74 UUIInteractionHandler::getSupportedServiceNames_static());
77 //////////////////////////////////////////////////////////////////////
78 // UUI Interaction Request String Resolver.
79 //////////////////////////////////////////////////////////////////////
81 else if ( rtl_str_compare(pImplName,
82 UUIInteractionRequestStringResolver::m_aImplementationName)
83 == 0)
85 xFactory =
86 cppu::createSingleFactory(
87 static_cast< XMultiServiceFactory * >(pServiceManager),
88 OUString::createFromAscii(
89 UUIInteractionRequestStringResolver::m_aImplementationName),
90 &UUIInteractionRequestStringResolver::createInstance,
91 UUIInteractionRequestStringResolver::getSupportedServiceNames_static());
94 //////////////////////////////////////////////////////////////////////
95 // UUI Password Container Interaction Handler.
96 //////////////////////////////////////////////////////////////////////
98 else if ( uui::PasswordContainerInteractionHandler::getImplementationName_Static().
99 compareToAscii( pImplName ) == 0 )
101 xFactory =
102 uui::PasswordContainerInteractionHandler::createServiceFactory( xSMgr );
105 //////////////////////////////////////////////////////////////////////
107 if ( xFactory.is() )
109 xFactory->acquire();
110 pRet = xFactory.get();
113 return pRet;
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */