Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <limits.h>
21 : #include <tools/debug.hxx>
22 : #include <tools/poly.hxx>
23 :
24 : #include <vcl/bitmap.hxx>
25 : #include <vcl/dialog.hxx>
26 : #include <vcl/event.hxx>
27 : #include <vcl/fixed.hxx>
28 : #include <vcl/layout.hxx>
29 : #include <vcl/timer.hxx>
30 : #include <vcl/metric.hxx>
31 : #include <vcl/virdev.hxx>
32 : #include <vcl/window.hxx>
33 : #include <vcl/scrbar.hxx>
34 : #include <vcl/dockwin.hxx>
35 : #include <vcl/tabctrl.hxx>
36 : #include <vcl/settings.hxx>
37 :
38 : #include <window.h>
39 : #include <outfont.hxx>
40 : #include <outdev.h>
41 : #include <svdata.hxx>
42 : #include <impbmp.hxx>
43 : #include <salbmp.hxx>
44 : #include <salgdi.hxx>
45 : #include <salframe.hxx>
46 : #include <scrwnd.hxx>
47 :
48 : using namespace com::sun::star;
49 :
50 : #define IMPL_MAXSAVEBACKSIZE (640*480)
51 : #define IMPL_MAXALLSAVEBACKSIZE (800*600*2)
52 :
53 0 : struct ImplFocusDelData : public ImplDelData
54 : {
55 : Window* mpFocusWin;
56 : };
57 :
58 0 : bool Window::ImplIsWindowInFront( const Window* pTestWindow ) const
59 : {
60 : // check for overlapping window
61 0 : pTestWindow = pTestWindow->ImplGetFirstOverlapWindow();
62 0 : const Window* pTempWindow = pTestWindow;
63 0 : const Window* pThisWindow = ImplGetFirstOverlapWindow();
64 0 : if ( pTempWindow == pThisWindow )
65 0 : return false;
66 0 : do
67 : {
68 0 : if ( pTempWindow == pThisWindow )
69 0 : return true;
70 0 : if ( pTempWindow->mpWindowImpl->mbFrame )
71 0 : break;
72 0 : pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
73 : }
74 : while ( pTempWindow );
75 0 : pTempWindow = pThisWindow;
76 0 : do
77 : {
78 0 : if ( pTempWindow == pTestWindow )
79 0 : return false;
80 0 : if ( pTempWindow->mpWindowImpl->mbFrame )
81 0 : break;
82 0 : pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
83 : }
84 : while ( pTempWindow );
85 :
86 : // move window to same level
87 0 : if ( pThisWindow->mpWindowImpl->mpOverlapWindow != pTestWindow->mpWindowImpl->mpOverlapWindow )
88 : {
89 0 : sal_uInt16 nThisLevel = 0;
90 0 : sal_uInt16 nTestLevel = 0;
91 0 : pTempWindow = pThisWindow;
92 0 : do
93 : {
94 0 : nThisLevel++;
95 0 : pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
96 : }
97 0 : while ( !pTempWindow->mpWindowImpl->mbFrame );
98 0 : pTempWindow = pTestWindow;
99 0 : do
100 : {
101 0 : nTestLevel++;
102 0 : pTempWindow = pTempWindow->mpWindowImpl->mpOverlapWindow;
103 : }
104 0 : while ( !pTempWindow->mpWindowImpl->mbFrame );
105 :
106 0 : if ( nThisLevel < nTestLevel )
107 : {
108 0 : do
109 : {
110 0 : if ( pTestWindow->mpWindowImpl->mpOverlapWindow == pThisWindow->mpWindowImpl->mpOverlapWindow )
111 0 : break;
112 0 : if ( pTestWindow->mpWindowImpl->mbFrame )
113 0 : break;
114 0 : pTestWindow = pTestWindow->mpWindowImpl->mpOverlapWindow;
115 : }
116 : while ( pTestWindow );
117 : }
118 : else
119 : {
120 0 : do
121 : {
122 0 : if ( pThisWindow->mpWindowImpl->mpOverlapWindow == pTempWindow->mpWindowImpl->mpOverlapWindow )
123 0 : break;
124 0 : if ( pThisWindow->mpWindowImpl->mbFrame )
125 0 : break;
126 0 : pThisWindow = pThisWindow->mpWindowImpl->mpOverlapWindow;
127 : }
128 : while ( pThisWindow );
129 : }
130 : }
131 :
132 : // if TestWindow is before ThisWindow, it is in front
133 0 : pTempWindow = pTestWindow;
134 0 : while ( pTempWindow )
135 : {
136 0 : if ( pTempWindow == pThisWindow )
137 0 : return true;
138 0 : pTempWindow = pTempWindow->mpWindowImpl->mpNext;
139 : }
140 :
141 0 : return false;
142 : }
143 :
144 0 : void Window::ImplSaveOverlapBackground()
145 : {
146 : DBG_ASSERT( !mpWindowImpl->mpOverlapData->mpSaveBackDev, "Window::ImplSaveOverlapBackground() - Background already saved" );
147 :
148 0 : if ( !mpWindowImpl->mbFrame )
149 : {
150 0 : sal_uLong nSaveBackSize = mnOutWidth*mnOutHeight;
151 0 : if ( nSaveBackSize <= IMPL_MAXSAVEBACKSIZE )
152 : {
153 0 : if ( nSaveBackSize+mpWindowImpl->mpFrameData->mnAllSaveBackSize <= IMPL_MAXALLSAVEBACKSIZE )
154 : {
155 0 : Size aOutSize( mnOutWidth, mnOutHeight );
156 0 : mpWindowImpl->mpOverlapData->mpSaveBackDev = new VirtualDevice( *mpWindowImpl->mpFrameWindow );
157 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackDev->SetOutputSizePixel( aOutSize ) )
158 : {
159 0 : mpWindowImpl->mpFrameWindow->ImplUpdateAll();
160 :
161 0 : if ( mpWindowImpl->mbInitWinClipRegion )
162 0 : ImplInitWinClipRegion();
163 :
164 0 : mpWindowImpl->mpOverlapData->mnSaveBackSize = nSaveBackSize;
165 0 : mpWindowImpl->mpFrameData->mnAllSaveBackSize += nSaveBackSize;
166 0 : Point aDevPt;
167 :
168 0 : OutputDevice *pOutDev = mpWindowImpl->mpFrameWindow->GetOutDev();
169 : pOutDev->ImplGetFrameDev( Point( mnOutOffX, mnOutOffY ),
170 : aDevPt, aOutSize,
171 0 : *(mpWindowImpl->mpOverlapData->mpSaveBackDev) );
172 0 : mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpFrameData->mpFirstBackWin;
173 0 : mpWindowImpl->mpFrameData->mpFirstBackWin = this;
174 : }
175 : else
176 : {
177 0 : delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
178 0 : mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
179 : }
180 : }
181 : }
182 : }
183 0 : }
184 :
185 0 : bool Window::ImplRestoreOverlapBackground( Region& rInvRegion )
186 : {
187 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
188 : {
189 0 : if ( mpWindowImpl->mbInitWinClipRegion )
190 0 : ImplInitWinClipRegion();
191 :
192 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
193 : {
194 0 : Point aDevPt;
195 0 : Point aDestPt( mnOutOffX, mnOutOffY );
196 0 : Size aDevSize = mpWindowImpl->mpOverlapData->mpSaveBackDev->GetOutputSizePixel();
197 :
198 0 : OutputDevice *pOutDev = mpWindowImpl->mpFrameWindow->GetOutDev();
199 :
200 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
201 : {
202 0 : mpWindowImpl->mpOverlapData->mpSaveBackRgn->Intersect( mpWindowImpl->maWinClipRegion );
203 0 : rInvRegion = mpWindowImpl->maWinClipRegion;
204 0 : rInvRegion.Exclude( *mpWindowImpl->mpOverlapData->mpSaveBackRgn );
205 : pOutDev->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
206 : *(mpWindowImpl->mpOverlapData->mpSaveBackDev),
207 0 : *mpWindowImpl->mpOverlapData->mpSaveBackRgn );
208 : }
209 : else
210 : {
211 : pOutDev->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
212 : *(mpWindowImpl->mpOverlapData->mpSaveBackDev),
213 0 : mpWindowImpl->maWinClipRegion );
214 : }
215 0 : ImplDeleteOverlapBackground();
216 : }
217 :
218 0 : return true;
219 : }
220 :
221 0 : return false;
222 : }
223 :
224 0 : void Window::ImplDeleteOverlapBackground()
225 : {
226 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackDev )
227 : {
228 0 : mpWindowImpl->mpFrameData->mnAllSaveBackSize -= mpWindowImpl->mpOverlapData->mnSaveBackSize;
229 0 : delete mpWindowImpl->mpOverlapData->mpSaveBackDev;
230 0 : mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
231 0 : if ( mpWindowImpl->mpOverlapData->mpSaveBackRgn )
232 : {
233 0 : delete mpWindowImpl->mpOverlapData->mpSaveBackRgn;
234 0 : mpWindowImpl->mpOverlapData->mpSaveBackRgn = NULL;
235 : }
236 :
237 : // remove window from the list
238 0 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin == this )
239 0 : mpWindowImpl->mpFrameData->mpFirstBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
240 : else
241 : {
242 0 : Window* pTemp = mpWindowImpl->mpFrameData->mpFirstBackWin;
243 0 : while ( pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin != this )
244 0 : pTemp = pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin;
245 0 : pTemp->mpWindowImpl->mpOverlapData->mpNextBackWin = mpWindowImpl->mpOverlapData->mpNextBackWin;
246 : }
247 0 : mpWindowImpl->mpOverlapData->mpNextBackWin = NULL;
248 : }
249 0 : }
250 :
251 0 : void Window::ImplInvalidateAllOverlapBackgrounds()
252 : {
253 0 : Window* pWindow = mpWindowImpl->mpFrameData->mpFirstBackWin;
254 0 : while ( pWindow )
255 : {
256 : // remember next window here already, as this window could
257 : // be removed within the next if clause from the list
258 0 : Window* pNext = pWindow->mpWindowImpl->mpOverlapData->mpNextBackWin;
259 :
260 0 : if ( ImplIsWindowInFront( pWindow ) )
261 : {
262 : Rectangle aRect1( Point( mnOutOffX, mnOutOffY ),
263 0 : Size( mnOutWidth, mnOutHeight ) );
264 : Rectangle aRect2( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
265 0 : Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
266 0 : aRect1.Intersection( aRect2 );
267 0 : if ( !aRect1.IsEmpty() )
268 : {
269 0 : if ( !pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn )
270 0 : pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn = new Region( aRect2 );
271 0 : pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn->Exclude( aRect1 );
272 0 : if ( pWindow->mpWindowImpl->mpOverlapData->mpSaveBackRgn->IsEmpty() )
273 0 : pWindow->ImplDeleteOverlapBackground();
274 : }
275 :
276 : }
277 :
278 0 : pWindow = pNext;
279 : }
280 0 : }
281 :
282 0 : void Window::ShowFocus( const Rectangle& rRect )
283 : {
284 0 : if( mpWindowImpl->mbInShowFocus )
285 0 : return;
286 0 : mpWindowImpl->mbInShowFocus = true;
287 :
288 0 : ImplWinData* pWinData = ImplGetWinData();
289 :
290 : // native themeing suggest not to use focus rects
291 0 : if( ! ( mpWindowImpl->mbUseNativeFocus &&
292 0 : IsNativeWidgetEnabled() ) )
293 : {
294 0 : if ( !mpWindowImpl->mbInPaint )
295 : {
296 0 : if ( mpWindowImpl->mbFocusVisible )
297 : {
298 0 : if ( *(pWinData->mpFocusRect) == rRect )
299 : {
300 0 : mpWindowImpl->mbInShowFocus = false;
301 0 : return;
302 : }
303 :
304 0 : ImplInvertFocus( *(pWinData->mpFocusRect) );
305 : }
306 :
307 0 : ImplInvertFocus( rRect );
308 : }
309 0 : if ( !pWinData->mpFocusRect )
310 0 : pWinData->mpFocusRect = new Rectangle( rRect );
311 : else
312 0 : *(pWinData->mpFocusRect) = rRect;
313 0 : mpWindowImpl->mbFocusVisible = true;
314 : }
315 : else
316 : {
317 0 : if( ! mpWindowImpl->mbNativeFocusVisible )
318 : {
319 0 : mpWindowImpl->mbNativeFocusVisible = true;
320 0 : if ( !mpWindowImpl->mbInPaint )
321 0 : Invalidate();
322 : }
323 : }
324 0 : mpWindowImpl->mbInShowFocus = false;
325 : }
326 :
327 0 : void Window::HideFocus()
328 : {
329 :
330 0 : if( mpWindowImpl->mbInHideFocus )
331 0 : return;
332 0 : mpWindowImpl->mbInHideFocus = true;
333 :
334 : // native themeing can suggest not to use focus rects
335 0 : if( ! ( mpWindowImpl->mbUseNativeFocus &&
336 0 : IsNativeWidgetEnabled() ) )
337 : {
338 0 : if ( !mpWindowImpl->mbFocusVisible )
339 : {
340 0 : mpWindowImpl->mbInHideFocus = false;
341 0 : return;
342 : }
343 :
344 0 : if ( !mpWindowImpl->mbInPaint )
345 0 : ImplInvertFocus( *(ImplGetWinData()->mpFocusRect) );
346 0 : mpWindowImpl->mbFocusVisible = false;
347 : }
348 : else
349 : {
350 0 : if( mpWindowImpl->mbNativeFocusVisible )
351 : {
352 0 : mpWindowImpl->mbNativeFocusVisible = false;
353 0 : if ( !mpWindowImpl->mbInPaint )
354 0 : Invalidate();
355 : }
356 : }
357 0 : mpWindowImpl->mbInHideFocus = false;
358 : }
359 :
360 0 : void Window::Invert( const Rectangle& rRect, sal_uInt16 nFlags )
361 : {
362 0 : if ( !IsDeviceOutputNecessary() )
363 0 : return;
364 :
365 0 : OutputDevice *pOutDev = GetOutDev();
366 0 : Rectangle aRect( pOutDev->ImplLogicToDevicePixel( rRect ) );
367 :
368 0 : if ( aRect.IsEmpty() )
369 0 : return;
370 0 : aRect.Justify();
371 :
372 : // we need a graphics
373 0 : if ( !mpGraphics )
374 : {
375 0 : if ( !pOutDev->ImplGetGraphics() )
376 0 : return;
377 : }
378 :
379 0 : if ( mbInitClipRegion )
380 0 : ImplInitClipRegion();
381 :
382 0 : if ( mbOutputClipped )
383 0 : return;
384 :
385 0 : SalInvert nSalFlags = 0;
386 0 : if ( nFlags & INVERT_HIGHLIGHT )
387 0 : nSalFlags |= SAL_INVERT_HIGHLIGHT;
388 0 : if ( nFlags & INVERT_50 )
389 0 : nSalFlags |= SAL_INVERT_50;
390 0 : mpGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), nSalFlags, this );
391 : }
392 :
393 0 : void Window::Invert( const Polygon& rPoly, sal_uInt16 nFlags )
394 : {
395 0 : if ( !IsDeviceOutputNecessary() )
396 0 : return;
397 :
398 0 : sal_uInt16 nPoints = rPoly.GetSize();
399 :
400 0 : if ( nPoints < 2 )
401 0 : return;
402 :
403 0 : OutputDevice *pOutDev = GetOutDev();
404 0 : Polygon aPoly( pOutDev->ImplLogicToDevicePixel( rPoly ) );
405 :
406 : // we need a graphics
407 0 : if ( !mpGraphics )
408 : {
409 0 : if ( !pOutDev->ImplGetGraphics() )
410 0 : return;
411 : }
412 :
413 0 : if ( mbInitClipRegion )
414 0 : ImplInitClipRegion();
415 :
416 0 : if ( mbOutputClipped )
417 0 : return;
418 :
419 0 : SalInvert nSalFlags = 0;
420 0 : if ( nFlags & INVERT_HIGHLIGHT )
421 0 : nSalFlags |= SAL_INVERT_HIGHLIGHT;
422 0 : if ( nFlags & INVERT_50 )
423 0 : nSalFlags |= SAL_INVERT_50;
424 0 : const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry();
425 0 : mpGraphics->Invert( nPoints, pPtAry, nSalFlags, this );
426 : }
427 :
428 0 : void Window::ShowTracking( const Rectangle& rRect, sal_uInt16 nFlags )
429 : {
430 0 : ImplWinData* pWinData = ImplGetWinData();
431 :
432 0 : if ( !mpWindowImpl->mbInPaint || !(nFlags & SHOWTRACK_WINDOW) )
433 : {
434 0 : if ( mpWindowImpl->mbTrackVisible )
435 : {
436 0 : if ( (*(pWinData->mpTrackRect) == rRect) &&
437 0 : (pWinData->mnTrackFlags == nFlags) )
438 0 : return;
439 :
440 0 : InvertTracking( *(pWinData->mpTrackRect), pWinData->mnTrackFlags );
441 : }
442 :
443 0 : InvertTracking( rRect, nFlags );
444 : }
445 :
446 0 : if ( !pWinData->mpTrackRect )
447 0 : pWinData->mpTrackRect = new Rectangle( rRect );
448 : else
449 0 : *(pWinData->mpTrackRect) = rRect;
450 0 : pWinData->mnTrackFlags = nFlags;
451 0 : mpWindowImpl->mbTrackVisible = true;
452 : }
453 :
454 0 : void Window::HideTracking()
455 : {
456 0 : if ( mpWindowImpl->mbTrackVisible )
457 : {
458 0 : ImplWinData* pWinData = ImplGetWinData();
459 0 : if ( !mpWindowImpl->mbInPaint || !(pWinData->mnTrackFlags & SHOWTRACK_WINDOW) )
460 0 : InvertTracking( *(pWinData->mpTrackRect), pWinData->mnTrackFlags );
461 0 : mpWindowImpl->mbTrackVisible = false;
462 : }
463 0 : }
464 :
465 0 : void Window::InvertTracking( const Rectangle& rRect, sal_uInt16 nFlags )
466 : {
467 0 : OutputDevice *pOutDev = GetOutDev();
468 0 : Rectangle aRect( pOutDev->ImplLogicToDevicePixel( rRect ) );
469 :
470 0 : if ( aRect.IsEmpty() )
471 0 : return;
472 0 : aRect.Justify();
473 :
474 : SalGraphics* pGraphics;
475 :
476 0 : if ( nFlags & SHOWTRACK_WINDOW )
477 : {
478 0 : if ( !IsDeviceOutputNecessary() )
479 0 : return;
480 :
481 : // we need a graphics
482 0 : if ( !mpGraphics )
483 : {
484 0 : if ( !pOutDev->ImplGetGraphics() )
485 0 : return;
486 : }
487 :
488 0 : if ( mbInitClipRegion )
489 0 : ImplInitClipRegion();
490 :
491 0 : if ( mbOutputClipped )
492 0 : return;
493 :
494 0 : pGraphics = mpGraphics;
495 : }
496 : else
497 : {
498 0 : pGraphics = ImplGetFrameGraphics();
499 :
500 0 : if ( nFlags & SHOWTRACK_CLIP )
501 : {
502 0 : Point aPoint( mnOutOffX, mnOutOffY );
503 : Region aRegion( Rectangle( aPoint,
504 0 : Size( mnOutWidth, mnOutHeight ) ) );
505 0 : ImplClipBoundaries( aRegion, false, false );
506 0 : pOutDev->ImplSelectClipRegion( aRegion, pGraphics );
507 : }
508 : }
509 :
510 0 : sal_uInt16 nStyle = nFlags & SHOWTRACK_STYLE;
511 0 : if ( nStyle == SHOWTRACK_OBJECT )
512 0 : pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_INVERT_TRACKFRAME, this );
513 0 : else if ( nStyle == SHOWTRACK_SPLIT )
514 0 : pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_INVERT_50, this );
515 : else
516 : {
517 0 : long nBorder = 1;
518 0 : if ( nStyle == SHOWTRACK_BIG )
519 0 : nBorder = 5;
520 0 : pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), nBorder, SAL_INVERT_50, this );
521 0 : pGraphics->Invert( aRect.Left(), aRect.Bottom()-nBorder+1, aRect.GetWidth(), nBorder, SAL_INVERT_50, this );
522 0 : pGraphics->Invert( aRect.Left(), aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SAL_INVERT_50, this );
523 0 : pGraphics->Invert( aRect.Right()-nBorder+1, aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SAL_INVERT_50, this );
524 : }
525 : }
526 :
527 0 : void Window::InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags )
528 : {
529 0 : sal_uInt16 nPoints = rPoly.GetSize();
530 :
531 0 : if ( nPoints < 2 )
532 0 : return;
533 :
534 0 : OutputDevice *pOutDev = GetOutDev();
535 :
536 0 : Polygon aPoly( pOutDev->ImplLogicToDevicePixel( rPoly ) );
537 :
538 : SalGraphics* pGraphics;
539 :
540 0 : if ( nFlags & SHOWTRACK_WINDOW )
541 : {
542 0 : if ( !IsDeviceOutputNecessary() )
543 0 : return;
544 :
545 : // we need a graphics
546 0 : if ( !mpGraphics )
547 : {
548 0 : if ( !pOutDev->ImplGetGraphics() )
549 0 : return;
550 : }
551 :
552 0 : if ( mbInitClipRegion )
553 0 : ImplInitClipRegion();
554 :
555 0 : if ( mbOutputClipped )
556 0 : return;
557 :
558 0 : pGraphics = mpGraphics;
559 : }
560 : else
561 : {
562 0 : pGraphics = ImplGetFrameGraphics();
563 :
564 0 : if ( nFlags & SHOWTRACK_CLIP )
565 : {
566 0 : Point aPoint( mnOutOffX, mnOutOffY );
567 : Region aRegion( Rectangle( aPoint,
568 0 : Size( mnOutWidth, mnOutHeight ) ) );
569 0 : ImplClipBoundaries( aRegion, false, false );
570 0 : pOutDev->ImplSelectClipRegion( aRegion, pGraphics );
571 : }
572 : }
573 :
574 0 : const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry();
575 0 : pGraphics->Invert( nPoints, pPtAry, SAL_INVERT_TRACKFRAME, this );
576 : }
577 :
578 0 : IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer )
579 : {
580 0 : ImplSVData* pSVData = ImplGetSVData();
581 :
582 : // Bei Button-Repeat muessen wir den Timeout umsetzen
583 0 : if ( pSVData->maWinData.mnTrackFlags & STARTTRACK_BUTTONREPEAT )
584 0 : pTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonRepeat() );
585 :
586 : // Tracking-Event erzeugen
587 0 : Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
588 0 : if( ImplIsAntiparallel() )
589 : {
590 : // - RTL - re-mirror frame pos at pChild
591 0 : const OutputDevice *pOutDev = GetOutDev();
592 0 : pOutDev->ReMirror( aMousePos );
593 : }
594 : MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
595 : mpWindowImpl->mpFrameData->mnClickCount, 0,
596 0 : mpWindowImpl->mpFrameData->mnMouseCode, mpWindowImpl->mpFrameData->mnMouseCode );
597 0 : TrackingEvent aTEvt( aMEvt, TRACKING_REPEAT );
598 0 : Tracking( aTEvt );
599 :
600 0 : return 0;
601 : }
602 :
603 0 : void Window::StartTracking( sal_uInt16 nFlags )
604 : {
605 0 : ImplSVData* pSVData = ImplGetSVData();
606 :
607 0 : if ( pSVData->maWinData.mpTrackWin != this )
608 : {
609 0 : if ( pSVData->maWinData.mpTrackWin )
610 0 : pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
611 : }
612 :
613 0 : if ( nFlags & (STARTTRACK_SCROLLREPEAT | STARTTRACK_BUTTONREPEAT) )
614 : {
615 0 : pSVData->maWinData.mpTrackTimer = new AutoTimer;
616 :
617 0 : if ( nFlags & STARTTRACK_SCROLLREPEAT )
618 0 : pSVData->maWinData.mpTrackTimer->SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() );
619 : else
620 0 : pSVData->maWinData.mpTrackTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() );
621 0 : pSVData->maWinData.mpTrackTimer->SetTimeoutHdl( LINK( this, Window, ImplTrackTimerHdl ) );
622 0 : pSVData->maWinData.mpTrackTimer->Start();
623 : }
624 :
625 0 : pSVData->maWinData.mpTrackWin = this;
626 0 : pSVData->maWinData.mnTrackFlags = nFlags;
627 0 : CaptureMouse();
628 0 : }
629 :
630 0 : void Window::EndTracking( sal_uInt16 nFlags )
631 : {
632 0 : ImplSVData* pSVData = ImplGetSVData();
633 :
634 0 : if ( pSVData->maWinData.mpTrackWin == this )
635 : {
636 : // due to DbgChkThis in brackets, as the window could be destroyed
637 : // in the handler
638 : {
639 :
640 0 : if ( pSVData->maWinData.mpTrackTimer )
641 : {
642 0 : delete pSVData->maWinData.mpTrackTimer;
643 0 : pSVData->maWinData.mpTrackTimer = NULL;
644 : }
645 :
646 0 : pSVData->maWinData.mpTrackWin = NULL;
647 0 : pSVData->maWinData.mnTrackFlags = 0;
648 0 : ReleaseMouse();
649 : }
650 :
651 : // call EndTracking if required
652 0 : if ( !(nFlags & ENDTRACK_DONTCALLHDL) )
653 : {
654 0 : Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
655 0 : if( ImplIsAntiparallel() )
656 : {
657 : // - RTL - re-mirror frame pos at pChild
658 0 : const OutputDevice *pOutDev = GetOutDev();
659 0 : pOutDev->ReMirror( aMousePos );
660 : }
661 :
662 : MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
663 : mpWindowImpl->mpFrameData->mnClickCount, 0,
664 0 : mpWindowImpl->mpFrameData->mnMouseCode, mpWindowImpl->mpFrameData->mnMouseCode );
665 0 : TrackingEvent aTEvt( aMEvt, nFlags | ENDTRACK_END );
666 0 : Tracking( aTEvt );
667 : }
668 : }
669 0 : }
670 :
671 0 : bool Window::IsTracking() const
672 : {
673 0 : return (ImplGetSVData()->maWinData.mpTrackWin == this);
674 : }
675 :
676 0 : void Window::StartAutoScroll( sal_uInt16 nFlags )
677 : {
678 0 : ImplSVData* pSVData = ImplGetSVData();
679 :
680 0 : if ( pSVData->maWinData.mpAutoScrollWin != this )
681 : {
682 0 : if ( pSVData->maWinData.mpAutoScrollWin )
683 0 : pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
684 : }
685 :
686 0 : pSVData->maWinData.mpAutoScrollWin = this;
687 0 : pSVData->maWinData.mnAutoScrollFlags = nFlags;
688 0 : pSVData->maAppData.mpWheelWindow = new ImplWheelWindow( this );
689 0 : }
690 :
691 0 : void Window::EndAutoScroll()
692 : {
693 0 : ImplSVData* pSVData = ImplGetSVData();
694 :
695 0 : if ( pSVData->maWinData.mpAutoScrollWin == this )
696 : {
697 0 : pSVData->maWinData.mpAutoScrollWin = NULL;
698 0 : pSVData->maWinData.mnAutoScrollFlags = 0;
699 0 : pSVData->maAppData.mpWheelWindow->ImplStop();
700 0 : pSVData->maAppData.mpWheelWindow->doLazyDelete();
701 0 : pSVData->maAppData.mpWheelWindow = NULL;
702 : }
703 0 : }
704 :
705 0 : void Window::SaveBackground( const Point& rPos, const Size& rSize,
706 : const Point& rDestOff, VirtualDevice& rSaveDevice )
707 : {
708 0 : if ( mpWindowImpl->mpPaintRegion )
709 : {
710 0 : Region aClip( *mpWindowImpl->mpPaintRegion );
711 0 : const Point aPixPos( LogicToPixel( rPos ) );
712 :
713 0 : aClip.Move( -mnOutOffX, -mnOutOffY );
714 0 : aClip.Intersect( Rectangle( aPixPos, LogicToPixel( rSize ) ) );
715 :
716 0 : if ( !aClip.IsEmpty() )
717 : {
718 0 : const Region aOldClip( rSaveDevice.GetClipRegion() );
719 0 : const Point aPixOffset( rSaveDevice.LogicToPixel( rDestOff ) );
720 0 : const bool bMap = rSaveDevice.IsMapModeEnabled();
721 :
722 : // move clip region to have the same distance to DestOffset
723 0 : aClip.Move( aPixOffset.X() - aPixPos.X(), aPixOffset.Y() - aPixPos.Y() );
724 :
725 : // set pixel clip region
726 0 : rSaveDevice.EnableMapMode( false );
727 0 : rSaveDevice.SetClipRegion( aClip );
728 0 : rSaveDevice.EnableMapMode( bMap );
729 0 : rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
730 0 : rSaveDevice.SetClipRegion( aOldClip );
731 0 : }
732 : }
733 : else
734 0 : rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
735 0 : }
736 :
737 0 : sal_uIntPtr Window::SaveFocus()
738 : {
739 0 : ImplSVData* pSVData = ImplGetSVData();
740 0 : if ( pSVData->maWinData.mpFocusWin )
741 : {
742 0 : ImplFocusDelData* pDelData = new ImplFocusDelData;
743 0 : pSVData->maWinData.mpFocusWin->ImplAddDel( pDelData );
744 0 : pDelData->mpFocusWin = pSVData->maWinData.mpFocusWin;
745 0 : return (sal_uIntPtr)(void*)pDelData;
746 : }
747 : else
748 0 : return 0;
749 : }
750 :
751 0 : bool Window::EndSaveFocus( sal_uIntPtr nSaveId, bool bRestore )
752 : {
753 0 : if ( !nSaveId )
754 0 : return false;
755 : else
756 : {
757 0 : bool bOK = true;
758 0 : ImplFocusDelData* pDelData = (ImplFocusDelData*)(void*)nSaveId;
759 0 : if ( !pDelData->IsDead() )
760 : {
761 0 : pDelData->mpFocusWin->ImplRemoveDel( pDelData );
762 0 : if ( bRestore )
763 0 : pDelData->mpFocusWin->GrabFocus();
764 : }
765 : else
766 0 : bOK = !bRestore;
767 0 : delete pDelData;
768 0 : return bOK;
769 : }
770 : }
771 :
772 0 : void Window::SetZoom( const Fraction& rZoom )
773 : {
774 0 : if ( mpWindowImpl->maZoom != rZoom )
775 : {
776 0 : mpWindowImpl->maZoom = rZoom;
777 0 : StateChanged( STATE_CHANGE_ZOOM );
778 : }
779 0 : }
780 :
781 0 : inline long WinFloatRound( double fVal )
782 : {
783 0 : return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) );
784 : }
785 :
786 0 : void Window::SetZoomedPointFont( const Font& rFont )
787 : {
788 0 : const Fraction& rZoom = GetZoom();
789 0 : if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
790 : {
791 0 : Font aFont( rFont );
792 0 : Size aSize = aFont.GetSize();
793 0 : double n = (double)aSize.Width();
794 0 : n *= (double)rZoom.GetNumerator();
795 0 : n /= (double)rZoom.GetDenominator();
796 0 : aSize.Width() = WinFloatRound( n );
797 0 : n = (double)aSize.Height();
798 0 : n *= (double)rZoom.GetNumerator();
799 0 : n /= (double)rZoom.GetDenominator();
800 0 : aSize.Height() = WinFloatRound( n );
801 0 : aFont.SetSize( aSize );
802 0 : SetPointFont( aFont );
803 :
804 : // Use another font if the representation is to be scaled,
805 : // and the actual font is not scalable
806 0 : FontMetric aMetric = GetFontMetric();
807 0 : long nFontDiff = std::abs( GetFont().GetSize().Height()-aMetric.GetSize().Height() );
808 0 : if ( (aMetric.GetType() == TYPE_RASTER) && (nFontDiff >= 2) )
809 : {
810 : sal_uInt16 nType;
811 0 : if ( aMetric.GetPitch() == PITCH_FIXED )
812 0 : nType = DEFAULTFONT_FIXED;
813 : else
814 0 : nType = DEFAULTFONT_UI_SANS;
815 0 : Font aTempFont = GetDefaultFont( nType, GetSettings().GetLanguageTag().getLanguageType(), 0 );
816 0 : aFont.SetName( aTempFont.GetName() );
817 0 : SetPointFont( aFont );
818 0 : }
819 : }
820 : else
821 0 : SetPointFont( rFont );
822 0 : }
823 :
824 0 : long Window::CalcZoom( long nCalc ) const
825 : {
826 :
827 0 : const Fraction& rZoom = GetZoom();
828 0 : if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
829 : {
830 0 : double n = (double)nCalc;
831 0 : n *= (double)rZoom.GetNumerator();
832 0 : n /= (double)rZoom.GetDenominator();
833 0 : nCalc = WinFloatRound( n );
834 : }
835 0 : return nCalc;
836 : }
837 :
838 0 : void Window::SetControlFont()
839 : {
840 0 : if ( mpWindowImpl->mpControlFont )
841 : {
842 0 : delete mpWindowImpl->mpControlFont;
843 0 : mpWindowImpl->mpControlFont = NULL;
844 0 : StateChanged( STATE_CHANGE_CONTROLFONT );
845 : }
846 0 : }
847 :
848 0 : void Window::SetControlFont( const Font& rFont )
849 : {
850 0 : if ( rFont == Font() )
851 : {
852 0 : SetControlFont();
853 0 : return;
854 : }
855 :
856 0 : if ( mpWindowImpl->mpControlFont )
857 : {
858 0 : if ( *mpWindowImpl->mpControlFont == rFont )
859 0 : return;
860 0 : *mpWindowImpl->mpControlFont = rFont;
861 : }
862 : else
863 0 : mpWindowImpl->mpControlFont = new Font( rFont );
864 :
865 0 : StateChanged( STATE_CHANGE_CONTROLFONT );
866 : }
867 :
868 0 : Font Window::GetControlFont() const
869 : {
870 0 : if ( mpWindowImpl->mpControlFont )
871 0 : return *mpWindowImpl->mpControlFont;
872 : else
873 : {
874 0 : Font aFont;
875 0 : return aFont;
876 : }
877 : }
878 :
879 0 : void Window::SetControlForeground()
880 : {
881 0 : if ( mpWindowImpl->mbControlForeground )
882 : {
883 0 : mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT );
884 0 : mpWindowImpl->mbControlForeground = false;
885 0 : StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
886 : }
887 0 : }
888 :
889 0 : void Window::SetControlForeground( const Color& rColor )
890 : {
891 0 : if ( rColor.GetTransparency() )
892 : {
893 0 : if ( mpWindowImpl->mbControlForeground )
894 : {
895 0 : mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT );
896 0 : mpWindowImpl->mbControlForeground = false;
897 0 : StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
898 : }
899 : }
900 : else
901 : {
902 0 : if ( mpWindowImpl->maControlForeground != rColor )
903 : {
904 0 : mpWindowImpl->maControlForeground = rColor;
905 0 : mpWindowImpl->mbControlForeground = true;
906 0 : StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
907 : }
908 : }
909 0 : }
910 :
911 0 : void Window::SetControlBackground()
912 : {
913 0 : if ( mpWindowImpl->mbControlBackground )
914 : {
915 0 : mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT );
916 0 : mpWindowImpl->mbControlBackground = false;
917 0 : StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
918 : }
919 0 : }
920 :
921 0 : void Window::SetControlBackground( const Color& rColor )
922 : {
923 0 : if ( rColor.GetTransparency() )
924 : {
925 0 : if ( mpWindowImpl->mbControlBackground )
926 : {
927 0 : mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT );
928 0 : mpWindowImpl->mbControlBackground = false;
929 0 : StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
930 : }
931 : }
932 : else
933 : {
934 0 : if ( mpWindowImpl->maControlBackground != rColor )
935 : {
936 0 : mpWindowImpl->maControlBackground = rColor;
937 0 : mpWindowImpl->mbControlBackground = true;
938 0 : StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
939 : }
940 : }
941 0 : }
942 :
943 0 : Size Window::CalcWindowSize( const Size& rOutSz ) const
944 : {
945 0 : Size aSz = rOutSz;
946 0 : aSz.Width() += mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder;
947 0 : aSz.Height() += mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder;
948 0 : return aSz;
949 : }
950 :
951 0 : Size Window::CalcOutputSize( const Size& rWinSz ) const
952 : {
953 0 : Size aSz = rWinSz;
954 0 : aSz.Width() -= mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder;
955 0 : aSz.Height() -= mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder;
956 0 : return aSz;
957 : }
958 :
959 0 : Font Window::GetDrawPixelFont( OutputDevice* pDev ) const
960 : {
961 0 : Font aFont = GetPointFont();
962 0 : Size aFontSize = aFont.GetSize();
963 0 : MapMode aPtMapMode( MAP_POINT );
964 0 : aFontSize = pDev->LogicToPixel( aFontSize, aPtMapMode );
965 0 : aFont.SetSize( aFontSize );
966 0 : return aFont;
967 : }
968 :
969 0 : long Window::GetDrawPixel( OutputDevice* pDev, long nPixels ) const
970 : {
971 0 : long nP = nPixels;
972 0 : if ( pDev->GetOutDevType() != OUTDEV_WINDOW )
973 : {
974 0 : MapMode aMap( MAP_100TH_MM );
975 0 : Size aSz( nP, 0 );
976 0 : aSz = PixelToLogic( aSz, aMap );
977 0 : aSz = pDev->LogicToPixel( aSz, aMap );
978 0 : nP = aSz.Width();
979 : }
980 0 : return nP;
981 : }
982 :
983 0 : static void lcl_HandleScrollHelper( ScrollBar* pScrl, long nN, bool isMultiplyByLineSize )
984 : {
985 0 : if ( pScrl && nN && pScrl->IsEnabled() && pScrl->IsInputEnabled() && ! pScrl->IsInModalMode() )
986 : {
987 0 : long nNewPos = pScrl->GetThumbPos();
988 :
989 0 : if ( nN == -LONG_MAX )
990 0 : nNewPos += pScrl->GetPageSize();
991 0 : else if ( nN == LONG_MAX )
992 0 : nNewPos -= pScrl->GetPageSize();
993 : else
994 : {
995 : // allowing both chunked and continuous scrolling
996 0 : if(isMultiplyByLineSize){
997 0 : nN*=pScrl->GetLineSize();
998 : }
999 :
1000 0 : const double fVal = (double)(nNewPos - nN);
1001 :
1002 0 : if ( fVal < LONG_MIN )
1003 0 : nNewPos = LONG_MIN;
1004 0 : else if ( fVal > LONG_MAX )
1005 0 : nNewPos = LONG_MAX;
1006 : else
1007 0 : nNewPos = (long)fVal;
1008 : }
1009 :
1010 0 : pScrl->DoScroll( nNewPos );
1011 : }
1012 :
1013 0 : }
1014 :
1015 0 : bool Window::HandleScrollCommand( const CommandEvent& rCmd,
1016 : ScrollBar* pHScrl, ScrollBar* pVScrl )
1017 : {
1018 0 : bool bRet = false;
1019 :
1020 0 : if ( pHScrl || pVScrl )
1021 : {
1022 0 : switch( rCmd.GetCommand() )
1023 : {
1024 : case COMMAND_STARTAUTOSCROLL:
1025 : {
1026 0 : sal_uInt16 nFlags = 0;
1027 0 : if ( pHScrl )
1028 : {
1029 0 : if ( (pHScrl->GetVisibleSize() < pHScrl->GetRangeMax()) &&
1030 0 : pHScrl->IsEnabled() && pHScrl->IsInputEnabled() && ! pHScrl->IsInModalMode() )
1031 0 : nFlags |= AUTOSCROLL_HORZ;
1032 : }
1033 0 : if ( pVScrl )
1034 : {
1035 0 : if ( (pVScrl->GetVisibleSize() < pVScrl->GetRangeMax()) &&
1036 0 : pVScrl->IsEnabled() && pVScrl->IsInputEnabled() && ! pVScrl->IsInModalMode() )
1037 0 : nFlags |= AUTOSCROLL_VERT;
1038 : }
1039 :
1040 0 : if ( nFlags )
1041 : {
1042 0 : StartAutoScroll( nFlags );
1043 0 : bRet = true;
1044 : }
1045 : }
1046 0 : break;
1047 :
1048 : case COMMAND_WHEEL:
1049 : {
1050 0 : const CommandWheelData* pData = rCmd.GetWheelData();
1051 :
1052 0 : if ( pData && (COMMAND_WHEEL_SCROLL == pData->GetMode()) )
1053 : {
1054 0 : if (!pData->IsDeltaPixel())
1055 : {
1056 0 : sal_uLong nScrollLines = pData->GetScrollLines();
1057 : long nLines;
1058 0 : if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL )
1059 : {
1060 0 : if ( pData->GetDelta() < 0 )
1061 0 : nLines = -LONG_MAX;
1062 : else
1063 0 : nLines = LONG_MAX;
1064 : }
1065 : else
1066 0 : nLines = pData->GetNotchDelta() * (long)nScrollLines;
1067 0 : if ( nLines )
1068 : {
1069 : ImplHandleScroll( NULL,
1070 : 0L,
1071 0 : pData->IsHorz() ? pHScrl : pVScrl,
1072 0 : nLines );
1073 0 : bRet = true;
1074 : }
1075 : }
1076 : else
1077 : {
1078 : // Mobile / touch scrolling section
1079 0 : const Point & deltaPoint = rCmd.GetMousePosPixel();
1080 :
1081 0 : double deltaXInPixels = double(deltaPoint.X());
1082 0 : double deltaYInPixels = double(deltaPoint.Y());
1083 0 : Size winSize = this->GetOutputSizePixel();
1084 :
1085 0 : if(pHScrl)
1086 : {
1087 0 : double visSizeX = double(pHScrl->GetVisibleSize());
1088 0 : double ratioX = deltaXInPixels / double(winSize.getWidth());
1089 0 : long deltaXInLogic = long(visSizeX * ratioX);
1090 : // Touch need to work by pixels. Did not apply this to
1091 : // Android, as android code may require adaptations
1092 : // to work with this scrolling code
1093 : #ifndef IOS
1094 0 : long lineSizeX = pHScrl->GetLineSize();
1095 :
1096 0 : if(lineSizeX)
1097 : {
1098 0 : deltaXInLogic /= lineSizeX;
1099 : }
1100 : else
1101 : {
1102 0 : deltaXInLogic = 0;
1103 : }
1104 : #endif
1105 0 : if ( deltaXInLogic)
1106 : {
1107 : #ifndef IOS
1108 0 : bool isMultiplyByLineSize = true;
1109 : #else
1110 : bool isMultiplyByLineSize = false;
1111 : #endif
1112 0 : lcl_HandleScrollHelper( pHScrl, deltaXInLogic, isMultiplyByLineSize );
1113 0 : bRet = true;
1114 : }
1115 : }
1116 0 : if(pVScrl)
1117 : {
1118 0 : double visSizeY = double(pVScrl->GetVisibleSize());
1119 0 : double ratioY = deltaYInPixels / double(winSize.getHeight());
1120 0 : long deltaYInLogic = long(visSizeY * ratioY);
1121 :
1122 : // Touch need to work by pixels. Did not apply this to
1123 : // Android, as android code may require adaptations
1124 : // to work with this scrolling code
1125 : #ifndef IOS
1126 0 : long lineSizeY = pVScrl->GetLineSize();
1127 0 : if(lineSizeY)
1128 : {
1129 0 : deltaYInLogic /= lineSizeY;
1130 : }
1131 : else
1132 : {
1133 0 : deltaYInLogic = 0;
1134 : }
1135 : #endif
1136 0 : if ( deltaYInLogic )
1137 : {
1138 : #ifndef IOS
1139 0 : bool isMultiplyByLineSize = true;
1140 : #else
1141 : bool isMultiplyByLineSize = false;
1142 : #endif
1143 0 : lcl_HandleScrollHelper( pVScrl, deltaYInLogic, isMultiplyByLineSize );
1144 :
1145 0 : bRet = true;
1146 : }
1147 : }
1148 : }
1149 : }
1150 : }
1151 0 : break;
1152 :
1153 : case COMMAND_AUTOSCROLL:
1154 : {
1155 0 : const CommandScrollData* pData = rCmd.GetAutoScrollData();
1156 0 : if ( pData && (pData->GetDeltaX() || pData->GetDeltaY()) )
1157 : {
1158 : ImplHandleScroll( pHScrl, pData->GetDeltaX(),
1159 0 : pVScrl, pData->GetDeltaY() );
1160 0 : bRet = true;
1161 : }
1162 : }
1163 0 : break;
1164 :
1165 : default:
1166 0 : break;
1167 : }
1168 : }
1169 :
1170 0 : return bRet;
1171 : }
1172 :
1173 : // Note that when called for COMMAND_WHEEL above, despite its name,
1174 : // pVScrl isn't necessarily the vertical scroll bar. Depending on
1175 : // whether the scroll is horizontal or vertical, it is either the
1176 : // horizontal or vertical scroll bar. nY is correspondingly either
1177 : // the horizontal or vertical scroll amount.
1178 :
1179 0 : void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX,
1180 : ScrollBar* pVScrl, long nY )
1181 : {
1182 0 : lcl_HandleScrollHelper( pHScrl, nX, true );
1183 0 : lcl_HandleScrollHelper( pVScrl, nY, true );
1184 0 : }
1185 :
1186 0 : DockingManager* Window::GetDockingManager()
1187 : {
1188 0 : return ImplGetDockingManager();
1189 : }
1190 :
1191 0 : void Window::EnableDocking( bool bEnable )
1192 : {
1193 : // update list of dockable windows
1194 0 : if( bEnable )
1195 0 : ImplGetDockingManager()->AddWindow( this );
1196 : else
1197 0 : ImplGetDockingManager()->RemoveWindow( this );
1198 0 : }
1199 :
1200 : // retrieves the list of owner draw decorated windows for this window hiearchy
1201 0 : ::std::vector<Window *>& Window::ImplGetOwnerDrawList()
1202 : {
1203 0 : return ImplGetTopmostFrameWindow()->mpWindowImpl->mpFrameData->maOwnerDrawList;
1204 : }
1205 :
1206 0 : Window* Window::ImplGetTopmostFrameWindow()
1207 : {
1208 0 : Window *pTopmostParent = this;
1209 0 : while( pTopmostParent->ImplGetParent() )
1210 0 : pTopmostParent = pTopmostParent->ImplGetParent();
1211 0 : return pTopmostParent->mpWindowImpl->mpFrameWindow;
1212 : }
1213 :
1214 0 : void Window::SetHelpId( const OString& rHelpId )
1215 : {
1216 0 : mpWindowImpl->maHelpId = rHelpId;
1217 0 : }
1218 :
1219 0 : const OString& Window::GetHelpId() const
1220 : {
1221 0 : return mpWindowImpl->maHelpId;
1222 : }
1223 :
1224 0 : void Window::SetUniqueId( const OString& rUniqueId )
1225 : {
1226 0 : mpWindowImpl->maUniqId = rUniqueId;
1227 0 : }
1228 :
1229 0 : const OString& Window::GetUniqueId() const
1230 : {
1231 0 : return mpWindowImpl->maUniqId;
1232 : }
1233 :
1234 : // --------- old inline methods ---------------
1235 :
1236 0 : Window* Window::ImplGetWindow()
1237 : {
1238 0 : if ( mpWindowImpl->mpClientWindow )
1239 0 : return mpWindowImpl->mpClientWindow;
1240 : else
1241 0 : return this;
1242 : }
1243 :
1244 0 : ImplFrameData* Window::ImplGetFrameData()
1245 : {
1246 0 : return mpWindowImpl->mpFrameData;
1247 : }
1248 :
1249 0 : SalFrame* Window::ImplGetFrame() const
1250 : {
1251 0 : return mpWindowImpl->mpFrame;
1252 : }
1253 :
1254 0 : Window* Window::ImplGetParent() const
1255 : {
1256 0 : return mpWindowImpl->mpParent;
1257 : }
1258 :
1259 0 : Window* Window::ImplGetClientWindow() const
1260 : {
1261 0 : return mpWindowImpl->mpClientWindow;
1262 : }
1263 :
1264 0 : Window* Window::ImplGetBorderWindow() const
1265 : {
1266 0 : return mpWindowImpl->mpBorderWindow;
1267 : }
1268 :
1269 0 : Window* Window::ImplGetFirstOverlapWindow()
1270 : {
1271 0 : if ( mpWindowImpl->mbOverlapWin )
1272 0 : return this;
1273 : else
1274 0 : return mpWindowImpl->mpOverlapWindow;
1275 : }
1276 :
1277 0 : const Window* Window::ImplGetFirstOverlapWindow() const
1278 : {
1279 0 : if ( mpWindowImpl->mbOverlapWin )
1280 0 : return this;
1281 : else
1282 0 : return mpWindowImpl->mpOverlapWindow;
1283 : }
1284 :
1285 0 : Window* Window::ImplGetFrameWindow() const
1286 : {
1287 0 : return mpWindowImpl->mpFrameWindow;
1288 : }
1289 :
1290 0 : bool Window::ImplIsDockingWindow() const
1291 : {
1292 0 : return mpWindowImpl->mbDockWin;
1293 : }
1294 :
1295 0 : bool Window::ImplIsFloatingWindow() const
1296 : {
1297 0 : return mpWindowImpl->mbFloatWin;
1298 : }
1299 :
1300 0 : bool Window::ImplIsSplitter() const
1301 : {
1302 0 : return mpWindowImpl->mbSplitter;
1303 : }
1304 :
1305 0 : bool Window::ImplIsPushButton() const
1306 : {
1307 0 : return mpWindowImpl->mbPushButton;
1308 : }
1309 :
1310 0 : bool Window::ImplIsOverlapWindow() const
1311 : {
1312 0 : return mpWindowImpl->mbOverlapWin;
1313 : }
1314 :
1315 0 : void Window::ImplSetMouseTransparent( bool bTransparent )
1316 : {
1317 0 : mpWindowImpl->mbMouseTransparent = bTransparent;
1318 0 : }
1319 :
1320 0 : Point Window::ImplOutputToFrame( const Point& rPos )
1321 : {
1322 0 : return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY );
1323 : }
1324 :
1325 0 : Point Window::ImplFrameToOutput( const Point& rPos )
1326 : {
1327 0 : return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY );
1328 : }
1329 :
1330 0 : void Window::SetCompoundControl( bool bCompound )
1331 : {
1332 0 : mpWindowImpl->mbCompoundControl = bCompound;
1333 0 : }
1334 :
1335 0 : void Window::IncrementLockCount()
1336 : {
1337 0 : mpWindowImpl->mnLockCount++;
1338 0 : }
1339 :
1340 0 : void Window::DecrementLockCount()
1341 : {
1342 0 : mpWindowImpl->mnLockCount--;
1343 0 : }
1344 :
1345 0 : WinBits Window::GetStyle() const
1346 : {
1347 0 : return mpWindowImpl->mnStyle;
1348 : }
1349 :
1350 0 : WinBits Window::GetPrevStyle() const
1351 : {
1352 0 : return mpWindowImpl->mnPrevStyle;
1353 : }
1354 :
1355 0 : WinBits Window::GetExtendedStyle() const
1356 : {
1357 0 : return mpWindowImpl->mnExtendedStyle;
1358 : }
1359 :
1360 0 : void Window::SetType( WindowType nType )
1361 : {
1362 0 : mpWindowImpl->mnType = nType;
1363 0 : }
1364 :
1365 0 : WindowType Window::GetType() const
1366 : {
1367 0 : return mpWindowImpl->mnType;
1368 : }
1369 :
1370 0 : Dialog* Window::GetParentDialog() const
1371 : {
1372 0 : const Window *pWindow = this;
1373 :
1374 0 : while( pWindow )
1375 : {
1376 0 : if( pWindow->IsDialog() )
1377 0 : break;
1378 :
1379 0 : pWindow = pWindow->GetParent();
1380 : }
1381 :
1382 0 : return const_cast<Dialog *>(dynamic_cast<const Dialog*>(pWindow));
1383 : }
1384 :
1385 0 : bool Window::IsSystemWindow() const
1386 : {
1387 0 : return mpWindowImpl->mbSysWin;
1388 : }
1389 :
1390 0 : bool Window::IsDialog() const
1391 : {
1392 0 : return mpWindowImpl->mbDialog;
1393 : }
1394 :
1395 0 : bool Window::IsMenuFloatingWindow() const
1396 : {
1397 0 : return mpWindowImpl->mbMenuFloatingWindow;
1398 : }
1399 :
1400 0 : bool Window::IsToolbarFloatingWindow() const
1401 : {
1402 0 : return mpWindowImpl->mbToolbarFloatingWindow;
1403 : }
1404 :
1405 0 : void Window::EnableAllResize( bool bEnable )
1406 : {
1407 0 : mpWindowImpl->mbAllResize = bEnable;
1408 0 : }
1409 :
1410 0 : void Window::EnableChildTransparentMode( bool bEnable )
1411 : {
1412 0 : mpWindowImpl->mbChildTransparent = bEnable;
1413 0 : }
1414 :
1415 0 : bool Window::IsChildTransparentModeEnabled() const
1416 : {
1417 0 : return mpWindowImpl->mbChildTransparent;
1418 : }
1419 :
1420 0 : bool Window::IsMouseTransparent() const
1421 : {
1422 0 : return mpWindowImpl->mbMouseTransparent;
1423 : }
1424 :
1425 0 : bool Window::IsPaintTransparent() const
1426 : {
1427 0 : return mpWindowImpl->mbPaintTransparent;
1428 : }
1429 :
1430 0 : void Window::SetDialogControlStart( bool bStart )
1431 : {
1432 0 : mpWindowImpl->mbDlgCtrlStart = bStart;
1433 0 : }
1434 :
1435 0 : bool Window::IsDialogControlStart() const
1436 : {
1437 0 : return mpWindowImpl->mbDlgCtrlStart;
1438 : }
1439 :
1440 0 : void Window::SetDialogControlFlags( sal_uInt16 nFlags )
1441 : {
1442 0 : mpWindowImpl->mnDlgCtrlFlags = nFlags;
1443 0 : }
1444 :
1445 0 : sal_uInt16 Window::GetDialogControlFlags() const
1446 : {
1447 0 : return mpWindowImpl->mnDlgCtrlFlags;
1448 : }
1449 :
1450 0 : const InputContext& Window::GetInputContext() const
1451 : {
1452 0 : return mpWindowImpl->maInputContext;
1453 : }
1454 :
1455 0 : bool Window::IsControlFont() const
1456 : {
1457 0 : return (mpWindowImpl->mpControlFont != 0);
1458 : }
1459 :
1460 0 : Color Window::GetControlForeground() const
1461 : {
1462 0 : return mpWindowImpl->maControlForeground;
1463 : }
1464 :
1465 0 : bool Window::IsControlForeground() const
1466 : {
1467 0 : return mpWindowImpl->mbControlForeground;
1468 : }
1469 :
1470 0 : Color Window::GetControlBackground() const
1471 : {
1472 0 : return mpWindowImpl->maControlBackground;
1473 : }
1474 :
1475 0 : bool Window::IsControlBackground() const
1476 : {
1477 0 : return mpWindowImpl->mbControlBackground;
1478 : }
1479 :
1480 0 : bool Window::IsInPaint() const
1481 : {
1482 0 : return mpWindowImpl->mbInPaint;
1483 : }
1484 :
1485 0 : Window* Window::GetParent() const
1486 : {
1487 0 : return mpWindowImpl->mpRealParent;
1488 : }
1489 :
1490 0 : bool Window::IsVisible() const
1491 : {
1492 0 : return mpWindowImpl->mbVisible;
1493 : }
1494 :
1495 0 : bool Window::IsReallyVisible() const
1496 : {
1497 0 : return mpWindowImpl->mbReallyVisible;
1498 : }
1499 :
1500 0 : bool Window::IsReallyShown() const
1501 : {
1502 0 : return mpWindowImpl->mbReallyShown;
1503 : }
1504 :
1505 0 : bool Window::IsInInitShow() const
1506 : {
1507 0 : return mpWindowImpl->mbInInitShow;
1508 : }
1509 :
1510 0 : bool Window::IsEnabled() const
1511 : {
1512 0 : return !mpWindowImpl->mbDisabled;
1513 : }
1514 :
1515 0 : bool Window::IsInputEnabled() const
1516 : {
1517 0 : return !mpWindowImpl->mbInputDisabled;
1518 : }
1519 :
1520 0 : bool Window::IsAlwaysEnableInput() const
1521 : {
1522 0 : return mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled;
1523 : }
1524 :
1525 0 : sal_uInt16 Window::GetActivateMode() const
1526 : {
1527 0 : return mpWindowImpl->mnActivateMode;
1528 :
1529 : }
1530 :
1531 0 : bool Window::IsAlwaysOnTopEnabled() const
1532 : {
1533 0 : return mpWindowImpl->mbAlwaysOnTop;
1534 : }
1535 :
1536 0 : bool Window::IsDefaultPos() const
1537 : {
1538 0 : return mpWindowImpl->mbDefPos;
1539 : }
1540 :
1541 0 : bool Window::IsDefaultSize() const
1542 : {
1543 0 : return mpWindowImpl->mbDefSize;
1544 : }
1545 :
1546 0 : void Window::EnablePaint( bool bEnable )
1547 : {
1548 0 : mpWindowImpl->mbPaintDisabled = !bEnable;
1549 0 : }
1550 :
1551 0 : bool Window::IsPaintEnabled() const
1552 : {
1553 0 : return !mpWindowImpl->mbPaintDisabled;
1554 : }
1555 :
1556 0 : bool Window::IsUpdateMode() const
1557 : {
1558 0 : return !mpWindowImpl->mbNoUpdate;
1559 : }
1560 :
1561 0 : void Window::SetParentUpdateMode( bool bUpdate )
1562 : {
1563 0 : mpWindowImpl->mbNoParentUpdate = !bUpdate;
1564 0 : }
1565 :
1566 0 : bool Window::IsActive() const
1567 : {
1568 0 : return mpWindowImpl->mbActive;
1569 : }
1570 :
1571 0 : sal_uInt16 Window::GetGetFocusFlags() const
1572 : {
1573 0 : return mpWindowImpl->mnGetFocusFlags;
1574 : }
1575 :
1576 0 : bool Window::IsCompoundControl() const
1577 : {
1578 0 : return mpWindowImpl->mbCompoundControl;
1579 : }
1580 :
1581 0 : bool Window::IsWait() const
1582 : {
1583 0 : return (mpWindowImpl->mnWaitCount != 0);
1584 : }
1585 :
1586 0 : Cursor* Window::GetCursor() const
1587 : {
1588 0 : return mpWindowImpl->mpCursor;
1589 : }
1590 :
1591 0 : const Fraction& Window::GetZoom() const
1592 : {
1593 0 : return mpWindowImpl->maZoom;
1594 : }
1595 :
1596 0 : bool Window::IsZoom() const
1597 : {
1598 0 : return mpWindowImpl->maZoom.GetNumerator() != mpWindowImpl->maZoom.GetDenominator();
1599 : }
1600 :
1601 0 : void Window::SetHelpText( const OUString& rHelpText )
1602 : {
1603 0 : mpWindowImpl->maHelpText = rHelpText;
1604 0 : mpWindowImpl->mbHelpTextDynamic = true;
1605 0 : }
1606 :
1607 0 : void Window::SetQuickHelpText( const OUString& rHelpText )
1608 : {
1609 0 : mpWindowImpl->maQuickHelpText = rHelpText;
1610 0 : }
1611 :
1612 0 : const OUString& Window::GetQuickHelpText() const
1613 : {
1614 0 : return mpWindowImpl->maQuickHelpText;
1615 : }
1616 :
1617 0 : void Window::SetData( void* pNewData )
1618 : {
1619 0 : mpWindowImpl->mpUserData = pNewData;
1620 0 : }
1621 :
1622 0 : void* Window::GetData() const
1623 : {
1624 0 : return mpWindowImpl->mpUserData;
1625 : }
1626 :
1627 0 : bool Window::IsCreatedWithToolkit() const
1628 : {
1629 0 : return mpWindowImpl->mbCreatedWithToolkit;
1630 : }
1631 :
1632 0 : void Window::SetCreatedWithToolkit( bool b )
1633 : {
1634 0 : mpWindowImpl->mbCreatedWithToolkit = b;
1635 :
1636 0 : }
1637 0 : const Pointer& Window::GetPointer() const
1638 : {
1639 0 : return mpWindowImpl->maPointer;
1640 : }
1641 :
1642 0 : VCLXWindow* Window::GetWindowPeer() const
1643 : {
1644 0 : return mpWindowImpl->mpVCLXWindow;
1645 : }
1646 :
1647 0 : void Window::SetPosPixel( const Point& rNewPos )
1648 : {
1649 0 : setPosSizePixel( rNewPos.X(), rNewPos.Y(), 0, 0, WINDOW_POSSIZE_POS );
1650 0 : }
1651 :
1652 0 : void Window::SetSizePixel( const Size& rNewSize )
1653 : {
1654 : setPosSizePixel( 0, 0, rNewSize.Width(), rNewSize.Height(),
1655 0 : WINDOW_POSSIZE_SIZE );
1656 0 : }
1657 :
1658 0 : void Window::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
1659 : {
1660 : setPosSizePixel( rNewPos.X(), rNewPos.Y(),
1661 : rNewSize.Width(), rNewSize.Height(),
1662 0 : WINDOW_POSSIZE_POSSIZE );
1663 0 : }
1664 :
1665 0 : void Window::SetOutputSizePixel( const Size& rNewSize )
1666 : {
1667 0 : SetSizePixel( Size( rNewSize.Width()+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder,
1668 0 : rNewSize.Height()+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ) );
1669 0 : }
1670 :
1671 : //When a widget wants to renegotiate layout, get toplevel parent dialog and call
1672 : //resize on it. Mark all intermediate containers (or container-alike) widgets
1673 : //as dirty for the size remains unchanged, but layout changed circumstances
1674 : namespace
1675 : {
1676 0 : bool queue_ungrouped_resize(Window *pOrigWindow)
1677 : {
1678 0 : bool bSomeoneCares = false;
1679 :
1680 0 : Window *pWindow = pOrigWindow->GetParent();
1681 0 : if (pWindow)
1682 : {
1683 0 : if (isContainerWindow(*pWindow))
1684 : {
1685 0 : bSomeoneCares = true;
1686 : }
1687 0 : else if (pWindow->GetType() == WINDOW_TABCONTROL)
1688 : {
1689 0 : bSomeoneCares = true;
1690 : }
1691 0 : pWindow->queue_resize();
1692 : }
1693 :
1694 0 : return bSomeoneCares;
1695 : }
1696 : }
1697 :
1698 0 : void Window::queue_resize()
1699 : {
1700 0 : bool bSomeoneCares = queue_ungrouped_resize(this);
1701 :
1702 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
1703 0 : if (pWindowImpl->m_xSizeGroup && pWindowImpl->m_xSizeGroup->get_mode() != VCL_SIZE_GROUP_NONE)
1704 : {
1705 0 : std::set<Window*> &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
1706 0 : for (std::set<Window*>::iterator aI = rWindows.begin(),
1707 0 : aEnd = rWindows.end(); aI != aEnd; ++aI)
1708 : {
1709 0 : Window *pOther = *aI;
1710 0 : if (pOther == this)
1711 0 : continue;
1712 0 : queue_ungrouped_resize(pOther);
1713 : }
1714 : }
1715 :
1716 0 : if (bSomeoneCares)
1717 : {
1718 : //fdo#57090 force a resync of the borders of the borderwindow onto this
1719 : //window in case they have changed
1720 0 : Window* pBorderWindow = ImplGetBorderWindow();
1721 0 : if (pBorderWindow)
1722 0 : pBorderWindow->Resize();
1723 : }
1724 0 : }
1725 :
1726 : namespace
1727 : {
1728 0 : VclAlign toAlign(const OString &rValue)
1729 : {
1730 0 : VclAlign eRet = VCL_ALIGN_FILL;
1731 :
1732 0 : if (rValue == "fill")
1733 0 : eRet = VCL_ALIGN_FILL;
1734 0 : else if (rValue == "start")
1735 0 : eRet = VCL_ALIGN_START;
1736 0 : else if (rValue == "end")
1737 0 : eRet = VCL_ALIGN_END;
1738 0 : else if (rValue == "center")
1739 0 : eRet = VCL_ALIGN_CENTER;
1740 0 : return eRet;
1741 : }
1742 : }
1743 :
1744 0 : bool Window::set_font_attribute(const OString &rKey, const OString &rValue)
1745 : {
1746 0 : if (rKey == "weight")
1747 : {
1748 0 : Font aFont(GetControlFont());
1749 0 : if (rValue == "thin")
1750 0 : aFont.SetWeight(WEIGHT_THIN);
1751 0 : else if (rValue == "ultralight")
1752 0 : aFont.SetWeight(WEIGHT_ULTRALIGHT);
1753 0 : else if (rValue == "light")
1754 0 : aFont.SetWeight(WEIGHT_LIGHT);
1755 0 : else if (rValue == "book")
1756 0 : aFont.SetWeight(WEIGHT_SEMILIGHT);
1757 0 : else if (rValue == "normal")
1758 0 : aFont.SetWeight(WEIGHT_NORMAL);
1759 0 : else if (rValue == "medium")
1760 0 : aFont.SetWeight(WEIGHT_MEDIUM);
1761 0 : else if (rValue == "semibold")
1762 0 : aFont.SetWeight(WEIGHT_SEMIBOLD);
1763 0 : else if (rValue == "bold")
1764 0 : aFont.SetWeight(WEIGHT_BOLD);
1765 0 : else if (rValue == "ultrabold")
1766 0 : aFont.SetWeight(WEIGHT_ULTRABOLD);
1767 : else
1768 0 : aFont.SetWeight(WEIGHT_BLACK);
1769 0 : SetControlFont(aFont);
1770 : }
1771 0 : else if (rKey == "style")
1772 : {
1773 0 : Font aFont(GetControlFont());
1774 0 : if (rValue == "normal")
1775 0 : aFont.SetItalic(ITALIC_NONE);
1776 0 : else if (rValue == "oblique")
1777 0 : aFont.SetItalic(ITALIC_OBLIQUE);
1778 0 : else if (rValue == "italic")
1779 0 : aFont.SetItalic(ITALIC_NORMAL);
1780 0 : SetControlFont(aFont);
1781 : }
1782 0 : else if (rKey == "underline" && toBool(rValue) == true)
1783 : {
1784 0 : Font aFont(GetControlFont());
1785 0 : aFont.SetUnderline(UNDERLINE_SINGLE);
1786 0 : SetControlFont(aFont);
1787 : }
1788 0 : else if (rKey == "size")
1789 : {
1790 0 : Font aFont(GetControlFont());
1791 0 : sal_Int32 nHeight = rValue.toInt32() / 1000;
1792 0 : aFont.SetHeight(nHeight);
1793 0 : SetControlFont(aFont);
1794 : }
1795 : else
1796 : {
1797 : SAL_INFO("vcl.layout", "unhandled font attribute: " << rKey.getStr());
1798 0 : return false;
1799 : }
1800 0 : return true;
1801 : }
1802 :
1803 0 : bool Window::set_property(const OString &rKey, const OString &rValue)
1804 : {
1805 0 : if ((rKey == "label") || (rKey == "title") || (rKey == "text") )
1806 : {
1807 0 : SetText(OStringToOUString(VclBuilder::convertMnemonicMarkup(rValue), RTL_TEXTENCODING_UTF8));
1808 : }
1809 0 : else if (rKey == "visible")
1810 0 : Show(toBool(rValue));
1811 0 : else if (rKey == "sensitive")
1812 0 : Enable(toBool(rValue));
1813 0 : else if (rKey == "resizable")
1814 : {
1815 0 : WinBits nBits = GetStyle();
1816 0 : nBits &= ~(WB_SIZEABLE);
1817 0 : if (toBool(rValue))
1818 0 : nBits |= WB_SIZEABLE;
1819 0 : SetStyle(nBits);
1820 : }
1821 0 : else if (rKey == "xalign")
1822 : {
1823 0 : WinBits nBits = GetStyle();
1824 0 : nBits &= ~(WB_LEFT | WB_CENTER | WB_RIGHT);
1825 :
1826 0 : float f = rValue.toFloat();
1827 0 : if (f == 0.0)
1828 0 : nBits |= WB_LEFT;
1829 0 : else if (f == 1.0)
1830 0 : nBits |= WB_RIGHT;
1831 0 : else if (f == 0.5)
1832 0 : nBits |= WB_CENTER;
1833 :
1834 0 : SetStyle(nBits);
1835 : }
1836 0 : else if (rKey == "justification")
1837 : {
1838 0 : WinBits nBits = GetStyle();
1839 0 : nBits &= ~(WB_LEFT | WB_CENTER | WB_RIGHT);
1840 :
1841 0 : if (rValue == "left")
1842 0 : nBits |= WB_LEFT;
1843 0 : else if (rValue == "right")
1844 0 : nBits |= WB_RIGHT;
1845 0 : else if (rValue == "center")
1846 0 : nBits |= WB_CENTER;
1847 :
1848 0 : SetStyle(nBits);
1849 : }
1850 0 : else if (rKey == "yalign")
1851 : {
1852 0 : WinBits nBits = GetStyle();
1853 0 : nBits &= ~(WB_TOP | WB_VCENTER | WB_BOTTOM);
1854 :
1855 0 : float f = rValue.toFloat();
1856 0 : if (f == 0.0)
1857 0 : nBits |= WB_TOP;
1858 0 : else if (f == 1.0)
1859 0 : nBits |= WB_BOTTOM;
1860 0 : else if (f == 0.5)
1861 0 : nBits |= WB_CENTER;
1862 :
1863 0 : SetStyle(nBits);
1864 : }
1865 0 : else if (rKey == "wrap")
1866 : {
1867 0 : WinBits nBits = GetStyle();
1868 0 : nBits &= ~(WB_WORDBREAK);
1869 0 : if (toBool(rValue))
1870 0 : nBits |= WB_WORDBREAK;
1871 0 : SetStyle(nBits);
1872 : }
1873 0 : else if (rKey == "height-request")
1874 0 : set_height_request(rValue.toInt32());
1875 0 : else if (rKey == "width-request")
1876 0 : set_width_request(rValue.toInt32());
1877 0 : else if (rKey == "hexpand")
1878 0 : set_hexpand(toBool(rValue));
1879 0 : else if (rKey == "vexpand")
1880 0 : set_vexpand(toBool(rValue));
1881 0 : else if (rKey == "halign")
1882 0 : set_halign(toAlign(rValue));
1883 0 : else if (rKey == "valign")
1884 0 : set_valign(toAlign(rValue));
1885 0 : else if (rKey == "tooltip-markup")
1886 0 : SetQuickHelpText(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
1887 0 : else if (rKey == "tooltip-text")
1888 0 : SetQuickHelpText(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
1889 0 : else if (rKey == "border-width")
1890 0 : set_border_width(rValue.toInt32());
1891 0 : else if (rKey == "margin-left")
1892 0 : set_margin_left(rValue.toInt32());
1893 0 : else if (rKey == "margin-right")
1894 0 : set_margin_right(rValue.toInt32());
1895 0 : else if (rKey == "margin-top")
1896 0 : set_margin_top(rValue.toInt32());
1897 0 : else if (rKey == "margin-bottom")
1898 0 : set_margin_bottom(rValue.toInt32());
1899 0 : else if (rKey == "hscrollbar-policy")
1900 : {
1901 0 : WinBits nBits = GetStyle();
1902 0 : nBits &= ~(WB_AUTOHSCROLL|WB_HSCROLL);
1903 0 : if (rValue == "always")
1904 0 : nBits |= WB_HSCROLL;
1905 0 : else if (rValue == "automatic")
1906 0 : nBits |= WB_AUTOHSCROLL;
1907 0 : SetStyle(nBits);
1908 : }
1909 0 : else if (rKey == "vscrollbar-policy")
1910 : {
1911 0 : WinBits nBits = GetStyle();
1912 0 : nBits &= ~(WB_AUTOVSCROLL|WB_VSCROLL);
1913 0 : if (rValue == "always")
1914 0 : nBits |= WB_VSCROLL;
1915 0 : else if (rValue == "automatic")
1916 0 : nBits |= WB_AUTOVSCROLL;
1917 0 : SetStyle(nBits);
1918 : }
1919 0 : else if (rKey == "accessible-name")
1920 : {
1921 0 : SetAccessibleName(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
1922 : }
1923 0 : else if (rKey == "accessible-description")
1924 : {
1925 0 : SetAccessibleDescription(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
1926 : }
1927 0 : else if (rKey == "use-markup")
1928 : {
1929 : //https://live.gnome.org/GnomeGoals/RemoveMarkupInMessages
1930 : SAL_WARN_IF(toBool(rValue), "vcl.layout", "Use pango attributes instead of mark-up");
1931 : }
1932 : else
1933 : {
1934 : SAL_INFO("vcl.layout", "unhandled property: " << rKey.getStr());
1935 0 : return false;
1936 : }
1937 0 : return true;
1938 : }
1939 :
1940 0 : void Window::set_height_request(sal_Int32 nHeightRequest)
1941 : {
1942 :
1943 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
1944 :
1945 0 : if ( pWindowImpl->mnHeightRequest != nHeightRequest )
1946 : {
1947 0 : pWindowImpl->mnHeightRequest = nHeightRequest;
1948 0 : queue_resize();
1949 : }
1950 0 : }
1951 :
1952 0 : void Window::set_width_request(sal_Int32 nWidthRequest)
1953 : {
1954 :
1955 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
1956 :
1957 0 : if ( pWindowImpl->mnWidthRequest != nWidthRequest )
1958 : {
1959 0 : pWindowImpl->mnWidthRequest = nWidthRequest;
1960 0 : queue_resize();
1961 : }
1962 0 : }
1963 :
1964 : namespace
1965 : {
1966 0 : Size get_ungrouped_preferred_size(const Window &rWindow)
1967 : {
1968 0 : Size aRet(rWindow.get_width_request(), rWindow.get_height_request());
1969 0 : if (aRet.Width() == -1 || aRet.Height() == -1)
1970 : {
1971 0 : Size aOptimal = rWindow.GetOptimalSize();
1972 0 : if (aRet.Width() == -1)
1973 0 : aRet.Width() = aOptimal.Width();
1974 0 : if (aRet.Height() == -1)
1975 0 : aRet.Height() = aOptimal.Height();
1976 : }
1977 0 : return aRet;
1978 : }
1979 : }
1980 :
1981 0 : Size Window::get_preferred_size() const
1982 : {
1983 0 : Size aRet(get_ungrouped_preferred_size(*this));
1984 :
1985 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
1986 0 : if (pWindowImpl->m_xSizeGroup)
1987 : {
1988 0 : const VclSizeGroupMode eMode = pWindowImpl->m_xSizeGroup->get_mode();
1989 0 : if (eMode != VCL_SIZE_GROUP_NONE)
1990 : {
1991 0 : const bool bIgnoreInHidden = pWindowImpl->m_xSizeGroup->get_ignore_hidden();
1992 0 : const std::set<Window*> &rWindows = pWindowImpl->m_xSizeGroup->get_widgets();
1993 0 : for (std::set<Window*>::const_iterator aI = rWindows.begin(),
1994 0 : aEnd = rWindows.end(); aI != aEnd; ++aI)
1995 : {
1996 0 : const Window *pOther = *aI;
1997 0 : if (pOther == this)
1998 0 : continue;
1999 0 : if (bIgnoreInHidden && !pOther->IsVisible())
2000 0 : continue;
2001 0 : Size aOtherSize = get_ungrouped_preferred_size(*pOther);
2002 0 : if (eMode == VCL_SIZE_GROUP_BOTH || eMode == VCL_SIZE_GROUP_HORIZONTAL)
2003 0 : aRet.Width() = std::max(aRet.Width(), aOtherSize.Width());
2004 0 : if (eMode == VCL_SIZE_GROUP_BOTH || eMode == VCL_SIZE_GROUP_VERTICAL)
2005 0 : aRet.Height() = std::max(aRet.Height(), aOtherSize.Height());
2006 : }
2007 : }
2008 : }
2009 :
2010 0 : return aRet;
2011 : }
2012 :
2013 0 : VclAlign Window::get_halign() const
2014 : {
2015 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2016 0 : return pWindowImpl->meHalign;
2017 : }
2018 :
2019 0 : void Window::set_halign(VclAlign eAlign)
2020 : {
2021 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2022 0 : pWindowImpl->meHalign = eAlign;
2023 0 : }
2024 :
2025 0 : VclAlign Window::get_valign() const
2026 : {
2027 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2028 0 : return pWindowImpl->meValign;
2029 : }
2030 :
2031 0 : void Window::set_valign(VclAlign eAlign)
2032 : {
2033 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2034 0 : pWindowImpl->meValign = eAlign;
2035 0 : }
2036 :
2037 0 : bool Window::get_hexpand() const
2038 : {
2039 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2040 0 : return pWindowImpl->mbHexpand;
2041 : }
2042 :
2043 0 : void Window::set_hexpand(bool bExpand)
2044 : {
2045 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2046 0 : pWindowImpl->mbHexpand = bExpand;
2047 0 : }
2048 :
2049 0 : bool Window::get_vexpand() const
2050 : {
2051 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2052 0 : return pWindowImpl->mbVexpand;
2053 : }
2054 :
2055 0 : void Window::set_vexpand(bool bExpand)
2056 : {
2057 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2058 0 : pWindowImpl->mbVexpand = bExpand;
2059 0 : }
2060 :
2061 0 : bool Window::get_expand() const
2062 : {
2063 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2064 0 : return pWindowImpl->mbExpand;
2065 : }
2066 :
2067 0 : void Window::set_expand(bool bExpand)
2068 : {
2069 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2070 0 : pWindowImpl->mbExpand = bExpand;
2071 0 : }
2072 :
2073 0 : VclPackType Window::get_pack_type() const
2074 : {
2075 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2076 0 : return pWindowImpl->mePackType;
2077 : }
2078 :
2079 0 : void Window::set_pack_type(VclPackType ePackType)
2080 : {
2081 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2082 0 : pWindowImpl->mePackType = ePackType;
2083 0 : }
2084 :
2085 0 : sal_Int32 Window::get_padding() const
2086 : {
2087 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2088 0 : return pWindowImpl->mnPadding;
2089 : }
2090 :
2091 0 : void Window::set_padding(sal_Int32 nPadding)
2092 : {
2093 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2094 0 : pWindowImpl->mnPadding = nPadding;
2095 0 : }
2096 :
2097 0 : bool Window::get_fill() const
2098 : {
2099 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2100 0 : return pWindowImpl->mbFill;
2101 : }
2102 :
2103 0 : void Window::set_fill(bool bFill)
2104 : {
2105 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2106 0 : pWindowImpl->mbFill = bFill;
2107 0 : }
2108 :
2109 0 : sal_Int32 Window::get_grid_width() const
2110 : {
2111 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2112 0 : return pWindowImpl->mnGridWidth;
2113 : }
2114 :
2115 0 : void Window::set_grid_width(sal_Int32 nCols)
2116 : {
2117 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2118 0 : pWindowImpl->mnGridWidth = nCols;
2119 0 : }
2120 :
2121 0 : sal_Int32 Window::get_grid_left_attach() const
2122 : {
2123 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2124 0 : return pWindowImpl->mnGridLeftAttach;
2125 : }
2126 :
2127 0 : void Window::set_grid_left_attach(sal_Int32 nAttach)
2128 : {
2129 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2130 0 : pWindowImpl->mnGridLeftAttach = nAttach;
2131 0 : }
2132 :
2133 0 : sal_Int32 Window::get_grid_height() const
2134 : {
2135 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2136 0 : return pWindowImpl->mnGridHeight;
2137 : }
2138 :
2139 0 : void Window::set_grid_height(sal_Int32 nRows)
2140 : {
2141 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2142 0 : pWindowImpl->mnGridHeight = nRows;
2143 0 : }
2144 :
2145 0 : sal_Int32 Window::get_grid_top_attach() const
2146 : {
2147 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2148 0 : return pWindowImpl->mnGridTopAttach;
2149 : }
2150 :
2151 0 : void Window::set_grid_top_attach(sal_Int32 nAttach)
2152 : {
2153 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2154 0 : pWindowImpl->mnGridTopAttach = nAttach;
2155 0 : }
2156 :
2157 0 : void Window::set_border_width(sal_Int32 nBorderWidth)
2158 : {
2159 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2160 0 : pWindowImpl->mnBorderWidth = nBorderWidth;
2161 0 : }
2162 :
2163 0 : sal_Int32 Window::get_border_width() const
2164 : {
2165 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2166 0 : return pWindowImpl->mnBorderWidth;
2167 : }
2168 :
2169 0 : void Window::set_margin_left(sal_Int32 nWidth)
2170 : {
2171 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2172 0 : pWindowImpl->mnMarginLeft = nWidth;
2173 0 : }
2174 :
2175 0 : sal_Int32 Window::get_margin_left() const
2176 : {
2177 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2178 0 : return pWindowImpl->mnMarginLeft;
2179 : }
2180 :
2181 0 : void Window::set_margin_right(sal_Int32 nWidth)
2182 : {
2183 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2184 0 : pWindowImpl->mnMarginRight = nWidth;
2185 0 : }
2186 :
2187 0 : sal_Int32 Window::get_margin_right() const
2188 : {
2189 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2190 0 : return pWindowImpl->mnMarginRight;
2191 : }
2192 :
2193 0 : void Window::set_margin_top(sal_Int32 nWidth)
2194 : {
2195 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2196 0 : pWindowImpl->mnMarginTop = nWidth;
2197 0 : }
2198 :
2199 0 : sal_Int32 Window::get_margin_top() const
2200 : {
2201 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2202 0 : return pWindowImpl->mnMarginTop;
2203 : }
2204 :
2205 0 : void Window::set_margin_bottom(sal_Int32 nWidth)
2206 : {
2207 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2208 0 : pWindowImpl->mnMarginBottom = nWidth;
2209 0 : }
2210 :
2211 0 : sal_Int32 Window::get_margin_bottom() const
2212 : {
2213 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2214 0 : return pWindowImpl->mnMarginBottom;
2215 : }
2216 :
2217 0 : sal_Int32 Window::get_height_request() const
2218 : {
2219 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2220 0 : return pWindowImpl->mnHeightRequest;
2221 : }
2222 :
2223 0 : sal_Int32 Window::get_width_request() const
2224 : {
2225 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2226 0 : return pWindowImpl->mnWidthRequest;
2227 : }
2228 :
2229 0 : bool Window::get_secondary() const
2230 : {
2231 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2232 0 : return pWindowImpl->mbSecondary;
2233 : }
2234 :
2235 0 : void Window::set_secondary(bool bSecondary)
2236 : {
2237 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2238 0 : pWindowImpl->mbSecondary = bSecondary;
2239 0 : }
2240 :
2241 0 : bool Window::get_non_homogeneous() const
2242 : {
2243 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2244 0 : return pWindowImpl->mbNonHomogeneous;
2245 : }
2246 :
2247 0 : void Window::set_non_homogeneous(bool bNonHomogeneous)
2248 : {
2249 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2250 0 : pWindowImpl->mbNonHomogeneous = bNonHomogeneous;
2251 0 : }
2252 :
2253 0 : void Window::add_to_size_group(boost::shared_ptr< VclSizeGroup > xGroup)
2254 : {
2255 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2256 : //To-Do, multiple groups
2257 0 : pWindowImpl->m_xSizeGroup = xGroup;
2258 0 : pWindowImpl->m_xSizeGroup->insert(this);
2259 0 : if (VCL_SIZE_GROUP_NONE != pWindowImpl->m_xSizeGroup->get_mode())
2260 0 : queue_resize();
2261 0 : }
2262 :
2263 0 : void Window::remove_from_all_size_groups()
2264 : {
2265 0 : WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
2266 : //To-Do, multiple groups
2267 0 : if (pWindowImpl->m_xSizeGroup)
2268 : {
2269 0 : if (VCL_SIZE_GROUP_NONE != pWindowImpl->m_xSizeGroup->get_mode())
2270 0 : queue_resize();
2271 0 : pWindowImpl->m_xSizeGroup->erase(this);
2272 0 : pWindowImpl->m_xSizeGroup.reset();
2273 : }
2274 0 : }
2275 :
2276 0 : void Window::add_mnemonic_label(FixedText *pLabel)
2277 : {
2278 0 : std::vector<FixedText*>& v = mpWindowImpl->m_aMnemonicLabels;
2279 0 : if (std::find(v.begin(), v.end(), pLabel) != v.end())
2280 0 : return;
2281 0 : v.push_back(pLabel);
2282 0 : pLabel->set_mnemonic_widget(this);
2283 : }
2284 :
2285 0 : void Window::remove_mnemonic_label(FixedText *pLabel)
2286 : {
2287 0 : std::vector<FixedText*>& v = mpWindowImpl->m_aMnemonicLabels;
2288 0 : std::vector<FixedText*>::iterator aFind = std::find(v.begin(), v.end(), pLabel);
2289 0 : if (aFind == v.end())
2290 0 : return;
2291 0 : v.erase(aFind);
2292 0 : pLabel->set_mnemonic_widget(NULL);
2293 : }
2294 :
2295 0 : std::vector<FixedText*> Window::list_mnemonic_labels() const
2296 : {
2297 0 : return mpWindowImpl->m_aMnemonicLabels;
2298 3 : }
2299 :
2300 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|