Avoid potential negative array index access to cached text.
[LibreOffice.git] / vcl / headless / headlessinst.cxx
blobabe3e1cf92c71de9f9bb0b7c6428b69282919836
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
9 #include <headless/svpinst.hxx>
10 #include <headless/svpdummies.hxx>
11 #include <headless/svpdata.hxx>
12 #include <unistd.h>
14 class HeadlessSalInstance : public SvpSalInstance
16 public:
17 explicit HeadlessSalInstance(std::unique_ptr<SalYieldMutex> pMutex);
19 virtual SalSystem* CreateSalSystem() override;
22 HeadlessSalInstance::HeadlessSalInstance(std::unique_ptr<SalYieldMutex> pMutex)
23 : SvpSalInstance(std::move(pMutex))
27 class HeadlessSalSystem : public SvpSalSystem {
28 public:
29 HeadlessSalSystem() : SvpSalSystem() {}
30 virtual int ShowNativeDialog( const OUString& rTitle,
31 const OUString& rMessage,
32 const std::vector< OUString >& rButtons ) override
34 (void)rButtons;
35 SAL_INFO("vcl.headless",
36 "LibreOffice - dialog '"
37 << rTitle << "': '"
38 << rMessage << "'");
39 return 0;
43 SalSystem *HeadlessSalInstance::CreateSalSystem()
45 return new HeadlessSalSystem();
48 extern "C" SalInstance *create_SalInstance()
50 HeadlessSalInstance* pInstance = new HeadlessSalInstance(std::make_unique<SvpSalYieldMutex>());
51 new SvpSalData();
52 return pInstance;
55 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */