Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <limits.h>
31 : : #include <tools/debug.hxx>
32 : : #include <tools/poly.hxx>
33 : :
34 : : #include <vcl/bitmap.hxx>
35 : : #include <vcl/event.hxx>
36 : : #include <vcl/timer.hxx>
37 : : #include <vcl/metric.hxx>
38 : : #include <vcl/virdev.hxx>
39 : : #include <vcl/window.hxx>
40 : : #include <vcl/scrbar.hxx>
41 : : #include <vcl/dockwin.hxx>
42 : :
43 : : #include <window.h>
44 : : #include <outfont.hxx>
45 : : #include <outdev.h>
46 : : #include <svdata.hxx>
47 : : #include <impbmp.hxx>
48 : : #include <salbmp.hxx>
49 : : #include <salgdi.hxx>
50 : : #include <salframe.hxx>
51 : : #include <scrwnd.hxx>
52 : :
53 : :
54 : : // =======================================================================
55 : :
56 : : DBG_NAMEEX( Window )
57 : :
58 : : // =======================================================================
59 : :
60 : : #define IMPL_MAXSAVEBACKSIZE (640*480)
61 : : #define IMPL_MAXALLSAVEBACKSIZE (800*600*2)
62 : :
63 : : // =======================================================================
64 : :
65 [ - + ]: 40 : struct ImplFocusDelData : public ImplDelData
66 : : {
67 : : Window* mpFocusWin;
68 : : };
69 : :
70 : : // =======================================================================
71 : :
72 : 0 : sal_Bool Window::ImplIsWindowInFront( const Window* pTestWindow ) const
73 : : {
74 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
75 : : DBG_CHKOBJ( pTestWindow, Window, ImplDbgCheckWindow );
76 : :
77 : : // check for overlapping window
78 : 0 : pTestWindow = pTestWindow->ImplGetFirstOverlapWindow();
79 : 0 : const Window* pTempWindow = pTestWindow;
80 : 0 : const Window* pThisWindow = ImplGetFirstOverlapWindow();
81 [ # # ]: 0 : if ( pTempWindow == pThisWindow )
82 : 0 : return sal_False;
83 [ # # ]: 0 : do
84 : : {
85 [ # # ]: 0 : if ( pTempWindow == pThisWindow )
86 : 0 : return sal_True;
87 [ # # ]: 0 : if ( pTempWindow->mpWindowImpl->mbFrame )
88 : 0 : break;
89 : 0 : pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
90 : : }
91 : : while ( pTempWindow );
92 : 0 : pTempWindow = pThisWindow;
93 [ # # ]: 0 : do
94 : : {
95 [ # # ]: 0 : if ( pTempWindow == pTestWindow )
96 : 0 : return sal_False;
97 [ # # ]: 0 : if ( pTempWindow->mpWindowImpl->mbFrame )
98 : 0 : break;
99 : 0 : pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
100 : : }
101 : : while ( pTempWindow );
102 : :
103 : : // move window to same level
104 [ # # ]: 0 : if ( pThisWindow->mpWindowImpl->mpOverlapWindow != pTestWindow->mpWindowImpl->mpOverlapWindow )
105 : : {
106 : 0 : sal_uInt16 nThisLevel = 0;
107 : 0 : sal_uInt16 nTestLevel = 0;
108 : 0 : pTempWindow = pThisWindow;
109 [ # # ]: 0 : do
110 : : {
111 : 0 : nThisLevel++;
112 : 0 : pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
113 : : }
114 : 0 : while ( !pTempWindow->mpWindowImpl->mbFrame );
115 : 0 : pTempWindow = pTestWindow;
116 [ # # ]: 0 : do
117 : : {
118 : 0 : nTestLevel++;
119 : 0 : pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
120 : : }
121 : 0 : while ( !pTempWindow->mpWindowImpl->mbFrame );
122 : :
123 [ # # ]: 0 : if ( nThisLevel < nTestLevel )
124 : : {
125 [ # # ]: 0 : do
126 : : {
127 [ # # ]: 0 : if ( pTestWindow->mpWindowImpl->mpOverlapWindow == pThisWindow->mpWindowImpl->mpOverlapWindow )
128 : 0 : break;
129 [ # # ]: 0 : if ( pTestWindow->mpWindowImpl->mbFrame )
130 : 0 : break;
131 : 0 : pTestWindow = pTestWindow->mpWindowImpl->mpOverlapWindow;
132 : : }
133 : : while ( pTestWindow );
134 : : }
135 : : else
136 : : {
137 [ # # ]: 0 : do
138 : : {
139 [ # # ]: 0 : if ( pThisWindow->mpWindowImpl->mpOverlapWindow == pTempWindow->mpWindowImpl->mpOverlapWindow )
140 : 0 : break;
141 [ # # ]: 0 : if ( pThisWindow->mpWindowImpl->mbFrame )
142 : 0 : break;
143 : 0 : pThisWindow = pThisWindow->mpWindowImpl->mpOverlapWindow;
144 : : }
145 : : while ( pThisWindow );
146 : : }
147 : : }
148 : :
149 : : // if TestWindow is before ThisWindow, it is in front
150 : 0 : pTempWindow = pTestWindow;
151 [ # # ]: 0 : do
152 : : {
153 [ # # ]: 0 : if ( pTempWindow == pThisWindow )
154 : 0 : return sal_True;
155 : 0 : pTempWindow = pTempWindow->mpWindowImpl->mpNext;
156 : : }
157 : : while ( pTempWindow );
158 : :
159 : 0 : return sal_False;
160 : : }
161 : :
162 : : // =======================================================================
163 : :
164 : 0 : void Window::ImplSaveOverlapBackground()
165 : : {
166 : : DBG_ASSERT( !mpWindowImpl->mpOverlapData->mpSaveBackDev, "Window::ImplSaveOverlapBackground() - Background already saved" );
167 : :
168 [ # # ]: 0 : if ( !mpWindowImpl->mbFrame )
169 : : {
170 : 0 : sal_uLong nSaveBackSize = mnOutWidth*mnOutHeight;
171 [ # # ]: 0 : if ( nSaveBackSize <= IMPL_MAXSAVEBACKSIZE )
172 : : {
173 [ # # ]: 0 : if ( nSaveBackSize+mpWindowImpl->mpFrameData->mnAllSaveBackSize <= IMPL_MAXALLSAVEBACKSIZE )
174 : : {
175 : 0 : Size aOutSize( mnOutWidth, mnOutHeight );
176 [ # # ][ # # ]: 0 : mpWindowImpl->mpOverlapData->mpSaveBackDev = new VirtualDevice( *mpWindowImpl->mpFrameWindow );
177 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackDev->SetOutputSizePixel( aOutSize ) )
178 : : {
179 [ # # ]: 0 : mpWindowImpl->mpFrameWindow->ImplUpdateAll();
180 : :
181 [ # # ]: 0 : if ( mpWindowImpl->mbInitWinClipRegion )
182 [ # # ]: 0 : ImplInitWinClipRegion();
183 : :
184 : 0 : mpWindowImpl->mpOverlapData->mnSaveBackSize = nSaveBackSize;
185 : 0 : mpWindowImpl->mpFrameData->mnAllSaveBackSize += nSaveBackSize;
186 : 0 : Point aDevPt;
187 : : mpWindowImpl->mpFrameWindow->ImplGetFrameDev( Point( mnOutOffX, mnOutOffY ),
188 : : aDevPt, aOutSize,
189 [ # # ]: 0 : *(mpWindowImpl->mpOverlapData->mpSaveBackDev) );
190 : 0 : mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpFrameData->mpFirstBackWin;
191 : 0 : mpWindowImpl->mpFrameData->mpFirstBackWin = this;
192 : : }
193 : : else
194 : : {
195 [ # # ][ # # ]: 0 : delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
196 : 0 : mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
197 : : }
198 : : }
199 : : }
200 : : }
201 : 0 : }
202 : :
203 : : // -----------------------------------------------------------------------
204 : :
205 : 0 : sal_Bool Window::ImplRestoreOverlapBackground( Region& rInvRegion )
206 : : {
207 [ # # ]: 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
208 : : {
209 [ # # ]: 0 : if ( mpWindowImpl->mbInitWinClipRegion )
210 : 0 : ImplInitWinClipRegion();
211 : :
212 [ # # ]: 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
213 : : {
214 : 0 : Point aDevPt;
215 : 0 : Point aDestPt( mnOutOffX, mnOutOffY );
216 : 0 : Size aDevSize = mpWindowImpl->mpOverlapData->mpSaveBackDev->GetOutputSizePixel();
217 [ # # ]: 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
218 : : {
219 [ # # ]: 0 : mpWindowImpl->mpOverlapData->mpSaveBackRgn->Intersect( mpWindowImpl->maWinClipRegion );
220 [ # # ]: 0 : rInvRegion = mpWindowImpl->maWinClipRegion;
221 [ # # ]: 0 : rInvRegion.Exclude( *mpWindowImpl->mpOverlapData->mpSaveBackRgn );
222 : : mpWindowImpl->mpFrameWindow->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
223 : : *(mpWindowImpl->mpOverlapData->mpSaveBackDev),
224 [ # # ]: 0 : *mpWindowImpl->mpOverlapData->mpSaveBackRgn );
225 : : }
226 : : else
227 : : {
228 : : mpWindowImpl->mpFrameWindow->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
229 : : *(mpWindowImpl->mpOverlapData->mpSaveBackDev),
230 [ # # ]: 0 : mpWindowImpl->maWinClipRegion );
231 : : }
232 [ # # ]: 0 : ImplDeleteOverlapBackground();
233 : : }
234 : :
235 : 0 : return sal_True;
236 : : }
237 : :
238 : 0 : return sal_False;
239 : : }
240 : :
241 : : // -----------------------------------------------------------------------
242 : :
243 : 0 : void Window::ImplDeleteOverlapBackground()
244 : : {
245 [ # # ]: 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
246 : : {
247 : 0 : mpWindowImpl->mpFrameData->mnAllSaveBackSize -= mpWindowImpl->mpOverlapData->mnSaveBackSize;
248 [ # # ]: 0 : delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
249 : 0 : mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
250 [ # # ]: 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
251 : : {
252 [ # # ]: 0 : delete mpWindowImpl->mpOverlapData->mpSaveBackRgn;
253 : 0 : mpWindowImpl->mpOverlapData->mpSaveBackRgn = NULL;
254 : : }
255 : :
256 : : // remove window from the list
257 [ # # ]: 0 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin == this )
258 : 0 : mpWindowImpl->mpFrameData->mpFirstBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
259 : : else
260 : : {
261 : 0 : Window* pTemp = mpWindowImpl->mpFrameData->mpFirstBackWin;
262 [ # # ]: 0 : while ( pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin != this )
263 : 0 : pTemp = pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin;
264 : 0 : pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
265 : : }
266 : 0 : mpWindowImpl->mpOverlapData->mpNextBackWin = NULL;
267 : : }
268 : 0 : }
269 : :
270 : : // -----------------------------------------------------------------------
271 : :
272 : 0 : void Window::ImplInvalidateAllOverlapBackgrounds()
273 : : {
274 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
275 : :
276 : 0 : Window* pWindow = mpWindowImpl->mpFrameData->mpFirstBackWin;
277 [ # # ]: 0 : while ( pWindow )
278 : : {
279 : : // remember next window here already, as this window could
280 : : // be removed within the next if clause from the list
281 : 0 : Window* pNext = pWindow->mpWindowImpl->mpOverlapData->mpNextBackWin;
282 : :
283 [ # # ]: 0 : if ( ImplIsWindowInFront( pWindow ) )
284 : : {
285 : : Rectangle aRect1( Point( mnOutOffX, mnOutOffY ),
286 [ # # ]: 0 : Size( mnOutWidth, mnOutHeight ) );
287 : : Rectangle aRect2( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
288 [ # # ]: 0 : Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
289 [ # # ]: 0 : aRect1.Intersection( aRect2 );
290 [ # # ][ # # ]: 0 : if ( !aRect1.IsEmpty() )
291 : : {
292 [ # # ]: 0 : if ( !pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn )
293 [ # # ][ # # ]: 0 : pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn = new Region( aRect2 );
294 [ # # ]: 0 : pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn->Exclude( aRect1 );
295 [ # # ][ # # ]: 0 : if ( pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn->IsEmpty() )
296 [ # # ]: 0 : pWindow->ImplDeleteOverlapBackground();
297 : : }
298 : :
299 : : }
300 : :
301 : 0 : pWindow = pNext;
302 : : }
303 : 0 : }
304 : :
305 : : // -----------------------------------------------------------------------
306 : :
307 : 101 : void Window::ShowFocus( const Rectangle& rRect )
308 : : {
309 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
310 : :
311 [ - + ]: 101 : if( mpWindowImpl->mbInShowFocus )
312 : 0 : return;
313 : 101 : mpWindowImpl->mbInShowFocus = sal_True;
314 : :
315 : 101 : ImplWinData* pWinData = ImplGetWinData();
316 : :
317 : : // native themeing suggest not to use focus rects
318 [ + - ]: 101 : if( ! ( mpWindowImpl->mbUseNativeFocus &&
319 [ # # ][ - + ]: 101 : IsNativeWidgetEnabled() ) )
320 : : {
321 [ + + ]: 101 : if ( !mpWindowImpl->mbInPaint )
322 : : {
323 [ + + ]: 47 : if ( mpWindowImpl->mbFocusVisible )
324 : : {
325 [ + - ]: 2 : if ( *(pWinData->mpFocusRect) == rRect )
326 : : {
327 : 2 : mpWindowImpl->mbInShowFocus = sal_False;
328 : 2 : return;
329 : : }
330 : :
331 : 0 : ImplInvertFocus( *(pWinData->mpFocusRect) );
332 : : }
333 : :
334 : 45 : ImplInvertFocus( rRect );
335 : : }
336 [ + + ]: 99 : if ( !pWinData->mpFocusRect )
337 : 42 : pWinData->mpFocusRect = new Rectangle( rRect );
338 : : else
339 : 57 : *(pWinData->mpFocusRect) = rRect;
340 : 99 : mpWindowImpl->mbFocusVisible = sal_True;
341 : : }
342 : : else
343 : : {
344 [ # # ]: 0 : if( ! mpWindowImpl->mbNativeFocusVisible )
345 : : {
346 : 0 : mpWindowImpl->mbNativeFocusVisible = sal_True;
347 [ # # ]: 0 : if ( !mpWindowImpl->mbInPaint )
348 : 0 : Invalidate();
349 : : }
350 : : }
351 : 101 : mpWindowImpl->mbInShowFocus = sal_False;
352 : : }
353 : :
354 : : // -----------------------------------------------------------------------
355 : :
356 : 14614 : void Window::HideFocus()
357 : : {
358 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
359 : :
360 [ - + ]: 14614 : if( mpWindowImpl->mbInHideFocus )
361 : 0 : return;
362 : 14614 : mpWindowImpl->mbInHideFocus = sal_True;
363 : :
364 : : // native themeing can suggest not to use focus rects
365 [ + - ]: 14614 : if( ! ( mpWindowImpl->mbUseNativeFocus &&
366 [ - + ][ # # ]: 14614 : IsNativeWidgetEnabled() ) )
367 : : {
368 [ + + ]: 14614 : if ( !mpWindowImpl->mbFocusVisible )
369 : : {
370 : 14534 : mpWindowImpl->mbInHideFocus = sal_False;
371 : 14534 : return;
372 : : }
373 : :
374 [ + + ]: 80 : if ( !mpWindowImpl->mbInPaint )
375 : 39 : ImplInvertFocus( *(ImplGetWinData()->mpFocusRect) );
376 : 80 : mpWindowImpl->mbFocusVisible = sal_False;
377 : : }
378 : : else
379 : : {
380 [ # # ]: 0 : if( mpWindowImpl->mbNativeFocusVisible )
381 : : {
382 : 0 : mpWindowImpl->mbNativeFocusVisible = sal_False;
383 [ # # ]: 0 : if ( !mpWindowImpl->mbInPaint )
384 : 0 : Invalidate();
385 : : }
386 : : }
387 : 14614 : mpWindowImpl->mbInHideFocus = sal_False;
388 : : }
389 : :
390 : : // -----------------------------------------------------------------------
391 : :
392 : 69718 : void Window::Invert( const Rectangle& rRect, sal_uInt16 nFlags )
393 : : {
394 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
395 : :
396 [ + + ]: 69718 : if ( !IsDeviceOutputNecessary() )
397 : : return;
398 : :
399 [ + - ]: 69661 : Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
400 : :
401 [ + - ][ + + ]: 69661 : if ( aRect.IsEmpty() )
402 : : return;
403 [ + - ]: 69519 : aRect.Justify();
404 : :
405 : : // we need a graphics
406 [ - + ]: 69519 : if ( !mpGraphics )
407 : : {
408 [ # # ][ # # ]: 0 : if ( !ImplGetGraphics() )
409 : : return;
410 : : }
411 : :
412 [ + + ]: 69519 : if ( mbInitClipRegion )
413 [ + - ]: 7696 : ImplInitClipRegion();
414 : :
415 [ + - ]: 69519 : if ( mbOutputClipped )
416 : : return;
417 : :
418 : 69519 : SalInvert nSalFlags = 0;
419 [ - + ]: 69519 : if ( nFlags & INVERT_HIGHLIGHT )
420 : 0 : nSalFlags |= SAL_INVERT_HIGHLIGHT;
421 [ - + ]: 69519 : if ( nFlags & INVERT_50 )
422 : 0 : nSalFlags |= SAL_INVERT_50;
423 [ + - ][ + - ]: 69718 : mpGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), nSalFlags, this );
[ + - ]
424 : : }
425 : :
426 : : // -----------------------------------------------------------------------
427 : :
428 : 0 : void Window::Invert( const Polygon& rPoly, sal_uInt16 nFlags )
429 : : {
430 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
431 : :
432 [ # # ]: 0 : if ( !IsDeviceOutputNecessary() )
433 : : return;
434 : :
435 [ # # ]: 0 : sal_uInt16 nPoints = rPoly.GetSize();
436 : :
437 [ # # ]: 0 : if ( nPoints < 2 )
438 : : return;
439 : :
440 [ # # ]: 0 : Polygon aPoly( ImplLogicToDevicePixel( rPoly ) );
441 : :
442 : : // we need a graphics
443 [ # # ]: 0 : if ( !mpGraphics )
444 : : {
445 [ # # ][ # # ]: 0 : if ( !ImplGetGraphics() )
446 : : return;
447 : : }
448 : :
449 [ # # ]: 0 : if ( mbInitClipRegion )
450 [ # # ]: 0 : ImplInitClipRegion();
451 : :
452 [ # # ]: 0 : if ( mbOutputClipped )
453 : : return;
454 : :
455 : 0 : SalInvert nSalFlags = 0;
456 [ # # ]: 0 : if ( nFlags & INVERT_HIGHLIGHT )
457 : 0 : nSalFlags |= SAL_INVERT_HIGHLIGHT;
458 [ # # ]: 0 : if ( nFlags & INVERT_50 )
459 : 0 : nSalFlags |= SAL_INVERT_50;
460 [ # # ]: 0 : const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry();
461 [ # # ][ # # ]: 0 : mpGraphics->Invert( nPoints, pPtAry, nSalFlags, this );
[ # # ]
462 : : }
463 : :
464 : : // -----------------------------------------------------------------------
465 : :
466 : 0 : void Window::ShowTracking( const Rectangle& rRect, sal_uInt16 nFlags )
467 : : {
468 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
469 : :
470 : 0 : ImplWinData* pWinData = ImplGetWinData();
471 : :
472 [ # # ][ # # ]: 0 : if ( !mpWindowImpl->mbInPaint || !(nFlags & SHOWTRACK_WINDOW) )
473 : : {
474 [ # # ]: 0 : if ( mpWindowImpl->mbTrackVisible )
475 : : {
476 [ # # ][ # # ]: 0 : if ( (*(pWinData->mpTrackRect) == rRect) &&
[ # # ]
477 : : (pWinData->mnTrackFlags == nFlags) )
478 : 0 : return;
479 : :
480 : 0 : InvertTracking( *(pWinData->mpTrackRect), pWinData->mnTrackFlags );
481 : : }
482 : :
483 : 0 : InvertTracking( rRect, nFlags );
484 : : }
485 : :
486 [ # # ]: 0 : if ( !pWinData->mpTrackRect )
487 : 0 : pWinData->mpTrackRect = new Rectangle( rRect );
488 : : else
489 : 0 : *(pWinData->mpTrackRect) = rRect;
490 : 0 : pWinData->mnTrackFlags = nFlags;
491 : 0 : mpWindowImpl->mbTrackVisible = sal_True;
492 : : }
493 : :
494 : : // -----------------------------------------------------------------------
495 : :
496 : 0 : void Window::HideTracking()
497 : : {
498 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
499 : :
500 [ # # ]: 0 : if ( mpWindowImpl->mbTrackVisible )
501 : : {
502 : 0 : ImplWinData* pWinData = ImplGetWinData();
503 [ # # ][ # # ]: 0 : if ( !mpWindowImpl->mbInPaint || !(pWinData->mnTrackFlags & SHOWTRACK_WINDOW) )
504 : 0 : InvertTracking( *(pWinData->mpTrackRect), pWinData->mnTrackFlags );
505 : 0 : mpWindowImpl->mbTrackVisible = sal_False;
506 : : }
507 : 0 : }
508 : :
509 : : // -----------------------------------------------------------------------
510 : :
511 : 153 : void Window::InvertTracking( const Rectangle& rRect, sal_uInt16 nFlags )
512 : : {
513 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
514 : :
515 [ + - ]: 153 : Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
516 : :
517 [ + - ][ + + ]: 153 : if ( aRect.IsEmpty() )
518 : : return;
519 [ + - ]: 147 : aRect.Justify();
520 : :
521 : : SalGraphics* pGraphics;
522 : :
523 [ + - ]: 147 : if ( nFlags & SHOWTRACK_WINDOW )
524 : : {
525 [ + + ]: 147 : if ( !IsDeviceOutputNecessary() )
526 : : return;
527 : :
528 : : // we need a graphics
529 [ - + ]: 135 : if ( !mpGraphics )
530 : : {
531 [ # # ][ # # ]: 0 : if ( !ImplGetGraphics() )
532 : : return;
533 : : }
534 : :
535 [ + + ]: 135 : if ( mbInitClipRegion )
536 [ + - ]: 45 : ImplInitClipRegion();
537 : :
538 [ + - ]: 135 : if ( mbOutputClipped )
539 : : return;
540 : :
541 : 135 : pGraphics = mpGraphics;
542 : : }
543 : : else
544 : : {
545 [ # # ]: 0 : pGraphics = ImplGetFrameGraphics();
546 : :
547 [ # # ]: 0 : if ( nFlags & SHOWTRACK_CLIP )
548 : : {
549 : 0 : Point aPoint( mnOutOffX, mnOutOffY );
550 : : Region aRegion( Rectangle( aPoint,
551 [ # # ][ # # ]: 0 : Size( mnOutWidth, mnOutHeight ) ) );
552 [ # # ]: 0 : ImplClipBoundaries( aRegion, sal_False, sal_False );
553 [ # # ][ # # ]: 0 : ImplSelectClipRegion( aRegion, pGraphics );
554 : : }
555 : : }
556 : :
557 : 135 : sal_uInt16 nStyle = nFlags & SHOWTRACK_STYLE;
558 [ - + ]: 135 : if ( nStyle == SHOWTRACK_OBJECT )
559 [ # # ][ # # ]: 0 : pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_INVERT_TRACKFRAME, this );
[ # # ]
560 [ - + ]: 135 : else if ( nStyle == SHOWTRACK_SPLIT )
561 [ # # ][ # # ]: 0 : pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_INVERT_50, this );
[ # # ]
562 : : else
563 : : {
564 : 135 : long nBorder = 1;
565 [ - + ]: 135 : if ( nStyle == SHOWTRACK_BIG )
566 : 0 : nBorder = 5;
567 [ + - ][ + - ]: 135 : pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), nBorder, SAL_INVERT_50, this );
568 [ + - ][ + - ]: 135 : pGraphics->Invert( aRect.Left(), aRect.Bottom()-nBorder+1, aRect.GetWidth(), nBorder, SAL_INVERT_50, this );
569 [ + - ][ + - ]: 135 : pGraphics->Invert( aRect.Left(), aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SAL_INVERT_50, this );
570 [ + - ][ + - ]: 153 : pGraphics->Invert( aRect.Right()-nBorder+1, aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SAL_INVERT_50, this );
571 : : }
572 : : }
573 : :
574 : : // -----------------------------------------------------------------------
575 : :
576 : 0 : void Window::InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags )
577 : : {
578 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
579 : :
580 [ # # ]: 0 : sal_uInt16 nPoints = rPoly.GetSize();
581 : :
582 [ # # ]: 0 : if ( nPoints < 2 )
583 : : return;
584 : :
585 [ # # ]: 0 : Polygon aPoly( ImplLogicToDevicePixel( rPoly ) );
586 : :
587 : : SalGraphics* pGraphics;
588 : :
589 [ # # ]: 0 : if ( nFlags & SHOWTRACK_WINDOW )
590 : : {
591 [ # # ]: 0 : if ( !IsDeviceOutputNecessary() )
592 : : return;
593 : :
594 : : // we need a graphics
595 [ # # ]: 0 : if ( !mpGraphics )
596 : : {
597 [ # # ][ # # ]: 0 : if ( !ImplGetGraphics() )
598 : : return;
599 : : }
600 : :
601 [ # # ]: 0 : if ( mbInitClipRegion )
602 [ # # ]: 0 : ImplInitClipRegion();
603 : :
604 [ # # ]: 0 : if ( mbOutputClipped )
605 : : return;
606 : :
607 : 0 : pGraphics = mpGraphics;
608 : : }
609 : : else
610 : : {
611 [ # # ]: 0 : pGraphics = ImplGetFrameGraphics();
612 : :
613 [ # # ]: 0 : if ( nFlags & SHOWTRACK_CLIP )
614 : : {
615 : 0 : Point aPoint( mnOutOffX, mnOutOffY );
616 : : Region aRegion( Rectangle( aPoint,
617 [ # # ][ # # ]: 0 : Size( mnOutWidth, mnOutHeight ) ) );
618 [ # # ]: 0 : ImplClipBoundaries( aRegion, sal_False, sal_False );
619 [ # # ][ # # ]: 0 : ImplSelectClipRegion( aRegion, pGraphics );
620 : : }
621 : : }
622 : :
623 [ # # ]: 0 : const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry();
624 [ # # ][ # # ]: 0 : pGraphics->Invert( nPoints, pPtAry, SAL_INVERT_TRACKFRAME, this );
[ # # ]
625 : : }
626 : :
627 : : // -----------------------------------------------------------------------
628 : :
629 : 0 : IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer )
630 : : {
631 [ # # ]: 0 : ImplSVData* pSVData = ImplGetSVData();
632 : :
633 : : // Bei Button-Repeat muessen wir den Timeout umsetzen
634 [ # # ]: 0 : if ( pSVData->maWinData.mnTrackFlags & STARTTRACK_BUTTONREPEAT )
635 [ # # ]: 0 : pTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonRepeat() );
636 : :
637 : : // Tracking-Event erzeugen
638 : 0 : Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
639 [ # # ][ # # ]: 0 : if( ImplIsAntiparallel() )
640 : : {
641 : : // - RTL - re-mirror frame pos at pChild
642 [ # # ]: 0 : ImplReMirror( aMousePos );
643 : : }
644 : : MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
645 : : mpWindowImpl->mpFrameData->mnClickCount, 0,
646 [ # # ]: 0 : mpWindowImpl->mpFrameData->mnMouseCode, mpWindowImpl->mpFrameData->mnMouseCode );
647 [ # # ]: 0 : TrackingEvent aTEvt( aMEvt, TRACKING_REPEAT );
648 [ # # ]: 0 : Tracking( aTEvt );
649 : :
650 : 0 : return 0;
651 : : }
652 : :
653 : : // -----------------------------------------------------------------------
654 : :
655 : 0 : void Window::StartTracking( sal_uInt16 nFlags )
656 : : {
657 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
658 : :
659 : 0 : ImplSVData* pSVData = ImplGetSVData();
660 : :
661 [ # # ]: 0 : if ( pSVData->maWinData.mpTrackWin != this )
662 : : {
663 [ # # ]: 0 : if ( pSVData->maWinData.mpTrackWin )
664 : 0 : pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
665 : : }
666 : :
667 [ # # ]: 0 : if ( nFlags & (STARTTRACK_SCROLLREPEAT | STARTTRACK_BUTTONREPEAT) )
668 : : {
669 [ # # ]: 0 : pSVData->maWinData.mpTrackTimer = new AutoTimer;
670 : :
671 [ # # ]: 0 : if ( nFlags & STARTTRACK_SCROLLREPEAT )
672 : 0 : pSVData->maWinData.mpTrackTimer->SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() );
673 : : else
674 : 0 : pSVData->maWinData.mpTrackTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() );
675 : 0 : pSVData->maWinData.mpTrackTimer->SetTimeoutHdl( LINK( this, Window, ImplTrackTimerHdl ) );
676 : 0 : pSVData->maWinData.mpTrackTimer->Start();
677 : : }
678 : :
679 : 0 : pSVData->maWinData.mpTrackWin = this;
680 : 0 : pSVData->maWinData.mnTrackFlags = nFlags;
681 : 0 : CaptureMouse();
682 : 0 : }
683 : :
684 : : // -----------------------------------------------------------------------
685 : :
686 : 8 : void Window::EndTracking( sal_uInt16 nFlags )
687 : : {
688 : 8 : ImplSVData* pSVData = ImplGetSVData();
689 : :
690 [ - + ]: 8 : if ( pSVData->maWinData.mpTrackWin == this )
691 : : {
692 : : // due to DbgChkThis in brackets, as the window could be destroyed
693 : : // in the handler
694 : : {
695 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
696 : :
697 [ # # ]: 0 : if ( pSVData->maWinData.mpTrackTimer )
698 : : {
699 [ # # ]: 0 : delete pSVData->maWinData.mpTrackTimer;
700 : 0 : pSVData->maWinData.mpTrackTimer = NULL;
701 : : }
702 : :
703 : 0 : pSVData->maWinData.mpTrackWin = NULL;
704 : 0 : pSVData->maWinData.mnTrackFlags = 0;
705 : 0 : ReleaseMouse();
706 : : }
707 : :
708 : : // call EndTracking if required
709 [ # # ]: 0 : if ( !(nFlags & ENDTRACK_DONTCALLHDL) )
710 : : {
711 : 0 : Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
712 [ # # ][ # # ]: 0 : if( ImplIsAntiparallel() )
713 : : {
714 : : // - RTL - re-mirror frame pos at pChild
715 [ # # ]: 0 : ImplReMirror( aMousePos );
716 : : }
717 : :
718 : : MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
719 : : mpWindowImpl->mpFrameData->mnClickCount, 0,
720 [ # # ]: 0 : mpWindowImpl->mpFrameData->mnMouseCode, mpWindowImpl->mpFrameData->mnMouseCode );
721 [ # # ]: 0 : TrackingEvent aTEvt( aMEvt, nFlags | ENDTRACK_END );
722 [ # # ]: 0 : Tracking( aTEvt );
723 : : }
724 : : }
725 : 8 : }
726 : :
727 : : // -----------------------------------------------------------------------
728 : :
729 : 28709 : sal_Bool Window::IsTracking() const
730 : : {
731 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
732 : :
733 : 28709 : return (ImplGetSVData()->maWinData.mpTrackWin == this);
734 : : }
735 : :
736 : : // -----------------------------------------------------------------------
737 : :
738 : 0 : void Window::StartAutoScroll( sal_uInt16 nFlags )
739 : : {
740 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
741 : :
742 : 0 : ImplSVData* pSVData = ImplGetSVData();
743 : :
744 [ # # ]: 0 : if ( pSVData->maWinData.mpAutoScrollWin != this )
745 : : {
746 [ # # ]: 0 : if ( pSVData->maWinData.mpAutoScrollWin )
747 : 0 : pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
748 : : }
749 : :
750 : 0 : pSVData->maWinData.mpAutoScrollWin = this;
751 : 0 : pSVData->maWinData.mnAutoScrollFlags = nFlags;
752 [ # # ]: 0 : pSVData->maAppData.mpWheelWindow = new ImplWheelWindow( this );
753 : 0 : }
754 : :
755 : : // -----------------------------------------------------------------------
756 : :
757 : 0 : void Window::EndAutoScroll()
758 : : {
759 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
760 : :
761 : 0 : ImplSVData* pSVData = ImplGetSVData();
762 : :
763 [ # # ]: 0 : if ( pSVData->maWinData.mpAutoScrollWin == this )
764 : : {
765 : 0 : pSVData->maWinData.mpAutoScrollWin = NULL;
766 : 0 : pSVData->maWinData.mnAutoScrollFlags = 0;
767 : 0 : pSVData->maAppData.mpWheelWindow->ImplStop();
768 : 0 : pSVData->maAppData.mpWheelWindow->doLazyDelete();
769 : 0 : pSVData->maAppData.mpWheelWindow = NULL;
770 : : }
771 : 0 : }
772 : :
773 : : // -----------------------------------------------------------------------
774 : :
775 : 0 : void Window::SaveBackground( const Point& rPos, const Size& rSize,
776 : : const Point& rDestOff, VirtualDevice& rSaveDevice )
777 : : {
778 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
779 : :
780 [ # # ]: 0 : if ( mpWindowImpl->mpPaintRegion )
781 : : {
782 [ # # ]: 0 : Region aClip( *mpWindowImpl->mpPaintRegion );
783 [ # # ]: 0 : const Point aPixPos( LogicToPixel( rPos ) );
784 : :
785 [ # # ]: 0 : aClip.Move( -mnOutOffX, -mnOutOffY );
786 [ # # ][ # # ]: 0 : aClip.Intersect( Rectangle( aPixPos, LogicToPixel( rSize ) ) );
[ # # ]
787 : :
788 [ # # ][ # # ]: 0 : if ( !aClip.IsEmpty() )
789 : : {
790 [ # # ]: 0 : const Region aOldClip( rSaveDevice.GetClipRegion() );
791 [ # # ]: 0 : const Point aPixOffset( rSaveDevice.LogicToPixel( rDestOff ) );
792 : 0 : const sal_Bool bMap = rSaveDevice.IsMapModeEnabled();
793 : :
794 : : // move clip region to have the same distance to DestOffset
795 [ # # ]: 0 : aClip.Move( aPixOffset.X() - aPixPos.X(), aPixOffset.Y() - aPixPos.Y() );
796 : :
797 : : // set pixel clip region
798 [ # # ]: 0 : rSaveDevice.EnableMapMode( sal_False );
799 [ # # ]: 0 : rSaveDevice.SetClipRegion( aClip );
800 [ # # ]: 0 : rSaveDevice.EnableMapMode( bMap );
801 [ # # ]: 0 : rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
802 [ # # ][ # # ]: 0 : rSaveDevice.SetClipRegion( aOldClip );
803 [ # # ]: 0 : }
804 : : }
805 : : else
806 : 0 : rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
807 : 0 : }
808 : :
809 : : // -----------------------------------------------------------------------
810 : :
811 : 16 : sal_uIntPtr Window::SaveFocus()
812 : : {
813 : 16 : ImplSVData* pSVData = ImplGetSVData();
814 [ + - ]: 16 : if ( pSVData->maWinData.mpFocusWin )
815 : : {
816 [ + - ]: 16 : ImplFocusDelData* pDelData = new ImplFocusDelData;
817 : 16 : pSVData->maWinData.mpFocusWin->ImplAddDel( pDelData );
818 : 16 : pDelData->mpFocusWin = pSVData->maWinData.mpFocusWin;
819 : 16 : return (sal_uIntPtr)(void*)pDelData;
820 : : }
821 : : else
822 : 16 : return 0;
823 : : }
824 : :
825 : : // -----------------------------------------------------------------------
826 : :
827 : 32 : sal_Bool Window::EndSaveFocus( sal_uIntPtr nSaveId, sal_Bool bRestore )
828 : : {
829 [ + + ]: 32 : if ( !nSaveId )
830 : 20 : return sal_False;
831 : : else
832 : : {
833 : 12 : sal_Bool bOK = sal_True;
834 : 12 : ImplFocusDelData* pDelData = (ImplFocusDelData*)(void*)nSaveId;
835 [ + - ]: 12 : if ( !pDelData->IsDead() )
836 : : {
837 : 12 : pDelData->mpFocusWin->ImplRemoveDel( pDelData );
838 [ + - ]: 12 : if ( bRestore )
839 : 12 : pDelData->mpFocusWin->GrabFocus();
840 : : }
841 : : else
842 : 0 : bOK = !bRestore;
843 [ + - ]: 12 : delete pDelData;
844 : 32 : return bOK;
845 : : }
846 : : }
847 : :
848 : : // -----------------------------------------------------------------------
849 : :
850 : 20462 : void Window::SetZoom( const Fraction& rZoom )
851 : : {
852 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
853 : :
854 [ + + ]: 20462 : if ( mpWindowImpl->maZoom != rZoom )
855 : : {
856 : 29 : mpWindowImpl->maZoom = rZoom;
857 : 29 : StateChanged( STATE_CHANGE_ZOOM );
858 : : }
859 : 20462 : }
860 : :
861 : : // -----------------------------------------------------------------------
862 : :
863 : 94 : inline long WinFloatRound( double fVal )
864 : : {
865 [ + + ]: 94 : return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) );
866 : : }
867 : :
868 : : // -----------------------------------------------------------------------
869 : :
870 : 54038 : void Window::SetZoomedPointFont( const Font& rFont )
871 : : {
872 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
873 : :
874 : 54038 : const Fraction& rZoom = GetZoom();
875 [ + + ]: 54038 : if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
876 : : {
877 [ + - ]: 39 : Font aFont( rFont );
878 [ + - ]: 39 : Size aSize = aFont.GetSize();
879 : 39 : double n = (double)aSize.Width();
880 : 39 : n *= (double)rZoom.GetNumerator();
881 : 39 : n /= (double)rZoom.GetDenominator();
882 : 39 : aSize.Width() = WinFloatRound( n );
883 : 39 : n = (double)aSize.Height();
884 : 39 : n *= (double)rZoom.GetNumerator();
885 : 39 : n /= (double)rZoom.GetDenominator();
886 : 39 : aSize.Height() = WinFloatRound( n );
887 [ + - ]: 39 : aFont.SetSize( aSize );
888 [ + - ]: 39 : SetPointFont( aFont );
889 : :
890 : : // Use another font if the representation is to be scaled,
891 : : // and the actual font is not scalable
892 [ + - ]: 39 : FontMetric aMetric = GetFontMetric();
893 [ + - ][ + - ]: 39 : long nFontDiff = Abs( GetFont().GetSize().Height()-aMetric.GetSize().Height() );
894 [ - + ][ # # ]: 39 : if ( (aMetric.GetType() == TYPE_RASTER) && (nFontDiff >= 2) )
[ - + ][ + - ]
895 : : {
896 : : sal_uInt16 nType;
897 [ # # ][ # # ]: 0 : if ( aMetric.GetPitch() == PITCH_FIXED )
898 : 0 : nType = DEFAULTFONT_FIXED;
899 : : else
900 : 0 : nType = DEFAULTFONT_UI_SANS;
901 [ # # ][ # # ]: 0 : Font aTempFont = GetDefaultFont( nType, GetSettings().GetLanguage(), 0 );
902 [ # # ][ # # ]: 0 : aFont.SetName( aTempFont.GetName() );
[ # # ]
903 [ # # ][ # # ]: 0 : SetPointFont( aFont );
904 [ + - ][ + - ]: 39 : }
905 : : }
906 : : else
907 : 53999 : SetPointFont( rFont );
908 : 54038 : }
909 : :
910 : : // -----------------------------------------------------------------------
911 : :
912 : 52742 : long Window::CalcZoom( long nCalc ) const
913 : : {
914 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
915 : :
916 : 52742 : const Fraction& rZoom = GetZoom();
917 [ + + ]: 52742 : if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
918 : : {
919 : 16 : double n = (double)nCalc;
920 : 16 : n *= (double)rZoom.GetNumerator();
921 : 16 : n /= (double)rZoom.GetDenominator();
922 : 16 : nCalc = WinFloatRound( n );
923 : : }
924 : 52742 : return nCalc;
925 : : }
926 : :
927 : : // -----------------------------------------------------------------------
928 : :
929 : 1597 : void Window::SetControlFont()
930 : : {
931 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
932 : :
933 [ - + ]: 1597 : if ( mpWindowImpl->mpControlFont )
934 : : {
935 [ # # ]: 0 : delete mpWindowImpl->mpControlFont;
936 : 0 : mpWindowImpl->mpControlFont = NULL;
937 : 0 : StateChanged( STATE_CHANGE_CONTROLFONT );
938 : : }
939 : 1597 : }
940 : :
941 : : // -----------------------------------------------------------------------
942 : :
943 : 7182 : void Window::SetControlFont( const Font& rFont )
944 : : {
945 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
946 : :
947 [ + - ][ + + ]: 7182 : if ( rFont == Font() )
948 : : {
949 : 1365 : SetControlFont();
950 : 1365 : return;
951 : : }
952 : :
953 [ + + ]: 5817 : if ( mpWindowImpl->mpControlFont )
954 : : {
955 [ + + ]: 5363 : if ( *mpWindowImpl->mpControlFont == rFont )
956 : 265 : return;
957 : 5098 : *mpWindowImpl->mpControlFont = rFont;
958 : : }
959 : : else
960 [ + - ]: 454 : mpWindowImpl->mpControlFont = new Font( rFont );
961 : :
962 : 7182 : StateChanged( STATE_CHANGE_CONTROLFONT );
963 : : }
964 : :
965 : : // -----------------------------------------------------------------------
966 : :
967 : 14503 : Font Window::GetControlFont() const
968 : : {
969 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
970 : :
971 [ + + ]: 14503 : if ( mpWindowImpl->mpControlFont )
972 : 12906 : return *mpWindowImpl->mpControlFont;
973 : : else
974 : : {
975 [ + - ]: 1597 : Font aFont;
976 [ + - ][ + - ]: 14503 : return aFont;
977 : : }
978 : : }
979 : :
980 : : // -----------------------------------------------------------------------
981 : :
982 : 1059 : void Window::SetControlForeground()
983 : : {
984 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
985 : :
986 [ - + ]: 1059 : if ( mpWindowImpl->mbControlForeground )
987 : : {
988 : 0 : mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT );
989 : 0 : mpWindowImpl->mbControlForeground = sal_False;
990 : 0 : StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
991 : : }
992 : 1059 : }
993 : :
994 : : // -----------------------------------------------------------------------
995 : :
996 : 50 : void Window::SetControlForeground( const Color& rColor )
997 : : {
998 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
999 : :
1000 [ - + ]: 50 : if ( rColor.GetTransparency() )
1001 : : {
1002 [ # # ]: 0 : if ( mpWindowImpl->mbControlForeground )
1003 : : {
1004 : 0 : mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT );
1005 : 0 : mpWindowImpl->mbControlForeground = sal_False;
1006 : 0 : StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
1007 : : }
1008 : : }
1009 : : else
1010 : : {
1011 [ + + ]: 50 : if ( mpWindowImpl->maControlForeground != rColor )
1012 : : {
1013 : 8 : mpWindowImpl->maControlForeground = rColor;
1014 : 8 : mpWindowImpl->mbControlForeground = sal_True;
1015 : 8 : StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
1016 : : }
1017 : : }
1018 : 50 : }
1019 : :
1020 : : // -----------------------------------------------------------------------
1021 : :
1022 : 1275 : void Window::SetControlBackground()
1023 : : {
1024 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1025 : :
1026 [ + + ]: 1275 : if ( mpWindowImpl->mbControlBackground )
1027 : : {
1028 : 48 : mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT );
1029 : 48 : mpWindowImpl->mbControlBackground = sal_False;
1030 : 48 : StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
1031 : : }
1032 : 1275 : }
1033 : :
1034 : : // -----------------------------------------------------------------------
1035 : :
1036 : 1831 : void Window::SetControlBackground( const Color& rColor )
1037 : : {
1038 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1039 : :
1040 [ - + ]: 1831 : if ( rColor.GetTransparency() )
1041 : : {
1042 [ # # ]: 0 : if ( mpWindowImpl->mbControlBackground )
1043 : : {
1044 : 0 : mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT );
1045 : 0 : mpWindowImpl->mbControlBackground = sal_False;
1046 : 0 : StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
1047 : : }
1048 : : }
1049 : : else
1050 : : {
1051 [ + - ]: 1831 : if ( mpWindowImpl->maControlBackground != rColor )
1052 : : {
1053 : 1831 : mpWindowImpl->maControlBackground = rColor;
1054 : 1831 : mpWindowImpl->mbControlBackground = sal_True;
1055 : 1831 : StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
1056 : : }
1057 : : }
1058 : 1831 : }
1059 : :
1060 : : // -----------------------------------------------------------------------
1061 : :
1062 : 979 : Size Window::CalcWindowSize( const Size& rOutSz ) const
1063 : : {
1064 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1065 : :
1066 : 979 : Size aSz = rOutSz;
1067 : 979 : aSz.Width() += mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder;
1068 : 979 : aSz.Height() += mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder;
1069 : 979 : return aSz;
1070 : : }
1071 : :
1072 : : // -----------------------------------------------------------------------
1073 : :
1074 : 0 : Size Window::CalcOutputSize( const Size& rWinSz ) const
1075 : : {
1076 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1077 : :
1078 : 0 : Size aSz = rWinSz;
1079 : 0 : aSz.Width() -= mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder;
1080 : 0 : aSz.Height() -= mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder;
1081 : 0 : return aSz;
1082 : : }
1083 : :
1084 : : // -----------------------------------------------------------------------
1085 : :
1086 : 0 : Font Window::GetDrawPixelFont( OutputDevice* pDev ) const
1087 : : {
1088 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1089 : :
1090 [ # # ]: 0 : Font aFont = GetPointFont();
1091 [ # # ]: 0 : Size aFontSize = aFont.GetSize();
1092 [ # # ]: 0 : MapMode aPtMapMode( MAP_POINT );
1093 [ # # ]: 0 : aFontSize = pDev->LogicToPixel( aFontSize, aPtMapMode );
1094 [ # # ]: 0 : aFont.SetSize( aFontSize );
1095 [ # # ]: 0 : return aFont;
1096 : : }
1097 : :
1098 : : // -----------------------------------------------------------------------
1099 : :
1100 : 1643 : long Window::GetDrawPixel( OutputDevice* pDev, long nPixels ) const
1101 : : {
1102 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1103 : :
1104 : 1643 : long nP = nPixels;
1105 [ - + ]: 1643 : if ( pDev->GetOutDevType() != OUTDEV_WINDOW )
1106 : : {
1107 [ # # ]: 0 : MapMode aMap( MAP_100TH_MM );
1108 : 0 : Size aSz( nP, 0 );
1109 [ # # ]: 0 : aSz = PixelToLogic( aSz, aMap );
1110 [ # # ]: 0 : aSz = pDev->LogicToPixel( aSz, aMap );
1111 [ # # ]: 0 : nP = aSz.Width();
1112 : : }
1113 : 1643 : return nP;
1114 : : }
1115 : :
1116 : : // -----------------------------------------------------------------------
1117 : :
1118 : 0 : sal_Bool Window::HandleScrollCommand( const CommandEvent& rCmd,
1119 : : ScrollBar* pHScrl, ScrollBar* pVScrl )
1120 : : {
1121 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1122 : :
1123 : 0 : sal_Bool bRet = sal_False;
1124 : :
1125 [ # # ][ # # ]: 0 : if ( pHScrl || pVScrl )
1126 : : {
1127 [ # # # # ]: 0 : switch( rCmd.GetCommand() )
1128 : : {
1129 : : case COMMAND_STARTAUTOSCROLL:
1130 : : {
1131 : 0 : sal_uInt16 nFlags = 0;
1132 [ # # ]: 0 : if ( pHScrl )
1133 : : {
1134 [ # # # # : 0 : if ( (pHScrl->GetVisibleSize() < pHScrl->GetRangeMax()) &&
# # # # ]
[ # # ]
1135 : 0 : pHScrl->IsEnabled() && pHScrl->IsInputEnabled() && ! pHScrl->IsInModalMode() )
1136 : 0 : nFlags |= AUTOSCROLL_HORZ;
1137 : : }
1138 [ # # ]: 0 : if ( pVScrl )
1139 : : {
1140 [ # # # # : 0 : if ( (pVScrl->GetVisibleSize() < pVScrl->GetRangeMax()) &&
# # # # ]
[ # # ]
1141 : 0 : pVScrl->IsEnabled() && pVScrl->IsInputEnabled() && ! pVScrl->IsInModalMode() )
1142 : 0 : nFlags |= AUTOSCROLL_VERT;
1143 : : }
1144 : :
1145 [ # # ]: 0 : if ( nFlags )
1146 : : {
1147 : 0 : StartAutoScroll( nFlags );
1148 : 0 : bRet = sal_True;
1149 : : }
1150 : : }
1151 : 0 : break;
1152 : :
1153 : : case COMMAND_WHEEL:
1154 : : {
1155 : 0 : const CommandWheelData* pData = rCmd.GetWheelData();
1156 : :
1157 [ # # ][ # # ]: 0 : if ( pData && (COMMAND_WHEEL_SCROLL == pData->GetMode()) )
[ # # ]
1158 : : {
1159 : 0 : sal_uLong nScrollLines = pData->GetScrollLines();
1160 : : long nLines;
1161 [ # # ]: 0 : if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL )
1162 : : {
1163 [ # # ]: 0 : if ( pData->GetDelta() < 0 )
1164 : 0 : nLines = -LONG_MAX;
1165 : : else
1166 : 0 : nLines = LONG_MAX;
1167 : : }
1168 : : else
1169 : 0 : nLines = pData->GetNotchDelta() * (long)nScrollLines;
1170 [ # # ]: 0 : if ( nLines )
1171 : : {
1172 : : ImplHandleScroll( NULL,
1173 : : 0L,
1174 : 0 : pData->IsHorz() ? pHScrl : pVScrl,
1175 [ # # ]: 0 : nLines );
1176 : 0 : bRet = sal_True;
1177 : : }
1178 : : }
1179 : : }
1180 : 0 : break;
1181 : :
1182 : : case COMMAND_AUTOSCROLL:
1183 : : {
1184 : 0 : const CommandScrollData* pData = rCmd.GetAutoScrollData();
1185 [ # # ][ # # ]: 0 : if ( pData && (pData->GetDeltaX() || pData->GetDeltaY()) )
[ # # ][ # # ]
1186 : : {
1187 : : ImplHandleScroll( pHScrl, pData->GetDeltaX(),
1188 : 0 : pVScrl, pData->GetDeltaY() );
1189 : 0 : bRet = sal_True;
1190 : : }
1191 : : }
1192 : 0 : break;
1193 : :
1194 : : default:
1195 : 0 : break;
1196 : : }
1197 : : }
1198 : :
1199 : 0 : return bRet;
1200 : : }
1201 : :
1202 : : // -----------------------------------------------------------------------
1203 : :
1204 : 0 : void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX,
1205 : : ScrollBar* pVScrl, long nY )
1206 : : {
1207 [ # # ][ # # ]: 0 : if ( pHScrl && nX && pHScrl->IsEnabled() && pHScrl->IsInputEnabled() && ! pHScrl->IsInModalMode() )
[ # # ][ # # ]
[ # # ][ # # ]
1208 : : {
1209 : 0 : long nNewPos = pHScrl->GetThumbPos();
1210 : :
1211 [ # # ]: 0 : if ( nX == -LONG_MAX )
1212 : 0 : nNewPos += pHScrl->GetPageSize();
1213 [ # # ]: 0 : else if ( nX == LONG_MAX )
1214 : 0 : nNewPos -= pHScrl->GetPageSize();
1215 : : else
1216 : : {
1217 : 0 : const double fVal = (double)nNewPos - ((double)nX * pHScrl->GetLineSize());
1218 : :
1219 [ # # ]: 0 : if ( fVal < LONG_MIN )
1220 : 0 : nNewPos = LONG_MIN;
1221 [ # # ]: 0 : else if ( fVal > LONG_MAX )
1222 : 0 : nNewPos = LONG_MAX;
1223 : : else
1224 : 0 : nNewPos = (long)fVal;
1225 : : }
1226 : :
1227 : 0 : pHScrl->DoScroll( nNewPos );
1228 : : }
1229 : :
1230 [ # # ][ # # ]: 0 : if ( pVScrl && nY && pVScrl->IsEnabled() && pVScrl->IsInputEnabled() && ! pVScrl->IsInModalMode() )
[ # # ][ # # ]
[ # # ][ # # ]
1231 : : {
1232 : 0 : long nNewPos = pVScrl->GetThumbPos();
1233 : :
1234 [ # # ]: 0 : if ( nY == -LONG_MAX )
1235 : 0 : nNewPos += pVScrl->GetPageSize();
1236 [ # # ]: 0 : else if ( nY == LONG_MAX )
1237 : 0 : nNewPos -= pVScrl->GetPageSize();
1238 : : else
1239 : : {
1240 : 0 : const double fVal = (double)nNewPos - ((double)nY * pVScrl->GetLineSize());
1241 : :
1242 [ # # ]: 0 : if ( fVal < LONG_MIN )
1243 : 0 : nNewPos = LONG_MIN;
1244 [ # # ]: 0 : else if ( fVal > LONG_MAX )
1245 : 0 : nNewPos = LONG_MAX;
1246 : : else
1247 : 0 : nNewPos = (long)fVal;
1248 : : }
1249 : :
1250 : 0 : pVScrl->DoScroll( nNewPos );
1251 : : }
1252 : 0 : }
1253 : :
1254 : 206653 : DockingManager* Window::GetDockingManager()
1255 : : {
1256 : 206653 : return ImplGetDockingManager();
1257 : : }
1258 : :
1259 : 3709 : void Window::EnableDocking( sal_Bool bEnable )
1260 : : {
1261 : : // update list of dockable windows
1262 [ + - ]: 3709 : if( bEnable )
1263 : 3709 : ImplGetDockingManager()->AddWindow( this );
1264 : : else
1265 : 0 : ImplGetDockingManager()->RemoveWindow( this );
1266 : 3709 : }
1267 : :
1268 : :
1269 : : // retrieves the list of owner draw decorated windows for this window hiearchy
1270 : 0 : ::std::vector<Window *>& Window::ImplGetOwnerDrawList()
1271 : : {
1272 : 0 : return ImplGetTopmostFrameWindow()->mpWindowImpl->mpFrameData->maOwnerDrawList;
1273 : : }
1274 : :
1275 : 0 : Window* Window::ImplGetTopmostFrameWindow()
1276 : : {
1277 : 0 : Window *pTopmostParent = this;
1278 [ # # ]: 0 : while( pTopmostParent->ImplGetParent() )
1279 : 0 : pTopmostParent = pTopmostParent->ImplGetParent();
1280 : 0 : return pTopmostParent->mpWindowImpl->mpFrameWindow;
1281 : : }
1282 : :
1283 : 18765 : void Window::SetHelpId( const rtl::OString& rHelpId )
1284 : : {
1285 : 18765 : mpWindowImpl->maHelpId = rHelpId;
1286 : 18765 : }
1287 : :
1288 : 112342 : const rtl::OString& Window::GetHelpId() const
1289 : : {
1290 : 112342 : return mpWindowImpl->maHelpId;
1291 : : }
1292 : :
1293 : 3070 : void Window::SetUniqueId( const rtl::OString& rUniqueId )
1294 : : {
1295 : 3070 : mpWindowImpl->maUniqId = rUniqueId;
1296 : 3070 : }
1297 : :
1298 : 52 : const rtl::OString& Window::GetUniqueId() const
1299 : : {
1300 : 52 : return mpWindowImpl->maUniqId;
1301 : : }
1302 : :
1303 : : // --------- old inline methods ---------------
1304 : :
1305 : 657029 : Window* Window::ImplGetWindow()
1306 : : {
1307 [ + + ]: 657029 : if ( mpWindowImpl->mpClientWindow )
1308 : 379427 : return mpWindowImpl->mpClientWindow;
1309 : : else
1310 : 657029 : return this;
1311 : : }
1312 : :
1313 : 0 : ImplFrameData* Window::ImplGetFrameData()
1314 : : {
1315 : 0 : return mpWindowImpl->mpFrameData;
1316 : : }
1317 : :
1318 : 80496 : SalFrame* Window::ImplGetFrame() const
1319 : : {
1320 : 80496 : return mpWindowImpl->mpFrame;
1321 : : }
1322 : :
1323 : 2126052 : Window* Window::ImplGetParent() const
1324 : : {
1325 : 2126052 : return mpWindowImpl->mpParent;
1326 : : }
1327 : :
1328 : 29146 : Window* Window::ImplGetClientWindow() const
1329 : : {
1330 : 29146 : return mpWindowImpl->mpClientWindow;
1331 : : }
1332 : :
1333 : 7354 : Window* Window::ImplGetBorderWindow() const
1334 : : {
1335 : 7354 : return mpWindowImpl->mpBorderWindow;
1336 : : }
1337 : :
1338 : 165493 : Window* Window::ImplGetFirstOverlapWindow()
1339 : : {
1340 [ + + ]: 165493 : if ( mpWindowImpl->mbOverlapWin )
1341 : 5812 : return this;
1342 : : else
1343 : 165493 : return mpWindowImpl->mpOverlapWindow;
1344 : : }
1345 : :
1346 : 0 : const Window* Window::ImplGetFirstOverlapWindow() const
1347 : : {
1348 [ # # ]: 0 : if ( mpWindowImpl->mbOverlapWin )
1349 : 0 : return this;
1350 : : else
1351 : 0 : return mpWindowImpl->mpOverlapWindow;
1352 : : }
1353 : :
1354 : 16430 : Window* Window::ImplGetFrameWindow() const
1355 : : {
1356 : 16430 : return mpWindowImpl->mpFrameWindow;
1357 : : }
1358 : :
1359 : 0 : sal_Bool Window::ImplIsDockingWindow() const
1360 : : {
1361 : 0 : return mpWindowImpl->mbDockWin;
1362 : : }
1363 : :
1364 : 178 : sal_Bool Window::ImplIsFloatingWindow() const
1365 : : {
1366 : 178 : return mpWindowImpl->mbFloatWin;
1367 : : }
1368 : :
1369 : 0 : sal_Bool Window::ImplIsSplitter() const
1370 : : {
1371 : 0 : return mpWindowImpl->mbSplitter;
1372 : : }
1373 : :
1374 : 7880 : sal_Bool Window::ImplIsPushButton() const
1375 : : {
1376 : 7880 : return mpWindowImpl->mbPushButton;
1377 : : }
1378 : :
1379 : 3275688 : sal_Bool Window::ImplIsOverlapWindow() const
1380 : : {
1381 : 3275688 : return mpWindowImpl->mbOverlapWin;
1382 : : }
1383 : :
1384 : 0 : void Window::ImplSetMouseTransparent( sal_Bool bTransparent )
1385 : : {
1386 : 0 : mpWindowImpl->mbMouseTransparent = bTransparent;
1387 : 0 : }
1388 : :
1389 : 0 : Point Window::ImplOutputToFrame( const Point& rPos )
1390 : : {
1391 : 0 : return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY );
1392 : : }
1393 : :
1394 : 18530 : Point Window::ImplFrameToOutput( const Point& rPos )
1395 : : {
1396 : 18530 : return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY );
1397 : : }
1398 : :
1399 : 4217 : void Window::SetCompoundControl( sal_Bool bCompound )
1400 : : {
1401 : 4217 : mpWindowImpl->mbCompoundControl = bCompound;
1402 : 4217 : }
1403 : :
1404 : 636 : void Window::IncrementLockCount()
1405 : : {
1406 : 636 : mpWindowImpl->mnLockCount++;
1407 : 636 : }
1408 : :
1409 : 636 : void Window::DecrementLockCount()
1410 : : {
1411 : 636 : mpWindowImpl->mnLockCount--;
1412 : 636 : }
1413 : :
1414 : 2300342 : WinBits Window::GetStyle() const
1415 : : {
1416 : 2300342 : return mpWindowImpl->mnStyle;
1417 : : }
1418 : :
1419 : 6129 : WinBits Window::GetPrevStyle() const
1420 : : {
1421 : 6129 : return mpWindowImpl->mnPrevStyle;
1422 : : }
1423 : :
1424 : 2 : WinBits Window::GetExtendedStyle() const
1425 : : {
1426 : 2 : return mpWindowImpl->mnExtendedStyle;
1427 : : }
1428 : :
1429 : 8625 : void Window::SetType( WindowType nType )
1430 : : {
1431 : 8625 : mpWindowImpl->mnType = nType;
1432 : 8625 : }
1433 : :
1434 : 3117771 : WindowType Window::GetType() const
1435 : : {
1436 : 3117771 : return mpWindowImpl->mnType;
1437 : : }
1438 : :
1439 : 0 : Window* Window::GetParentDialog() const
1440 : : {
1441 : 0 : const Window *pWindow = this;
1442 : :
1443 [ # # ]: 0 : while( pWindow )
1444 : : {
1445 [ # # ]: 0 : if( pWindow->IsDialog() )
1446 : 0 : break;
1447 : :
1448 : 0 : pWindow = pWindow->GetParent();
1449 : : }
1450 : :
1451 : 0 : return const_cast<Window *>(pWindow);
1452 : : }
1453 : :
1454 : 182519 : sal_Bool Window::IsSystemWindow() const
1455 : : {
1456 : 182519 : return mpWindowImpl->mbSysWin;
1457 : : }
1458 : :
1459 : 640 : sal_Bool Window::IsDialog() const
1460 : : {
1461 : 640 : return mpWindowImpl->mbDialog;
1462 : : }
1463 : :
1464 : 1075 : sal_Bool Window::IsMenuFloatingWindow() const
1465 : : {
1466 : 1075 : return mpWindowImpl->mbMenuFloatingWindow;
1467 : : }
1468 : :
1469 : 323 : sal_Bool Window::IsToolbarFloatingWindow() const
1470 : : {
1471 : 323 : return mpWindowImpl->mbToolbarFloatingWindow;
1472 : : }
1473 : :
1474 : 12392 : void Window::EnableAllResize( sal_Bool bEnable )
1475 : : {
1476 : 12392 : mpWindowImpl->mbAllResize = bEnable;
1477 : 12392 : }
1478 : :
1479 : 23435 : void Window::EnableChildTransparentMode( sal_Bool bEnable )
1480 : : {
1481 : 23435 : mpWindowImpl->mbChildTransparent = bEnable;
1482 : 23435 : }
1483 : :
1484 : 11018 : sal_Bool Window::IsChildTransparentModeEnabled() const
1485 : : {
1486 : 11018 : return mpWindowImpl->mbChildTransparent;
1487 : : }
1488 : :
1489 : 0 : sal_Bool Window::IsMouseTransparent() const
1490 : : {
1491 : 0 : return mpWindowImpl->mbMouseTransparent;
1492 : : }
1493 : :
1494 : 520314 : sal_Bool Window::IsPaintTransparent() const
1495 : : {
1496 : 520314 : return mpWindowImpl->mbPaintTransparent;
1497 : : }
1498 : :
1499 : 0 : void Window::SetDialogControlStart( sal_Bool bStart )
1500 : : {
1501 : 0 : mpWindowImpl->mbDlgCtrlStart = bStart;
1502 : 0 : }
1503 : :
1504 : 10739 : sal_Bool Window::IsDialogControlStart() const
1505 : : {
1506 : 10739 : return mpWindowImpl->mbDlgCtrlStart;
1507 : : }
1508 : :
1509 : 1833 : void Window::SetDialogControlFlags( sal_uInt16 nFlags )
1510 : : {
1511 : 1833 : mpWindowImpl->mnDlgCtrlFlags = nFlags;
1512 : 1833 : }
1513 : :
1514 : 7138 : sal_uInt16 Window::GetDialogControlFlags() const
1515 : : {
1516 : 7138 : return mpWindowImpl->mnDlgCtrlFlags;
1517 : : }
1518 : :
1519 : 12114 : const InputContext& Window::GetInputContext() const
1520 : : {
1521 : 12114 : return mpWindowImpl->maInputContext;
1522 : : }
1523 : :
1524 : 54958 : sal_Bool Window::IsControlFont() const
1525 : : {
1526 : 54958 : return (mpWindowImpl->mpControlFont != 0);
1527 : : }
1528 : :
1529 : 146 : Color Window::GetControlForeground() const
1530 : : {
1531 : 146 : return mpWindowImpl->maControlForeground;
1532 : : }
1533 : :
1534 : 74783 : sal_Bool Window::IsControlForeground() const
1535 : : {
1536 : 74783 : return mpWindowImpl->mbControlForeground;
1537 : : }
1538 : :
1539 : 292 : Color Window::GetControlBackground() const
1540 : : {
1541 : 292 : return mpWindowImpl->maControlBackground;
1542 : : }
1543 : :
1544 : 113460 : sal_Bool Window::IsControlBackground() const
1545 : : {
1546 : 113460 : return mpWindowImpl->mbControlBackground;
1547 : : }
1548 : :
1549 : 187949 : sal_Bool Window::IsInPaint() const
1550 : : {
1551 : 187949 : return mpWindowImpl->mbInPaint;
1552 : : }
1553 : :
1554 : 8773706 : Window* Window::GetParent() const
1555 : : {
1556 : 8773706 : return mpWindowImpl->mpRealParent;
1557 : : }
1558 : :
1559 : 693952 : sal_Bool Window::IsVisible() const
1560 : : {
1561 : 693952 : return mpWindowImpl->mbVisible;
1562 : : }
1563 : :
1564 : 1325496 : sal_Bool Window::IsReallyVisible() const
1565 : : {
1566 : 1325496 : return mpWindowImpl->mbReallyVisible;
1567 : : }
1568 : :
1569 : 59918 : sal_Bool Window::IsReallyShown() const
1570 : : {
1571 : 59918 : return mpWindowImpl->mbReallyShown;
1572 : : }
1573 : :
1574 : 0 : sal_Bool Window::IsInInitShow() const
1575 : : {
1576 : 0 : return mpWindowImpl->mbInInitShow;
1577 : : }
1578 : :
1579 : 190046 : sal_Bool Window::IsEnabled() const
1580 : : {
1581 : 190046 : return !mpWindowImpl->mbDisabled;
1582 : : }
1583 : :
1584 : 18919 : sal_Bool Window::IsInputEnabled() const
1585 : : {
1586 : 18919 : return !mpWindowImpl->mbInputDisabled;
1587 : : }
1588 : :
1589 : 0 : sal_Bool Window::IsAlwaysEnableInput() const
1590 : : {
1591 : 0 : return mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled;
1592 : : }
1593 : :
1594 : 2298 : sal_uInt16 Window::GetActivateMode() const
1595 : : {
1596 : 2298 : return mpWindowImpl->mnActivateMode;
1597 : :
1598 : : }
1599 : :
1600 : 0 : sal_Bool Window::IsAlwaysOnTopEnabled() const
1601 : : {
1602 : 0 : return mpWindowImpl->mbAlwaysOnTop;
1603 : : }
1604 : :
1605 : 0 : sal_Bool Window::IsDefaultPos() const
1606 : : {
1607 : 0 : return mpWindowImpl->mbDefPos;
1608 : : }
1609 : :
1610 : 130 : sal_Bool Window::IsDefaultSize() const
1611 : : {
1612 : 130 : return mpWindowImpl->mbDefSize;
1613 : : }
1614 : :
1615 : 6349 : void Window::EnablePaint( sal_Bool bEnable )
1616 : : {
1617 : 6349 : mpWindowImpl->mbPaintDisabled = !bEnable;
1618 : 6349 : }
1619 : :
1620 : 26117 : sal_Bool Window::IsPaintEnabled() const
1621 : : {
1622 : 26117 : return !mpWindowImpl->mbPaintDisabled;
1623 : : }
1624 : :
1625 : 492056 : sal_Bool Window::IsUpdateMode() const
1626 : : {
1627 : 492056 : return !mpWindowImpl->mbNoUpdate;
1628 : : }
1629 : :
1630 : 96 : void Window::SetParentUpdateMode( sal_Bool bUpdate )
1631 : : {
1632 : 96 : mpWindowImpl->mbNoParentUpdate = !bUpdate;
1633 : 96 : }
1634 : :
1635 : 24368 : sal_Bool Window::IsActive() const
1636 : : {
1637 : 24368 : return mpWindowImpl->mbActive;
1638 : : }
1639 : :
1640 : 2590 : sal_uInt16 Window::GetGetFocusFlags() const
1641 : : {
1642 : 2590 : return mpWindowImpl->mnGetFocusFlags;
1643 : : }
1644 : :
1645 : 24087 : sal_Bool Window::IsCompoundControl() const
1646 : : {
1647 : 24087 : return mpWindowImpl->mbCompoundControl;
1648 : : }
1649 : :
1650 : 538 : sal_Bool Window::IsWait() const
1651 : : {
1652 : 538 : return (mpWindowImpl->mnWaitCount != 0);
1653 : : }
1654 : :
1655 : 23435 : Cursor* Window::GetCursor() const
1656 : : {
1657 : 23435 : return mpWindowImpl->mpCursor;
1658 : : }
1659 : :
1660 : 107614 : const Fraction& Window::GetZoom() const
1661 : : {
1662 : 107614 : return mpWindowImpl->maZoom;
1663 : : }
1664 : :
1665 : 3085 : sal_Bool Window::IsZoom() const
1666 : : {
1667 : 3085 : return mpWindowImpl->maZoom.GetNumerator() != mpWindowImpl->maZoom.GetDenominator();
1668 : : }
1669 : :
1670 : 0 : void Window::SetHelpText( const XubString& rHelpText )
1671 : : {
1672 : 0 : mpWindowImpl->maHelpText = rHelpText;
1673 : 0 : mpWindowImpl->mbHelpTextDynamic = sal_True;
1674 : 0 : }
1675 : :
1676 : 9066 : void Window::SetQuickHelpText( const XubString& rHelpText )
1677 : : {
1678 : 9066 : mpWindowImpl->maQuickHelpText = rHelpText;
1679 : 9066 : }
1680 : :
1681 : 12 : const XubString& Window::GetQuickHelpText() const
1682 : : {
1683 : 12 : return mpWindowImpl->maQuickHelpText;
1684 : : }
1685 : :
1686 : 129 : void Window::SetData( void* pNewData )
1687 : : {
1688 : 129 : mpWindowImpl->mpUserData = pNewData;
1689 : 129 : }
1690 : :
1691 : 119 : void* Window::GetData() const
1692 : : {
1693 : 119 : return mpWindowImpl->mpUserData;
1694 : : }
1695 : :
1696 : 9302 : sal_Bool Window::IsCreatedWithToolkit() const
1697 : : {
1698 : 9302 : return mpWindowImpl->mbCreatedWithToolkit;
1699 : : }
1700 : :
1701 : 16392 : void Window::SetCreatedWithToolkit( sal_Bool b )
1702 : : {
1703 : 16392 : mpWindowImpl->mbCreatedWithToolkit = b;
1704 : :
1705 : 16392 : }
1706 : 0 : const Pointer& Window::GetPointer() const
1707 : : {
1708 : 0 : return mpWindowImpl->maPointer;
1709 : : }
1710 : :
1711 : 415985 : VCLXWindow* Window::GetWindowPeer() const
1712 : : {
1713 : 415985 : return mpWindowImpl->mpVCLXWindow;
1714 : : }
1715 : :
1716 : 20877 : void Window::SetPosPixel( const Point& rNewPos )
1717 : : {
1718 : 20877 : SetPosSizePixel( rNewPos.X(), rNewPos.Y(), 0, 0, WINDOW_POSSIZE_POS );
1719 : 20877 : }
1720 : :
1721 : 77875 : void Window::SetSizePixel( const Size& rNewSize )
1722 : : {
1723 : : SetPosSizePixel( 0, 0, rNewSize.Width(), rNewSize.Height(),
1724 : 77875 : WINDOW_POSSIZE_SIZE );
1725 : 77875 : }
1726 : :
1727 : 97276 : void Window::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
1728 : : {
1729 : : SetPosSizePixel( rNewPos.X(), rNewPos.Y(),
1730 : : rNewSize.Width(), rNewSize.Height(),
1731 : 97276 : WINDOW_POSSIZE_POSSIZE );
1732 : 97276 : }
1733 : :
1734 : 15922 : void Window::SetOutputSizePixel( const Size& rNewSize )
1735 : : {
1736 : 15922 : SetSizePixel( Size( rNewSize.Width()+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder,
1737 [ + - ]: 31844 : rNewSize.Height()+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ) );
1738 : 15922 : }
1739 : :
1740 : 0 : void Window::SetBackgroundBitmap( const BitmapEx& rBitmapEx )
1741 : : {
1742 [ # # ]: 0 : if( !rBitmapEx.IsEmpty() )
1743 : : {
1744 : 0 : SalBitmap* pBmp = rBitmapEx.ImplGetBitmapImpBitmap()->ImplGetSalBitmap();
1745 : 0 : ImplGetFrame()->SetBackgroundBitmap( pBmp );
1746 : : }
1747 : 0 : }
1748 : :
1749 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|