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/.
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>
20 class SalGenericDisplay
;
23 class PrintFontManager
;
26 enum GenericUnixSalDataType
39 class VCL_DLLPUBLIC GenericUnixSalData
: public SalData
42 GenericUnixSalDataType
const m_eType
;
43 SalGenericDisplay
* m_pDisplay
;
44 // cached hostname to avoid slow lookup
46 // for transient storage of unicode strings eg. 'u123' by input methods
47 OUString m_aUnicodeEntry
;
49 std::unique_ptr
<GlyphCache
> m_pGlyphCache
;
50 std::unique_ptr
<psp::PrintFontManager
> m_pPrintFontManager
;
52 void InitGlyphCache();
53 void InitPrintFontManager();
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
);
70 OUString
& GetUnicodeCommand() { return m_aUnicodeEntry
; }
72 GenericUnixSalDataType
GetType() const { return m_eType
; }
74 GlyphCache
* GetGlyphCache()
78 return m_pGlyphCache
.get();
81 psp::PrintFontManager
* GetPrintFontManager()
83 if (!m_pPrintFontManager
)
84 InitPrintFontManager();
85 // PrintFontManager needs the GlyphCache
86 assert(m_pGlyphCache
.get());
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
);
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */