bump product version to 4.1.6.2
[LibreOffice.git] / vcl / inc / generic / gendata.hxx
blob6783c36e262b508893cf86973f6b635e9b91df76
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 _SV_GENDATA_HXX
11 #define _SV_GENDATA_HXX
13 #include <osl/socket.hxx>
14 #include <saldatabasic.hxx>
16 class SalGenericDisplay;
18 // Not the prettiest - but helpful for migrating old code ...
19 class SalDisplay;
20 class GtkSalDisplay;
21 enum SalGenericDataType { SAL_DATA_GTK, SAL_DATA_GTK3,
22 SAL_DATA_TDE3, SAL_DATA_KDE3, SAL_DATA_KDE4,
23 SAL_DATA_UNX, SAL_DATA_SVP,
24 SAL_DATA_ANDROID, SAL_DATA_IOS,
25 SAL_DATA_HEADLESS };
27 class VCL_DLLPUBLIC SalGenericData : public SalData
29 protected:
30 SalGenericDataType m_eType;
31 SalGenericDisplay *m_pDisplay;
32 // cached hostname to avoid slow lookup
33 OUString m_aHostname;
34 // for transient storage of unicode strings eg. 'u123' by input methods
35 OUString m_aUnicodeEntry;
36 public:
37 SalGenericData( SalGenericDataType t, SalInstance *pInstance ) : SalData(), m_eType( t ), m_pDisplay( NULL ) { m_pInstance = pInstance; SetSalData( this ); }
38 virtual ~SalGenericData() {}
39 virtual void Dispose() {}
41 SalGenericDisplay *GetDisplay() const { return m_pDisplay; }
42 void SetDisplay( SalGenericDisplay *pDisp ) { m_pDisplay = pDisp; }
44 const OUString& GetHostname()
46 if (m_aHostname.isEmpty())
47 osl_getLocalHostname( &m_aHostname.pData );
48 return m_aHostname;
50 OUString &GetUnicodeCommand()
52 return m_aUnicodeEntry;
54 inline SalGenericDataType GetType() const
56 return m_eType;
59 // Mostly useful for remote protocol backends
60 virtual void ErrorTrapPush() = 0;
61 virtual bool ErrorTrapPop( bool bIgnoreError = true ) = 0; // true on error
63 // Not the prettiest - but helpful for migrating old code ...
64 inline SalDisplay *GetSalDisplay() const
66 OSL_ASSERT( m_eType != SAL_DATA_GTK3 );
67 return (SalDisplay *)GetDisplay();
69 inline GtkSalDisplay *GetGtkDisplay() const
71 return (GtkSalDisplay *)GetDisplay();
75 inline SalGenericData * GetGenericData()
77 return (SalGenericData *)ImplGetSVData()->mpSalData;
80 #endif
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */