LibreOffice Module vcl (master) 1
gendata.hxx
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
10#pragma once
11
12#include <osl/socket.hxx>
13
14#include <svdata.hxx>
15
16#include <memory>
17
18#ifndef IOS
19class FreetypeManager;
20#endif
22
23#ifndef IOS
24
25namespace psp
26{
27class PrintFontManager;
28class PrinterInfoManager;
29}
30
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.
37{
38protected:
40
41public:
42 virtual ~SalData();
43};
44
45#endif
46
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.
51{
52#ifndef IOS
53 friend class ::psp::PrinterInfoManager;
54#endif
55
57 // cached hostname to avoid slow lookup
58 OUString m_aHostname;
59 // for transient storage of unicode strings eg. 'u123' by input methods
61
62#ifndef IOS
63 std::unique_ptr<FreetypeManager> m_pFreetypeManager;
64 std::unique_ptr<psp::PrintFontManager> m_pPrintFontManager;
65 std::unique_ptr<psp::PrinterInfoManager> m_pPrinterInfoManager;
66#endif
67
70
71public:
73 virtual ~GenericUnixSalData() override;
74 virtual void Dispose();
75
76 SalGenericDisplay* GetDisplay() const { return m_pDisplay; }
77 void SetDisplay(SalGenericDisplay* pDisp) { m_pDisplay = pDisp; }
78
79 const OUString& GetHostname()
80 {
81 if (m_aHostname.isEmpty())
82 osl_getLocalHostname(&m_aHostname.pData);
83 return m_aHostname;
84 }
85
86 OUString& GetUnicodeCommand() { return m_aUnicodeEntry; }
87
88#ifndef IOS
89
91 {
92 if (!m_pFreetypeManager)
93 InitFreetypeManager();
94 return m_pFreetypeManager.get();
95 }
96
98 {
99 if (!m_pPrintFontManager)
100 InitPrintFontManager();
101 // PrintFontManager needs the FreetypeManager
102 assert(m_pFreetypeManager);
103 return m_pPrintFontManager.get();
104 }
105
106#endif
107
108 // Mostly useful for remote protocol backends
109 virtual void ErrorTrapPush() = 0;
110 virtual bool ErrorTrapPop(bool bIgnoreError = true) = 0; // true on error
111};
112
114{
115 return static_cast<GenericUnixSalData*>(ImplGetSVData()->mpSalData);
116}
117
118/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
The FreetypeManager caches various aspects of Freetype fonts.
Definition: glyphcache.hxx:79
OUString & GetUnicodeCommand()
Definition: gendata.hxx:86
OUString m_aUnicodeEntry
Definition: gendata.hxx:60
std::unique_ptr< psp::PrintFontManager > m_pPrintFontManager
Definition: gendata.hxx:64
virtual bool ErrorTrapPop(bool bIgnoreError=true)=0
std::unique_ptr< FreetypeManager > m_pFreetypeManager
Definition: gendata.hxx:63
void InitPrintFontManager()
FreetypeManager * GetFreetypeManager()
Definition: gendata.hxx:90
virtual void Dispose()
void SetDisplay(SalGenericDisplay *pDisp)
Definition: gendata.hxx:77
std::unique_ptr< psp::PrinterInfoManager > m_pPrinterInfoManager
Definition: gendata.hxx:65
SalGenericDisplay * m_pDisplay
Definition: gendata.hxx:56
virtual void ErrorTrapPush()=0
psp::PrintFontManager * GetPrintFontManager()
Definition: gendata.hxx:97
const OUString & GetHostname()
Definition: gendata.hxx:79
SalGenericDisplay * GetDisplay() const
Definition: gendata.hxx:76
void InitFreetypeManager()
OUString m_aHostname
Definition: gendata.hxx:58
virtual ~GenericUnixSalData() override
virtual ~SalData()
#define VCL_PLUGIN_PUBLIC
Definition: dllapi.h:40
GenericUnixSalData * GetGenericUnixSalData()
Definition: gendata.hxx:113
SalData * mpSalData
Definition: svdata.hxx:388
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:77