1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <cppuhelper/supportsservice.hxx>
21 #include <cppuhelper/weak.hxx>
22 #include <com/sun/star/uno/XComponentContext.hpp>
23 #include "smplmailsuppl.hxx"
24 #include "smplmailclient.hxx"
26 #define WIN32_LEAN_AND_MEAN
29 using com::sun::star::uno::Reference
;
30 using com::sun::star::uno::RuntimeException
;
31 using com::sun::star::uno::Sequence
;
32 using com::sun::star::lang::XServiceInfo
;
33 using com::sun::star::system::XSimpleMailClientSupplier
;
34 using com::sun::star::system::XSimpleMailClient
;
38 CSmplMailSuppl::CSmplMailSuppl() :
39 WeakComponentImplHelper
<XSimpleMailClientSupplier
, XServiceInfo
>(m_aMutex
)
43 CSmplMailSuppl::~CSmplMailSuppl()
47 Reference
<XSimpleMailClient
> SAL_CALL
CSmplMailSuppl::querySimpleMailClient()
49 /* We just try to load the MAPI dll as a test
50 if a mail client is available */
51 Reference
<XSimpleMailClient
> xSmplMailClient
;
52 HMODULE handle
= LoadLibraryW(L
"mapi32.dll");
53 if ((handle
!= INVALID_HANDLE_VALUE
) && (handle
!= nullptr))
56 xSmplMailClient
.set(new CSmplMailClient
);
58 return xSmplMailClient
;
63 OUString SAL_CALL
CSmplMailSuppl::getImplementationName()
65 return "com.sun.star.sys.shell.SimpleSystemMail";
68 sal_Bool SAL_CALL
CSmplMailSuppl::supportsService(const OUString
& ServiceName
)
70 return cppu::supportsService(this, ServiceName
);
73 Sequence
<OUString
> SAL_CALL
CSmplMailSuppl::getSupportedServiceNames()
75 return { "com.sun.star.system.SimpleSystemMail" };
78 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
79 shell_CSmplMailSuppl_get_implementation(
80 css::uno::XComponentContext
* , css::uno::Sequence
<css::uno::Any
> const&)
82 return cppu::acquire(new CSmplMailSuppl());
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */