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/.
12 #include <osl/socket.hxx>
19 class FreetypeManager
;
21 class SalGenericDisplay
;
27 class PrintFontManager
;
28 class PrinterInfoManager
;
31 // SalData is a bit of a mess. For ImplSVData we need a SalData base class.
32 // Windows, MacOS and iOS implement their own SalData class, so there is no
33 // way to do inheritance from the "top" in all plugins. We also really don't
34 // want to rename GenericUnixSalData and don't want to reinterpret_cast some
35 // dummy pointer everywhere, so this seems the only sensible solution.
36 class VCL_PLUGIN_PUBLIC SalData
47 // This class is kind of a misnomer. What this class is mainly about is the
48 // usage of Freetype and Fontconfig, which happens to match all *nix backends;
49 // except that the osx and ios backends are *nix but don't use this.
50 class VCL_PLUGIN_PUBLIC GenericUnixSalData
: public SalData
53 friend class ::psp::PrinterInfoManager
;
56 SalGenericDisplay
* m_pDisplay
;
57 // cached hostname to avoid slow lookup
59 // for transient storage of unicode strings eg. 'u123' by input methods
60 OUString m_aUnicodeEntry
;
63 std::unique_ptr
<FreetypeManager
> m_pFreetypeManager
;
64 std::unique_ptr
<psp::PrintFontManager
> m_pPrintFontManager
;
65 std::unique_ptr
<psp::PrinterInfoManager
> m_pPrinterInfoManager
;
68 void InitFreetypeManager();
69 void InitPrintFontManager();
73 virtual ~GenericUnixSalData() override
;
74 virtual void Dispose();
76 SalGenericDisplay
* GetDisplay() const { return m_pDisplay
; }
77 void SetDisplay(SalGenericDisplay
* pDisp
) { m_pDisplay
= pDisp
; }
79 const OUString
& GetHostname()
81 if (m_aHostname
.isEmpty())
82 osl_getLocalHostname(&m_aHostname
.pData
);
86 OUString
& GetUnicodeCommand() { return m_aUnicodeEntry
; }
90 FreetypeManager
* GetFreetypeManager()
92 if (!m_pFreetypeManager
)
93 InitFreetypeManager();
94 return m_pFreetypeManager
.get();
97 psp::PrintFontManager
* GetPrintFontManager()
99 if (!m_pPrintFontManager
)
100 InitPrintFontManager();
101 // PrintFontManager needs the FreetypeManager
102 assert(m_pFreetypeManager
);
103 return m_pPrintFontManager
.get();
108 // Mostly useful for remote protocol backends
109 virtual void ErrorTrapPush() = 0;
110 virtual bool ErrorTrapPop(bool bIgnoreError
= true) = 0; // true on error
113 inline GenericUnixSalData
* GetGenericUnixSalData()
115 return static_cast<GenericUnixSalData
*>(ImplGetSVData()->mpSalData
);
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */