LibreOffice Module shell (master) 1
smplmailsuppl.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
21#include <cppuhelper/weak.hxx>
22#include <com/sun/star/uno/XComponentContext.hpp>
23#include "smplmailsuppl.hxx"
24#include "smplmailclient.hxx"
25
26#define WIN32_LEAN_AND_MEAN
27#include <windows.h>
28
31using com::sun::star::lang::XServiceInfo;
32using com::sun::star::system::XSimpleMailClientSupplier;
33using com::sun::star::system::XSimpleMailClient;
34
35using namespace cppu;
36
38 WeakComponentImplHelper<XSimpleMailClientSupplier, XServiceInfo>(m_aMutex)
39{
40}
41
43{
44}
45
47{
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))
53 {
54 FreeLibrary(handle);
55 xSmplMailClient.set(new CSmplMailClient);
56 }
57 return xSmplMailClient;
58}
59
60// XServiceInfo
61
63{
64 return "com.sun.star.sys.shell.SimpleSystemMail";
65}
66
67sal_Bool SAL_CALL CSmplMailSuppl::supportsService(const OUString& ServiceName)
68{
70}
71
73{
74 return { "com.sun.star.system.SimpleSystemMail" };
75}
76
77extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
79 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
80{
81 return cppu::acquire(new CSmplMailSuppl());
82}
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::system::XSimpleMailClient > SAL_CALL querySimpleMailClient() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
~CSmplMailSuppl() override
virtual OUString SAL_CALL getImplementationName() override
std::mutex m_aMutex
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * shell_CSmplMailSuppl_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
unsigned char sal_Bool