1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
24 #include <tools/debug.hxx>
26 #include <vcl/svapp.hxx>
28 #include <win/wincomp.hxx>
29 #include <win/saldata.hxx>
30 #include <win/salinst.h>
31 #include <win/salframe.h>
32 #include <win/salobj.h>
34 // =======================================================================
36 static sal_Bool
ImplIsSysWindowOrChild( HWND hWndParent
, HWND hWndChild
)
38 if ( hWndParent
== hWndChild
)
41 HWND hTempWnd
= ::GetParent( hWndChild
);
44 // Ab nicht Child-Fenstern hoeren wir auf zu suchen
45 if ( !(GetWindowStyle( hTempWnd
) & WS_CHILD
) )
47 if ( hTempWnd
== hWndParent
)
49 hTempWnd
= ::GetParent( hTempWnd
);
55 // -----------------------------------------------------------------------
57 WinSalObject
* ImplFindSalObject( HWND hWndChild
)
59 SalData
* pSalData
= GetSalData();
60 WinSalObject
* pObject
= pSalData
->mpFirstObject
;
63 if ( ImplIsSysWindowOrChild( pObject
->mhWndChild
, hWndChild
) )
66 pObject
= pObject
->mpNextObject
;
72 // -----------------------------------------------------------------------
74 WinSalFrame
* ImplFindSalObjectFrame( HWND hWnd
)
76 WinSalFrame
* pFrame
= NULL
;
77 WinSalObject
* pObject
= ImplFindSalObject( hWnd
);
80 // Dazugehoerenden Frame suchen
81 HWND hWnd2
= ::GetParent( pObject
->mhWnd
);
82 pFrame
= GetSalData()->mpFirstFrame
;
85 if ( pFrame
->mhWnd
== hWnd2
)
88 pFrame
= pFrame
->mpNextFrame
;
95 // -----------------------------------------------------------------------
97 LRESULT CALLBACK
SalSysMsgProc( int nCode
, WPARAM wParam
, LPARAM lParam
)
99 // Used for Unicode and none Unicode
100 SalData
* pSalData
= GetSalData();
102 if ( (nCode
>= 0) && lParam
)
104 CWPSTRUCT
* pData
= (CWPSTRUCT
*)lParam
;
105 if ( (pData
->message
!= WM_KEYDOWN
) &&
106 (pData
->message
!= WM_KEYUP
) )
107 pSalData
->mnSalObjWantKeyEvt
= 0;
109 // Testen, ob wir Daten fuer ein SalObject-Fenster behandeln
111 WinSalObject
* pObject
;
112 if ( pData
->message
== WM_SETFOCUS
)
114 pObject
= ImplFindSalObject( pData
->hwnd
);
117 pObject
->mhLastFocusWnd
= pData
->hwnd
;
118 if ( ImplSalYieldMutexTryToAcquire() )
120 pObject
->CallCallback( SALOBJ_EVENT_GETFOCUS
, 0 );
121 ImplSalYieldMutexRelease();
124 ImplPostMessage( pObject
->mhWnd
, SALOBJ_MSG_POSTFOCUS
, 0, 0 );
127 else if ( pData
->message
== WM_KILLFOCUS
)
129 pObject
= ImplFindSalObject( pData
->hwnd
);
130 if ( pObject
&& !ImplFindSalObject( (HWND
)pData
->wParam
) )
132 // LoseFocus nur rufen, wenn wirklich kein ChildFenster
134 if ( !pData
->wParam
|| !ImplFindSalObject( (HWND
)pData
->wParam
) )
136 if ( ImplSalYieldMutexTryToAcquire() )
138 pObject
->CallCallback( SALOBJ_EVENT_LOSEFOCUS
, 0 );
139 ImplSalYieldMutexRelease();
142 ImplPostMessage( pObject
->mhWnd
, SALOBJ_MSG_POSTFOCUS
, 0, 0 );
145 pObject
->mhLastFocusWnd
= (HWND
)pData
->wParam
;
150 return CallNextHookEx( pSalData
->mhSalObjMsgHook
, nCode
, wParam
, lParam
);
153 // -----------------------------------------------------------------------
155 sal_Bool
ImplSalPreDispatchMsg( MSG
* pMsg
)
157 // Used for Unicode and none Unicode
158 SalData
* pSalData
= GetSalData();
159 WinSalObject
* pObject
;
161 if ( (pMsg
->message
== WM_LBUTTONDOWN
) ||
162 (pMsg
->message
== WM_RBUTTONDOWN
) ||
163 (pMsg
->message
== WM_MBUTTONDOWN
) )
165 ImplSalYieldMutexAcquireWithWait();
166 pObject
= ImplFindSalObject( pMsg
->hwnd
);
167 if ( pObject
&& !pObject
->IsMouseTransparent() )
168 ImplPostMessage( pObject
->mhWnd
, SALOBJ_MSG_TOTOP
, 0, 0 );
169 ImplSalYieldMutexRelease();
172 if ( (pMsg
->message
== WM_KEYDOWN
) ||
173 (pMsg
->message
== WM_KEYUP
) )
175 // KeyEvents wollen wir nach Moeglichkeit auch abarbeiten,
176 // wenn das Control diese nicht selber auswertet
177 // SysKeys werden als WM_SYSCOMMAND verarbeitet
178 // Char-Events verarbeiten wir nicht, da wir nur
179 // Accelerator relevante Keys verarbeiten wollen
180 sal_Bool bWantedKeyCode
= FALSE
;
181 // A-Z, 0-9 nur in Verbindung mit Control-Taste
182 if ( ((pMsg
->wParam
>= 65) && (pMsg
->wParam
<= 90)) ||
183 ((pMsg
->wParam
>= 48) && (pMsg
->wParam
<= 57)) )
185 if ( GetKeyState( VK_CONTROL
) & 0x8000 )
186 bWantedKeyCode
= TRUE
;
188 else if ( ((pMsg
->wParam
>= VK_F1
) && (pMsg
->wParam
<= VK_F24
)) ||
189 ((pMsg
->wParam
>= VK_SPACE
) && (pMsg
->wParam
<= VK_HELP
)) ||
190 (pMsg
->wParam
== VK_BACK
) || (pMsg
->wParam
== VK_TAB
) ||
191 (pMsg
->wParam
== VK_CLEAR
) || (pMsg
->wParam
== VK_RETURN
) ||
192 (pMsg
->wParam
== VK_ESCAPE
) )
193 bWantedKeyCode
= TRUE
;
194 if ( bWantedKeyCode
)
196 ImplSalYieldMutexAcquireWithWait();
197 pObject
= ImplFindSalObject( pMsg
->hwnd
);
199 pSalData
->mnSalObjWantKeyEvt
= pMsg
->wParam
;
200 ImplSalYieldMutexRelease();
203 // Hier WM_SYSCHAR abfangen, um mit Alt+Taste evtl. Menu zu aktivieren
204 else if ( pMsg
->message
== WM_SYSCHAR
)
206 pSalData
->mnSalObjWantKeyEvt
= 0;
208 sal_uInt16 nKeyCode
= LOWORD( pMsg
->wParam
);
210 if ( ((nKeyCode
>= 48) && (nKeyCode
<= 57)) ||
211 ((nKeyCode
>= 65) && (nKeyCode
<= 90)) ||
212 ((nKeyCode
>= 97) && (nKeyCode
<= 122)) )
214 sal_Bool bRet
= FALSE
;
215 ImplSalYieldMutexAcquireWithWait();
216 pObject
= ImplFindSalObject( pMsg
->hwnd
);
219 if ( pMsg
->hwnd
== ::GetFocus() )
221 WinSalFrame
* pFrame
= ImplFindSalObjectFrame( pMsg
->hwnd
);
224 if ( ImplHandleSalObjSysCharMsg( pFrame
->mhWnd
, pMsg
->wParam
, pMsg
->lParam
) )
229 ImplSalYieldMutexRelease();
235 pSalData
->mnSalObjWantKeyEvt
= 0;
240 // -----------------------------------------------------------------------
242 void ImplSalPostDispatchMsg( MSG
* pMsg
, LRESULT
/* nDispatchResult */ )
244 // Used for Unicode and none Unicode
245 SalData
* pSalData
= GetSalData();
248 if ( (pMsg
->message
== WM_KEYDOWN
) || (pMsg
->message
== WM_KEYUP
) )
250 if ( pSalData
->mnSalObjWantKeyEvt
== pMsg
->wParam
)
252 pSalData
->mnSalObjWantKeyEvt
= 0;
253 if ( pMsg
->hwnd
== ::GetFocus() )
255 ImplSalYieldMutexAcquireWithWait();
256 pFrame
= ImplFindSalObjectFrame( pMsg
->hwnd
);
258 ImplHandleSalObjKeyMsg( pFrame
->mhWnd
, pMsg
->message
, pMsg
->wParam
, pMsg
->lParam
);
259 ImplSalYieldMutexRelease();
264 pSalData
->mnSalObjWantKeyEvt
= 0;
267 // =======================================================================
269 LRESULT CALLBACK
SalSysObjWndProc( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
, int& rDef
)
271 WinSalObject
* pSysObj
;
283 BeginPaint( hWnd
, &aPs
);
284 EndPaint( hWnd
, &aPs
);
289 case WM_PARENTNOTIFY
:
291 UINT nNotifyMsg
= LOWORD( wParam
);
292 if ( (nNotifyMsg
== WM_LBUTTONDOWN
) ||
293 (nNotifyMsg
== WM_RBUTTONDOWN
) ||
294 (nNotifyMsg
== WM_MBUTTONDOWN
) )
296 ImplSalYieldMutexAcquireWithWait();
297 pSysObj
= GetSalObjWindowPtr( hWnd
);
298 if ( pSysObj
&& !pSysObj
->IsMouseTransparent() )
299 pSysObj
->CallCallback( SALOBJ_EVENT_TOTOP
, 0 );
300 ImplSalYieldMutexRelease();
305 case WM_MOUSEACTIVATE
:
307 ImplSalYieldMutexAcquireWithWait();
308 pSysObj
= GetSalObjWindowPtr( hWnd
);
309 if ( pSysObj
&& !pSysObj
->IsMouseTransparent() )
310 ImplPostMessage( hWnd
, SALOBJ_MSG_TOTOP
, 0, 0 );
311 ImplSalYieldMutexRelease();
315 case SALOBJ_MSG_TOTOP
:
316 if ( ImplSalYieldMutexTryToAcquire() )
318 pSysObj
= GetSalObjWindowPtr( hWnd
);
319 pSysObj
->CallCallback( SALOBJ_EVENT_TOTOP
, 0 );
320 ImplSalYieldMutexRelease();
324 ImplPostMessage( hWnd
, SALOBJ_MSG_TOTOP
, 0, 0 );
327 case SALOBJ_MSG_POSTFOCUS
:
328 if ( ImplSalYieldMutexTryToAcquire() )
330 pSysObj
= GetSalObjWindowPtr( hWnd
);
331 HWND hFocusWnd
= ::GetFocus();
333 if ( hFocusWnd
&& ImplIsSysWindowOrChild( hWnd
, hFocusWnd
) )
334 nEvent
= SALOBJ_EVENT_GETFOCUS
;
336 nEvent
= SALOBJ_EVENT_LOSEFOCUS
;
337 pSysObj
->CallCallback( nEvent
, 0 );
338 ImplSalYieldMutexRelease();
341 ImplPostMessage( hWnd
, SALOBJ_MSG_POSTFOCUS
, 0, 0 );
347 HWND hWndChild
= GetWindow( hWnd
, GW_CHILD
);
350 SetWindowPos( hWndChild
,
351 0, 0, 0, (int)LOWORD( lParam
), (int)HIWORD( lParam
),
352 SWP_NOZORDER
| SWP_NOACTIVATE
);
360 // Window-Instanz am Windowhandle speichern
361 // Can also be used for the W-Version, because the struct
362 // to access lpCreateParams is the same structure
363 CREATESTRUCTA
* pStruct
= (CREATESTRUCTA
*)lParam
;
364 pSysObj
= (WinSalObject
*)pStruct
->lpCreateParams
;
365 SetSalObjWindowPtr( hWnd
, pSysObj
);
366 // HWND schon hier setzen, da schon auf den Instanzdaten
367 // gearbeitet werden kann, wenn Messages waehrend
368 // CreateWindow() gesendet werden
369 pSysObj
->mhWnd
= hWnd
;
378 LRESULT CALLBACK
SalSysObjWndProcA( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
)
381 LRESULT nRet
= SalSysObjWndProc( hWnd
, nMsg
, wParam
, lParam
, bDef
);
383 nRet
= DefWindowProcA( hWnd
, nMsg
, wParam
, lParam
);
387 LRESULT CALLBACK
SalSysObjWndProcW( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
)
390 LRESULT nRet
= SalSysObjWndProc( hWnd
, nMsg
, wParam
, lParam
, bDef
);
392 nRet
= DefWindowProcW( hWnd
, nMsg
, wParam
, lParam
);
396 // -----------------------------------------------------------------------
398 LRESULT CALLBACK
SalSysObjChildWndProc( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
, int& rDef
)
404 // Wegen PlugIn's loeschen wir erstmal den Hintergrund
407 WinSalObject
* pSysObj
= GetSalObjWindowPtr( ::GetParent( hWnd
) );
409 if( pSysObj
&& !pSysObj
->IsEraseBackgroundEnabled() )
411 // do not erase background
421 BeginPaint( hWnd
, &aPs
);
422 EndPaint( hWnd
, &aPs
);
435 WinSalObject
* pSysObj
;
436 pSysObj
= GetSalObjWindowPtr( ::GetParent( hWnd
) );
438 if( pSysObj
&& pSysObj
->IsMouseTransparent() )
440 // forward mouse events to parent frame
441 HWND hWndParent
= ::GetParent( pSysObj
->mhWnd
);
443 // transform coordinates
445 pt
.x
= (long) LOWORD( lParam
);
446 pt
.y
= (long) HIWORD( lParam
);
447 MapWindowPoints( hWnd
, hWndParent
, &pt
, 1 );
448 lParam
= MAKELPARAM( (WORD
) pt
.x
, (WORD
) pt
.y
);
450 nRet
= ImplSendMessage( hWndParent
, nMsg
, wParam
, lParam
);
460 LRESULT CALLBACK
SalSysObjChildWndProcA( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
)
463 LRESULT nRet
= SalSysObjChildWndProc( hWnd
, nMsg
, wParam
, lParam
, bDef
);
465 nRet
= DefWindowProcA( hWnd
, nMsg
, wParam
, lParam
);
469 LRESULT CALLBACK
SalSysObjChildWndProcW( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
)
472 LRESULT nRet
= SalSysObjChildWndProc( hWnd
, nMsg
, wParam
, lParam
, bDef
);
474 nRet
= DefWindowProcW( hWnd
, nMsg
, wParam
, lParam
);
478 // =======================================================================
480 SalObject
* ImplSalCreateObject( WinSalInstance
* pInst
, WinSalFrame
* pParent
)
482 SalData
* pSalData
= GetSalData();
484 // Hook installieren, wenn es das erste SalObject ist
485 if ( !pSalData
->mpFirstObject
)
487 pSalData
->mhSalObjMsgHook
= SetWindowsHookExW( WH_CALLWNDPROC
,
490 pSalData
->mnAppThreadId
);
493 if ( !pSalData
->mbObjClassInit
)
495 WNDCLASSEXA aWndClassEx
;
496 aWndClassEx
.cbSize
= sizeof( aWndClassEx
);
497 aWndClassEx
.style
= 0;
498 aWndClassEx
.lpfnWndProc
= SalSysObjWndProcA
;
499 aWndClassEx
.cbClsExtra
= 0;
500 aWndClassEx
.cbWndExtra
= SAL_OBJECT_WNDEXTRA
;
501 aWndClassEx
.hInstance
= pSalData
->mhInst
;
502 aWndClassEx
.hIcon
= 0;
503 aWndClassEx
.hIconSm
= 0;
504 aWndClassEx
.hCursor
= LoadCursor( 0, IDC_ARROW
);
505 aWndClassEx
.hbrBackground
= 0;
506 aWndClassEx
.lpszMenuName
= 0;
507 aWndClassEx
.lpszClassName
= SAL_OBJECT_CLASSNAMEA
;
508 if ( RegisterClassExA( &aWndClassEx
) )
510 // Clean background first because of plugins.
511 aWndClassEx
.cbWndExtra
= 0;
512 aWndClassEx
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+1);
513 aWndClassEx
.lpfnWndProc
= SalSysObjChildWndProcA
;
514 aWndClassEx
.lpszClassName
= SAL_OBJECT_CHILDCLASSNAMEA
;
515 if ( RegisterClassExA( &aWndClassEx
) )
516 pSalData
->mbObjClassInit
= TRUE
;
520 if ( pSalData
->mbObjClassInit
)
522 WinSalObject
* pObject
= new WinSalObject
;
524 // #135235# Clip siblings of this
525 // SystemChildWindow. Otherwise, DXCanvas (using a hidden
526 // SystemChildWindow) clobbers applets/plugins during
528 HWND hWnd
= CreateWindowExA( 0, SAL_OBJECT_CLASSNAMEA
, "",
529 WS_CHILD
| WS_CLIPSIBLINGS
, 0, 0, 0, 0,
531 pInst
->mhInst
, (void*)pObject
);
536 // #135235# Explicitely stack SystemChildWindows in
537 // the order they're created - since there's no notion
539 SetWindowPos(hWnd
,HWND_TOP
,0,0,0,0,
540 SWP_NOACTIVATE
|SWP_NOMOVE
|SWP_NOREDRAW
|SWP_NOSIZE
);
541 hWndChild
= CreateWindowExA( 0, SAL_OBJECT_CHILDCLASSNAMEA
, "",
542 WS_CHILD
| WS_CLIPCHILDREN
| WS_CLIPSIBLINGS
| WS_VISIBLE
,
545 pInst
->mhInst
, NULL
);
550 #if OSL_DEBUG_LEVEL > 1
552 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER
553 |FORMAT_MESSAGE_IGNORE_INSERTS
554 |FORMAT_MESSAGE_FROM_SYSTEM
,
555 NULL
, GetLastError(), 0,
556 (LPSTR
) &msg
, 0, NULL
);
557 MessageBoxA(NULL
, msg
, "CreateWindowExA failed", MB_OK
);
565 pObject
->mhWnd
= hWnd
;
566 pObject
->mhWndChild
= hWndChild
;
567 pObject
->maSysData
.hWnd
= hWndChild
;
575 // =======================================================================
577 WinSalObject::WinSalObject()
579 SalData
* pSalData
= GetSalData();
584 maSysData
.nSize
= sizeof( SystemEnvData
);
585 mpStdClipRgnData
= NULL
;
587 // Insert object in objectlist
588 mpNextObject
= pSalData
->mpFirstObject
;
589 pSalData
->mpFirstObject
= this;
592 // -----------------------------------------------------------------------
594 WinSalObject::~WinSalObject()
596 SalData
* pSalData
= GetSalData();
598 // remove frame from framelist
599 if ( this == pSalData
->mpFirstObject
)
601 pSalData
->mpFirstObject
= mpNextObject
;
603 // Wenn letztes SalObject, dann Hook wieder entfernen
604 if ( !pSalData
->mpFirstObject
)
605 UnhookWindowsHookEx( pSalData
->mhSalObjMsgHook
);
609 WinSalObject
* pTempObject
= pSalData
->mpFirstObject
;
610 while ( pTempObject
->mpNextObject
!= this )
611 pTempObject
= pTempObject
->mpNextObject
;
613 pTempObject
->mpNextObject
= mpNextObject
;
616 // Cache-Daten zerstoeren
617 delete mpStdClipRgnData
;
619 HWND hWndParent
= ::GetParent( mhWnd
);
622 DestroyWindow( mhWndChild
);
624 DestroyWindow( mhWnd
);
626 // Palette wieder zuruecksetzen, wenn kein externes Child-Fenster
627 // mehr vorhanden ist, da diese unsere Palette ueberschrieben haben
630 ::GetActiveWindow() == hWndParent
&&
631 !GetWindow( hWndParent
, GW_CHILD
) )
632 ImplSendMessage( hWndParent
, SAL_MSG_FORCEPALETTE
, 0, 0 );
635 // -----------------------------------------------------------------------
637 void WinSalObject::ResetClipRegion()
639 SetWindowRgn( mhWnd
, 0, TRUE
);
642 // -----------------------------------------------------------------------
644 sal_uInt16
WinSalObject::GetClipRegionType()
646 return SAL_OBJECT_CLIP_INCLUDERECTS
;
649 // -----------------------------------------------------------------------
651 void WinSalObject::BeginSetClipRegion( sal_uLong nRectCount
)
653 sal_uLong nRectBufSize
= sizeof(RECT
)*nRectCount
;
654 if ( nRectCount
< SAL_CLIPRECT_COUNT
)
656 if ( !mpStdClipRgnData
)
657 mpStdClipRgnData
= (RGNDATA
*)new BYTE
[sizeof(RGNDATA
)-1+(SAL_CLIPRECT_COUNT
*sizeof(RECT
))];
658 mpClipRgnData
= mpStdClipRgnData
;
661 mpClipRgnData
= (RGNDATA
*)new BYTE
[sizeof(RGNDATA
)-1+nRectBufSize
];
662 mpClipRgnData
->rdh
.dwSize
= sizeof( RGNDATAHEADER
);
663 mpClipRgnData
->rdh
.iType
= RDH_RECTANGLES
;
664 mpClipRgnData
->rdh
.nCount
= nRectCount
;
665 mpClipRgnData
->rdh
.nRgnSize
= nRectBufSize
;
666 SetRectEmpty( &(mpClipRgnData
->rdh
.rcBound
) );
667 mpNextClipRect
= (RECT
*)(&(mpClipRgnData
->Buffer
));
668 mbFirstClipRect
= TRUE
;
671 // -----------------------------------------------------------------------
673 void WinSalObject::UnionClipRegion( long nX
, long nY
, long nWidth
, long nHeight
)
675 RECT
* pRect
= mpNextClipRect
;
676 RECT
* pBoundRect
= &(mpClipRgnData
->rdh
.rcBound
);
677 long nRight
= nX
+ nWidth
;
678 long nBottom
= nY
+ nHeight
;
680 if ( mbFirstClipRect
)
682 pBoundRect
->left
= nX
;
683 pBoundRect
->top
= nY
;
684 pBoundRect
->right
= nRight
;
685 pBoundRect
->bottom
= nBottom
;
686 mbFirstClipRect
= FALSE
;
690 if ( nX
< pBoundRect
->left
)
691 pBoundRect
->left
= (int)nX
;
693 if ( nY
< pBoundRect
->top
)
694 pBoundRect
->top
= (int)nY
;
696 if ( nRight
> pBoundRect
->right
)
697 pBoundRect
->right
= (int)nRight
;
699 if ( nBottom
> pBoundRect
->bottom
)
700 pBoundRect
->bottom
= (int)nBottom
;
703 pRect
->left
= (int)nX
;
704 pRect
->top
= (int)nY
;
705 pRect
->right
= (int)nRight
;
706 pRect
->bottom
= (int)nBottom
;
710 // -----------------------------------------------------------------------
712 void WinSalObject::EndSetClipRegion()
716 // Aus den Region-Daten muessen wir jetzt eine ClipRegion erzeugen
717 if ( mpClipRgnData
->rdh
.nCount
== 1 )
719 RECT
* pRect
= &(mpClipRgnData
->rdh
.rcBound
);
720 hRegion
= CreateRectRgn( pRect
->left
, pRect
->top
,
721 pRect
->right
, pRect
->bottom
);
725 sal_uLong nSize
= mpClipRgnData
->rdh
.nRgnSize
+sizeof(RGNDATAHEADER
);
726 hRegion
= ExtCreateRegion( NULL
, nSize
, mpClipRgnData
);
727 if ( mpClipRgnData
!= mpStdClipRgnData
)
728 delete [] (BYTE
*)mpClipRgnData
;
731 DBG_ASSERT( hRegion
, "SalObject::EndSetClipRegion() - Can't create ClipRegion" );
732 SetWindowRgn( mhWnd
, hRegion
, TRUE
);
735 // -----------------------------------------------------------------------
737 void WinSalObject::SetPosSize( long nX
, long nY
, long nWidth
, long nHeight
)
739 sal_uLong nStyle
= 0;
740 sal_Bool bVisible
= (GetWindowStyle( mhWnd
) & WS_VISIBLE
) != 0;
743 ShowWindow( mhWnd
, SW_HIDE
);
744 nStyle
|= SWP_SHOWWINDOW
;
746 SetWindowPos( mhWnd
, 0,
747 (int)nX
, (int)nY
, (int)nWidth
, (int)nHeight
,
748 SWP_NOZORDER
| SWP_NOACTIVATE
| nStyle
);
751 // -----------------------------------------------------------------------
753 void WinSalObject::Show( sal_Bool bVisible
)
756 ShowWindow( mhWnd
, SW_SHOWNORMAL
);
758 ShowWindow( mhWnd
, SW_HIDE
);
761 // -----------------------------------------------------------------------
763 void WinSalObject::Enable( sal_Bool bEnable
)
765 EnableWindow( mhWnd
, bEnable
);
768 // -----------------------------------------------------------------------
770 void WinSalObject::GrabFocus()
772 if ( mhLastFocusWnd
&&
773 IsWindow( mhLastFocusWnd
) &&
774 ImplIsSysWindowOrChild( mhWndChild
, mhLastFocusWnd
) )
775 ::SetFocus( mhLastFocusWnd
);
777 ::SetFocus( mhWndChild
);
780 const SystemEnvData
* WinSalObject::GetSystemData() const
785 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */