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::Sequence
;
31 using com::sun::star::lang::XServiceInfo
;
32 using com::sun::star::system::XSimpleMailClientSupplier
;
33 using com::sun::star::system::XSimpleMailClient
;
37 CSmplMailSuppl::CSmplMailSuppl() :
38 WeakComponentImplHelper
<XSimpleMailClientSupplier
, XServiceInfo
>(m_aMutex
)
42 CSmplMailSuppl::~CSmplMailSuppl()
46 Reference
<XSimpleMailClient
> SAL_CALL
CSmplMailSuppl::querySimpleMailClient()
48 /* We just try to load the MAPI dll as a test
49 if a mail client is available */
50 Reference
<XSimpleMailClient
> xSmplMailClient
;
51 HMODULE handle
= LoadLibraryW(L
"mapi32.dll");
52 if ((handle
!= INVALID_HANDLE_VALUE
) && (handle
!= nullptr))
55 xSmplMailClient
.set(new CSmplMailClient
);
57 return xSmplMailClient
;
62 OUString SAL_CALL
CSmplMailSuppl::getImplementationName()
64 return "com.sun.star.sys.shell.SimpleSystemMail";
67 sal_Bool SAL_CALL
CSmplMailSuppl::supportsService(const OUString
& ServiceName
)
69 return cppu::supportsService(this, ServiceName
);
72 Sequence
<OUString
> SAL_CALL
CSmplMailSuppl::getSupportedServiceNames()
74 return { "com.sun.star.system.SimpleSystemMail" };
77 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
78 shell_CSmplMailSuppl_get_implementation(
79 css::uno::XComponentContext
* , css::uno::Sequence
<css::uno::Any
> const&)
81 return cppu::acquire(new CSmplMailSuppl());
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */