Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / vcl / inc / unx / gendata.hxx
blob8a34120d2541f1cb5a26e4c2e2ccb33d73766540
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 class SalGenericDisplay;
19 enum SalGenericDataType { SAL_DATA_GTK, SAL_DATA_GTK3,
20 SAL_DATA_TDE3, SAL_DATA_KDE3, SAL_DATA_KDE4,
21 SAL_DATA_UNX, SAL_DATA_SVP,
22 SAL_DATA_ANDROID, SAL_DATA_IOS,
23 SAL_DATA_HEADLESS };
25 class VCL_DLLPUBLIC SalGenericData : public SalData
27 protected:
28 SalGenericDataType m_eType;
29 SalGenericDisplay *m_pDisplay;
30 // cached hostname to avoid slow lookup
31 OUString m_aHostname;
32 // for transient storage of unicode strings eg. 'u123' by input methods
33 OUString m_aUnicodeEntry;
34 public:
35 SalGenericData( SalGenericDataType t, SalInstance *pInstance ) : SalData(), m_eType( t ), m_pDisplay( nullptr ) { m_pInstance = pInstance; SetSalData( this ); }
36 virtual void Dispose() {}
38 SalGenericDisplay *GetDisplay() const { return m_pDisplay; }
39 void SetDisplay( SalGenericDisplay *pDisp ) { m_pDisplay = pDisp; }
41 const OUString& GetHostname()
43 if (m_aHostname.isEmpty())
44 osl_getLocalHostname( &m_aHostname.pData );
45 return m_aHostname;
47 OUString &GetUnicodeCommand()
49 return m_aUnicodeEntry;
51 SalGenericDataType GetType() const
53 return m_eType;
56 // Mostly useful for remote protocol backends
57 virtual void ErrorTrapPush() = 0;
58 virtual bool ErrorTrapPop( bool bIgnoreError = true ) = 0; // true on error
61 inline SalGenericData * GetGenericData()
63 return static_cast<SalGenericData *>(ImplGetSVData()->mpSalData);
66 #endif
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */