2010-10-12 15:57:08 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 15:18:56 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 09:16:38 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-11 09:16:38 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-11 09:16:38 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-11 09:16:38 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-11 09:16:38 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
2008-04-11 09:16:38 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 15:18:56 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-16 12:05:04 +00:00
|
|
|
|
2001-06-27 09:56:03 +00:00
|
|
|
#include <rtl/unload.h>
|
|
|
|
#include <osl/time.h>
|
2000-09-18 15:18:56 +00:00
|
|
|
#include "ole2uno.hxx"
|
2001-06-27 09:56:03 +00:00
|
|
|
#include "servprov.hxx"
|
2006-06-19 09:45:22 +00:00
|
|
|
#include <rtl/ustring.hxx>
|
2001-06-27 09:56:03 +00:00
|
|
|
#include <cppuhelper/factory.hxx>
|
|
|
|
using namespace ole_adapter;
|
|
|
|
using namespace cppu;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2011-02-26 01:14:41 +01:00
|
|
|
using ::rtl::OUString;
|
|
|
|
|
2001-06-27 09:56:03 +00:00
|
|
|
namespace ole_adapter
|
|
|
|
{
|
|
|
|
rtl_StandardModuleCount globalModuleCount= MODULE_COUNT_INIT;
|
2000-09-18 15:18:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2001-06-27 09:56:03 +00:00
|
|
|
Reference<XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr)
|
|
|
|
throw(Exception)
|
|
|
|
{
|
|
|
|
Reference<XInterface> xService = *new OleConverter_Impl2( xSMgr);
|
|
|
|
return xService;
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference<XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr)
|
|
|
|
throw(Exception)
|
|
|
|
{
|
|
|
|
Reference<XInterface> xService = *new OleConverter_Impl2( xSMgr, UNO_OBJECT_WRAPPER_REMOTE_OPT, IUNKNOWN_WRAPPER_IMPL);
|
|
|
|
return xService;
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference<XInterface> SAL_CALL OleClient_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
|
|
|
|
throw(Exception)
|
|
|
|
{
|
|
|
|
Reference<XInterface> xService = *new OleClient_Impl( xSMgr);
|
|
|
|
return xService;
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
|
|
|
|
throw (Exception)
|
|
|
|
{
|
|
|
|
Reference<XInterface > xService = *new OleServer_Impl(xSMgr);
|
|
|
|
return xService;
|
|
|
|
}
|
|
|
|
} // end namespace
|
2000-09-18 15:18:56 +00:00
|
|
|
|
2011-04-20 14:10:36 +02:00
|
|
|
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
|
2008-01-14 13:48:00 +00:00
|
|
|
const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
|
|
|
void * pRet = 0;
|
|
|
|
|
|
|
|
OUString aImplName( OUString::createFromAscii( pImplName ) );
|
|
|
|
Reference< XSingleServiceFactory > xFactory;
|
2001-06-27 09:56:03 +00:00
|
|
|
Sequence<OUString> seqServiceNames;
|
2007-03-26 12:08:26 +00:00
|
|
|
if (pServiceManager && aImplName.equals( reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleConverter2") ))
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-06-27 09:56:03 +00:00
|
|
|
xFactory= createSingleFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
|
|
|
|
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleConverter2")),
|
|
|
|
ConverterProvider_CreateInstance2, seqServiceNames,
|
|
|
|
&globalModuleCount.modCnt );
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2007-03-26 12:08:26 +00:00
|
|
|
else if (pServiceManager && aImplName.equals( reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleConverterVar1") ))
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-06-27 09:56:03 +00:00
|
|
|
xFactory= createSingleFactory( reinterpret_cast<XMultiServiceFactory*>(pServiceManager),
|
|
|
|
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleConverterVar1")),
|
|
|
|
ConverterProvider_CreateInstanceVar1, seqServiceNames,
|
|
|
|
&globalModuleCount.modCnt );
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2007-03-26 12:08:26 +00:00
|
|
|
else if(pServiceManager && aImplName.equals(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleClient")))
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-06-27 09:56:03 +00:00
|
|
|
xFactory= createSingleFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
|
|
|
|
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleClient")),
|
|
|
|
OleClient_CreateInstance, seqServiceNames,
|
|
|
|
&globalModuleCount.modCnt);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
2007-03-26 12:08:26 +00:00
|
|
|
else if(pServiceManager && aImplName.equals(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleServer")))
|
2000-09-18 15:18:56 +00:00
|
|
|
{
|
2001-06-27 09:56:03 +00:00
|
|
|
xFactory= createOneInstanceFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
|
|
|
|
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.OleServer")),
|
|
|
|
OleServer_CreateInstance, seqServiceNames,
|
|
|
|
&globalModuleCount.modCnt);
|
2000-09-18 15:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (xFactory.is())
|
|
|
|
{
|
|
|
|
xFactory->acquire();
|
|
|
|
pRet = xFactory.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
return pRet;
|
|
|
|
}
|
|
|
|
|
2012-01-06 21:09:13 +01:00
|
|
|
extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL
|
2011-12-14 20:10:08 +01:00
|
|
|
component_canUnload( TimeValue* libUnused)
|
2001-06-27 09:56:03 +00:00
|
|
|
{
|
|
|
|
return globalModuleCount.canUnload( &globalModuleCount, libUnused);
|
|
|
|
}
|
2010-10-12 15:57:08 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|