xref: /aoo41x/main/vcl/source/window/window2.cxx (revision 9f62ea84)
1*9f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9f62ea84SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9f62ea84SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9f62ea84SAndrew Rist  * distributed with this work for additional information
6*9f62ea84SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9f62ea84SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9f62ea84SAndrew Rist  * "License"); you may not use this file except in compliance
9*9f62ea84SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9f62ea84SAndrew Rist  *
11*9f62ea84SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9f62ea84SAndrew Rist  *
13*9f62ea84SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9f62ea84SAndrew Rist  * software distributed under the License is distributed on an
15*9f62ea84SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9f62ea84SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9f62ea84SAndrew Rist  * specific language governing permissions and limitations
18*9f62ea84SAndrew Rist  * under the License.
19*9f62ea84SAndrew Rist  *
20*9f62ea84SAndrew Rist  *************************************************************/
21*9f62ea84SAndrew Rist 
22*9f62ea84SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <limits.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <tools/debug.hxx>
30cdf0e10cSrcweir #include <tools/poly.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <vcl/bitmap.hxx>
33cdf0e10cSrcweir #include <vcl/event.hxx>
34cdf0e10cSrcweir #include <vcl/timer.hxx>
35cdf0e10cSrcweir #include <vcl/metric.hxx>
36cdf0e10cSrcweir #include <vcl/virdev.hxx>
37cdf0e10cSrcweir #include <vcl/window.hxx>
38cdf0e10cSrcweir #include <vcl/scrbar.hxx>
39cdf0e10cSrcweir #include <vcl/dockwin.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <window.h>
42cdf0e10cSrcweir #include <outfont.hxx>
43cdf0e10cSrcweir #include <outdev.h>
44cdf0e10cSrcweir #include <svdata.hxx>
45cdf0e10cSrcweir #include <impbmp.hxx>
46cdf0e10cSrcweir #include <salbmp.hxx>
47cdf0e10cSrcweir #include <salgdi.hxx>
48cdf0e10cSrcweir #include <salframe.hxx>
49cdf0e10cSrcweir #include <scrwnd.hxx>
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
52cdf0e10cSrcweir // =======================================================================
53cdf0e10cSrcweir 
54cdf0e10cSrcweir DBG_NAMEEX( Window )
55cdf0e10cSrcweir 
56cdf0e10cSrcweir // =======================================================================
57cdf0e10cSrcweir 
58cdf0e10cSrcweir #define IMPL_MAXSAVEBACKSIZE    (640*480)
59cdf0e10cSrcweir #define IMPL_MAXALLSAVEBACKSIZE (800*600*2)
60cdf0e10cSrcweir 
61cdf0e10cSrcweir // =======================================================================
62cdf0e10cSrcweir 
63cdf0e10cSrcweir struct ImplFocusDelData : public ImplDelData
64cdf0e10cSrcweir {
65cdf0e10cSrcweir     Window*         mpFocusWin;
66cdf0e10cSrcweir };
67cdf0e10cSrcweir 
68cdf0e10cSrcweir // =======================================================================
69cdf0e10cSrcweir 
ImplIsWindowInFront(const Window * pTestWindow) const70cdf0e10cSrcweir sal_Bool Window::ImplIsWindowInFront( const Window* pTestWindow ) const
71cdf0e10cSrcweir {
72cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
73cdf0e10cSrcweir     DBG_CHKOBJ( pTestWindow, Window, ImplDbgCheckWindow );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     // Testen, ob es Fenster untereinander liegen
76cdf0e10cSrcweir     pTestWindow = pTestWindow->ImplGetFirstOverlapWindow();
77cdf0e10cSrcweir     const Window* pTempWindow = pTestWindow;
78cdf0e10cSrcweir     const Window* pThisWindow = ImplGetFirstOverlapWindow();
79cdf0e10cSrcweir     if ( pTempWindow == pThisWindow )
80cdf0e10cSrcweir         return sal_False;
81cdf0e10cSrcweir     do
82cdf0e10cSrcweir     {
83cdf0e10cSrcweir         if ( pTempWindow == pThisWindow )
84cdf0e10cSrcweir             return sal_True;
85cdf0e10cSrcweir         if ( pTempWindow->mpWindowImpl->mbFrame )
86cdf0e10cSrcweir             break;
87cdf0e10cSrcweir         pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
88cdf0e10cSrcweir     }
89cdf0e10cSrcweir     while ( pTempWindow );
90cdf0e10cSrcweir     pTempWindow = pThisWindow;
91cdf0e10cSrcweir     do
92cdf0e10cSrcweir     {
93cdf0e10cSrcweir         if ( pTempWindow == pTestWindow )
94cdf0e10cSrcweir             return sal_False;
95cdf0e10cSrcweir         if ( pTempWindow->mpWindowImpl->mbFrame )
96cdf0e10cSrcweir             break;
97cdf0e10cSrcweir         pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
98cdf0e10cSrcweir     }
99cdf0e10cSrcweir     while ( pTempWindow );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     // Fenster auf gleiche Ebene bringen
102cdf0e10cSrcweir     if ( pThisWindow->mpWindowImpl->mpOverlapWindow != pTestWindow->mpWindowImpl->mpOverlapWindow )
103cdf0e10cSrcweir     {
104cdf0e10cSrcweir         sal_uInt16 nThisLevel = 0;
105cdf0e10cSrcweir         sal_uInt16 nTestLevel = 0;
106cdf0e10cSrcweir         pTempWindow = pThisWindow;
107cdf0e10cSrcweir         do
108cdf0e10cSrcweir         {
109cdf0e10cSrcweir             nThisLevel++;
110cdf0e10cSrcweir             pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
111cdf0e10cSrcweir         }
112cdf0e10cSrcweir         while ( !pTempWindow->mpWindowImpl->mbFrame );
113cdf0e10cSrcweir         pTempWindow = pTestWindow;
114cdf0e10cSrcweir         do
115cdf0e10cSrcweir         {
116cdf0e10cSrcweir             nTestLevel++;
117cdf0e10cSrcweir             pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
118cdf0e10cSrcweir         }
119cdf0e10cSrcweir         while ( !pTempWindow->mpWindowImpl->mbFrame );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir         if ( nThisLevel < nTestLevel )
122cdf0e10cSrcweir         {
123cdf0e10cSrcweir             do
124cdf0e10cSrcweir             {
125cdf0e10cSrcweir                 if ( pTestWindow->mpWindowImpl->mpOverlapWindow == pThisWindow->mpWindowImpl->mpOverlapWindow )
126cdf0e10cSrcweir                     break;
127cdf0e10cSrcweir                 if ( pTestWindow->mpWindowImpl->mbFrame )
128cdf0e10cSrcweir                     break;
129cdf0e10cSrcweir                 pTestWindow = pTestWindow->mpWindowImpl->mpOverlapWindow;
130cdf0e10cSrcweir             }
131cdf0e10cSrcweir             while ( pTestWindow );
132cdf0e10cSrcweir         }
133cdf0e10cSrcweir         else
134cdf0e10cSrcweir         {
135cdf0e10cSrcweir             do
136cdf0e10cSrcweir             {
137cdf0e10cSrcweir                 if ( pThisWindow->mpWindowImpl->mpOverlapWindow == pTempWindow->mpWindowImpl->mpOverlapWindow )
138cdf0e10cSrcweir                     break;
139cdf0e10cSrcweir                 if ( pThisWindow->mpWindowImpl->mbFrame )
140cdf0e10cSrcweir                     break;
141cdf0e10cSrcweir                 pThisWindow = pThisWindow->mpWindowImpl->mpOverlapWindow;
142cdf0e10cSrcweir             }
143cdf0e10cSrcweir             while ( pThisWindow );
144cdf0e10cSrcweir         }
145cdf0e10cSrcweir     }
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     // Wenn TestWindow vor ThisWindow kommt, liegt es vorne
148cdf0e10cSrcweir     pTempWindow = pTestWindow;
149cdf0e10cSrcweir     do
150cdf0e10cSrcweir     {
151cdf0e10cSrcweir         if ( pTempWindow == pThisWindow )
152cdf0e10cSrcweir             return sal_True;
153cdf0e10cSrcweir         pTempWindow = pTempWindow->mpWindowImpl->mpNext;
154cdf0e10cSrcweir     }
155cdf0e10cSrcweir     while ( pTempWindow );
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     return sal_False;
158cdf0e10cSrcweir }
159cdf0e10cSrcweir 
160cdf0e10cSrcweir // =======================================================================
161cdf0e10cSrcweir 
ImplSaveOverlapBackground()162cdf0e10cSrcweir void Window::ImplSaveOverlapBackground()
163cdf0e10cSrcweir {
164cdf0e10cSrcweir     DBG_ASSERT( !mpWindowImpl->mpOverlapData->mpSaveBackDev, "Window::ImplSaveOverlapBackground() - Background already saved" );
165cdf0e10cSrcweir 
166cdf0e10cSrcweir     if ( !mpWindowImpl->mbFrame )
167cdf0e10cSrcweir     {
168cdf0e10cSrcweir         sal_uLong nSaveBackSize = mnOutWidth*mnOutHeight;
169cdf0e10cSrcweir         if ( nSaveBackSize <= IMPL_MAXSAVEBACKSIZE )
170cdf0e10cSrcweir         {
171cdf0e10cSrcweir             if ( nSaveBackSize+mpWindowImpl->mpFrameData->mnAllSaveBackSize <= IMPL_MAXALLSAVEBACKSIZE )
172cdf0e10cSrcweir             {
173cdf0e10cSrcweir                 Size aOutSize( mnOutWidth, mnOutHeight );
174cdf0e10cSrcweir                 mpWindowImpl->mpOverlapData->mpSaveBackDev = new VirtualDevice( *mpWindowImpl->mpFrameWindow );
175cdf0e10cSrcweir                 if ( mpWindowImpl->mpOverlapData->mpSaveBackDev->SetOutputSizePixel( aOutSize ) )
176cdf0e10cSrcweir                 {
177cdf0e10cSrcweir                     mpWindowImpl->mpFrameWindow->ImplUpdateAll();
178cdf0e10cSrcweir 
179cdf0e10cSrcweir                     if ( mpWindowImpl->mbInitWinClipRegion )
180cdf0e10cSrcweir                         ImplInitWinClipRegion();
181cdf0e10cSrcweir 
182cdf0e10cSrcweir                     mpWindowImpl->mpOverlapData->mnSaveBackSize = nSaveBackSize;
183cdf0e10cSrcweir                     mpWindowImpl->mpFrameData->mnAllSaveBackSize += nSaveBackSize;
184cdf0e10cSrcweir                     Point aDevPt;
185cdf0e10cSrcweir                     mpWindowImpl->mpFrameWindow->ImplGetFrameDev( Point( mnOutOffX, mnOutOffY ),
186cdf0e10cSrcweir                                                     aDevPt, aOutSize,
187cdf0e10cSrcweir                                                     *(mpWindowImpl->mpOverlapData->mpSaveBackDev) );
188cdf0e10cSrcweir                     mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpFrameData->mpFirstBackWin;
189cdf0e10cSrcweir                     mpWindowImpl->mpFrameData->mpFirstBackWin = this;
190cdf0e10cSrcweir                 }
191cdf0e10cSrcweir                 else
192cdf0e10cSrcweir                 {
193cdf0e10cSrcweir                     delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
194cdf0e10cSrcweir                     mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
195cdf0e10cSrcweir                 }
196cdf0e10cSrcweir             }
197cdf0e10cSrcweir         }
198cdf0e10cSrcweir     }
199cdf0e10cSrcweir }
200cdf0e10cSrcweir 
201cdf0e10cSrcweir // -----------------------------------------------------------------------
202cdf0e10cSrcweir 
ImplRestoreOverlapBackground(Region & rInvRegion)203cdf0e10cSrcweir sal_Bool Window::ImplRestoreOverlapBackground( Region& rInvRegion )
204cdf0e10cSrcweir {
205cdf0e10cSrcweir     if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
206cdf0e10cSrcweir     {
207cdf0e10cSrcweir         if ( mpWindowImpl->mbInitWinClipRegion )
208cdf0e10cSrcweir             ImplInitWinClipRegion();
209cdf0e10cSrcweir 
210cdf0e10cSrcweir         if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
211cdf0e10cSrcweir         {
212cdf0e10cSrcweir             Point   aDevPt;
213cdf0e10cSrcweir             Point   aDestPt( mnOutOffX, mnOutOffY );
214cdf0e10cSrcweir             Size    aDevSize = mpWindowImpl->mpOverlapData->mpSaveBackDev->GetOutputSizePixel();
215cdf0e10cSrcweir             if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
216cdf0e10cSrcweir             {
217cdf0e10cSrcweir                 mpWindowImpl->mpOverlapData->mpSaveBackRgn->Intersect( mpWindowImpl->maWinClipRegion );
218cdf0e10cSrcweir                 rInvRegion = mpWindowImpl->maWinClipRegion;
219cdf0e10cSrcweir                 rInvRegion.Exclude( *mpWindowImpl->mpOverlapData->mpSaveBackRgn );
220cdf0e10cSrcweir                 mpWindowImpl->mpFrameWindow->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
221cdf0e10cSrcweir                                                  *(mpWindowImpl->mpOverlapData->mpSaveBackDev),
222cdf0e10cSrcweir                                                  *mpWindowImpl->mpOverlapData->mpSaveBackRgn );
223cdf0e10cSrcweir             }
224cdf0e10cSrcweir             else
225cdf0e10cSrcweir             {
226cdf0e10cSrcweir                 mpWindowImpl->mpFrameWindow->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
227cdf0e10cSrcweir                                                  *(mpWindowImpl->mpOverlapData->mpSaveBackDev),
228cdf0e10cSrcweir                                                  mpWindowImpl->maWinClipRegion );
229cdf0e10cSrcweir             }
230cdf0e10cSrcweir             ImplDeleteOverlapBackground();
231cdf0e10cSrcweir         }
232cdf0e10cSrcweir 
233cdf0e10cSrcweir         return sal_True;
234cdf0e10cSrcweir     }
235cdf0e10cSrcweir 
236cdf0e10cSrcweir     return sal_False;
237cdf0e10cSrcweir }
238cdf0e10cSrcweir 
239cdf0e10cSrcweir // -----------------------------------------------------------------------
240cdf0e10cSrcweir 
ImplDeleteOverlapBackground()241cdf0e10cSrcweir void Window::ImplDeleteOverlapBackground()
242cdf0e10cSrcweir {
243cdf0e10cSrcweir     if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
244cdf0e10cSrcweir     {
245cdf0e10cSrcweir         mpWindowImpl->mpFrameData->mnAllSaveBackSize -= mpWindowImpl->mpOverlapData->mnSaveBackSize;
246cdf0e10cSrcweir         delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
247cdf0e10cSrcweir         mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
248cdf0e10cSrcweir         if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
249cdf0e10cSrcweir         {
250cdf0e10cSrcweir             delete mpWindowImpl->mpOverlapData->mpSaveBackRgn;
251cdf0e10cSrcweir             mpWindowImpl->mpOverlapData->mpSaveBackRgn = NULL;
252cdf0e10cSrcweir         }
253cdf0e10cSrcweir 
254cdf0e10cSrcweir         // Fenster aus der Liste entfernen
255cdf0e10cSrcweir         if ( mpWindowImpl->mpFrameData->mpFirstBackWin == this )
256cdf0e10cSrcweir             mpWindowImpl->mpFrameData->mpFirstBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
257cdf0e10cSrcweir         else
258cdf0e10cSrcweir         {
259cdf0e10cSrcweir             Window* pTemp = mpWindowImpl->mpFrameData->mpFirstBackWin;
260cdf0e10cSrcweir             while ( pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin != this )
261cdf0e10cSrcweir                 pTemp = pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin;
262cdf0e10cSrcweir             pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
263cdf0e10cSrcweir         }
264cdf0e10cSrcweir         mpWindowImpl->mpOverlapData->mpNextBackWin = NULL;
265cdf0e10cSrcweir     }
266cdf0e10cSrcweir }
267cdf0e10cSrcweir 
268cdf0e10cSrcweir // -----------------------------------------------------------------------
269cdf0e10cSrcweir 
ImplInvalidateAllOverlapBackgrounds()270cdf0e10cSrcweir void Window::ImplInvalidateAllOverlapBackgrounds()
271cdf0e10cSrcweir {
272cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
273cdf0e10cSrcweir 
274cdf0e10cSrcweir     Window* pWindow = mpWindowImpl->mpFrameData->mpFirstBackWin;
275cdf0e10cSrcweir     while ( pWindow )
276cdf0e10cSrcweir     {
277cdf0e10cSrcweir         // Naechstes Fenster schon hier merken, da dieses Fenster in
278cdf0e10cSrcweir         // der if-Abfrage aus der Liste entfernt werden kann
279cdf0e10cSrcweir         Window* pNext = pWindow->mpWindowImpl->mpOverlapData->mpNextBackWin;
280cdf0e10cSrcweir 
281cdf0e10cSrcweir         if ( ImplIsWindowInFront( pWindow ) )
282cdf0e10cSrcweir         {
283cdf0e10cSrcweir             Rectangle aRect1( Point( mnOutOffX, mnOutOffY ),
284cdf0e10cSrcweir                               Size( mnOutWidth, mnOutHeight ) );
285cdf0e10cSrcweir             Rectangle aRect2( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
286cdf0e10cSrcweir                               Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
287cdf0e10cSrcweir             aRect1.Intersection( aRect2 );
288cdf0e10cSrcweir             if ( !aRect1.IsEmpty() )
289cdf0e10cSrcweir             {
290cdf0e10cSrcweir                 if ( !pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn )
291cdf0e10cSrcweir                     pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn = new Region( aRect2 );
292cdf0e10cSrcweir                 pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn->Exclude( aRect1 );
293cdf0e10cSrcweir                 if ( pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn->IsEmpty() )
294cdf0e10cSrcweir                     pWindow->ImplDeleteOverlapBackground();
295cdf0e10cSrcweir             }
296cdf0e10cSrcweir 
297cdf0e10cSrcweir         }
298cdf0e10cSrcweir 
299cdf0e10cSrcweir         pWindow = pNext;
300cdf0e10cSrcweir     }
301cdf0e10cSrcweir }
302cdf0e10cSrcweir 
303cdf0e10cSrcweir // =======================================================================
304cdf0e10cSrcweir 
SnapShot(sal_Bool bBorder) const305cdf0e10cSrcweir Bitmap Window::SnapShot( sal_Bool bBorder ) const
306cdf0e10cSrcweir {
307cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
308cdf0e10cSrcweir 
309cdf0e10cSrcweir     Bitmap aBmp;
310cdf0e10cSrcweir 
311cdf0e10cSrcweir     if ( IsReallyVisible() )
312cdf0e10cSrcweir     {
313cdf0e10cSrcweir         if ( bBorder && mpWindowImpl->mpBorderWindow )
314cdf0e10cSrcweir             aBmp = mpWindowImpl->mpBorderWindow->SnapShot();
315cdf0e10cSrcweir         else
316cdf0e10cSrcweir         {
317cdf0e10cSrcweir             ((Window*)this)->Update();
318cdf0e10cSrcweir 
319cdf0e10cSrcweir             if ( bBorder && mpWindowImpl->mbFrame )
320cdf0e10cSrcweir             {
321cdf0e10cSrcweir                 SalBitmap* pSalBmp = mpWindowImpl->mpFrame->SnapShot();
322cdf0e10cSrcweir 
323cdf0e10cSrcweir                 if ( pSalBmp )
324cdf0e10cSrcweir                 {
325cdf0e10cSrcweir                     ImpBitmap* pImpBmp = new ImpBitmap;
326cdf0e10cSrcweir                     pImpBmp->ImplSetSalBitmap( pSalBmp );
327cdf0e10cSrcweir                     aBmp.ImplSetImpBitmap( pImpBmp );
328cdf0e10cSrcweir                     return aBmp;
329cdf0e10cSrcweir                 }
330cdf0e10cSrcweir             }
331cdf0e10cSrcweir 
332cdf0e10cSrcweir             mpWindowImpl->mpFrameWindow->ImplGetFrameBitmap( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ), aBmp );
333cdf0e10cSrcweir         }
334cdf0e10cSrcweir     }
335cdf0e10cSrcweir 
336cdf0e10cSrcweir     return aBmp;
337cdf0e10cSrcweir }
338cdf0e10cSrcweir 
339cdf0e10cSrcweir // -----------------------------------------------------------------------
340cdf0e10cSrcweir 
SnapShot() const341cdf0e10cSrcweir Bitmap Window::SnapShot() const
342cdf0e10cSrcweir {
343cdf0e10cSrcweir     // Should be merged in the next top level build !!!
344cdf0e10cSrcweir     return SnapShot( sal_True );
345cdf0e10cSrcweir }
346cdf0e10cSrcweir 
347cdf0e10cSrcweir // -----------------------------------------------------------------------
348cdf0e10cSrcweir 
ShowFocus(const Rectangle & rRect)349cdf0e10cSrcweir void Window::ShowFocus( const Rectangle& rRect )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
352cdf0e10cSrcweir 
353cdf0e10cSrcweir     if( mpWindowImpl->mbInShowFocus )
354cdf0e10cSrcweir         return;
355cdf0e10cSrcweir     mpWindowImpl->mbInShowFocus = sal_True;
356cdf0e10cSrcweir 
357cdf0e10cSrcweir     ImplWinData* pWinData = ImplGetWinData();
358cdf0e10cSrcweir 
359cdf0e10cSrcweir     // native themeing suggest not to use focus rects
360cdf0e10cSrcweir     if( ! ( mpWindowImpl->mbUseNativeFocus &&
361cdf0e10cSrcweir             IsNativeWidgetEnabled() ) )
362cdf0e10cSrcweir     {
363cdf0e10cSrcweir         if ( !mpWindowImpl->mbInPaint )
364cdf0e10cSrcweir         {
365cdf0e10cSrcweir             if ( mpWindowImpl->mbFocusVisible )
366cdf0e10cSrcweir             {
367cdf0e10cSrcweir                 if ( *(pWinData->mpFocusRect) == rRect )
368cdf0e10cSrcweir                 {
369cdf0e10cSrcweir                     mpWindowImpl->mbInShowFocus = sal_False;
370cdf0e10cSrcweir                     return;
371cdf0e10cSrcweir                 }
372cdf0e10cSrcweir 
373cdf0e10cSrcweir                 ImplInvertFocus( *(pWinData->mpFocusRect) );
374cdf0e10cSrcweir             }
375cdf0e10cSrcweir 
376cdf0e10cSrcweir             ImplInvertFocus( rRect );
377cdf0e10cSrcweir         }
378cdf0e10cSrcweir         if ( !pWinData->mpFocusRect )
379cdf0e10cSrcweir             pWinData->mpFocusRect = new Rectangle( rRect );
380cdf0e10cSrcweir         else
381cdf0e10cSrcweir             *(pWinData->mpFocusRect) = rRect;
382cdf0e10cSrcweir         mpWindowImpl->mbFocusVisible = sal_True;
383cdf0e10cSrcweir     }
384cdf0e10cSrcweir     else
385cdf0e10cSrcweir     {
386cdf0e10cSrcweir         if( ! mpWindowImpl->mbNativeFocusVisible )
387cdf0e10cSrcweir         {
388cdf0e10cSrcweir             mpWindowImpl->mbNativeFocusVisible = sal_True;
389cdf0e10cSrcweir             if ( !mpWindowImpl->mbInPaint )
390cdf0e10cSrcweir                 Invalidate();
391cdf0e10cSrcweir         }
392cdf0e10cSrcweir     }
393cdf0e10cSrcweir     mpWindowImpl->mbInShowFocus = sal_False;
394cdf0e10cSrcweir }
395cdf0e10cSrcweir 
396cdf0e10cSrcweir // -----------------------------------------------------------------------
397cdf0e10cSrcweir 
HideFocus()398cdf0e10cSrcweir void Window::HideFocus()
399cdf0e10cSrcweir {
400cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
401cdf0e10cSrcweir 
402cdf0e10cSrcweir     if( mpWindowImpl->mbInHideFocus )
403cdf0e10cSrcweir         return;
404cdf0e10cSrcweir     mpWindowImpl->mbInHideFocus = sal_True;
405cdf0e10cSrcweir 
406cdf0e10cSrcweir     // native themeing can suggest not to use focus rects
407cdf0e10cSrcweir     if( ! ( mpWindowImpl->mbUseNativeFocus &&
408cdf0e10cSrcweir             IsNativeWidgetEnabled() ) )
409cdf0e10cSrcweir     {
410cdf0e10cSrcweir         if ( !mpWindowImpl->mbFocusVisible )
411cdf0e10cSrcweir         {
412cdf0e10cSrcweir             mpWindowImpl->mbInHideFocus = sal_False;
413cdf0e10cSrcweir             return;
414cdf0e10cSrcweir         }
415cdf0e10cSrcweir 
416cdf0e10cSrcweir         if ( !mpWindowImpl->mbInPaint )
417cdf0e10cSrcweir             ImplInvertFocus( *(ImplGetWinData()->mpFocusRect) );
418cdf0e10cSrcweir         mpWindowImpl->mbFocusVisible = sal_False;
419cdf0e10cSrcweir     }
420cdf0e10cSrcweir     else
421cdf0e10cSrcweir     {
422cdf0e10cSrcweir         if( mpWindowImpl->mbNativeFocusVisible )
423cdf0e10cSrcweir         {
424cdf0e10cSrcweir             mpWindowImpl->mbNativeFocusVisible = sal_False;
425cdf0e10cSrcweir             if ( !mpWindowImpl->mbInPaint )
426cdf0e10cSrcweir                 Invalidate();
427cdf0e10cSrcweir         }
428cdf0e10cSrcweir     }
429cdf0e10cSrcweir     mpWindowImpl->mbInHideFocus = sal_False;
430cdf0e10cSrcweir }
431cdf0e10cSrcweir 
432cdf0e10cSrcweir // -----------------------------------------------------------------------
433cdf0e10cSrcweir 
Invert(const Rectangle & rRect,sal_uInt16 nFlags)434cdf0e10cSrcweir void Window::Invert( const Rectangle& rRect, sal_uInt16 nFlags )
435cdf0e10cSrcweir {
436cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
437cdf0e10cSrcweir 
438cdf0e10cSrcweir     if ( !IsDeviceOutputNecessary() )
439cdf0e10cSrcweir         return;
440cdf0e10cSrcweir 
441cdf0e10cSrcweir     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
442cdf0e10cSrcweir 
443cdf0e10cSrcweir     if ( aRect.IsEmpty() )
444cdf0e10cSrcweir         return;
445cdf0e10cSrcweir     aRect.Justify();
446cdf0e10cSrcweir 
447cdf0e10cSrcweir     // we need a graphics
448cdf0e10cSrcweir     if ( !mpGraphics )
449cdf0e10cSrcweir     {
450cdf0e10cSrcweir         if ( !ImplGetGraphics() )
451cdf0e10cSrcweir             return;
452cdf0e10cSrcweir     }
453cdf0e10cSrcweir 
454cdf0e10cSrcweir     if ( mbInitClipRegion )
455cdf0e10cSrcweir         ImplInitClipRegion();
456cdf0e10cSrcweir 
457cdf0e10cSrcweir     if ( mbOutputClipped )
458cdf0e10cSrcweir         return;
459cdf0e10cSrcweir 
460cdf0e10cSrcweir     SalInvert nSalFlags = 0;
461cdf0e10cSrcweir     if ( nFlags & INVERT_HIGHLIGHT )
462cdf0e10cSrcweir         nSalFlags |= SAL_INVERT_HIGHLIGHT;
463cdf0e10cSrcweir     if ( nFlags & INVERT_50 )
464cdf0e10cSrcweir         nSalFlags |= SAL_INVERT_50;
465cdf0e10cSrcweir     mpGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), nSalFlags, this );
466cdf0e10cSrcweir }
467cdf0e10cSrcweir 
468cdf0e10cSrcweir // -----------------------------------------------------------------------
469cdf0e10cSrcweir 
Invert(const Polygon & rPoly,sal_uInt16 nFlags)470cdf0e10cSrcweir void Window::Invert( const Polygon& rPoly, sal_uInt16 nFlags )
471cdf0e10cSrcweir {
472cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
473cdf0e10cSrcweir 
474cdf0e10cSrcweir     if ( !IsDeviceOutputNecessary() )
475cdf0e10cSrcweir         return;
476cdf0e10cSrcweir 
477cdf0e10cSrcweir     sal_uInt16 nPoints = rPoly.GetSize();
478cdf0e10cSrcweir 
479cdf0e10cSrcweir     if ( nPoints < 2 )
480cdf0e10cSrcweir         return;
481cdf0e10cSrcweir 
482cdf0e10cSrcweir     Polygon aPoly( ImplLogicToDevicePixel( rPoly ) );
483cdf0e10cSrcweir 
484cdf0e10cSrcweir     // we need a graphics
485cdf0e10cSrcweir     if ( !mpGraphics )
486cdf0e10cSrcweir     {
487cdf0e10cSrcweir         if ( !ImplGetGraphics() )
488cdf0e10cSrcweir             return;
489cdf0e10cSrcweir     }
490cdf0e10cSrcweir 
491cdf0e10cSrcweir     if ( mbInitClipRegion )
492cdf0e10cSrcweir         ImplInitClipRegion();
493cdf0e10cSrcweir 
494cdf0e10cSrcweir     if ( mbOutputClipped )
495cdf0e10cSrcweir         return;
496cdf0e10cSrcweir 
497cdf0e10cSrcweir     SalInvert nSalFlags = 0;
498cdf0e10cSrcweir     if ( nFlags & INVERT_HIGHLIGHT )
499cdf0e10cSrcweir         nSalFlags |= SAL_INVERT_HIGHLIGHT;
500cdf0e10cSrcweir     if ( nFlags & INVERT_50 )
501cdf0e10cSrcweir         nSalFlags |= SAL_INVERT_50;
502cdf0e10cSrcweir     const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry();
503cdf0e10cSrcweir     mpGraphics->Invert( nPoints, pPtAry, nSalFlags, this );
504cdf0e10cSrcweir }
505cdf0e10cSrcweir 
506cdf0e10cSrcweir // -----------------------------------------------------------------------
507cdf0e10cSrcweir 
ShowTracking(const Rectangle & rRect,sal_uInt16 nFlags)508cdf0e10cSrcweir void Window::ShowTracking( const Rectangle& rRect, sal_uInt16 nFlags )
509cdf0e10cSrcweir {
510cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
511cdf0e10cSrcweir 
512cdf0e10cSrcweir     ImplWinData* pWinData = ImplGetWinData();
513cdf0e10cSrcweir 
514cdf0e10cSrcweir     if ( !mpWindowImpl->mbInPaint || !(nFlags & SHOWTRACK_WINDOW) )
515cdf0e10cSrcweir     {
516cdf0e10cSrcweir         if ( mpWindowImpl->mbTrackVisible )
517cdf0e10cSrcweir         {
518cdf0e10cSrcweir             if ( (*(pWinData->mpTrackRect)  == rRect) &&
519cdf0e10cSrcweir                  (pWinData->mnTrackFlags    == nFlags) )
520cdf0e10cSrcweir                 return;
521cdf0e10cSrcweir 
522cdf0e10cSrcweir             InvertTracking( *(pWinData->mpTrackRect), pWinData->mnTrackFlags );
523cdf0e10cSrcweir         }
524cdf0e10cSrcweir 
525cdf0e10cSrcweir         InvertTracking( rRect, nFlags );
526cdf0e10cSrcweir     }
527cdf0e10cSrcweir 
528cdf0e10cSrcweir     if ( !pWinData->mpTrackRect )
529cdf0e10cSrcweir         pWinData->mpTrackRect = new Rectangle( rRect );
530cdf0e10cSrcweir     else
531cdf0e10cSrcweir         *(pWinData->mpTrackRect) = rRect;
532cdf0e10cSrcweir     pWinData->mnTrackFlags      = nFlags;
533cdf0e10cSrcweir     mpWindowImpl->mbTrackVisible              = sal_True;
534cdf0e10cSrcweir }
535cdf0e10cSrcweir 
536cdf0e10cSrcweir // -----------------------------------------------------------------------
537cdf0e10cSrcweir 
HideTracking()538cdf0e10cSrcweir void Window::HideTracking()
539cdf0e10cSrcweir {
540cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
541cdf0e10cSrcweir 
542cdf0e10cSrcweir     if ( mpWindowImpl->mbTrackVisible )
543cdf0e10cSrcweir     {
544cdf0e10cSrcweir         ImplWinData* pWinData = ImplGetWinData();
545cdf0e10cSrcweir         if ( !mpWindowImpl->mbInPaint || !(pWinData->mnTrackFlags & SHOWTRACK_WINDOW) )
546cdf0e10cSrcweir             InvertTracking( *(pWinData->mpTrackRect), pWinData->mnTrackFlags );
547cdf0e10cSrcweir         mpWindowImpl->mbTrackVisible = sal_False;
548cdf0e10cSrcweir     }
549cdf0e10cSrcweir }
550cdf0e10cSrcweir 
551cdf0e10cSrcweir // -----------------------------------------------------------------------
552cdf0e10cSrcweir 
InvertTracking(const Rectangle & rRect,sal_uInt16 nFlags)553cdf0e10cSrcweir void Window::InvertTracking( const Rectangle& rRect, sal_uInt16 nFlags )
554cdf0e10cSrcweir {
555cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
556cdf0e10cSrcweir 
557cdf0e10cSrcweir     Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
558cdf0e10cSrcweir 
559cdf0e10cSrcweir     if ( aRect.IsEmpty() )
560cdf0e10cSrcweir         return;
561cdf0e10cSrcweir     aRect.Justify();
562cdf0e10cSrcweir 
563cdf0e10cSrcweir     SalGraphics* pGraphics;
564cdf0e10cSrcweir 
565cdf0e10cSrcweir     if ( nFlags & SHOWTRACK_WINDOW )
566cdf0e10cSrcweir     {
567cdf0e10cSrcweir         if ( !IsDeviceOutputNecessary() )
568cdf0e10cSrcweir             return;
569cdf0e10cSrcweir 
570cdf0e10cSrcweir         // we need a graphics
571cdf0e10cSrcweir         if ( !mpGraphics )
572cdf0e10cSrcweir         {
573cdf0e10cSrcweir             if ( !ImplGetGraphics() )
574cdf0e10cSrcweir                 return;
575cdf0e10cSrcweir         }
576cdf0e10cSrcweir 
577cdf0e10cSrcweir         if ( mbInitClipRegion )
578cdf0e10cSrcweir             ImplInitClipRegion();
579cdf0e10cSrcweir 
580cdf0e10cSrcweir         if ( mbOutputClipped )
581cdf0e10cSrcweir             return;
582cdf0e10cSrcweir 
583cdf0e10cSrcweir         pGraphics = mpGraphics;
584cdf0e10cSrcweir     }
585cdf0e10cSrcweir     else
586cdf0e10cSrcweir     {
587cdf0e10cSrcweir         pGraphics = ImplGetFrameGraphics();
588cdf0e10cSrcweir 
589cdf0e10cSrcweir         if ( nFlags & SHOWTRACK_CLIP )
590cdf0e10cSrcweir         {
591cdf0e10cSrcweir             Point aPoint( mnOutOffX, mnOutOffY );
592cdf0e10cSrcweir             Region aRegion( Rectangle( aPoint,
593cdf0e10cSrcweir                                        Size( mnOutWidth, mnOutHeight ) ) );
594cdf0e10cSrcweir             ImplClipBoundaries( aRegion, sal_False, sal_False );
595cdf0e10cSrcweir             ImplSelectClipRegion( aRegion, pGraphics );
596cdf0e10cSrcweir         }
597cdf0e10cSrcweir     }
598cdf0e10cSrcweir 
599cdf0e10cSrcweir     sal_uInt16 nStyle = nFlags & SHOWTRACK_STYLE;
600cdf0e10cSrcweir     if ( nStyle == SHOWTRACK_OBJECT )
601cdf0e10cSrcweir         pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_INVERT_TRACKFRAME, this );
602cdf0e10cSrcweir     else if ( nStyle == SHOWTRACK_SPLIT )
603cdf0e10cSrcweir         pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_INVERT_50, this );
604cdf0e10cSrcweir     else
605cdf0e10cSrcweir     {
606cdf0e10cSrcweir         long nBorder = 1;
607cdf0e10cSrcweir         if ( nStyle == SHOWTRACK_BIG )
608cdf0e10cSrcweir             nBorder = 5;
609cdf0e10cSrcweir         pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), nBorder, SAL_INVERT_50, this );
610cdf0e10cSrcweir         pGraphics->Invert( aRect.Left(), aRect.Bottom()-nBorder+1, aRect.GetWidth(), nBorder, SAL_INVERT_50, this );
611cdf0e10cSrcweir         pGraphics->Invert( aRect.Left(), aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SAL_INVERT_50, this );
612cdf0e10cSrcweir         pGraphics->Invert( aRect.Right()-nBorder+1, aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SAL_INVERT_50, this );
613cdf0e10cSrcweir     }
614cdf0e10cSrcweir }
615cdf0e10cSrcweir 
616cdf0e10cSrcweir // -----------------------------------------------------------------------
617cdf0e10cSrcweir 
InvertTracking(const Polygon & rPoly,sal_uInt16 nFlags)618cdf0e10cSrcweir void Window::InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags )
619cdf0e10cSrcweir {
620cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
621cdf0e10cSrcweir 
622cdf0e10cSrcweir     sal_uInt16 nPoints = rPoly.GetSize();
623cdf0e10cSrcweir 
624cdf0e10cSrcweir     if ( nPoints < 2 )
625cdf0e10cSrcweir         return;
626cdf0e10cSrcweir 
627cdf0e10cSrcweir     Polygon aPoly( ImplLogicToDevicePixel( rPoly ) );
628cdf0e10cSrcweir 
629cdf0e10cSrcweir     SalGraphics* pGraphics;
630cdf0e10cSrcweir 
631cdf0e10cSrcweir     if ( nFlags & SHOWTRACK_WINDOW )
632cdf0e10cSrcweir     {
633cdf0e10cSrcweir         if ( !IsDeviceOutputNecessary() )
634cdf0e10cSrcweir             return;
635cdf0e10cSrcweir 
636cdf0e10cSrcweir         // we need a graphics
637cdf0e10cSrcweir         if ( !mpGraphics )
638cdf0e10cSrcweir         {
639cdf0e10cSrcweir             if ( !ImplGetGraphics() )
640cdf0e10cSrcweir                 return;
641cdf0e10cSrcweir         }
642cdf0e10cSrcweir 
643cdf0e10cSrcweir         if ( mbInitClipRegion )
644cdf0e10cSrcweir             ImplInitClipRegion();
645cdf0e10cSrcweir 
646cdf0e10cSrcweir         if ( mbOutputClipped )
647cdf0e10cSrcweir             return;
648cdf0e10cSrcweir 
649cdf0e10cSrcweir         pGraphics = mpGraphics;
650cdf0e10cSrcweir     }
651cdf0e10cSrcweir     else
652cdf0e10cSrcweir     {
653cdf0e10cSrcweir         pGraphics = ImplGetFrameGraphics();
654cdf0e10cSrcweir 
655cdf0e10cSrcweir         if ( nFlags & SHOWTRACK_CLIP )
656cdf0e10cSrcweir         {
657cdf0e10cSrcweir             Point aPoint( mnOutOffX, mnOutOffY );
658cdf0e10cSrcweir             Region aRegion( Rectangle( aPoint,
659cdf0e10cSrcweir                                        Size( mnOutWidth, mnOutHeight ) ) );
660cdf0e10cSrcweir             ImplClipBoundaries( aRegion, sal_False, sal_False );
661cdf0e10cSrcweir             ImplSelectClipRegion( aRegion, pGraphics );
662cdf0e10cSrcweir         }
663cdf0e10cSrcweir     }
664cdf0e10cSrcweir 
665cdf0e10cSrcweir     const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry();
666cdf0e10cSrcweir     pGraphics->Invert( nPoints, pPtAry, SAL_INVERT_TRACKFRAME, this );
667cdf0e10cSrcweir }
668cdf0e10cSrcweir 
669cdf0e10cSrcweir // -----------------------------------------------------------------------
670cdf0e10cSrcweir 
IMPL_LINK(Window,ImplTrackTimerHdl,Timer *,pTimer)671cdf0e10cSrcweir IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer )
672cdf0e10cSrcweir {
673cdf0e10cSrcweir     ImplSVData* pSVData = ImplGetSVData();
674cdf0e10cSrcweir 
675cdf0e10cSrcweir     // Bei Button-Repeat muessen wir den Timeout umsetzen
676cdf0e10cSrcweir     if ( pSVData->maWinData.mnTrackFlags & STARTTRACK_BUTTONREPEAT )
677cdf0e10cSrcweir         pTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonRepeat() );
678cdf0e10cSrcweir 
679cdf0e10cSrcweir     // Tracking-Event erzeugen
680cdf0e10cSrcweir     Point           aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
681cdf0e10cSrcweir     if( ImplIsAntiparallel() )
682cdf0e10cSrcweir     {
683cdf0e10cSrcweir         // - RTL - re-mirror frame pos at pChild
684cdf0e10cSrcweir         ImplReMirror( aMousePos );
685cdf0e10cSrcweir     }
686cdf0e10cSrcweir     MouseEvent      aMEvt( ImplFrameToOutput( aMousePos ),
687cdf0e10cSrcweir                            mpWindowImpl->mpFrameData->mnClickCount, 0,
688cdf0e10cSrcweir                            mpWindowImpl->mpFrameData->mnMouseCode, mpWindowImpl->mpFrameData->mnMouseCode );
689cdf0e10cSrcweir     TrackingEvent   aTEvt( aMEvt, TRACKING_REPEAT );
690cdf0e10cSrcweir     Tracking( aTEvt );
691cdf0e10cSrcweir 
692cdf0e10cSrcweir     return 0;
693cdf0e10cSrcweir }
694cdf0e10cSrcweir 
695cdf0e10cSrcweir // -----------------------------------------------------------------------
696cdf0e10cSrcweir 
StartTracking(sal_uInt16 nFlags)697cdf0e10cSrcweir void Window::StartTracking( sal_uInt16 nFlags )
698cdf0e10cSrcweir {
699cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
700cdf0e10cSrcweir 
701cdf0e10cSrcweir     ImplSVData* pSVData = ImplGetSVData();
702cdf0e10cSrcweir 
703cdf0e10cSrcweir     if ( pSVData->maWinData.mpTrackWin != this )
704cdf0e10cSrcweir     {
705cdf0e10cSrcweir         if ( pSVData->maWinData.mpTrackWin )
706cdf0e10cSrcweir             pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
707cdf0e10cSrcweir     }
708cdf0e10cSrcweir 
709cdf0e10cSrcweir     if ( nFlags & (STARTTRACK_SCROLLREPEAT | STARTTRACK_BUTTONREPEAT) )
710cdf0e10cSrcweir     {
711cdf0e10cSrcweir         pSVData->maWinData.mpTrackTimer = new AutoTimer;
712cdf0e10cSrcweir 
713cdf0e10cSrcweir         if ( nFlags & STARTTRACK_SCROLLREPEAT )
714cdf0e10cSrcweir             pSVData->maWinData.mpTrackTimer->SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() );
715cdf0e10cSrcweir         else
716cdf0e10cSrcweir             pSVData->maWinData.mpTrackTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() );
717cdf0e10cSrcweir         pSVData->maWinData.mpTrackTimer->SetTimeoutHdl( LINK( this, Window, ImplTrackTimerHdl ) );
718cdf0e10cSrcweir         pSVData->maWinData.mpTrackTimer->Start();
719cdf0e10cSrcweir     }
720cdf0e10cSrcweir 
721cdf0e10cSrcweir     pSVData->maWinData.mpTrackWin   = this;
722cdf0e10cSrcweir     pSVData->maWinData.mnTrackFlags = nFlags;
723cdf0e10cSrcweir     CaptureMouse();
724cdf0e10cSrcweir }
725cdf0e10cSrcweir 
726cdf0e10cSrcweir // -----------------------------------------------------------------------
727cdf0e10cSrcweir 
EndTracking(sal_uInt16 nFlags)728cdf0e10cSrcweir void Window::EndTracking( sal_uInt16 nFlags )
729cdf0e10cSrcweir {
730cdf0e10cSrcweir     ImplSVData* pSVData = ImplGetSVData();
731cdf0e10cSrcweir 
732cdf0e10cSrcweir     if ( pSVData->maWinData.mpTrackWin == this )
733cdf0e10cSrcweir     {
734cdf0e10cSrcweir         // Hier wegen DbgChkThis geklammert, da Window im Handler zerstoert
735cdf0e10cSrcweir         // werden kann
736cdf0e10cSrcweir         {
737cdf0e10cSrcweir         DBG_CHKTHIS( Window, ImplDbgCheckWindow );
738cdf0e10cSrcweir 
739cdf0e10cSrcweir         if ( pSVData->maWinData.mpTrackTimer )
740cdf0e10cSrcweir         {
741cdf0e10cSrcweir             delete pSVData->maWinData.mpTrackTimer;
742cdf0e10cSrcweir             pSVData->maWinData.mpTrackTimer = NULL;
743cdf0e10cSrcweir         }
744cdf0e10cSrcweir 
745cdf0e10cSrcweir         pSVData->maWinData.mpTrackWin    = NULL;
746cdf0e10cSrcweir         pSVData->maWinData.mnTrackFlags  = 0;
747cdf0e10cSrcweir         ReleaseMouse();
748cdf0e10cSrcweir         }
749cdf0e10cSrcweir 
750cdf0e10cSrcweir         // EndTracking rufen, wenn es gerufen werden soll
751cdf0e10cSrcweir         if ( !(nFlags & ENDTRACK_DONTCALLHDL) )
752cdf0e10cSrcweir         {
753cdf0e10cSrcweir             Point           aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
754cdf0e10cSrcweir             if( ImplIsAntiparallel() )
755cdf0e10cSrcweir             {
756cdf0e10cSrcweir                 // - RTL - re-mirror frame pos at pChild
757cdf0e10cSrcweir                 ImplReMirror( aMousePos );
758cdf0e10cSrcweir             }
759cdf0e10cSrcweir 
760cdf0e10cSrcweir             MouseEvent      aMEvt( ImplFrameToOutput( aMousePos ),
761cdf0e10cSrcweir                                    mpWindowImpl->mpFrameData->mnClickCount, 0,
762cdf0e10cSrcweir                                    mpWindowImpl->mpFrameData->mnMouseCode, mpWindowImpl->mpFrameData->mnMouseCode );
763cdf0e10cSrcweir             TrackingEvent   aTEvt( aMEvt, nFlags | ENDTRACK_END );
764cdf0e10cSrcweir             Tracking( aTEvt );
765cdf0e10cSrcweir         }
766cdf0e10cSrcweir     }
767cdf0e10cSrcweir }
768cdf0e10cSrcweir 
769cdf0e10cSrcweir // -----------------------------------------------------------------------
770cdf0e10cSrcweir 
IsTracking() const771cdf0e10cSrcweir sal_Bool Window::IsTracking() const
772cdf0e10cSrcweir {
773cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
774cdf0e10cSrcweir 
775cdf0e10cSrcweir     return (ImplGetSVData()->maWinData.mpTrackWin == this);
776cdf0e10cSrcweir }
777cdf0e10cSrcweir 
778cdf0e10cSrcweir // -----------------------------------------------------------------------
779cdf0e10cSrcweir 
StartAutoScroll(sal_uInt16 nFlags)780cdf0e10cSrcweir void Window::StartAutoScroll( sal_uInt16 nFlags )
781cdf0e10cSrcweir {
782cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
783cdf0e10cSrcweir 
784cdf0e10cSrcweir     ImplSVData* pSVData = ImplGetSVData();
785cdf0e10cSrcweir 
786cdf0e10cSrcweir     if ( pSVData->maWinData.mpAutoScrollWin != this )
787cdf0e10cSrcweir     {
788cdf0e10cSrcweir         if ( pSVData->maWinData.mpAutoScrollWin )
789cdf0e10cSrcweir             pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
790cdf0e10cSrcweir     }
791cdf0e10cSrcweir 
792cdf0e10cSrcweir     pSVData->maWinData.mpAutoScrollWin = this;
793cdf0e10cSrcweir     pSVData->maWinData.mnAutoScrollFlags = nFlags;
794cdf0e10cSrcweir     pSVData->maAppData.mpWheelWindow = new ImplWheelWindow( this );
795cdf0e10cSrcweir }
796cdf0e10cSrcweir 
797cdf0e10cSrcweir // -----------------------------------------------------------------------
798cdf0e10cSrcweir 
EndAutoScroll()799cdf0e10cSrcweir void Window::EndAutoScroll()
800cdf0e10cSrcweir {
801cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
802cdf0e10cSrcweir 
803cdf0e10cSrcweir     ImplSVData* pSVData = ImplGetSVData();
804cdf0e10cSrcweir 
805cdf0e10cSrcweir     if ( pSVData->maWinData.mpAutoScrollWin == this )
806cdf0e10cSrcweir     {
807cdf0e10cSrcweir         pSVData->maWinData.mpAutoScrollWin = NULL;
808cdf0e10cSrcweir         pSVData->maWinData.mnAutoScrollFlags = 0;
809cdf0e10cSrcweir         pSVData->maAppData.mpWheelWindow->ImplStop();
810cdf0e10cSrcweir         pSVData->maAppData.mpWheelWindow->doLazyDelete();
811cdf0e10cSrcweir         pSVData->maAppData.mpWheelWindow = NULL;
812cdf0e10cSrcweir     }
813cdf0e10cSrcweir }
814cdf0e10cSrcweir 
815cdf0e10cSrcweir // -----------------------------------------------------------------------
816cdf0e10cSrcweir 
IsAutoScroll() const817cdf0e10cSrcweir sal_Bool Window::IsAutoScroll() const
818cdf0e10cSrcweir {
819cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
820cdf0e10cSrcweir 
821cdf0e10cSrcweir     return (ImplGetSVData()->maWinData.mpAutoScrollWin == this);
822cdf0e10cSrcweir }
823cdf0e10cSrcweir 
824cdf0e10cSrcweir // -----------------------------------------------------------------------
825cdf0e10cSrcweir 
SaveBackground(const Point & rPos,const Size & rSize,const Point & rDestOff,VirtualDevice & rSaveDevice)826cdf0e10cSrcweir void Window::SaveBackground( const Point& rPos, const Size& rSize,
827cdf0e10cSrcweir                              const Point& rDestOff, VirtualDevice& rSaveDevice )
828cdf0e10cSrcweir {
829cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
830cdf0e10cSrcweir 
831cdf0e10cSrcweir     if ( mpWindowImpl->mpPaintRegion )
832cdf0e10cSrcweir     {
833cdf0e10cSrcweir         Region      aClip( *mpWindowImpl->mpPaintRegion );
834cdf0e10cSrcweir         const Point aPixPos( LogicToPixel( rPos ) );
835cdf0e10cSrcweir 
836cdf0e10cSrcweir         aClip.Move( -mnOutOffX, -mnOutOffY );
837cdf0e10cSrcweir         aClip.Intersect( Rectangle( aPixPos, LogicToPixel( rSize ) ) );
838cdf0e10cSrcweir 
839cdf0e10cSrcweir         if ( !aClip.IsEmpty() )
840cdf0e10cSrcweir         {
841cdf0e10cSrcweir             const Region    aOldClip( rSaveDevice.GetClipRegion() );
842cdf0e10cSrcweir             const Point     aPixOffset( rSaveDevice.LogicToPixel( rDestOff ) );
843cdf0e10cSrcweir             const sal_Bool      bMap = rSaveDevice.IsMapModeEnabled();
844cdf0e10cSrcweir 
845cdf0e10cSrcweir             // move clip region to have the same distance to DestOffset
846cdf0e10cSrcweir             aClip.Move( aPixOffset.X() - aPixPos.X(), aPixOffset.Y() - aPixPos.Y() );
847cdf0e10cSrcweir 
848cdf0e10cSrcweir             // set pixel clip region
849cdf0e10cSrcweir             rSaveDevice.EnableMapMode( sal_False );
850cdf0e10cSrcweir             rSaveDevice.SetClipRegion( aClip );
851cdf0e10cSrcweir             rSaveDevice.EnableMapMode( bMap );
852cdf0e10cSrcweir             rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
853cdf0e10cSrcweir             rSaveDevice.SetClipRegion( aOldClip );
854cdf0e10cSrcweir         }
855cdf0e10cSrcweir     }
856cdf0e10cSrcweir     else
857cdf0e10cSrcweir         rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
858cdf0e10cSrcweir }
859cdf0e10cSrcweir 
860cdf0e10cSrcweir // -----------------------------------------------------------------------
861cdf0e10cSrcweir 
SaveFocus()862cdf0e10cSrcweir sal_uIntPtr Window::SaveFocus()
863cdf0e10cSrcweir {
864cdf0e10cSrcweir     ImplSVData* pSVData = ImplGetSVData();
865cdf0e10cSrcweir     if ( pSVData->maWinData.mpFocusWin )
866cdf0e10cSrcweir     {
867cdf0e10cSrcweir         ImplFocusDelData* pDelData = new ImplFocusDelData;
868cdf0e10cSrcweir         pSVData->maWinData.mpFocusWin->ImplAddDel( pDelData );
869cdf0e10cSrcweir         pDelData->mpFocusWin = pSVData->maWinData.mpFocusWin;
870cdf0e10cSrcweir         return (sal_uIntPtr)(void*)pDelData;
871cdf0e10cSrcweir     }
872cdf0e10cSrcweir     else
873cdf0e10cSrcweir         return 0;
874cdf0e10cSrcweir }
875cdf0e10cSrcweir 
876cdf0e10cSrcweir // -----------------------------------------------------------------------
877cdf0e10cSrcweir 
EndSaveFocus(sal_uIntPtr nSaveId,sal_Bool bRestore)878cdf0e10cSrcweir sal_Bool Window::EndSaveFocus( sal_uIntPtr nSaveId, sal_Bool bRestore )
879cdf0e10cSrcweir {
880cdf0e10cSrcweir     if ( !nSaveId )
881cdf0e10cSrcweir         return sal_False;
882cdf0e10cSrcweir     else
883cdf0e10cSrcweir     {
884cdf0e10cSrcweir         sal_Bool                bOK = sal_True;
885cdf0e10cSrcweir         ImplFocusDelData*   pDelData = (ImplFocusDelData*)(void*)nSaveId;
886cdf0e10cSrcweir         if ( !pDelData->IsDelete() )
887cdf0e10cSrcweir         {
888cdf0e10cSrcweir             pDelData->mpFocusWin->ImplRemoveDel( pDelData );
889cdf0e10cSrcweir             if ( bRestore )
890cdf0e10cSrcweir                 pDelData->mpFocusWin->GrabFocus();
891cdf0e10cSrcweir         }
892cdf0e10cSrcweir         else
893cdf0e10cSrcweir             bOK = !bRestore;
894cdf0e10cSrcweir         delete pDelData;
895cdf0e10cSrcweir         return bOK;
896cdf0e10cSrcweir     }
897cdf0e10cSrcweir }
898cdf0e10cSrcweir 
899cdf0e10cSrcweir // -----------------------------------------------------------------------
900cdf0e10cSrcweir 
SetZoom(const Fraction & rZoom)901cdf0e10cSrcweir void Window::SetZoom( const Fraction& rZoom )
902cdf0e10cSrcweir {
903cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
904cdf0e10cSrcweir 
905cdf0e10cSrcweir     if ( mpWindowImpl->maZoom != rZoom )
906cdf0e10cSrcweir     {
907cdf0e10cSrcweir         mpWindowImpl->maZoom = rZoom;
908cdf0e10cSrcweir         StateChanged( STATE_CHANGE_ZOOM );
909cdf0e10cSrcweir     }
910cdf0e10cSrcweir }
911cdf0e10cSrcweir 
912cdf0e10cSrcweir // -----------------------------------------------------------------------
913cdf0e10cSrcweir 
WinFloatRound(double fVal)914cdf0e10cSrcweir inline long WinFloatRound( double fVal )
915cdf0e10cSrcweir {
916cdf0e10cSrcweir     return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) );
917cdf0e10cSrcweir }
918cdf0e10cSrcweir 
919cdf0e10cSrcweir // -----------------------------------------------------------------------
920cdf0e10cSrcweir 
SetZoomedPointFont(const Font & rFont)921cdf0e10cSrcweir void Window::SetZoomedPointFont( const Font& rFont )
922cdf0e10cSrcweir {
923cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
924cdf0e10cSrcweir 
925cdf0e10cSrcweir     const Fraction& rZoom = GetZoom();
926cdf0e10cSrcweir     if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
927cdf0e10cSrcweir     {
928cdf0e10cSrcweir         Font aFont( rFont );
929cdf0e10cSrcweir         Size aSize = aFont.GetSize();
930cdf0e10cSrcweir         double n = (double)aSize.Width();
931cdf0e10cSrcweir         n *= (double)rZoom.GetNumerator();
932cdf0e10cSrcweir         n /= (double)rZoom.GetDenominator();
933cdf0e10cSrcweir         aSize.Width() = WinFloatRound( n );
934cdf0e10cSrcweir         n = (double)aSize.Height();
935cdf0e10cSrcweir         n *= (double)rZoom.GetNumerator();
936cdf0e10cSrcweir         n /= (double)rZoom.GetDenominator();
937cdf0e10cSrcweir         aSize.Height() = WinFloatRound( n );
938cdf0e10cSrcweir         aFont.SetSize( aSize );
939cdf0e10cSrcweir         SetPointFont( aFont );
940cdf0e10cSrcweir 
941cdf0e10cSrcweir         // Wenn Darstellung skaliert wird, nehmen wir gegebenenfalls
942cdf0e10cSrcweir         // einen anderen Font, wenn der aktuelle nicht skalierbar ist
943cdf0e10cSrcweir         FontMetric aMetric = GetFontMetric();
944cdf0e10cSrcweir         long       nFontDiff = Abs( GetFont().GetSize().Height()-aMetric.GetSize().Height() );
945cdf0e10cSrcweir         if ( (aMetric.GetType() == TYPE_RASTER) && (nFontDiff >= 2) )
946cdf0e10cSrcweir         {
947cdf0e10cSrcweir             sal_uInt16 nType;
948cdf0e10cSrcweir             if ( aMetric.GetPitch() == PITCH_FIXED )
949cdf0e10cSrcweir                 nType = DEFAULTFONT_FIXED;
950cdf0e10cSrcweir             else
951cdf0e10cSrcweir                 nType = DEFAULTFONT_UI_SANS;
952cdf0e10cSrcweir             Font aTempFont = GetDefaultFont( nType, GetSettings().GetLanguage(), 0 );
953cdf0e10cSrcweir             aFont.SetName( aTempFont.GetName() );
954cdf0e10cSrcweir             SetPointFont( aFont );
955cdf0e10cSrcweir         }
956cdf0e10cSrcweir     }
957cdf0e10cSrcweir     else
958cdf0e10cSrcweir         SetPointFont( rFont );
959cdf0e10cSrcweir }
960cdf0e10cSrcweir 
961cdf0e10cSrcweir // -----------------------------------------------------------------------
962cdf0e10cSrcweir 
CalcZoom(long nCalc) const963cdf0e10cSrcweir long Window::CalcZoom( long nCalc ) const
964cdf0e10cSrcweir {
965cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
966cdf0e10cSrcweir 
967cdf0e10cSrcweir     const Fraction& rZoom = GetZoom();
968cdf0e10cSrcweir     if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
969cdf0e10cSrcweir     {
970cdf0e10cSrcweir         double n = (double)nCalc;
971cdf0e10cSrcweir         n *= (double)rZoom.GetNumerator();
972cdf0e10cSrcweir         n /= (double)rZoom.GetDenominator();
973cdf0e10cSrcweir         nCalc = WinFloatRound( n );
974cdf0e10cSrcweir     }
975cdf0e10cSrcweir     return nCalc;
976cdf0e10cSrcweir }
977cdf0e10cSrcweir 
978cdf0e10cSrcweir // -----------------------------------------------------------------------
979cdf0e10cSrcweir 
SetControlFont()980cdf0e10cSrcweir void Window::SetControlFont()
981cdf0e10cSrcweir {
982cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
983cdf0e10cSrcweir 
984cdf0e10cSrcweir     if ( mpWindowImpl->mpControlFont )
985cdf0e10cSrcweir     {
986cdf0e10cSrcweir         delete mpWindowImpl->mpControlFont;
987cdf0e10cSrcweir         mpWindowImpl->mpControlFont = NULL;
988cdf0e10cSrcweir         StateChanged( STATE_CHANGE_CONTROLFONT );
989cdf0e10cSrcweir     }
990cdf0e10cSrcweir }
991cdf0e10cSrcweir 
992cdf0e10cSrcweir // -----------------------------------------------------------------------
993cdf0e10cSrcweir 
SetControlFont(const Font & rFont)994cdf0e10cSrcweir void Window::SetControlFont( const Font& rFont )
995cdf0e10cSrcweir {
996cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
997cdf0e10cSrcweir 
998cdf0e10cSrcweir     if ( rFont == Font() )
999cdf0e10cSrcweir     {
1000cdf0e10cSrcweir         SetControlFont();
1001cdf0e10cSrcweir         return;
1002cdf0e10cSrcweir     }
1003cdf0e10cSrcweir 
1004cdf0e10cSrcweir     if ( mpWindowImpl->mpControlFont )
1005cdf0e10cSrcweir     {
1006cdf0e10cSrcweir         if ( *mpWindowImpl->mpControlFont == rFont )
1007cdf0e10cSrcweir             return;
1008cdf0e10cSrcweir         *mpWindowImpl->mpControlFont = rFont;
1009cdf0e10cSrcweir     }
1010cdf0e10cSrcweir     else
1011cdf0e10cSrcweir         mpWindowImpl->mpControlFont = new Font( rFont );
1012cdf0e10cSrcweir 
1013cdf0e10cSrcweir     StateChanged( STATE_CHANGE_CONTROLFONT );
1014cdf0e10cSrcweir }
1015cdf0e10cSrcweir 
1016cdf0e10cSrcweir // -----------------------------------------------------------------------
1017cdf0e10cSrcweir 
GetControlFont() const1018cdf0e10cSrcweir Font Window::GetControlFont() const
1019cdf0e10cSrcweir {
1020cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir     if ( mpWindowImpl->mpControlFont )
1023cdf0e10cSrcweir         return *mpWindowImpl->mpControlFont;
1024cdf0e10cSrcweir     else
1025cdf0e10cSrcweir     {
1026cdf0e10cSrcweir         Font aFont;
1027cdf0e10cSrcweir         return aFont;
1028cdf0e10cSrcweir     }
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir 
1031cdf0e10cSrcweir // -----------------------------------------------------------------------
1032cdf0e10cSrcweir 
SetControlForeground()1033cdf0e10cSrcweir void Window::SetControlForeground()
1034cdf0e10cSrcweir {
1035cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir     if ( mpWindowImpl->mbControlForeground )
1038cdf0e10cSrcweir     {
1039cdf0e10cSrcweir         mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT );
1040cdf0e10cSrcweir         mpWindowImpl->mbControlForeground = sal_False;
1041cdf0e10cSrcweir         StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
1042cdf0e10cSrcweir     }
1043cdf0e10cSrcweir }
1044cdf0e10cSrcweir 
1045cdf0e10cSrcweir // -----------------------------------------------------------------------
1046cdf0e10cSrcweir 
SetControlForeground(const Color & rColor)1047cdf0e10cSrcweir void Window::SetControlForeground( const Color& rColor )
1048cdf0e10cSrcweir {
1049cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1050cdf0e10cSrcweir 
1051cdf0e10cSrcweir     if ( rColor.GetTransparency() )
1052cdf0e10cSrcweir     {
1053cdf0e10cSrcweir         if ( mpWindowImpl->mbControlForeground )
1054cdf0e10cSrcweir         {
1055cdf0e10cSrcweir             mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT );
1056cdf0e10cSrcweir             mpWindowImpl->mbControlForeground = sal_False;
1057cdf0e10cSrcweir             StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
1058cdf0e10cSrcweir         }
1059cdf0e10cSrcweir     }
1060cdf0e10cSrcweir     else
1061cdf0e10cSrcweir     {
1062cdf0e10cSrcweir         if ( mpWindowImpl->maControlForeground != rColor )
1063cdf0e10cSrcweir         {
1064cdf0e10cSrcweir             mpWindowImpl->maControlForeground = rColor;
1065cdf0e10cSrcweir             mpWindowImpl->mbControlForeground = sal_True;
1066cdf0e10cSrcweir             StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
1067cdf0e10cSrcweir         }
1068cdf0e10cSrcweir     }
1069cdf0e10cSrcweir }
1070cdf0e10cSrcweir 
1071cdf0e10cSrcweir // -----------------------------------------------------------------------
1072cdf0e10cSrcweir 
SetControlBackground()1073cdf0e10cSrcweir void Window::SetControlBackground()
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1076cdf0e10cSrcweir 
1077cdf0e10cSrcweir     if ( mpWindowImpl->mbControlBackground )
1078cdf0e10cSrcweir     {
1079cdf0e10cSrcweir         mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT );
1080cdf0e10cSrcweir         mpWindowImpl->mbControlBackground = sal_False;
1081cdf0e10cSrcweir         StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
1082cdf0e10cSrcweir     }
1083cdf0e10cSrcweir }
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir // -----------------------------------------------------------------------
1086cdf0e10cSrcweir 
SetControlBackground(const Color & rColor)1087cdf0e10cSrcweir void Window::SetControlBackground( const Color& rColor )
1088cdf0e10cSrcweir {
1089cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1090cdf0e10cSrcweir 
1091cdf0e10cSrcweir     if ( rColor.GetTransparency() )
1092cdf0e10cSrcweir     {
1093cdf0e10cSrcweir         if ( mpWindowImpl->mbControlBackground )
1094cdf0e10cSrcweir         {
1095cdf0e10cSrcweir             mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT );
1096cdf0e10cSrcweir             mpWindowImpl->mbControlBackground = sal_False;
1097cdf0e10cSrcweir             StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
1098cdf0e10cSrcweir         }
1099cdf0e10cSrcweir     }
1100cdf0e10cSrcweir     else
1101cdf0e10cSrcweir     {
1102cdf0e10cSrcweir         if ( mpWindowImpl->maControlBackground != rColor )
1103cdf0e10cSrcweir         {
1104cdf0e10cSrcweir             mpWindowImpl->maControlBackground = rColor;
1105cdf0e10cSrcweir             mpWindowImpl->mbControlBackground = sal_True;
1106cdf0e10cSrcweir             StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
1107cdf0e10cSrcweir         }
1108cdf0e10cSrcweir     }
1109cdf0e10cSrcweir }
1110cdf0e10cSrcweir 
1111cdf0e10cSrcweir // -----------------------------------------------------------------------
1112cdf0e10cSrcweir 
CalcWindowSize(const Size & rOutSz) const1113cdf0e10cSrcweir Size Window::CalcWindowSize( const Size& rOutSz ) const
1114cdf0e10cSrcweir {
1115cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir     Size aSz = rOutSz;
1118cdf0e10cSrcweir     aSz.Width()  += mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder;
1119cdf0e10cSrcweir     aSz.Height() += mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder;
1120cdf0e10cSrcweir     return aSz;
1121cdf0e10cSrcweir }
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir // -----------------------------------------------------------------------
1124cdf0e10cSrcweir 
CalcOutputSize(const Size & rWinSz) const1125cdf0e10cSrcweir Size Window::CalcOutputSize( const Size& rWinSz ) const
1126cdf0e10cSrcweir {
1127cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1128cdf0e10cSrcweir 
1129cdf0e10cSrcweir     Size aSz = rWinSz;
1130cdf0e10cSrcweir     aSz.Width()  -= mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder;
1131cdf0e10cSrcweir     aSz.Height() -= mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder;
1132cdf0e10cSrcweir     return aSz;
1133cdf0e10cSrcweir }
1134cdf0e10cSrcweir 
1135cdf0e10cSrcweir // -----------------------------------------------------------------------
1136cdf0e10cSrcweir 
GetDrawPixelFont(OutputDevice * pDev) const1137cdf0e10cSrcweir Font Window::GetDrawPixelFont( OutputDevice* pDev ) const
1138cdf0e10cSrcweir {
1139cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1140cdf0e10cSrcweir 
1141cdf0e10cSrcweir     Font    aFont = GetPointFont();
1142cdf0e10cSrcweir     Size    aFontSize = aFont.GetSize();
1143cdf0e10cSrcweir     MapMode aPtMapMode( MAP_POINT );
1144cdf0e10cSrcweir     aFontSize = pDev->LogicToPixel( aFontSize, aPtMapMode );
1145cdf0e10cSrcweir     aFont.SetSize( aFontSize );
1146cdf0e10cSrcweir     return aFont;
1147cdf0e10cSrcweir }
1148cdf0e10cSrcweir 
1149cdf0e10cSrcweir // -----------------------------------------------------------------------
1150cdf0e10cSrcweir 
GetDrawPixel(OutputDevice * pDev,long nPixels) const1151cdf0e10cSrcweir long Window::GetDrawPixel( OutputDevice* pDev, long nPixels ) const
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1154cdf0e10cSrcweir 
1155cdf0e10cSrcweir     long nP = nPixels;
1156cdf0e10cSrcweir     if ( pDev->GetOutDevType() != OUTDEV_WINDOW )
1157cdf0e10cSrcweir     {
1158cdf0e10cSrcweir         MapMode aMap( MAP_100TH_MM );
1159cdf0e10cSrcweir         Size aSz( nP, 0 );
1160cdf0e10cSrcweir         aSz = PixelToLogic( aSz, aMap );
1161cdf0e10cSrcweir         aSz = pDev->LogicToPixel( aSz, aMap );
1162cdf0e10cSrcweir         nP = aSz.Width();
1163cdf0e10cSrcweir     }
1164cdf0e10cSrcweir     return nP;
1165cdf0e10cSrcweir }
1166cdf0e10cSrcweir 
1167cdf0e10cSrcweir // -----------------------------------------------------------------------
1168cdf0e10cSrcweir 
HandleScrollCommand(const CommandEvent & rCmd,ScrollBar * pHScrl,ScrollBar * pVScrl)1169cdf0e10cSrcweir sal_Bool Window::HandleScrollCommand( const CommandEvent& rCmd,
1170cdf0e10cSrcweir                                   ScrollBar* pHScrl, ScrollBar* pVScrl )
1171cdf0e10cSrcweir {
1172cdf0e10cSrcweir     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1173cdf0e10cSrcweir 
1174cdf0e10cSrcweir     sal_Bool bRet = sal_False;
1175cdf0e10cSrcweir 
1176cdf0e10cSrcweir     if ( pHScrl || pVScrl )
1177cdf0e10cSrcweir     {
1178cdf0e10cSrcweir         switch( rCmd.GetCommand() )
1179cdf0e10cSrcweir         {
1180cdf0e10cSrcweir             case COMMAND_STARTAUTOSCROLL:
1181cdf0e10cSrcweir             {
1182cdf0e10cSrcweir                 sal_uInt16 nFlags = 0;
1183cdf0e10cSrcweir                 if ( pHScrl )
1184cdf0e10cSrcweir                 {
1185cdf0e10cSrcweir                     if ( (pHScrl->GetVisibleSize() < pHScrl->GetRangeMax()) &&
1186cdf0e10cSrcweir                          pHScrl->IsEnabled() && pHScrl->IsInputEnabled() && ! pHScrl->IsInModalMode() )
1187cdf0e10cSrcweir                         nFlags |= AUTOSCROLL_HORZ;
1188cdf0e10cSrcweir                 }
1189cdf0e10cSrcweir                 if ( pVScrl )
1190cdf0e10cSrcweir                 {
1191cdf0e10cSrcweir                     if ( (pVScrl->GetVisibleSize() < pVScrl->GetRangeMax()) &&
1192cdf0e10cSrcweir                          pVScrl->IsEnabled() && pVScrl->IsInputEnabled() && ! pVScrl->IsInModalMode() )
1193cdf0e10cSrcweir                         nFlags |= AUTOSCROLL_VERT;
1194cdf0e10cSrcweir                 }
1195cdf0e10cSrcweir 
1196cdf0e10cSrcweir                 if ( nFlags )
1197cdf0e10cSrcweir                 {
1198cdf0e10cSrcweir                     StartAutoScroll( nFlags );
1199cdf0e10cSrcweir                     bRet = sal_True;
1200cdf0e10cSrcweir                 }
1201cdf0e10cSrcweir             }
1202cdf0e10cSrcweir             break;
1203cdf0e10cSrcweir 
1204cdf0e10cSrcweir             case COMMAND_WHEEL:
1205cdf0e10cSrcweir             {
1206cdf0e10cSrcweir                 const CommandWheelData* pData = rCmd.GetWheelData();
1207cdf0e10cSrcweir 
1208cdf0e10cSrcweir                 if ( pData && (COMMAND_WHEEL_SCROLL == pData->GetMode()) )
1209cdf0e10cSrcweir                 {
1210cdf0e10cSrcweir                     sal_uLong nScrollLines = pData->GetScrollLines();
1211cdf0e10cSrcweir                     long nLines;
1212cdf0e10cSrcweir                     if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL )
1213cdf0e10cSrcweir                     {
1214cdf0e10cSrcweir                         if ( pData->GetDelta() < 0 )
1215cdf0e10cSrcweir                             nLines = -LONG_MAX;
1216cdf0e10cSrcweir                         else
1217cdf0e10cSrcweir                             nLines = LONG_MAX;
1218cdf0e10cSrcweir                     }
1219cdf0e10cSrcweir                     else
1220cdf0e10cSrcweir                         nLines = pData->GetNotchDelta() * (long)nScrollLines;
1221cdf0e10cSrcweir                     if ( nLines )
1222cdf0e10cSrcweir                     {
1223cdf0e10cSrcweir                         ImplHandleScroll( NULL,
1224cdf0e10cSrcweir                                           0L,
1225cdf0e10cSrcweir                                           pData->IsHorz() ? pHScrl : pVScrl,
1226cdf0e10cSrcweir                                           nLines );
1227cdf0e10cSrcweir                         bRet = sal_True;
1228cdf0e10cSrcweir                     }
1229cdf0e10cSrcweir                 }
1230cdf0e10cSrcweir             }
1231cdf0e10cSrcweir             break;
1232cdf0e10cSrcweir 
1233cdf0e10cSrcweir             case COMMAND_AUTOSCROLL:
1234cdf0e10cSrcweir             {
1235cdf0e10cSrcweir                 const CommandScrollData* pData = rCmd.GetAutoScrollData();
1236cdf0e10cSrcweir                 if ( pData && (pData->GetDeltaX() || pData->GetDeltaY()) )
1237cdf0e10cSrcweir                 {
1238cdf0e10cSrcweir                     ImplHandleScroll( pHScrl, pData->GetDeltaX(),
1239cdf0e10cSrcweir                                       pVScrl, pData->GetDeltaY() );
1240cdf0e10cSrcweir                     bRet = sal_True;
1241cdf0e10cSrcweir                 }
1242cdf0e10cSrcweir             }
1243cdf0e10cSrcweir             break;
1244cdf0e10cSrcweir 
1245cdf0e10cSrcweir             default:
1246cdf0e10cSrcweir             break;
1247cdf0e10cSrcweir         }
1248cdf0e10cSrcweir     }
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir     return bRet;
1251cdf0e10cSrcweir }
1252cdf0e10cSrcweir 
1253cdf0e10cSrcweir // -----------------------------------------------------------------------
1254cdf0e10cSrcweir 
ImplHandleScroll(ScrollBar * pHScrl,long nX,ScrollBar * pVScrl,long nY)1255cdf0e10cSrcweir void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX,
1256cdf0e10cSrcweir                                ScrollBar* pVScrl, long nY )
1257cdf0e10cSrcweir {
1258cdf0e10cSrcweir     if ( pHScrl && nX && pHScrl->IsEnabled() && pHScrl->IsInputEnabled() && ! pHScrl->IsInModalMode() )
1259cdf0e10cSrcweir     {
1260cdf0e10cSrcweir         long nNewPos = pHScrl->GetThumbPos();
1261cdf0e10cSrcweir 
1262cdf0e10cSrcweir         if ( nX == -LONG_MAX )
1263cdf0e10cSrcweir             nNewPos += pHScrl->GetPageSize();
1264cdf0e10cSrcweir         else if ( nX == LONG_MAX )
1265cdf0e10cSrcweir             nNewPos -= pHScrl->GetPageSize();
1266cdf0e10cSrcweir         else
1267cdf0e10cSrcweir         {
1268cdf0e10cSrcweir             const double fVal = (double)nNewPos - ((double)nX * pHScrl->GetLineSize());
1269cdf0e10cSrcweir 
1270cdf0e10cSrcweir             if ( fVal < LONG_MIN )
1271cdf0e10cSrcweir                 nNewPos = LONG_MIN;
1272cdf0e10cSrcweir             else if ( fVal > LONG_MAX )
1273cdf0e10cSrcweir                 nNewPos = LONG_MAX;
1274cdf0e10cSrcweir             else
1275cdf0e10cSrcweir                 nNewPos = (long)fVal;
1276cdf0e10cSrcweir         }
1277cdf0e10cSrcweir 
1278cdf0e10cSrcweir         pHScrl->DoScroll( nNewPos );
1279cdf0e10cSrcweir     }
1280cdf0e10cSrcweir 
1281cdf0e10cSrcweir     if ( pVScrl && nY && pVScrl->IsEnabled() && pVScrl->IsInputEnabled() && ! pVScrl->IsInModalMode() )
1282cdf0e10cSrcweir     {
1283cdf0e10cSrcweir         long nNewPos = pVScrl->GetThumbPos();
1284cdf0e10cSrcweir 
1285cdf0e10cSrcweir         if ( nY == -LONG_MAX )
1286cdf0e10cSrcweir             nNewPos += pVScrl->GetPageSize();
1287cdf0e10cSrcweir         else if ( nY == LONG_MAX )
1288cdf0e10cSrcweir             nNewPos -= pVScrl->GetPageSize();
1289cdf0e10cSrcweir         else
1290cdf0e10cSrcweir         {
1291cdf0e10cSrcweir             const double fVal = (double)nNewPos - ((double)nY * pVScrl->GetLineSize());
1292cdf0e10cSrcweir 
1293cdf0e10cSrcweir             if ( fVal < LONG_MIN )
1294cdf0e10cSrcweir                 nNewPos = LONG_MIN;
1295cdf0e10cSrcweir             else if ( fVal > LONG_MAX )
1296cdf0e10cSrcweir                 nNewPos = LONG_MAX;
1297cdf0e10cSrcweir             else
1298cdf0e10cSrcweir                 nNewPos = (long)fVal;
1299cdf0e10cSrcweir         }
1300cdf0e10cSrcweir 
1301cdf0e10cSrcweir         pVScrl->DoScroll( nNewPos );
1302cdf0e10cSrcweir     }
1303cdf0e10cSrcweir }
1304cdf0e10cSrcweir 
1305cdf0e10cSrcweir // support for docking
1306cdf0e10cSrcweir // this is currently handled in ImplDockingWindowWrapper
1307cdf0e10cSrcweir /*
1308cdf0e10cSrcweir void Window::ImplSetFloatingMode( sal_Bool bFloatMode )
1309cdf0e10cSrcweir {
1310cdf0e10cSrcweir     // if the window is docked, put it into a flaoting window
1311cdf0e10cSrcweir     // if it is floating put it back in the old frame
1312cdf0e10cSrcweir 
1313cdf0e10cSrcweir     ImplDockingWindowWrapper *pWrapper = pDockingMgr->GetDockingWindowWrapper( this );
1314cdf0e10cSrcweir     if( !pDockingData )
1315cdf0e10cSrcweir         return;
1316cdf0e10cSrcweir 
1317cdf0e10cSrcweir     if ( pWrapper->IsFloatingMode() != bFloatMode )
1318cdf0e10cSrcweir     {
1319cdf0e10cSrcweir         if ( pWrapper->PrepareToggleFloatingMode() )
1320cdf0e10cSrcweir         {
1321cdf0e10cSrcweir             sal_Bool bVisible = IsVisible();
1322cdf0e10cSrcweir 
1323cdf0e10cSrcweir             if ( bFloatMode )
1324cdf0e10cSrcweir             {
1325cdf0e10cSrcweir                 Show( sal_False, SHOW_NOFOCUSCHANGE );
1326cdf0e10cSrcweir 
1327cdf0e10cSrcweir                 pWrapper->maDockPos = GetPosPixel();
1328cdf0e10cSrcweir 
1329cdf0e10cSrcweir                 Window* pRealParent = mpWindowImpl->mpRealParent;
1330cdf0e10cSrcweir                 pWrapper->mpOldBorderWin = mpWindowImpl->mpBorderWindow;
1331cdf0e10cSrcweir 
1332cdf0e10cSrcweir                 ImplDockFloatWin* pWin =
1333cdf0e10cSrcweir                     new ImplDockFloatWin2(
1334cdf0e10cSrcweir                                          mpWindowImpl->mpParent,
1335cdf0e10cSrcweir                                          mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ?  mnFloatBits | WB_SYSTEMWINDOW : mnFloatBits,
1336cdf0e10cSrcweir                                          pWrapper );
1337cdf0e10cSrcweir                 pWrapper->mpFloatWin = pWin;
1338cdf0e10cSrcweir                 mpWindowImpl->mpBorderWindow  = NULL;
1339cdf0e10cSrcweir                 mpWindowImpl->mnLeftBorder    = 0;
1340cdf0e10cSrcweir                 mpWindowImpl->mnTopBorder     = 0;
1341cdf0e10cSrcweir                 mpWindowImpl->mnRightBorder   = 0;
1342cdf0e10cSrcweir                 mpWindowImpl->mnBottomBorder  = 0;
1343cdf0e10cSrcweir                 // Falls Parent zerstoert wird, muessen wir auch vom
1344cdf0e10cSrcweir                 // BorderWindow den Parent umsetzen
1345cdf0e10cSrcweir                 if ( pWrapper->mpOldBorderWin )
1346cdf0e10cSrcweir                     pWrapper->mpOldBorderWin->SetParent( pWin );
1347cdf0e10cSrcweir                 SetParent( pWin );
1348cdf0e10cSrcweir                 pWin->SetPosPixel( Point() );
1349cdf0e10cSrcweir                 mpWindowImpl->mpBorderWindow = pWin;
1350cdf0e10cSrcweir                 pWin->mpWindowImpl->mpClientWindow = this;
1351cdf0e10cSrcweir                 mpWindowImpl->mpRealParent = pRealParent;
1352cdf0e10cSrcweir                 pWin->SetText( GetText() );
1353cdf0e10cSrcweir                 pWin->SetOutputSizePixel( GetSizePixel() );
1354cdf0e10cSrcweir                 pWin->SetPosPixel( pWrapper->maFloatPos );
1355cdf0e10cSrcweir                 // DockingDaten ans FloatingWindow weiterreichen
1356cdf0e10cSrcweir                 pWin->ShowTitleButton( TITLE_BUTTON_DOCKING, pWrapper->mbDockBtn );
1357cdf0e10cSrcweir                 pWin->ShowTitleButton( TITLE_BUTTON_HIDE, pWrapper->mbHideBtn );
1358cdf0e10cSrcweir                 pWin->SetPin( pWrapper->mbPined );
1359cdf0e10cSrcweir                 if ( pWrapper->mbRollUp )
1360cdf0e10cSrcweir                     pWin->RollUp();
1361cdf0e10cSrcweir                 else
1362cdf0e10cSrcweir                     pWin->RollDown();
1363cdf0e10cSrcweir                 pWin->SetRollUpOutputSizePixel( pWrapper->maRollUpOutSize );
1364cdf0e10cSrcweir                 pWin->SetMinOutputSizePixel( pWrapper->maMinOutSize );
1365cdf0e10cSrcweir 
1366cdf0e10cSrcweir                 pWrapper->ToggleFloatingMode();
1367cdf0e10cSrcweir 
1368cdf0e10cSrcweir                 if ( bVisible )
1369cdf0e10cSrcweir                     Show();
1370cdf0e10cSrcweir             }
1371cdf0e10cSrcweir             else
1372cdf0e10cSrcweir             {
1373cdf0e10cSrcweir                 Show( sal_False, SHOW_NOFOCUSCHANGE );
1374cdf0e10cSrcweir 
1375cdf0e10cSrcweir                 // FloatingDaten wird im FloatingWindow speichern
1376cdf0e10cSrcweir                 pWrapper->maFloatPos      = mpFloatWin->GetPosPixel();
1377cdf0e10cSrcweir                 pWrapper->mbDockBtn       = mpFloatWin->IsTitleButtonVisible( TITLE_BUTTON_DOCKING );
1378cdf0e10cSrcweir                 pWrapper->mbHideBtn       = mpFloatWin->IsTitleButtonVisible( TITLE_BUTTON_HIDE );
1379cdf0e10cSrcweir                 pWrapper->mbPined         = mpFloatWin->IsPined();
1380cdf0e10cSrcweir                 pWrapper->mbRollUp        = mpFloatWin->IsRollUp();
1381cdf0e10cSrcweir                 pWrapper->maRollUpOutSize = mpFloatWin->GetRollUpOutputSizePixel();
1382cdf0e10cSrcweir                 pWrapper->maMinOutSize    = mpFloatWin->GetMinOutputSizePixel();
1383cdf0e10cSrcweir 
1384cdf0e10cSrcweir                 Window* pRealParent = mpWindowImpl->mpRealParent;
1385cdf0e10cSrcweir                 mpWindowImpl->mpBorderWindow = NULL;
1386cdf0e10cSrcweir                 if ( pWrapper->mpOldBorderWin )
1387cdf0e10cSrcweir                 {
1388cdf0e10cSrcweir                     SetParent( pWrapper->mpOldBorderWin );
1389cdf0e10cSrcweir                     ((ImplBorderWindow*)pWrapper->mpOldBorderWin)->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
1390cdf0e10cSrcweir                     pWrapper->mpOldBorderWin->Resize();
1391cdf0e10cSrcweir                 }
1392cdf0e10cSrcweir                 mpWindowImpl->mpBorderWindow = pWrapper->mpOldBorderWin;
1393cdf0e10cSrcweir                 SetParent( pRealParent );
1394cdf0e10cSrcweir                 mpWindowImpl->mpRealParent = pRealParent;
1395cdf0e10cSrcweir                 delete static_cast<ImplDockFloatWin*>(mpFloatWin);
1396cdf0e10cSrcweir                 pWrapper->mpFloatWin = NULL;
1397cdf0e10cSrcweir                 SetPosPixel( maDockPos );
1398cdf0e10cSrcweir 
1399cdf0e10cSrcweir                 pWrapper->ToggleFloatingMode();
1400cdf0e10cSrcweir 
1401cdf0e10cSrcweir                 if ( bVisible )
1402cdf0e10cSrcweir                     Show();
1403cdf0e10cSrcweir             }
1404cdf0e10cSrcweir         }
1405cdf0e10cSrcweir     }
1406cdf0e10cSrcweir }
1407cdf0e10cSrcweir */
1408cdf0e10cSrcweir 
GetDockingManager()1409cdf0e10cSrcweir DockingManager* Window::GetDockingManager()
1410cdf0e10cSrcweir {
1411cdf0e10cSrcweir     return ImplGetDockingManager();
1412cdf0e10cSrcweir }
1413cdf0e10cSrcweir 
EnableDocking(sal_Bool bEnable)1414cdf0e10cSrcweir void Window::EnableDocking( sal_Bool bEnable )
1415cdf0e10cSrcweir {
1416cdf0e10cSrcweir     // update list of dockable windows
1417cdf0e10cSrcweir     if( bEnable )
1418cdf0e10cSrcweir         ImplGetDockingManager()->AddWindow( this );
1419cdf0e10cSrcweir     else
1420cdf0e10cSrcweir         ImplGetDockingManager()->RemoveWindow( this );
1421cdf0e10cSrcweir }
1422cdf0e10cSrcweir 
1423cdf0e10cSrcweir 
1424cdf0e10cSrcweir // retrieves the list of owner draw decorated windows for this window hiearchy
ImplGetOwnerDrawList()1425cdf0e10cSrcweir ::std::vector<Window *>& Window::ImplGetOwnerDrawList()
1426cdf0e10cSrcweir {
1427cdf0e10cSrcweir     return ImplGetTopmostFrameWindow()->mpWindowImpl->mpFrameData->maOwnerDrawList;
1428cdf0e10cSrcweir }
1429cdf0e10cSrcweir 
ImplGetTopmostFrameWindow()1430cdf0e10cSrcweir Window* Window::ImplGetTopmostFrameWindow()
1431cdf0e10cSrcweir {
1432cdf0e10cSrcweir     Window *pTopmostParent = this;
1433cdf0e10cSrcweir     while( pTopmostParent->ImplGetParent() )
1434cdf0e10cSrcweir         pTopmostParent = pTopmostParent->ImplGetParent();
1435cdf0e10cSrcweir     return pTopmostParent->mpWindowImpl->mpFrameWindow;
1436cdf0e10cSrcweir }
1437cdf0e10cSrcweir 
SetHelpId(const rtl::OString & rHelpId)1438cdf0e10cSrcweir void Window::SetHelpId( const rtl::OString& rHelpId )
1439cdf0e10cSrcweir {
1440cdf0e10cSrcweir     mpWindowImpl->maHelpId = rHelpId;
1441cdf0e10cSrcweir }
1442cdf0e10cSrcweir 
GetHelpId() const1443cdf0e10cSrcweir const rtl::OString& Window::GetHelpId() const
1444cdf0e10cSrcweir {
1445cdf0e10cSrcweir     return mpWindowImpl->maHelpId;
1446cdf0e10cSrcweir }
1447cdf0e10cSrcweir 
SetUniqueId(const rtl::OString & rUniqueId)1448cdf0e10cSrcweir void Window::SetUniqueId( const rtl::OString& rUniqueId )
1449cdf0e10cSrcweir {
1450cdf0e10cSrcweir     mpWindowImpl->maUniqId = rUniqueId;
1451cdf0e10cSrcweir }
1452cdf0e10cSrcweir 
GetUniqueId() const1453cdf0e10cSrcweir const rtl::OString& Window::GetUniqueId() const
1454cdf0e10cSrcweir {
1455cdf0e10cSrcweir     return mpWindowImpl->maUniqId;
1456cdf0e10cSrcweir }
1457cdf0e10cSrcweir 
GetUniqueOrHelpId() const1458cdf0e10cSrcweir const rtl::OString& Window::GetUniqueOrHelpId() const
1459cdf0e10cSrcweir {
1460cdf0e10cSrcweir     return mpWindowImpl->maUniqId.getLength() ? mpWindowImpl->maUniqId : mpWindowImpl->maHelpId;
1461cdf0e10cSrcweir }
1462cdf0e10cSrcweir 
1463cdf0e10cSrcweir // --------- old inline methods ---------------
1464cdf0e10cSrcweir 
ImplGetWindow()1465cdf0e10cSrcweir Window* Window::ImplGetWindow()
1466cdf0e10cSrcweir {
1467cdf0e10cSrcweir     if ( mpWindowImpl->mpClientWindow )
1468cdf0e10cSrcweir         return mpWindowImpl->mpClientWindow;
1469cdf0e10cSrcweir     else
1470cdf0e10cSrcweir         return this;
1471cdf0e10cSrcweir }
1472cdf0e10cSrcweir 
ImplGetFrameData()1473cdf0e10cSrcweir ImplFrameData* Window::ImplGetFrameData()
1474cdf0e10cSrcweir {
1475cdf0e10cSrcweir     return mpWindowImpl->mpFrameData;
1476cdf0e10cSrcweir }
1477cdf0e10cSrcweir 
ImplGetFrame() const1478cdf0e10cSrcweir SalFrame* Window::ImplGetFrame() const
1479cdf0e10cSrcweir {
1480cdf0e10cSrcweir     return mpWindowImpl->mpFrame;
1481cdf0e10cSrcweir }
1482cdf0e10cSrcweir 
ImplGetParent() const1483cdf0e10cSrcweir Window* Window::ImplGetParent() const
1484cdf0e10cSrcweir {
1485cdf0e10cSrcweir     return mpWindowImpl->mpParent;
1486cdf0e10cSrcweir }
1487cdf0e10cSrcweir 
ImplGetClientWindow() const1488cdf0e10cSrcweir Window* Window::ImplGetClientWindow() const
1489cdf0e10cSrcweir {
1490cdf0e10cSrcweir     return mpWindowImpl->mpClientWindow;
1491cdf0e10cSrcweir }
1492cdf0e10cSrcweir 
ImplGetBorderWindow() const1493cdf0e10cSrcweir Window* Window::ImplGetBorderWindow() const
1494cdf0e10cSrcweir {
1495cdf0e10cSrcweir     return mpWindowImpl->mpBorderWindow;
1496cdf0e10cSrcweir }
1497cdf0e10cSrcweir 
ImplGetFirstOverlapWindow()1498cdf0e10cSrcweir Window* Window::ImplGetFirstOverlapWindow()
1499cdf0e10cSrcweir {
1500cdf0e10cSrcweir     if ( mpWindowImpl->mbOverlapWin )
1501cdf0e10cSrcweir         return this;
1502cdf0e10cSrcweir     else
1503cdf0e10cSrcweir         return mpWindowImpl->mpOverlapWindow;
1504cdf0e10cSrcweir }
1505cdf0e10cSrcweir 
ImplGetFirstOverlapWindow() const1506cdf0e10cSrcweir const Window* Window::ImplGetFirstOverlapWindow() const
1507cdf0e10cSrcweir {
1508cdf0e10cSrcweir     if ( mpWindowImpl->mbOverlapWin )
1509cdf0e10cSrcweir         return this;
1510cdf0e10cSrcweir     else
1511cdf0e10cSrcweir         return mpWindowImpl->mpOverlapWindow;
1512cdf0e10cSrcweir }
1513cdf0e10cSrcweir 
ImplGetFrameWindow() const1514cdf0e10cSrcweir Window* Window::ImplGetFrameWindow() const
1515cdf0e10cSrcweir {
1516cdf0e10cSrcweir     return mpWindowImpl->mpFrameWindow;
1517cdf0e10cSrcweir }
1518cdf0e10cSrcweir 
ImplIsDockingWindow() const1519cdf0e10cSrcweir sal_Bool Window::ImplIsDockingWindow() const
1520cdf0e10cSrcweir {
1521cdf0e10cSrcweir     return mpWindowImpl->mbDockWin;
1522cdf0e10cSrcweir }
1523cdf0e10cSrcweir 
ImplIsFloatingWindow() const1524cdf0e10cSrcweir sal_Bool Window::ImplIsFloatingWindow() const
1525cdf0e10cSrcweir {
1526cdf0e10cSrcweir     return mpWindowImpl->mbFloatWin;
1527cdf0e10cSrcweir }
1528cdf0e10cSrcweir 
ImplIsToolbox() const1529cdf0e10cSrcweir sal_Bool Window::ImplIsToolbox() const
1530cdf0e10cSrcweir {
1531cdf0e10cSrcweir     return mpWindowImpl->mbToolBox;
1532cdf0e10cSrcweir }
1533cdf0e10cSrcweir 
ImplIsSplitter() const1534cdf0e10cSrcweir sal_Bool Window::ImplIsSplitter() const
1535cdf0e10cSrcweir {
1536cdf0e10cSrcweir     return mpWindowImpl->mbSplitter;
1537cdf0e10cSrcweir }
1538cdf0e10cSrcweir 
ImplIsPushButton() const1539cdf0e10cSrcweir sal_Bool Window::ImplIsPushButton() const
1540cdf0e10cSrcweir {
1541cdf0e10cSrcweir     return mpWindowImpl->mbPushButton;
1542cdf0e10cSrcweir }
1543cdf0e10cSrcweir 
ImplIsOverlapWindow() const1544cdf0e10cSrcweir sal_Bool Window::ImplIsOverlapWindow() const
1545cdf0e10cSrcweir {
1546cdf0e10cSrcweir     return mpWindowImpl->mbOverlapWin;
1547cdf0e10cSrcweir }
1548cdf0e10cSrcweir 
ImplSetActive(sal_Bool bActive)1549cdf0e10cSrcweir void Window::ImplSetActive( sal_Bool bActive )
1550cdf0e10cSrcweir {
1551cdf0e10cSrcweir     mpWindowImpl->mbActive = bActive;
1552cdf0e10cSrcweir }
1553cdf0e10cSrcweir 
ImplIsMouseTransparent() const1554cdf0e10cSrcweir sal_Bool Window::ImplIsMouseTransparent() const
1555cdf0e10cSrcweir {
1556cdf0e10cSrcweir     return mpWindowImpl->mbMouseTransparent;
1557cdf0e10cSrcweir }
1558cdf0e10cSrcweir 
ImplSetMouseTransparent(sal_Bool bTransparent)1559cdf0e10cSrcweir void Window::ImplSetMouseTransparent( sal_Bool bTransparent )
1560cdf0e10cSrcweir {
1561cdf0e10cSrcweir     mpWindowImpl->mbMouseTransparent = bTransparent;
1562cdf0e10cSrcweir }
1563cdf0e10cSrcweir 
ImplOutputToFrame(const Point & rPos)1564cdf0e10cSrcweir Point Window::ImplOutputToFrame( const Point& rPos )
1565cdf0e10cSrcweir {
1566cdf0e10cSrcweir     return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY );
1567cdf0e10cSrcweir }
1568cdf0e10cSrcweir 
ImplFrameToOutput(const Point & rPos)1569cdf0e10cSrcweir Point Window::ImplFrameToOutput( const Point& rPos )
1570cdf0e10cSrcweir {
1571cdf0e10cSrcweir     return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY );
1572cdf0e10cSrcweir }
1573cdf0e10cSrcweir 
ImplOutputToFrame(Rectangle & rRect)1574cdf0e10cSrcweir void Window::ImplOutputToFrame( Rectangle& rRect )
1575cdf0e10cSrcweir {
1576cdf0e10cSrcweir     rRect.Left()+=mnOutOffX;
1577cdf0e10cSrcweir     rRect.Top()+=mnOutOffY;
1578cdf0e10cSrcweir     rRect.Right()+=mnOutOffX;
1579cdf0e10cSrcweir     rRect.Bottom()+=mnOutOffY;
1580cdf0e10cSrcweir }
1581cdf0e10cSrcweir 
ImplFrameToOutput(Rectangle & rRect)1582cdf0e10cSrcweir void Window::ImplFrameToOutput( Rectangle& rRect )
1583cdf0e10cSrcweir {
1584cdf0e10cSrcweir     rRect.Left()-=mnOutOffX;
1585cdf0e10cSrcweir     rRect.Top()-=mnOutOffY;
1586cdf0e10cSrcweir     rRect.Right()-=mnOutOffX;
1587cdf0e10cSrcweir     rRect.Bottom()-=mnOutOffY;
1588cdf0e10cSrcweir }
1589cdf0e10cSrcweir 
SetCompoundControl(sal_Bool bCompound)1590cdf0e10cSrcweir void Window::SetCompoundControl( sal_Bool bCompound )
1591cdf0e10cSrcweir {
1592cdf0e10cSrcweir     mpWindowImpl->mbCompoundControl = bCompound;
1593cdf0e10cSrcweir }
1594cdf0e10cSrcweir 
IncrementLockCount()1595cdf0e10cSrcweir void Window::IncrementLockCount()
1596cdf0e10cSrcweir {
1597cdf0e10cSrcweir     mpWindowImpl->mnLockCount++;
1598cdf0e10cSrcweir }
1599cdf0e10cSrcweir 
DecrementLockCount()1600cdf0e10cSrcweir void Window::DecrementLockCount()
1601cdf0e10cSrcweir {
1602cdf0e10cSrcweir     mpWindowImpl->mnLockCount--;
1603cdf0e10cSrcweir }
1604cdf0e10cSrcweir 
GetStyle() const1605cdf0e10cSrcweir WinBits Window::GetStyle() const
1606cdf0e10cSrcweir {
1607cdf0e10cSrcweir     return mpWindowImpl->mnStyle;
1608cdf0e10cSrcweir }
1609cdf0e10cSrcweir 
GetPrevStyle() const1610cdf0e10cSrcweir WinBits Window::GetPrevStyle() const
1611cdf0e10cSrcweir {
1612cdf0e10cSrcweir     return mpWindowImpl->mnPrevStyle;
1613cdf0e10cSrcweir }
1614cdf0e10cSrcweir 
GetExtendedStyle() const1615cdf0e10cSrcweir WinBits Window::GetExtendedStyle() const
1616cdf0e10cSrcweir {
1617cdf0e10cSrcweir     return mpWindowImpl->mnExtendedStyle;
1618cdf0e10cSrcweir }
1619cdf0e10cSrcweir 
GetPrevExtendedStyle() const1620cdf0e10cSrcweir WinBits Window::GetPrevExtendedStyle() const
1621cdf0e10cSrcweir {
1622cdf0e10cSrcweir     return mpWindowImpl->mnExtendedStyle;
1623cdf0e10cSrcweir }
1624cdf0e10cSrcweir 
SetType(WindowType nType)1625cdf0e10cSrcweir void Window::SetType( WindowType nType )
1626cdf0e10cSrcweir {
1627cdf0e10cSrcweir     mpWindowImpl->mnType = nType;
1628cdf0e10cSrcweir }
1629cdf0e10cSrcweir 
GetType() const1630cdf0e10cSrcweir WindowType Window::GetType() const
1631cdf0e10cSrcweir {
1632cdf0e10cSrcweir     return mpWindowImpl->mnType;
1633cdf0e10cSrcweir }
IsSystemWindow() const1634cdf0e10cSrcweir sal_Bool Window::IsSystemWindow() const
1635cdf0e10cSrcweir {
1636cdf0e10cSrcweir     return mpWindowImpl->mbSysWin;
1637cdf0e10cSrcweir }
1638cdf0e10cSrcweir 
IsDialog() const1639cdf0e10cSrcweir sal_Bool Window::IsDialog() const
1640cdf0e10cSrcweir {
1641cdf0e10cSrcweir     return mpWindowImpl->mbDialog;
1642cdf0e10cSrcweir }
1643cdf0e10cSrcweir 
IsMenuFloatingWindow() const1644cdf0e10cSrcweir sal_Bool Window::IsMenuFloatingWindow() const
1645cdf0e10cSrcweir {
1646cdf0e10cSrcweir     return mpWindowImpl->mbMenuFloatingWindow;
1647cdf0e10cSrcweir }
1648cdf0e10cSrcweir 
IsToolbarFloatingWindow() const1649cdf0e10cSrcweir sal_Bool Window::IsToolbarFloatingWindow() const
1650cdf0e10cSrcweir {
1651cdf0e10cSrcweir     return mpWindowImpl->mbToolbarFloatingWindow;
1652cdf0e10cSrcweir }
1653cdf0e10cSrcweir 
EnableAllResize(sal_Bool bEnable)1654cdf0e10cSrcweir void Window::EnableAllResize( sal_Bool bEnable )
1655cdf0e10cSrcweir {
1656cdf0e10cSrcweir     mpWindowImpl->mbAllResize = bEnable;
1657cdf0e10cSrcweir }
1658cdf0e10cSrcweir 
IsAllResizeEnabled() const1659cdf0e10cSrcweir sal_Bool Window::IsAllResizeEnabled() const
1660cdf0e10cSrcweir {
1661cdf0e10cSrcweir     return mpWindowImpl->mbAllResize;
1662cdf0e10cSrcweir }
1663cdf0e10cSrcweir 
IsClipSiblingsEnabled() const1664cdf0e10cSrcweir sal_Bool Window::IsClipSiblingsEnabled() const
1665cdf0e10cSrcweir {
1666cdf0e10cSrcweir     return mpWindowImpl->mbClipSiblings;
1667cdf0e10cSrcweir }
1668cdf0e10cSrcweir 
EnableChildTransparentMode(sal_Bool bEnable)1669cdf0e10cSrcweir void Window::EnableChildTransparentMode( sal_Bool bEnable )
1670cdf0e10cSrcweir {
1671cdf0e10cSrcweir     mpWindowImpl->mbChildTransparent = bEnable;
1672cdf0e10cSrcweir }
1673cdf0e10cSrcweir 
IsChildTransparentModeEnabled() const1674cdf0e10cSrcweir sal_Bool Window::IsChildTransparentModeEnabled() const
1675cdf0e10cSrcweir {
1676cdf0e10cSrcweir     return mpWindowImpl->mbChildTransparent;
1677cdf0e10cSrcweir }
1678cdf0e10cSrcweir 
IsMouseTransparent() const1679cdf0e10cSrcweir sal_Bool Window::IsMouseTransparent() const
1680cdf0e10cSrcweir {
1681cdf0e10cSrcweir     return mpWindowImpl->mbMouseTransparent;
1682cdf0e10cSrcweir }
1683cdf0e10cSrcweir 
IsPaintTransparent() const1684cdf0e10cSrcweir sal_Bool Window::IsPaintTransparent() const
1685cdf0e10cSrcweir {
1686cdf0e10cSrcweir     return mpWindowImpl->mbPaintTransparent;
1687cdf0e10cSrcweir }
1688cdf0e10cSrcweir 
SetDialogControlStart(sal_Bool bStart)1689cdf0e10cSrcweir void Window::SetDialogControlStart( sal_Bool bStart )
1690cdf0e10cSrcweir {
1691cdf0e10cSrcweir     mpWindowImpl->mbDlgCtrlStart = bStart;
1692cdf0e10cSrcweir }
1693cdf0e10cSrcweir 
IsDialogControlStart() const1694cdf0e10cSrcweir sal_Bool Window::IsDialogControlStart() const
1695cdf0e10cSrcweir {
1696cdf0e10cSrcweir     return mpWindowImpl->mbDlgCtrlStart;
1697cdf0e10cSrcweir }
1698cdf0e10cSrcweir 
SetDialogControlFlags(sal_uInt16 nFlags)1699cdf0e10cSrcweir void Window::SetDialogControlFlags( sal_uInt16 nFlags )
1700cdf0e10cSrcweir {
1701cdf0e10cSrcweir     mpWindowImpl->mnDlgCtrlFlags = nFlags;
1702cdf0e10cSrcweir }
1703cdf0e10cSrcweir 
GetDialogControlFlags() const1704cdf0e10cSrcweir sal_uInt16 Window::GetDialogControlFlags() const
1705cdf0e10cSrcweir {
1706cdf0e10cSrcweir     return mpWindowImpl->mnDlgCtrlFlags;
1707cdf0e10cSrcweir }
1708cdf0e10cSrcweir 
GetInputContext() const1709cdf0e10cSrcweir const InputContext& Window::GetInputContext() const
1710cdf0e10cSrcweir {
1711cdf0e10cSrcweir     return mpWindowImpl->maInputContext;
1712cdf0e10cSrcweir }
1713cdf0e10cSrcweir 
IsExtTextInput() const1714cdf0e10cSrcweir sal_Bool Window::IsExtTextInput() const
1715cdf0e10cSrcweir {
1716cdf0e10cSrcweir     return mpWindowImpl->mbExtTextInput;
1717cdf0e10cSrcweir }
1718cdf0e10cSrcweir 
EnableChildNotify(sal_Bool bEnable)1719cdf0e10cSrcweir void Window::EnableChildNotify( sal_Bool bEnable )
1720cdf0e10cSrcweir {
1721cdf0e10cSrcweir     mpWindowImpl->mbChildNotify = bEnable;
1722cdf0e10cSrcweir }
1723cdf0e10cSrcweir 
IsChildNotify() const1724cdf0e10cSrcweir sal_Bool Window::IsChildNotify() const
1725cdf0e10cSrcweir {
1726cdf0e10cSrcweir     return mpWindowImpl->mbChildNotify;
1727cdf0e10cSrcweir }
1728cdf0e10cSrcweir 
IsControlFont() const1729cdf0e10cSrcweir sal_Bool Window::IsControlFont() const
1730cdf0e10cSrcweir {
1731cdf0e10cSrcweir     return (mpWindowImpl->mpControlFont != 0);
1732cdf0e10cSrcweir }
1733cdf0e10cSrcweir 
GetControlForeground() const1734cdf0e10cSrcweir Color Window::GetControlForeground() const
1735cdf0e10cSrcweir {
1736cdf0e10cSrcweir     return mpWindowImpl->maControlForeground;
1737cdf0e10cSrcweir }
1738cdf0e10cSrcweir 
IsControlForeground() const1739cdf0e10cSrcweir sal_Bool Window::IsControlForeground() const
1740cdf0e10cSrcweir {
1741cdf0e10cSrcweir     return mpWindowImpl->mbControlForeground;
1742cdf0e10cSrcweir }
1743cdf0e10cSrcweir 
GetControlBackground() const1744cdf0e10cSrcweir Color Window::GetControlBackground() const
1745cdf0e10cSrcweir {
1746cdf0e10cSrcweir     return mpWindowImpl->maControlBackground;
1747cdf0e10cSrcweir }
1748cdf0e10cSrcweir 
IsControlBackground() const1749cdf0e10cSrcweir sal_Bool Window::IsControlBackground() const
1750cdf0e10cSrcweir {
1751cdf0e10cSrcweir     return mpWindowImpl->mbControlBackground;
1752cdf0e10cSrcweir }
1753cdf0e10cSrcweir 
IsInPaint() const1754cdf0e10cSrcweir sal_Bool Window::IsInPaint() const
1755cdf0e10cSrcweir {
1756cdf0e10cSrcweir     return mpWindowImpl->mbInPaint;
1757cdf0e10cSrcweir }
1758cdf0e10cSrcweir 
GetParent() const1759cdf0e10cSrcweir Window* Window::GetParent() const
1760cdf0e10cSrcweir {
1761cdf0e10cSrcweir     return mpWindowImpl->mpRealParent;
1762cdf0e10cSrcweir }
1763cdf0e10cSrcweir 
IsVisible() const1764cdf0e10cSrcweir sal_Bool Window::IsVisible() const
1765cdf0e10cSrcweir {
1766cdf0e10cSrcweir     return mpWindowImpl->mbVisible;
1767cdf0e10cSrcweir }
1768cdf0e10cSrcweir 
IsReallyVisible() const1769cdf0e10cSrcweir sal_Bool Window::IsReallyVisible() const
1770cdf0e10cSrcweir {
1771cdf0e10cSrcweir     return mpWindowImpl->mbReallyVisible;
1772cdf0e10cSrcweir }
1773cdf0e10cSrcweir 
IsParentPathVisible() const1774cdf0e10cSrcweir sal_Bool Window::IsParentPathVisible() const
1775cdf0e10cSrcweir {
1776cdf0e10cSrcweir     return mpWindowImpl->mbReallyVisible;
1777cdf0e10cSrcweir }
1778cdf0e10cSrcweir 
IsReallyShown() const1779cdf0e10cSrcweir sal_Bool Window::IsReallyShown() const
1780cdf0e10cSrcweir {
1781cdf0e10cSrcweir     return mpWindowImpl->mbReallyShown;
1782cdf0e10cSrcweir }
1783cdf0e10cSrcweir 
IsInInitShow() const1784cdf0e10cSrcweir sal_Bool Window::IsInInitShow() const
1785cdf0e10cSrcweir {
1786cdf0e10cSrcweir     return mpWindowImpl->mbInInitShow;
1787cdf0e10cSrcweir }
1788cdf0e10cSrcweir 
IsEnabled() const1789cdf0e10cSrcweir sal_Bool Window::IsEnabled() const
1790cdf0e10cSrcweir {
1791cdf0e10cSrcweir     return !mpWindowImpl->mbDisabled;
1792cdf0e10cSrcweir }
1793cdf0e10cSrcweir 
IsInputEnabled() const1794cdf0e10cSrcweir sal_Bool Window::IsInputEnabled() const
1795cdf0e10cSrcweir {
1796cdf0e10cSrcweir     return !mpWindowImpl->mbInputDisabled;
1797cdf0e10cSrcweir }
1798cdf0e10cSrcweir 
IsAlwaysEnableInput() const1799cdf0e10cSrcweir sal_Bool Window::IsAlwaysEnableInput() const
1800cdf0e10cSrcweir {
1801cdf0e10cSrcweir     return mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled;
1802cdf0e10cSrcweir }
1803cdf0e10cSrcweir 
IsAlwaysDisableInput() const1804cdf0e10cSrcweir sal_Bool Window::IsAlwaysDisableInput() const
1805cdf0e10cSrcweir {
1806cdf0e10cSrcweir     return mpWindowImpl->meAlwaysInputMode == AlwaysInputDisabled;
1807cdf0e10cSrcweir }
1808cdf0e10cSrcweir 
GetActivateMode() const1809cdf0e10cSrcweir sal_uInt16 Window::GetActivateMode() const
1810cdf0e10cSrcweir {
1811cdf0e10cSrcweir     return mpWindowImpl->mnActivateMode;
1812cdf0e10cSrcweir 
1813cdf0e10cSrcweir }
1814cdf0e10cSrcweir 
IsAlwaysOnTopEnabled() const1815cdf0e10cSrcweir sal_Bool Window::IsAlwaysOnTopEnabled() const
1816cdf0e10cSrcweir {
1817cdf0e10cSrcweir     return mpWindowImpl->mbAlwaysOnTop;
1818cdf0e10cSrcweir }
1819cdf0e10cSrcweir 
IsDefaultPos() const1820cdf0e10cSrcweir sal_Bool Window::IsDefaultPos() const
1821cdf0e10cSrcweir {
1822cdf0e10cSrcweir     return mpWindowImpl->mbDefPos;
1823cdf0e10cSrcweir }
1824cdf0e10cSrcweir 
IsDefaultSize() const1825cdf0e10cSrcweir sal_Bool Window::IsDefaultSize() const
1826cdf0e10cSrcweir {
1827cdf0e10cSrcweir     return mpWindowImpl->mbDefSize;
1828cdf0e10cSrcweir }
1829cdf0e10cSrcweir 
EnablePaint(sal_Bool bEnable)1830cdf0e10cSrcweir void Window::EnablePaint( sal_Bool bEnable )
1831cdf0e10cSrcweir {
1832cdf0e10cSrcweir     mpWindowImpl->mbPaintDisabled = !bEnable;
1833cdf0e10cSrcweir }
1834cdf0e10cSrcweir 
IsPaintEnabled() const1835cdf0e10cSrcweir sal_Bool Window::IsPaintEnabled() const
1836cdf0e10cSrcweir {
1837cdf0e10cSrcweir     return !mpWindowImpl->mbPaintDisabled;
1838cdf0e10cSrcweir }
1839cdf0e10cSrcweir 
IsUpdateMode() const1840cdf0e10cSrcweir sal_Bool Window::IsUpdateMode() const
1841cdf0e10cSrcweir {
1842cdf0e10cSrcweir     return !mpWindowImpl->mbNoUpdate;
1843cdf0e10cSrcweir }
1844cdf0e10cSrcweir 
SetParentUpdateMode(sal_Bool bUpdate)1845cdf0e10cSrcweir void Window::SetParentUpdateMode( sal_Bool bUpdate )
1846cdf0e10cSrcweir {
1847cdf0e10cSrcweir     mpWindowImpl->mbNoParentUpdate = !bUpdate;
1848cdf0e10cSrcweir }
1849cdf0e10cSrcweir 
IsParentUpdateMode() const1850cdf0e10cSrcweir sal_Bool Window::IsParentUpdateMode() const
1851cdf0e10cSrcweir {
1852cdf0e10cSrcweir     return !mpWindowImpl->mbNoParentUpdate;
1853cdf0e10cSrcweir }
1854cdf0e10cSrcweir 
IsActive() const1855cdf0e10cSrcweir sal_Bool Window::IsActive() const
1856cdf0e10cSrcweir {
1857cdf0e10cSrcweir     return mpWindowImpl->mbActive;
1858cdf0e10cSrcweir }
1859cdf0e10cSrcweir 
GetGetFocusFlags() const1860cdf0e10cSrcweir sal_uInt16 Window::GetGetFocusFlags() const
1861cdf0e10cSrcweir {
1862cdf0e10cSrcweir     return mpWindowImpl->mnGetFocusFlags;
1863cdf0e10cSrcweir }
1864cdf0e10cSrcweir 
IsCompoundControl() const1865cdf0e10cSrcweir sal_Bool Window::IsCompoundControl() const
1866cdf0e10cSrcweir {
1867cdf0e10cSrcweir     return mpWindowImpl->mbCompoundControl;
1868cdf0e10cSrcweir }
1869cdf0e10cSrcweir 
HasCompoundControlFocus() const1870cdf0e10cSrcweir sal_Bool Window::HasCompoundControlFocus() const
1871cdf0e10cSrcweir {
1872cdf0e10cSrcweir     return mpWindowImpl->mbCompoundControlHasFocus;
1873cdf0e10cSrcweir }
1874cdf0e10cSrcweir 
IsChildPointerOverwrite() const1875cdf0e10cSrcweir sal_Bool Window::IsChildPointerOverwrite() const
1876cdf0e10cSrcweir {
1877cdf0e10cSrcweir     return mpWindowImpl->mbChildPtrOverwrite;
1878cdf0e10cSrcweir }
1879cdf0e10cSrcweir 
IsPointerVisible() const1880cdf0e10cSrcweir sal_Bool Window::IsPointerVisible() const
1881cdf0e10cSrcweir {
1882cdf0e10cSrcweir     return !mpWindowImpl->mbNoPtrVisible;
1883cdf0e10cSrcweir }
1884cdf0e10cSrcweir 
IsWait() const1885cdf0e10cSrcweir sal_Bool Window::IsWait() const
1886cdf0e10cSrcweir {
1887cdf0e10cSrcweir     return (mpWindowImpl->mnWaitCount != 0);
1888cdf0e10cSrcweir }
1889cdf0e10cSrcweir 
GetCursor() const1890cdf0e10cSrcweir Cursor* Window::GetCursor() const
1891cdf0e10cSrcweir {
1892cdf0e10cSrcweir     return mpWindowImpl->mpCursor;
1893cdf0e10cSrcweir }
1894cdf0e10cSrcweir 
GetZoom() const1895cdf0e10cSrcweir const Fraction& Window::GetZoom() const
1896cdf0e10cSrcweir {
1897cdf0e10cSrcweir     return mpWindowImpl->maZoom;
1898cdf0e10cSrcweir }
1899cdf0e10cSrcweir 
IsZoom() const1900cdf0e10cSrcweir sal_Bool Window::IsZoom() const
1901cdf0e10cSrcweir {
1902cdf0e10cSrcweir     return mpWindowImpl->maZoom.GetNumerator() != mpWindowImpl->maZoom.GetDenominator();
1903cdf0e10cSrcweir }
1904cdf0e10cSrcweir 
SetHelpText(const XubString & rHelpText)1905cdf0e10cSrcweir void Window::SetHelpText( const XubString& rHelpText )
1906cdf0e10cSrcweir {
1907cdf0e10cSrcweir     mpWindowImpl->maHelpText = rHelpText;
1908cdf0e10cSrcweir     mpWindowImpl->mbHelpTextDynamic = sal_True;
1909cdf0e10cSrcweir }
1910cdf0e10cSrcweir 
SetQuickHelpText(const XubString & rHelpText)1911cdf0e10cSrcweir void Window::SetQuickHelpText( const XubString& rHelpText )
1912cdf0e10cSrcweir {
1913cdf0e10cSrcweir     mpWindowImpl->maQuickHelpText = rHelpText;
1914cdf0e10cSrcweir }
1915cdf0e10cSrcweir 
GetQuickHelpText() const1916cdf0e10cSrcweir const XubString& Window::GetQuickHelpText() const
1917cdf0e10cSrcweir {
1918cdf0e10cSrcweir     return mpWindowImpl->maQuickHelpText;
1919cdf0e10cSrcweir }
1920cdf0e10cSrcweir 
SetData(void * pNewData)1921cdf0e10cSrcweir void Window::SetData( void* pNewData )
1922cdf0e10cSrcweir {
1923cdf0e10cSrcweir     mpWindowImpl->mpUserData = pNewData;
1924cdf0e10cSrcweir }
1925cdf0e10cSrcweir 
GetData() const1926cdf0e10cSrcweir void* Window::GetData() const
1927cdf0e10cSrcweir {
1928cdf0e10cSrcweir     return mpWindowImpl->mpUserData;
1929cdf0e10cSrcweir }
1930cdf0e10cSrcweir 
IsCreatedWithToolkit() const1931cdf0e10cSrcweir sal_Bool Window::IsCreatedWithToolkit() const
1932cdf0e10cSrcweir {
1933cdf0e10cSrcweir     return mpWindowImpl->mbCreatedWithToolkit;
1934cdf0e10cSrcweir }
1935cdf0e10cSrcweir 
SetCreatedWithToolkit(sal_Bool b)1936cdf0e10cSrcweir void Window::SetCreatedWithToolkit( sal_Bool b )
1937cdf0e10cSrcweir {
1938cdf0e10cSrcweir     mpWindowImpl->mbCreatedWithToolkit = b;
1939cdf0e10cSrcweir 
1940cdf0e10cSrcweir }
GetPointer() const1941cdf0e10cSrcweir const Pointer& Window::GetPointer() const
1942cdf0e10cSrcweir {
1943cdf0e10cSrcweir     return mpWindowImpl->maPointer;
1944cdf0e10cSrcweir }
1945cdf0e10cSrcweir 
GetWindowPeer() const1946cdf0e10cSrcweir VCLXWindow* Window::GetWindowPeer() const
1947cdf0e10cSrcweir {
1948cdf0e10cSrcweir     return mpWindowImpl->mpVCLXWindow;
1949cdf0e10cSrcweir }
1950cdf0e10cSrcweir 
SetPosPixel(const Point & rNewPos)1951cdf0e10cSrcweir void Window::SetPosPixel( const Point& rNewPos )
1952cdf0e10cSrcweir {
1953cdf0e10cSrcweir     SetPosSizePixel( rNewPos.X(), rNewPos.Y(), 0, 0, WINDOW_POSSIZE_POS );
1954cdf0e10cSrcweir }
1955cdf0e10cSrcweir 
SetSizePixel(const Size & rNewSize)1956cdf0e10cSrcweir void Window::SetSizePixel( const Size& rNewSize )
1957cdf0e10cSrcweir {
1958cdf0e10cSrcweir     SetPosSizePixel( 0, 0, rNewSize.Width(), rNewSize.Height(),
1959cdf0e10cSrcweir                      WINDOW_POSSIZE_SIZE );
1960cdf0e10cSrcweir }
1961cdf0e10cSrcweir 
SetPosSizePixel(const Point & rNewPos,const Size & rNewSize)1962cdf0e10cSrcweir void Window::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
1963cdf0e10cSrcweir {
1964cdf0e10cSrcweir     SetPosSizePixel( rNewPos.X(), rNewPos.Y(),
1965cdf0e10cSrcweir                      rNewSize.Width(), rNewSize.Height(),
1966cdf0e10cSrcweir                      WINDOW_POSSIZE_POSSIZE );
1967cdf0e10cSrcweir }
1968cdf0e10cSrcweir 
SetOutputSizePixel(const Size & rNewSize)1969cdf0e10cSrcweir void Window::SetOutputSizePixel( const Size& rNewSize )
1970cdf0e10cSrcweir {
1971cdf0e10cSrcweir     SetSizePixel( Size( rNewSize.Width()+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder,
1972cdf0e10cSrcweir                         rNewSize.Height()+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ) );
1973cdf0e10cSrcweir }
1974cdf0e10cSrcweir 
1975