merged tag ooo/DEV300_m102
[LibreOffice.git] / vcl / os2 / inc / saldata.hxx
blobcf536a58d8ddae3cf4ea6b537030d55900d46e77
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _SV_SALDATA_HXX
29 #define _SV_SALDATA_HXX
31 #include <vcl/sv.h>
32 #include <vcl/svdata.hxx>
33 #include <vcl/salwtype.hxx>
35 class Os2SalInstance;
36 class Os2SalFrame;
37 class Os2SalObject;
39 extern "C" int debug_printf(const char *f, ...);
41 // --------------
42 // - SalIMEData -
43 // --------------
45 // YD FIXME #define ENABLE_IME
47 #ifdef ENABLE_IME
49 struct SalIMEData;
51 #ifdef OS2IM_INCLUDED
53 typedef APIRET (APIENTRY ImAssociateInstanceFunc)( HWND hwnd, HIMI himi, PHIMI phimiPrev );
54 typedef APIRET (APIENTRY ImGetInstanceFunc)( HWND hwnd, PHIMI phimi );
55 typedef APIRET (APIENTRY ImReleaseInstanceFunc)( HWND hwnd, HIMI himi );
56 typedef APIRET (APIENTRY ImSetConversionFontFunc)( HIMI himi, PFATTRS pFontAttrs );
57 typedef APIRET (APIENTRY ImSetConversionFontSizeFunc)( HIMI himi, PSIZEF psizfxBox );
58 typedef APIRET (APIENTRY ImGetConversionStringFunc)( HIMI himi, ULONG ulIndex, PVOID pBuf, PULONG pulBufLen );
59 typedef APIRET (APIENTRY ImGetResultStringFunc)( HIMI himi, ULONG ulIndex, PVOID pBuf, PULONG pulBufLen );
60 typedef APIRET (APIENTRY ImSetCandidateWindowPosFunc)( HIMI himi, PCANDIDATEPOS pCandidatePos );
61 typedef APIRET (APIENTRY ImQueryIMEPropertyFunc)( HIMI himi, ULONG ulIndex, PULONG pulProp );
62 typedef APIRET (APIENTRY ImRequestIMEFunc)( HIMI himi, ULONG ulAction, ULONG ulIndex, ULONG ulValue );
63 typedef APIRET (APIENTRY ImSetIMModeFunc)( HIMI himi, ULONG ulInputMode, ULONG ulConversionMode );
64 typedef APIRET (APIENTRY ImQueryIMModeFunc)( HIMI himi, PULONG pulInputMode, PULONG pulConversionMode );
66 struct SalIMEData
68 HMODULE mhModIME;
69 ImAssociateInstanceFunc* mpAssocIME;
70 ImGetInstanceFunc* mpGetIME;
71 ImReleaseInstanceFunc* mpReleaseIME;
72 ImSetConversionFontFunc* mpSetConversionFont;
73 ImSetConversionFontSizeFunc* mpSetConversionFontSize;
74 ImGetConversionStringFunc* mpGetConversionString;
75 ImGetResultStringFunc* mpGetResultString;
76 ImSetCandidateWindowPosFunc* mpSetCandidateWin;
77 ImQueryIMEPropertyFunc* mpQueryIMEProperty;
78 ImRequestIMEFunc* mpRequestIME;
79 ImSetIMModeFunc* mpSetIMEMode;
80 ImQueryIMModeFunc* mpQueryIMEMode;
83 #endif
85 #endif
87 // --------------------
88 // - Icon cache -
89 // --------------------
91 struct SalIcon
93 int nId;
94 HPOINTER hIcon;
95 SalIcon *pNext;
98 // -----------
99 // - SalData -
100 // -----------
102 struct SalData
104 HAB mhAB; // anchor block handle
105 HMQ mhMQ; // handle of os2 message queue
106 int mnArgc; // commandline param count
107 char** mpArgv; // commandline
108 ULONG mnNewTimerMS; // Neue Zeit, mit dem der Timer gestartet werden soll
109 ULONG mnTimerMS; // Current Time (in MS) of the Timer
110 ULONG mnTimerOrgMS; // Current Original Time (in MS)
111 ULONG mnNextTimerTime;
112 ULONG mnLastEventTime;
113 ULONG mnTimerId; // os2 timer id
114 BOOL mbInTimerProc; // timer event is currently being dispatched
115 //SALTIMERPROC mpTimerProc; // timer callback proc
116 HWND mhWantLeaveMsg; // window handle, that want a MOUSELEAVE message
117 AutoTimer* mpMouseLeaveTimer; // Timer for MouseLeave Test
118 Os2SalInstance* mpFirstInstance; // pointer of first instance
119 Os2SalFrame* mpFirstFrame; // pointer of first frame
120 Os2SalFrame* mpCreateFrame; // Create-Frame for WM_CREATE
121 Os2SalObject* mpFirstObject; // pointer of first object window
122 ULONG mnAppThreadId; // Id from Applikation-Thread
123 ULONG mnFontMetricCount; // number of entries in the font list
124 PFONTMETRICS mpFontMetrics; // cached font list
125 BOOL mbObjClassInit; // Ist SALOBJECTCLASS initialised
126 #ifdef ENABLE_IME
127 SalIMEData* mpIMEData; // SalIME-Data
128 BOOL mbIMEInit; // SalIME-Data-Init
129 #endif
131 SalIcon* mpFirstIcon; // icon cache, points to first icon, NULL if none
135 inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; }
136 inline SalData* GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; }
137 inline SalData* GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; }
139 // --------------
140 // - SalShlData -
141 // --------------
143 #define OS2_VER_211 211
144 #define OS2_VER_WARP3 230
145 #define OS2_VER_WARP4 240
147 struct SalShlData
149 HMODULE mhMod; // Module handle of SAL-DLL
150 USHORT mnVersion; // 211 = OS2 2.11; 230 = OS2 3.0; 240 = OS2 4.0
151 PFNWP mpFrameProc; // old frame proc
154 extern SalShlData aSalShlData;
156 BOOL SalImplHandleProcessMenu( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 );
158 // --------------------------------------------
159 // - SALSHL.CXX - for accessing DLL resources -
160 // --------------------------------------------
162 HPOINTER ImplLoadSalCursor( int nId );
163 HBITMAP ImplLoadSalBitmap( int nId );
164 BOOL ImplLoadSalIcon( int nId, HPOINTER& rIcon);
166 // SALGDI.CXX
167 void ImplInitSalGDI();
168 void ImplFreeSalGDI();
170 // --------------
171 // - Prototypes -
172 // --------------
174 // \\OS2\SOURCE\APP\SALINST.CXX
175 void ImplSalYieldMutexAcquireWithWait();
176 ULONG ImplSalReleaseYieldMutex();
177 void ImplSalAcquireYieldMutex( ULONG nCount );
178 ULONG GetCurrentThreadId();
179 BOOL ImplSalYieldMutexTryToAcquire();
180 void ImplSalYieldMutexAcquire();
181 void ImplSalYieldMutexRelease();
183 // \\OS2\SOURCE\WINDOW\SALFRAME.CXX
184 MRESULT EXPENTRY SalFrameWndProc( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 );
185 MRESULT EXPENTRY SalFrameFrameProc( HWND hWnd, ULONG nMsg, MPARAM nMP1, MPARAM nMP2 );
186 // \SV\WIN\SOURCE\APP\SALTIMER.CXX
187 #define SALTIMERPROC_RECURSIVE 0xffffffff
188 void SalTimerProc( HWND hWnd, UINT nMsg, UINT nId, ULONG nTime );
190 // \WIN\SOURCE\WINDOW\SALFRAME.CXX
191 void SalTestMouseLeave();
193 // \\OS2\SOURCE\WINDOW\SALFRAME.CXX
194 // return Frame for Message-Handling
195 Os2SalFrame* GetSalDefaultFrame();
197 // \\OS2\SOURCE\WINDOW\SALFRAME.CXX
198 // IME-Daten wieder freigeben
199 #ifdef ENABLE_IME
200 void ImplReleaseSALIMEData();
201 #endif
203 // -----------
204 // - Defines -
205 // -----------
207 #define SAL_PROFILE_APPNAME ((PSZ)"StarOffice")
208 #define SAL_PROFILE_USEDJP ((PSZ)"UseDJP")
209 #define SAL_PROFILE_PRINTDJP ((PSZ)"PrintDJP")
210 #define SAL_PROFILE_PRINTRAW ((PSZ)"PrintRAW")
212 #define SAL_FRAME_WNDEXTRA sizeof(ULONG)
213 #define SAL_FRAME_THIS 0
214 #define SAL_FRAME_CLASSNAME "SALFRAME"
215 #define SAL_SUBFRAME_CLASSNAME "SALSUBFRAME"
216 #define SAL_OBJECT_WNDEXTRA sizeof(ULONG)
217 #define SAL_OBJECT_THIS 0
218 #define SAL_OBJECT_CLASSNAME "SALOBJECT"
219 #define SAL_OBJECT_CHILDCLASSNAME "SALOBJECTCHILD"
220 #define SAL_OBJECT_CLIPCLASSNAME "SALOBJECTCLIP"
221 #define SAL_COM_CLASSNAME "SALCOMWND"
223 #define SAL_MOUSELEAVE_TIMEOUT 300
225 // MP1 == 0; MP2 == pData
226 #define SAL_MSG_USEREVENT (WM_USER+111)
227 // MP1 == 0; MP2 == MousePosition relativ to upper left of screen
228 #define SAL_MSG_MOUSELEAVE (WM_USER+112)
229 // MP1 == hDC; MP2 == 0
230 #define SAL_MSG_PRINTABORTJOB (WM_USER+113)
231 // MP1 == 0; MP2 == 0
232 #define SAL_MSG_STARTTIMER (WM_USER+114)
233 // MP1 == nFrameStyle; MP2 == pParent; lResult pFrame
234 #define SAL_MSG_CREATEFRAME (WM_USER+115)
235 // MP1 == 0; MP2 == pParent; lResult pObject
236 #define SAL_MSG_CREATEOBJECT (WM_USER+116)
237 // MP1 == bWait; MP2 == pMutex
238 #define SAL_MSG_THREADYIELD (WM_USER+117)
239 // MP1 == 0; MP2 == 0
240 #define SAL_MSG_RELEASEWAITYIELD (WM_USER+118)
241 // MP1 == 0; MP2 == pData
242 #define SAL_MSG_SYSPROCESSMENU (WM_USER+119)
243 // POSTFOCUS-Message; MP1 == nMP1; MP2 == nMP2 (SHORT1( bFocus ), 0)
244 #define SAL_MSG_POSTFOCUS (WM_USER+120)
245 // POSTSIZE-Message; MP1 == nMP1; MP2 == nMP2
246 #define SAL_MSG_POSTSIZE (WM_USER+121)
248 // wParam == wParam; lParam == lParam
249 #define SAL_MSG_POSTMOVE (WM_USER+136)
250 // wParam == pRECT; lParam == 0
251 #define SAL_MSG_POSTPAINT (WM_USER+137)
252 // wParam == nFlags; lParam == 0
253 #define SAL_MSG_TOTOP (WM_USER+142)
254 // wParam == bVisible; lParam == 0
255 #define SAL_MSG_SHOW (WM_USER+143)
257 // SysChild-ToTop; nMP1 = 0; nMP2 = 0
258 #define SALOBJ_MSG_TOTOP (WM_USER+150)
259 // POSTFOCUS-Message; MP1 == nMP1; MP2 == nMP2 (SHORT1( bFocus ), 0)
260 #define SALOBJ_MSG_POSTFOCUS (WM_USER+151)
262 // wParam == 0; lParam == 0
263 #define SAL_MSG_DESTROYFRAME (WM_USER+160)
264 // wParam == 0; lParam == pObject;
265 #define SAL_MSG_DESTROYOBJECT (WM_USER+161)
266 // wParam == 0; lParam == this; lResult == bRet
267 #define SAL_MSG_CREATESOUND (WM_USER+162)
268 // wParam == 0; lParam == this
269 #define SAL_MSG_DESTROYSOUND (WM_USER+163)
270 // wParam == hWnd; lParam == 0; lResult == hDC
271 #define SAL_MSG_GETDC (WM_USER+164)
272 // wParam == hWnd; lParam == 0
273 #define SAL_MSG_RELEASEDC (WM_USER+165)
274 // wParam == newParentHwnd; lParam == oldHwnd; lResult == newhWnd
275 #define SAL_MSG_RECREATEHWND (WM_USER+166)
276 // wParam == newParentHwnd; lParam == oldHwnd; lResult == newhWnd
277 #define SAL_MSG_RECREATECHILDHWND (WM_USER+167)
278 // wParam == 0; lParam == HWND;
279 #define SAL_MSG_DESTROYHWND (WM_USER+168)
280 // POSTTIMER-Message; wparam = 0, lParam == time
281 #define SAL_MSG_POSTTIMER (WM_USER+169)
283 // -----------------
284 // - Helpfunctions -
285 // -----------------
287 inline void SetWindowPtr( HWND hWnd, SalFrame* pThis )
289 WinSetWindowULong( hWnd, SAL_FRAME_THIS, (ULONG)pThis );
292 inline Os2SalFrame* GetWindowPtr( HWND hWnd )
294 return (Os2SalFrame*)WinQueryWindowULong( hWnd, SAL_FRAME_THIS );
297 inline void SetSalObjWindowPtr( HWND hWnd, SalObject* pThis )
299 WinSetWindowULong( hWnd, SAL_OBJECT_THIS, (ULONG)pThis );
302 inline Os2SalObject* GetSalObjWindowPtr( HWND hWnd )
304 return (Os2SalObject*)WinQueryWindowULong( hWnd, SAL_OBJECT_THIS );
307 #endif // _SV_SALDATA_HXX