merge the formfield patch from ooo-build
[ooovba.git] / vcl / unx / inc / saldata.hxx
blobaa8fbcb22f97af50bf892ba709e5849fd0184462
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: saldata.hxx,v $
10 * $Revision: 1.18 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SV_SALDATA_HXX
32 #define _SV_SALDATA_HXX
34 // -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
35 #include <signal.h>
36 #include <salstd.hxx>
37 #include <vcl/salframe.hxx>
38 #include <salinst.h>
39 #include <vcl/saldatabasic.hxx>
40 #ifndef _OSL_MODULE_H
41 #include <osl/module.h>
42 #endif
43 #include <vcl/dllapi.h>
45 // -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
46 class SalXLib;
47 class SalDisplay;
48 class SalPrinter;
50 // -=-= typedefs -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
52 DECLARE_LIST( SalDisplays, SalDisplay* )
54 #if defined SCO || defined LINUX || defined NETBSD || defined AIX || defined HPUX || defined FREEBSD
55 #include <pthread.h>
56 #else
57 typedef unsigned int pthread_t;
58 #endif
60 // -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
61 class VCL_DLLPUBLIC X11SalData : public SalData
63 protected:
64 BOOL bNoExceptions_;
65 SalXLib *pXLib_;
66 SalDisplay *m_pSalDisplay;
67 pthread_t hMainThread_;
69 public:
70 X11SalData();
71 virtual ~X11SalData();
73 virtual void Init();
74 virtual void initNWF();
75 virtual void deInitNWF();
77 inline void XError( Display *pDisplay, XErrorEvent *pEvent ) const;
79 SalDisplay* GetDisplay() const
80 { return m_pSalDisplay; }
81 void SetSalDisplay( SalDisplay* pDisplay )
82 { m_pSalDisplay = pDisplay; }
84 void DeleteDisplay(); // for shutdown
86 inline SalXLib* GetLib() const { return pXLib_; }
87 inline pthread_t GetMainThread() const { return hMainThread_; }
89 void StartTimer( ULONG nMS );
90 inline void StopTimer();
91 void Timeout() const;
93 static int XErrorHdl( Display*, XErrorEvent* );
94 static int XIOErrorHdl( Display* );
96 // set helper functions to set class and res name in W_CLASS hint
97 static const char* getFrameResName();
98 static const char* getFrameClassName();
99 static rtl::OString getFrameResName( SalExtStyle nStyle );
103 inline X11SalData* GetX11SalData()
104 { return (X11SalData*)ImplGetSVData()->mpSalData; }
107 #ifdef _SV_SALDISP_HXX
108 inline void X11SalData::XError( Display *pDisplay, XErrorEvent *pEvent ) const
109 { pXLib_->XError( pDisplay, pEvent ); }
110 #endif
112 class YieldMutexReleaser
114 ULONG m_nYieldCount;
115 public:
116 inline YieldMutexReleaser();
117 inline ~YieldMutexReleaser();
120 inline YieldMutexReleaser::YieldMutexReleaser()
122 m_nYieldCount = GetSalData()->m_pInstance->ReleaseYieldMutex();
125 inline YieldMutexReleaser::~YieldMutexReleaser()
127 GetSalData()->m_pInstance->AcquireYieldMutex( m_nYieldCount );
130 #endif // _SV_SALDATA_HXX