Line data Source code
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 : #ifndef INCLUDED_VCL_INC_GENERIC_GENDATA_HXX
11 : #define INCLUDED_VCL_INC_GENERIC_GENDATA_HXX
12 :
13 : #include <osl/socket.hxx>
14 :
15 : #include <saldatabasic.hxx>
16 :
17 : class SalGenericDisplay;
18 :
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 };
24 :
25 : class VCL_DLLPUBLIC SalGenericData : public SalData
26 : {
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 245 : SalGenericData( SalGenericDataType t, SalInstance *pInstance ) : SalData(), m_eType( t ), m_pDisplay( NULL ) { m_pInstance = pInstance; SetSalData( this ); }
36 0 : virtual ~SalGenericData() {}
37 0 : virtual void Dispose() {}
38 :
39 851 : SalGenericDisplay *GetDisplay() const { return m_pDisplay; }
40 6 : void SetDisplay( SalGenericDisplay *pDisp ) { m_pDisplay = pDisp; }
41 :
42 0 : const OUString& GetHostname()
43 : {
44 0 : if (m_aHostname.isEmpty())
45 0 : osl_getLocalHostname( &m_aHostname.pData );
46 0 : return m_aHostname;
47 : }
48 0 : OUString &GetUnicodeCommand()
49 : {
50 0 : return m_aUnicodeEntry;
51 : }
52 : inline SalGenericDataType GetType() const
53 : {
54 : return m_eType;
55 : }
56 :
57 : // Mostly useful for remote protocol backends
58 : virtual void ErrorTrapPush() = 0;
59 : virtual bool ErrorTrapPop( bool bIgnoreError = true ) = 0; // true on error
60 : };
61 :
62 548 : inline SalGenericData * GetGenericData()
63 : {
64 548 : return static_cast<SalGenericData *>(ImplGetSVData()->mpSalData);
65 : }
66 :
67 : #endif
68 :
69 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|