bump product version to 7.2.5.1
[LibreOffice.git] / vcl / inc / unx / gendata.hxx
blobf06dda35cb2e5f7d9c4612871a16718417b1ac81
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 */
10 #ifndef INCLUDED_VCL_INC_GENERIC_GENDATA_HXX
11 #define INCLUDED_VCL_INC_GENERIC_GENDATA_HXX
13 #include <osl/socket.hxx>
15 #include <saldatabasic.hxx>
17 #include <memory>
19 class FreetypeManager;
20 class SalGenericDisplay;
21 namespace psp
23 class PrintFontManager;
26 enum GenericUnixSalDataType
28 SAL_DATA_GTK,
29 SAL_DATA_GTK3,
30 SAL_DATA_KF5,
31 SAL_DATA_UNX,
32 SAL_DATA_SVP,
33 SAL_DATA_ANDROID,
34 SAL_DATA_IOS,
35 SAL_DATA_HEADLESS,
36 SAL_DATA_QT5
39 class VCL_DLLPUBLIC GenericUnixSalData : public SalData
41 private:
42 GenericUnixSalDataType m_eType;
43 SalGenericDisplay* m_pDisplay;
44 // cached hostname to avoid slow lookup
45 OUString m_aHostname;
46 // for transient storage of unicode strings eg. 'u123' by input methods
47 OUString m_aUnicodeEntry;
49 std::unique_ptr<FreetypeManager> m_pFreetypeManager;
50 std::unique_ptr<psp::PrintFontManager> m_pPrintFontManager;
52 void InitFreetypeManager();
53 void InitPrintFontManager();
55 public:
56 GenericUnixSalData(GenericUnixSalDataType const t, SalInstance* const pInstance);
57 virtual ~GenericUnixSalData() override;
58 virtual void Dispose() {}
60 SalGenericDisplay* GetDisplay() const { return m_pDisplay; }
61 void SetDisplay(SalGenericDisplay* pDisp) { m_pDisplay = pDisp; }
63 const OUString& GetHostname()
65 if (m_aHostname.isEmpty())
66 osl_getLocalHostname(&m_aHostname.pData);
67 return m_aHostname;
70 OUString& GetUnicodeCommand() { return m_aUnicodeEntry; }
72 GenericUnixSalDataType GetType() const { return m_eType; }
74 FreetypeManager* GetFreetypeManager()
76 if (!m_pFreetypeManager)
77 InitFreetypeManager();
78 return m_pFreetypeManager.get();
81 psp::PrintFontManager* GetPrintFontManager()
83 if (!m_pPrintFontManager)
84 InitPrintFontManager();
85 // PrintFontManager needs the FreetypeManager
86 assert(m_pFreetypeManager);
87 return m_pPrintFontManager.get();
90 // Mostly useful for remote protocol backends
91 virtual void ErrorTrapPush() = 0;
92 virtual bool ErrorTrapPop(bool bIgnoreError = true) = 0; // true on error
95 inline GenericUnixSalData* GetGenericUnixSalData()
97 return static_cast<GenericUnixSalData*>(ImplGetSVData()->mpSalData);
100 #endif
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */