1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: saldata.hxx,v $
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
35 #include <vcl/svdata.hxx>
36 #include <vcl/salwtype.hxx>
42 extern "C" int debug_printf(const char *f
, ...);
48 // YD FIXME #define ENABLE_IME
56 typedef APIRET (APIENTRY ImAssociateInstanceFunc
)( HWND hwnd
, HIMI himi
, PHIMI phimiPrev
);
57 typedef APIRET (APIENTRY ImGetInstanceFunc
)( HWND hwnd
, PHIMI phimi
);
58 typedef APIRET (APIENTRY ImReleaseInstanceFunc
)( HWND hwnd
, HIMI himi
);
59 typedef APIRET (APIENTRY ImSetConversionFontFunc
)( HIMI himi
, PFATTRS pFontAttrs
);
60 typedef APIRET (APIENTRY ImSetConversionFontSizeFunc
)( HIMI himi
, PSIZEF psizfxBox
);
61 typedef APIRET (APIENTRY ImGetConversionStringFunc
)( HIMI himi
, ULONG ulIndex
, PVOID pBuf
, PULONG pulBufLen
);
62 typedef APIRET (APIENTRY ImGetResultStringFunc
)( HIMI himi
, ULONG ulIndex
, PVOID pBuf
, PULONG pulBufLen
);
63 typedef APIRET (APIENTRY ImSetCandidateWindowPosFunc
)( HIMI himi
, PCANDIDATEPOS pCandidatePos
);
64 typedef APIRET (APIENTRY ImQueryIMEPropertyFunc
)( HIMI himi
, ULONG ulIndex
, PULONG pulProp
);
65 typedef APIRET (APIENTRY ImRequestIMEFunc
)( HIMI himi
, ULONG ulAction
, ULONG ulIndex
, ULONG ulValue
);
66 typedef APIRET (APIENTRY ImSetIMModeFunc
)( HIMI himi
, ULONG ulInputMode
, ULONG ulConversionMode
);
67 typedef APIRET (APIENTRY ImQueryIMModeFunc
)( HIMI himi
, PULONG pulInputMode
, PULONG pulConversionMode
);
72 ImAssociateInstanceFunc
* mpAssocIME
;
73 ImGetInstanceFunc
* mpGetIME
;
74 ImReleaseInstanceFunc
* mpReleaseIME
;
75 ImSetConversionFontFunc
* mpSetConversionFont
;
76 ImSetConversionFontSizeFunc
* mpSetConversionFontSize
;
77 ImGetConversionStringFunc
* mpGetConversionString
;
78 ImGetResultStringFunc
* mpGetResultString
;
79 ImSetCandidateWindowPosFunc
* mpSetCandidateWin
;
80 ImQueryIMEPropertyFunc
* mpQueryIMEProperty
;
81 ImRequestIMEFunc
* mpRequestIME
;
82 ImSetIMModeFunc
* mpSetIMEMode
;
83 ImQueryIMModeFunc
* mpQueryIMEMode
;
90 // --------------------
92 // --------------------
107 HAB mhAB
; // anchor block handle
108 HMQ mhMQ
; // handle of os2 message queue
109 int mnArgc
; // commandline param count
110 char** mpArgv
; // commandline
111 ULONG mnNewTimerMS
; // Neue Zeit, mit dem der Timer gestartet werden soll
112 ULONG mnTimerMS
; // Current Time (in MS) of the Timer
113 ULONG mnTimerOrgMS
; // Current Original Time (in MS)
114 ULONG mnNextTimerTime
;
115 ULONG mnLastEventTime
;
116 ULONG mnTimerId
; // os2 timer id
117 BOOL mbInTimerProc
; // timer event is currently being dispatched
118 //SALTIMERPROC mpTimerProc; // timer callback proc
119 HWND mhWantLeaveMsg
; // window handle, that want a MOUSELEAVE message
120 AutoTimer
* mpMouseLeaveTimer
; // Timer for MouseLeave Test
121 Os2SalInstance
* mpFirstInstance
; // pointer of first instance
122 Os2SalFrame
* mpFirstFrame
; // pointer of first frame
123 Os2SalFrame
* mpCreateFrame
; // Create-Frame for WM_CREATE
124 Os2SalObject
* mpFirstObject
; // pointer of first object window
125 ULONG mnAppThreadId
; // Id from Applikation-Thread
126 ULONG mnFontMetricCount
; // number of entries in the font list
127 PFONTMETRICS mpFontMetrics
; // cached font list
128 BOOL mbObjClassInit
; // Ist SALOBJECTCLASS initialised
130 SalIMEData
* mpIMEData
; // SalIME-Data
131 BOOL mbIMEInit
; // SalIME-Data-Init
134 SalIcon
* mpFirstIcon
; // icon cache, points to first icon, NULL if none
138 inline void SetSalData( SalData
* pData
) { ImplGetSVData()->mpSalData
= (void*)pData
; }
139 inline SalData
* GetSalData() { return (SalData
*)ImplGetSVData()->mpSalData
; }
140 inline SalData
* GetAppSalData() { return (SalData
*)ImplGetAppSVData()->mpSalData
; }
146 #define OS2_VER_211 211
147 #define OS2_VER_WARP3 230
148 #define OS2_VER_WARP4 240
152 HMODULE mhMod
; // Module handle of SAL-DLL
153 USHORT mnVersion
; // 211 = OS2 2.11; 230 = OS2 3.0; 240 = OS2 4.0
154 PFNWP mpFrameProc
; // old frame proc
157 extern SalShlData aSalShlData
;
159 BOOL
SalImplHandleProcessMenu( HWND hWnd
, ULONG nMsg
, MPARAM nMP1
, MPARAM nMP2
);
161 // --------------------------------------------
162 // - SALSHL.CXX - for accessing DLL resources -
163 // --------------------------------------------
165 HPOINTER
ImplLoadSalCursor( int nId
);
166 HBITMAP
ImplLoadSalBitmap( int nId
);
167 BOOL
ImplLoadSalIcon( int nId
, HPOINTER
& rIcon
);
170 void ImplInitSalGDI();
171 void ImplFreeSalGDI();
177 // \\OS2\SOURCE\APP\SALINST.CXX
178 void ImplSalYieldMutexAcquireWithWait();
179 ULONG
ImplSalReleaseYieldMutex();
180 void ImplSalAcquireYieldMutex( ULONG nCount
);
181 ULONG
GetCurrentThreadId();
182 BOOL
ImplSalYieldMutexTryToAcquire();
183 void ImplSalYieldMutexAcquire();
184 void ImplSalYieldMutexRelease();
186 // \\OS2\SOURCE\WINDOW\SALFRAME.CXX
187 MRESULT EXPENTRY
SalFrameWndProc( HWND hWnd
, ULONG nMsg
, MPARAM nMP1
, MPARAM nMP2
);
188 MRESULT EXPENTRY
SalFrameFrameProc( HWND hWnd
, ULONG nMsg
, MPARAM nMP1
, MPARAM nMP2
);
189 // \SV\WIN\SOURCE\APP\SALTIMER.CXX
190 #define SALTIMERPROC_RECURSIVE 0xffffffff
191 void SalTimerProc( HWND hWnd
, UINT nMsg
, UINT nId
, ULONG nTime
);
193 // \WIN\SOURCE\WINDOW\SALFRAME.CXX
194 void SalTestMouseLeave();
196 // \\OS2\SOURCE\WINDOW\SALFRAME.CXX
197 // return Frame for Message-Handling
198 Os2SalFrame
* GetSalDefaultFrame();
200 // \\OS2\SOURCE\WINDOW\SALFRAME.CXX
201 // IME-Daten wieder freigeben
203 void ImplReleaseSALIMEData();
210 #define SAL_PROFILE_APPNAME ((PSZ)"StarOffice")
211 #define SAL_PROFILE_USEDJP ((PSZ)"UseDJP")
212 #define SAL_PROFILE_PRINTDJP ((PSZ)"PrintDJP")
213 #define SAL_PROFILE_PRINTRAW ((PSZ)"PrintRAW")
215 #define SAL_FRAME_WNDEXTRA sizeof(ULONG)
216 #define SAL_FRAME_THIS 0
217 #define SAL_FRAME_CLASSNAME "SALFRAME"
218 #define SAL_SUBFRAME_CLASSNAME "SALSUBFRAME"
219 #define SAL_OBJECT_WNDEXTRA sizeof(ULONG)
220 #define SAL_OBJECT_THIS 0
221 #define SAL_OBJECT_CLASSNAME "SALOBJECT"
222 #define SAL_OBJECT_CHILDCLASSNAME "SALOBJECTCHILD"
223 #define SAL_OBJECT_CLIPCLASSNAME "SALOBJECTCLIP"
224 #define SAL_COM_CLASSNAME "SALCOMWND"
226 #define SAL_MOUSELEAVE_TIMEOUT 300
228 // MP1 == 0; MP2 == pData
229 #define SAL_MSG_USEREVENT (WM_USER+111)
230 // MP1 == 0; MP2 == MousePosition relativ to upper left of screen
231 #define SAL_MSG_MOUSELEAVE (WM_USER+112)
232 // MP1 == hDC; MP2 == 0
233 #define SAL_MSG_PRINTABORTJOB (WM_USER+113)
234 // MP1 == 0; MP2 == 0
235 #define SAL_MSG_STARTTIMER (WM_USER+114)
236 // MP1 == nFrameStyle; MP2 == pParent; lResult pFrame
237 #define SAL_MSG_CREATEFRAME (WM_USER+115)
238 // MP1 == 0; MP2 == pParent; lResult pObject
239 #define SAL_MSG_CREATEOBJECT (WM_USER+116)
240 // MP1 == bWait; MP2 == pMutex
241 #define SAL_MSG_THREADYIELD (WM_USER+117)
242 // MP1 == 0; MP2 == 0
243 #define SAL_MSG_RELEASEWAITYIELD (WM_USER+118)
244 // MP1 == 0; MP2 == pData
245 #define SAL_MSG_SYSPROCESSMENU (WM_USER+119)
246 // POSTFOCUS-Message; MP1 == nMP1; MP2 == nMP2 (SHORT1( bFocus ), 0)
247 #define SAL_MSG_POSTFOCUS (WM_USER+120)
248 // POSTSIZE-Message; MP1 == nMP1; MP2 == nMP2
249 #define SAL_MSG_POSTSIZE (WM_USER+121)
251 // wParam == wParam; lParam == lParam
252 #define SAL_MSG_POSTMOVE (WM_USER+136)
253 // wParam == pRECT; lParam == 0
254 #define SAL_MSG_POSTPAINT (WM_USER+137)
255 // wParam == nFlags; lParam == 0
256 #define SAL_MSG_TOTOP (WM_USER+142)
257 // wParam == bVisible; lParam == 0
258 #define SAL_MSG_SHOW (WM_USER+143)
260 // SysChild-ToTop; nMP1 = 0; nMP2 = 0
261 #define SALOBJ_MSG_TOTOP (WM_USER+150)
262 // POSTFOCUS-Message; MP1 == nMP1; MP2 == nMP2 (SHORT1( bFocus ), 0)
263 #define SALOBJ_MSG_POSTFOCUS (WM_USER+151)
265 // wParam == 0; lParam == 0
266 #define SAL_MSG_DESTROYFRAME (WM_USER+160)
267 // wParam == 0; lParam == pObject;
268 #define SAL_MSG_DESTROYOBJECT (WM_USER+161)
269 // wParam == 0; lParam == this; lResult == bRet
270 #define SAL_MSG_CREATESOUND (WM_USER+162)
271 // wParam == 0; lParam == this
272 #define SAL_MSG_DESTROYSOUND (WM_USER+163)
273 // wParam == hWnd; lParam == 0; lResult == hDC
274 #define SAL_MSG_GETDC (WM_USER+164)
275 // wParam == hWnd; lParam == 0
276 #define SAL_MSG_RELEASEDC (WM_USER+165)
277 // wParam == newParentHwnd; lParam == oldHwnd; lResult == newhWnd
278 #define SAL_MSG_RECREATEHWND (WM_USER+166)
279 // wParam == newParentHwnd; lParam == oldHwnd; lResult == newhWnd
280 #define SAL_MSG_RECREATECHILDHWND (WM_USER+167)
281 // wParam == 0; lParam == HWND;
282 #define SAL_MSG_DESTROYHWND (WM_USER+168)
283 // POSTTIMER-Message; wparam = 0, lParam == time
284 #define SAL_MSG_POSTTIMER (WM_USER+169)
290 inline void SetWindowPtr( HWND hWnd
, SalFrame
* pThis
)
292 WinSetWindowULong( hWnd
, SAL_FRAME_THIS
, (ULONG
)pThis
);
295 inline Os2SalFrame
* GetWindowPtr( HWND hWnd
)
297 return (Os2SalFrame
*)WinQueryWindowULong( hWnd
, SAL_FRAME_THIS
);
300 inline void SetSalObjWindowPtr( HWND hWnd
, SalObject
* pThis
)
302 WinSetWindowULong( hWnd
, SAL_OBJECT_THIS
, (ULONG
)pThis
);
305 inline Os2SalObject
* GetSalObjWindowPtr( HWND hWnd
)
307 return (Os2SalObject
*)WinQueryWindowULong( hWnd
, SAL_OBJECT_THIS
);
310 #endif // _SV_SALDATA_HXX