LCOV - code coverage report
Current view: top level - vcl/source/window - window2.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 558 1214 46.0 %
Date: 2014-04-11 Functions: 139 190 73.2 %
Legend: Lines: hit not hit

          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          20 : 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           7 : void Window::ShowFocus( const Rectangle& rRect )
     283             : {
     284           7 :     if( mpWindowImpl->mbInShowFocus )
     285           0 :         return;
     286           7 :     mpWindowImpl->mbInShowFocus = true;
     287             : 
     288           7 :     ImplWinData* pWinData = ImplGetWinData();
     289             : 
     290             :     // native themeing suggest not to use focus rects
     291           7 :     if( ! ( mpWindowImpl->mbUseNativeFocus &&
     292           7 :             IsNativeWidgetEnabled() ) )
     293             :     {
     294           7 :         if ( !mpWindowImpl->mbInPaint )
     295             :         {
     296           4 :             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           4 :             ImplInvertFocus( rRect );
     308             :         }
     309           7 :         if ( !pWinData->mpFocusRect )
     310           4 :             pWinData->mpFocusRect = new Rectangle( rRect );
     311             :         else
     312           3 :             *(pWinData->mpFocusRect) = rRect;
     313           7 :         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           7 :     mpWindowImpl->mbInShowFocus = false;
     325             : }
     326             : 
     327        6843 : void Window::HideFocus()
     328             : {
     329             : 
     330        6843 :     if( mpWindowImpl->mbInHideFocus )
     331           0 :         return;
     332        6843 :     mpWindowImpl->mbInHideFocus = true;
     333             : 
     334             :     // native themeing can suggest not to use focus rects
     335        6843 :     if( ! ( mpWindowImpl->mbUseNativeFocus &&
     336        6843 :             IsNativeWidgetEnabled() ) )
     337             :     {
     338        6843 :         if ( !mpWindowImpl->mbFocusVisible )
     339             :         {
     340        6839 :             mpWindowImpl->mbInHideFocus = false;
     341        6839 :             return;
     342             :         }
     343             : 
     344           4 :         if ( !mpWindowImpl->mbInPaint )
     345           2 :             ImplInvertFocus( *(ImplGetWinData()->mpFocusRect) );
     346           4 :         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           4 :     mpWindowImpl->mbInHideFocus = false;
     358             : }
     359             : 
     360       45364 : void Window::Invert( const Rectangle& rRect, sal_uInt16 nFlags )
     361             : {
     362       45364 :     if ( !IsDeviceOutputNecessary() )
     363         188 :         return;
     364             : 
     365       45329 :     OutputDevice *pOutDev = GetOutDev();
     366       45329 :     Rectangle aRect( pOutDev->ImplLogicToDevicePixel( rRect ) );
     367             : 
     368       45329 :     if ( aRect.IsEmpty() )
     369         118 :         return;
     370       45211 :     aRect.Justify();
     371             : 
     372             :     // we need a graphics
     373       45211 :     if ( !mpGraphics )
     374             :     {
     375           0 :         if ( !pOutDev->ImplGetGraphics() )
     376           0 :             return;
     377             :     }
     378             : 
     379       45211 :     if ( mbInitClipRegion )
     380        6497 :         ImplInitClipRegion();
     381             : 
     382       45211 :     if ( mbOutputClipped )
     383           0 :         return;
     384             : 
     385       45211 :     SalInvert nSalFlags = 0;
     386       45211 :     if ( nFlags & INVERT_HIGHLIGHT )
     387           0 :         nSalFlags |= SAL_INVERT_HIGHLIGHT;
     388       45211 :     if ( nFlags & INVERT_50 )
     389           0 :         nSalFlags |= SAL_INVERT_50;
     390       45211 :     mpGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), nSalFlags, this );
     391             : }
     392             : 
     393          16 : void Window::Invert( const Polygon& rPoly, sal_uInt16 nFlags )
     394             : {
     395          16 :     if ( !IsDeviceOutputNecessary() )
     396           0 :         return;
     397             : 
     398          16 :     sal_uInt16 nPoints = rPoly.GetSize();
     399             : 
     400          16 :     if ( nPoints < 2 )
     401           0 :         return;
     402             : 
     403          16 :     OutputDevice *pOutDev = GetOutDev();
     404          16 :     Polygon aPoly( pOutDev->ImplLogicToDevicePixel( rPoly ) );
     405             : 
     406             :     // we need a graphics
     407          16 :     if ( !mpGraphics )
     408             :     {
     409           0 :         if ( !pOutDev->ImplGetGraphics() )
     410           0 :             return;
     411             :     }
     412             : 
     413          16 :     if ( mbInitClipRegion )
     414           2 :         ImplInitClipRegion();
     415             : 
     416          16 :     if ( mbOutputClipped )
     417           0 :         return;
     418             : 
     419          16 :     SalInvert nSalFlags = 0;
     420          16 :     if ( nFlags & INVERT_HIGHLIGHT )
     421           0 :         nSalFlags |= SAL_INVERT_HIGHLIGHT;
     422          16 :     if ( nFlags & INVERT_50 )
     423           0 :         nSalFlags |= SAL_INVERT_50;
     424          16 :     const SalPoint* pPtAry = (const SalPoint*)aPoly.GetConstPointAry();
     425          16 :     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          19 : void Window::InvertTracking( const Rectangle& rRect, sal_uInt16 nFlags )
     466             : {
     467          19 :     OutputDevice *pOutDev = GetOutDev();
     468          19 :     Rectangle aRect( pOutDev->ImplLogicToDevicePixel( rRect ) );
     469             : 
     470          19 :     if ( aRect.IsEmpty() )
     471           6 :         return;
     472          16 :     aRect.Justify();
     473             : 
     474             :     SalGraphics* pGraphics;
     475             : 
     476          16 :     if ( nFlags & SHOWTRACK_WINDOW )
     477             :     {
     478          16 :         if ( !IsDeviceOutputNecessary() )
     479           0 :             return;
     480             : 
     481             :         // we need a graphics
     482          16 :         if ( !mpGraphics )
     483             :         {
     484           0 :             if ( !pOutDev->ImplGetGraphics() )
     485           0 :                 return;
     486             :         }
     487             : 
     488          16 :         if ( mbInitClipRegion )
     489           5 :             ImplInitClipRegion();
     490             : 
     491          16 :         if ( mbOutputClipped )
     492           0 :             return;
     493             : 
     494          16 :         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          16 :     sal_uInt16 nStyle = nFlags & SHOWTRACK_STYLE;
     511          16 :     if ( nStyle == SHOWTRACK_OBJECT )
     512           0 :         pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_INVERT_TRACKFRAME, this );
     513          16 :     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          16 :         long nBorder = 1;
     518          16 :         if ( nStyle == SHOWTRACK_BIG )
     519           0 :             nBorder = 5;
     520          16 :         pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), nBorder, SAL_INVERT_50, this );
     521          16 :         pGraphics->Invert( aRect.Left(), aRect.Bottom()-nBorder+1, aRect.GetWidth(), nBorder, SAL_INVERT_50, this );
     522          16 :         pGraphics->Invert( aRect.Left(), aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SAL_INVERT_50, this );
     523          16 :         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           2 : void Window::EndTracking( sal_uInt16 nFlags )
     631             : {
     632           2 :     ImplSVData* pSVData = ImplGetSVData();
     633             : 
     634           2 :     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           2 : }
     670             : 
     671       38746 : bool Window::IsTracking() const
     672             : {
     673       38746 :     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           8 : sal_uIntPtr Window::SaveFocus()
     738             : {
     739           8 :     ImplSVData* pSVData = ImplGetSVData();
     740           8 :     if ( pSVData->maWinData.mpFocusWin )
     741             :     {
     742           8 :         ImplFocusDelData* pDelData = new ImplFocusDelData;
     743           8 :         pSVData->maWinData.mpFocusWin->ImplAddDel( pDelData );
     744           8 :         pDelData->mpFocusWin = pSVData->maWinData.mpFocusWin;
     745           8 :         return (sal_uIntPtr)(void*)pDelData;
     746             :     }
     747             :     else
     748           0 :         return 0;
     749             : }
     750             : 
     751          16 : bool Window::EndSaveFocus( sal_uIntPtr nSaveId, bool bRestore )
     752             : {
     753          16 :     if ( !nSaveId )
     754          10 :         return false;
     755             :     else
     756             :     {
     757           6 :         bool                bOK = true;
     758           6 :         ImplFocusDelData*   pDelData = (ImplFocusDelData*)(void*)nSaveId;
     759           6 :         if ( !pDelData->IsDead() )
     760             :         {
     761           6 :             pDelData->mpFocusWin->ImplRemoveDel( pDelData );
     762           6 :             if ( bRestore )
     763           6 :                 pDelData->mpFocusWin->GrabFocus();
     764             :         }
     765             :         else
     766           0 :             bOK = !bRestore;
     767           6 :         delete pDelData;
     768           6 :         return bOK;
     769             :     }
     770             : }
     771             : 
     772       13804 : void Window::SetZoom( const Fraction& rZoom )
     773             : {
     774       13804 :     if ( mpWindowImpl->maZoom != rZoom )
     775             :     {
     776          56 :         mpWindowImpl->maZoom = rZoom;
     777          56 :         StateChanged( STATE_CHANGE_ZOOM );
     778             :     }
     779       13804 : }
     780             : 
     781         297 : inline long WinFloatRound( double fVal )
     782             : {
     783         297 :     return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) );
     784             : }
     785             : 
     786       44226 : void Window::SetZoomedPointFont( const Font& rFont )
     787             : {
     788       44226 :     const Fraction& rZoom = GetZoom();
     789       44226 :     if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
     790             :     {
     791          56 :         Font aFont( rFont );
     792          56 :         Size aSize = aFont.GetSize();
     793          56 :         double n = (double)aSize.Width();
     794          56 :         n *= (double)rZoom.GetNumerator();
     795          56 :         n /= (double)rZoom.GetDenominator();
     796          56 :         aSize.Width() = WinFloatRound( n );
     797          56 :         n = (double)aSize.Height();
     798          56 :         n *= (double)rZoom.GetNumerator();
     799          56 :         n /= (double)rZoom.GetDenominator();
     800          56 :         aSize.Height() = WinFloatRound( n );
     801          56 :         aFont.SetSize( aSize );
     802          56 :         SetPointFont( aFont );
     803             : 
     804             :         // Use another font if the representation is to be scaled,
     805             :         // and the actual font is not scalable
     806         112 :         FontMetric aMetric = GetFontMetric();
     807          56 :         long       nFontDiff = std::abs( GetFont().GetSize().Height()-aMetric.GetSize().Height() );
     808          56 :         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          56 :         }
     819             :     }
     820             :     else
     821       44170 :         SetPointFont( rFont );
     822       44226 : }
     823             : 
     824       27902 : long Window::CalcZoom( long nCalc ) const
     825             : {
     826             : 
     827       27902 :     const Fraction& rZoom = GetZoom();
     828       27902 :     if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
     829             :     {
     830         185 :         double n = (double)nCalc;
     831         185 :         n *= (double)rZoom.GetNumerator();
     832         185 :         n /= (double)rZoom.GetDenominator();
     833         185 :         nCalc = WinFloatRound( n );
     834             :     }
     835       27902 :     return nCalc;
     836             : }
     837             : 
     838         814 : void Window::SetControlFont()
     839             : {
     840         814 :     if ( mpWindowImpl->mpControlFont )
     841             :     {
     842           0 :         delete mpWindowImpl->mpControlFont;
     843           0 :         mpWindowImpl->mpControlFont = NULL;
     844           0 :         StateChanged( STATE_CHANGE_CONTROLFONT );
     845             :     }
     846         814 : }
     847             : 
     848        4102 : void Window::SetControlFont( const Font& rFont )
     849             : {
     850        4102 :     if ( rFont == Font() )
     851             :     {
     852         702 :         SetControlFont();
     853         702 :         return;
     854             :     }
     855             : 
     856        3400 :     if ( mpWindowImpl->mpControlFont )
     857             :     {
     858        3019 :         if ( *mpWindowImpl->mpControlFont == rFont )
     859         404 :             return;
     860        2615 :         *mpWindowImpl->mpControlFont = rFont;
     861             :     }
     862             :     else
     863         381 :         mpWindowImpl->mpControlFont = new Font( rFont );
     864             : 
     865        2996 :     StateChanged( STATE_CHANGE_CONTROLFONT );
     866             : }
     867             : 
     868        8905 : Font Window::GetControlFont() const
     869             : {
     870        8905 :     if ( mpWindowImpl->mpControlFont )
     871        7514 :         return *mpWindowImpl->mpControlFont;
     872             :     else
     873             :     {
     874        1391 :         Font aFont;
     875        1391 :         return aFont;
     876             :     }
     877             : }
     878             : 
     879         530 : void Window::SetControlForeground()
     880             : {
     881         530 :     if ( mpWindowImpl->mbControlForeground )
     882             :     {
     883           0 :         mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT );
     884           0 :         mpWindowImpl->mbControlForeground = false;
     885           0 :         StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
     886             :     }
     887         530 : }
     888             : 
     889         104 : void Window::SetControlForeground( const Color& rColor )
     890             : {
     891         104 :     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         104 :         if ( mpWindowImpl->maControlForeground != rColor )
     903             :         {
     904          59 :             mpWindowImpl->maControlForeground = rColor;
     905          59 :             mpWindowImpl->mbControlForeground = true;
     906          59 :             StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
     907             :         }
     908             :     }
     909         104 : }
     910             : 
     911         775 : void Window::SetControlBackground()
     912             : {
     913         775 :     if ( mpWindowImpl->mbControlBackground )
     914             :     {
     915          48 :         mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT );
     916          48 :         mpWindowImpl->mbControlBackground = false;
     917          48 :         StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
     918             :     }
     919         775 : }
     920             : 
     921        2265 : void Window::SetControlBackground( const Color& rColor )
     922             : {
     923        2265 :     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        2265 :         if ( mpWindowImpl->maControlBackground != rColor )
     935             :         {
     936        2265 :             mpWindowImpl->maControlBackground = rColor;
     937        2265 :             mpWindowImpl->mbControlBackground = true;
     938        2265 :             StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
     939             :         }
     940             :     }
     941        2265 : }
     942             : 
     943        6150 : Size Window::CalcWindowSize( const Size& rOutSz ) const
     944             : {
     945        6150 :     Size aSz = rOutSz;
     946        6150 :     aSz.Width()  += mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder;
     947        6150 :     aSz.Height() += mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder;
     948        6150 :     return aSz;
     949             : }
     950             : 
     951        2527 : Size Window::CalcOutputSize( const Size& rWinSz ) const
     952             : {
     953        2527 :     Size aSz = rWinSz;
     954        2527 :     aSz.Width()  -= mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder;
     955        2527 :     aSz.Height() -= mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder;
     956        2527 :     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         997 : long Window::GetDrawPixel( OutputDevice* pDev, long nPixels ) const
     970             : {
     971         997 :     long nP = nPixels;
     972         997 :     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         997 :     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      246396 : DockingManager* Window::GetDockingManager()
    1187             : {
    1188      246396 :     return ImplGetDockingManager();
    1189             : }
    1190             : 
    1191        6103 : void Window::EnableDocking( bool bEnable )
    1192             : {
    1193             :     // update list of dockable windows
    1194        6103 :     if( bEnable )
    1195        6103 :         ImplGetDockingManager()->AddWindow( this );
    1196             :     else
    1197           0 :         ImplGetDockingManager()->RemoveWindow( this );
    1198        6103 : }
    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       11405 : void Window::SetHelpId( const OString& rHelpId )
    1215             : {
    1216       11405 :     mpWindowImpl->maHelpId = rHelpId;
    1217       11405 : }
    1218             : 
    1219      104578 : const OString& Window::GetHelpId() const
    1220             : {
    1221      104578 :     return mpWindowImpl->maHelpId;
    1222             : }
    1223             : 
    1224        2919 : void Window::SetUniqueId( const OString& rUniqueId )
    1225             : {
    1226        2919 :     mpWindowImpl->maUniqId = rUniqueId;
    1227        2919 : }
    1228             : 
    1229          42 : const OString& Window::GetUniqueId() const
    1230             : {
    1231          42 :     return mpWindowImpl->maUniqId;
    1232             : }
    1233             : 
    1234             : // --------- old inline methods ---------------
    1235             : 
    1236      433785 : Window* Window::ImplGetWindow()
    1237             : {
    1238      433785 :     if ( mpWindowImpl->mpClientWindow )
    1239      301454 :         return mpWindowImpl->mpClientWindow;
    1240             :     else
    1241      132331 :         return this;
    1242             : }
    1243             : 
    1244           0 : ImplFrameData* Window::ImplGetFrameData()
    1245             : {
    1246           0 :     return mpWindowImpl->mpFrameData;
    1247             : }
    1248             : 
    1249       71216 : SalFrame* Window::ImplGetFrame() const
    1250             : {
    1251       71216 :     return mpWindowImpl->mpFrame;
    1252             : }
    1253             : 
    1254     2196310 : Window* Window::ImplGetParent() const
    1255             : {
    1256     2196310 :     return mpWindowImpl->mpParent;
    1257             : }
    1258             : 
    1259       29321 : Window* Window::ImplGetClientWindow() const
    1260             : {
    1261       29321 :     return mpWindowImpl->mpClientWindow;
    1262             : }
    1263             : 
    1264        6025 : Window* Window::ImplGetBorderWindow() const
    1265             : {
    1266        6025 :     return mpWindowImpl->mpBorderWindow;
    1267             : }
    1268             : 
    1269      171533 : Window* Window::ImplGetFirstOverlapWindow()
    1270             : {
    1271      171533 :     if ( mpWindowImpl->mbOverlapWin )
    1272        4536 :         return this;
    1273             :     else
    1274      166997 :         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       14816 : Window* Window::ImplGetFrameWindow() const
    1286             : {
    1287       14816 :     return mpWindowImpl->mpFrameWindow;
    1288             : }
    1289             : 
    1290           0 : bool Window::ImplIsDockingWindow() const
    1291             : {
    1292           0 :     return mpWindowImpl->mbDockWin;
    1293             : }
    1294             : 
    1295          86 : bool Window::ImplIsFloatingWindow() const
    1296             : {
    1297          86 :     return mpWindowImpl->mbFloatWin;
    1298             : }
    1299             : 
    1300           0 : bool Window::ImplIsSplitter() const
    1301             : {
    1302           0 :     return mpWindowImpl->mbSplitter;
    1303             : }
    1304             : 
    1305        2541 : bool Window::ImplIsPushButton() const
    1306             : {
    1307        2541 :     return mpWindowImpl->mbPushButton;
    1308             : }
    1309             : 
    1310     3331704 : bool Window::ImplIsOverlapWindow() const
    1311             : {
    1312     3331704 :     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       19515 : Point Window::ImplFrameToOutput( const Point& rPos )
    1326             : {
    1327       19515 :     return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY );
    1328             : }
    1329             : 
    1330        2485 : void Window::SetCompoundControl( bool bCompound )
    1331             : {
    1332        2485 :     mpWindowImpl->mbCompoundControl = bCompound;
    1333        2485 : }
    1334             : 
    1335         328 : void Window::IncrementLockCount()
    1336             : {
    1337         328 :     mpWindowImpl->mnLockCount++;
    1338         328 : }
    1339             : 
    1340         328 : void Window::DecrementLockCount()
    1341             : {
    1342         328 :     mpWindowImpl->mnLockCount--;
    1343         328 : }
    1344             : 
    1345     1864531 : WinBits Window::GetStyle() const
    1346             : {
    1347     1864531 :     return mpWindowImpl->mnStyle;
    1348             : }
    1349             : 
    1350         951 : WinBits Window::GetPrevStyle() const
    1351             : {
    1352         951 :     return mpWindowImpl->mnPrevStyle;
    1353             : }
    1354             : 
    1355           6 : WinBits Window::GetExtendedStyle() const
    1356             : {
    1357           6 :     return mpWindowImpl->mnExtendedStyle;
    1358             : }
    1359             : 
    1360        8089 : void Window::SetType( WindowType nType )
    1361             : {
    1362        8089 :     mpWindowImpl->mnType = nType;
    1363        8089 : }
    1364             : 
    1365     4484496 : WindowType Window::GetType() const
    1366             : {
    1367     4484496 :     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      188581 : bool Window::IsSystemWindow() const
    1386             : {
    1387      188581 :     return mpWindowImpl->mbSysWin;
    1388             : }
    1389             : 
    1390        9065 : bool Window::IsDialog() const
    1391             : {
    1392        9065 :     return mpWindowImpl->mbDialog;
    1393             : }
    1394             : 
    1395         667 : bool Window::IsMenuFloatingWindow() const
    1396             : {
    1397         667 :     return mpWindowImpl->mbMenuFloatingWindow;
    1398             : }
    1399             : 
    1400         163 : bool Window::IsToolbarFloatingWindow() const
    1401             : {
    1402         163 :     return mpWindowImpl->mbToolbarFloatingWindow;
    1403             : }
    1404             : 
    1405       15350 : void Window::EnableAllResize( bool bEnable )
    1406             : {
    1407       15350 :     mpWindowImpl->mbAllResize = bEnable;
    1408       15350 : }
    1409             : 
    1410       15748 : void Window::EnableChildTransparentMode( bool bEnable )
    1411             : {
    1412       15748 :     mpWindowImpl->mbChildTransparent = bEnable;
    1413       15748 : }
    1414             : 
    1415        6156 : bool Window::IsChildTransparentModeEnabled() const
    1416             : {
    1417        6156 :     return mpWindowImpl->mbChildTransparent;
    1418             : }
    1419             : 
    1420           0 : bool Window::IsMouseTransparent() const
    1421             : {
    1422           0 :     return mpWindowImpl->mbMouseTransparent;
    1423             : }
    1424             : 
    1425      565310 : bool Window::IsPaintTransparent() const
    1426             : {
    1427      565310 :     return mpWindowImpl->mbPaintTransparent;
    1428             : }
    1429             : 
    1430           8 : void Window::SetDialogControlStart( bool bStart )
    1431             : {
    1432           8 :     mpWindowImpl->mbDlgCtrlStart = bStart;
    1433           8 : }
    1434             : 
    1435        5901 : bool Window::IsDialogControlStart() const
    1436             : {
    1437        5901 :     return mpWindowImpl->mbDlgCtrlStart;
    1438             : }
    1439             : 
    1440        2093 : void Window::SetDialogControlFlags( sal_uInt16 nFlags )
    1441             : {
    1442        2093 :     mpWindowImpl->mnDlgCtrlFlags = nFlags;
    1443        2093 : }
    1444             : 
    1445        9374 : sal_uInt16 Window::GetDialogControlFlags() const
    1446             : {
    1447        9374 :     return mpWindowImpl->mnDlgCtrlFlags;
    1448             : }
    1449             : 
    1450       14006 : const InputContext& Window::GetInputContext() const
    1451             : {
    1452       14006 :     return mpWindowImpl->maInputContext;
    1453             : }
    1454             : 
    1455       44747 : bool Window::IsControlFont() const
    1456             : {
    1457       44747 :     return (mpWindowImpl->mpControlFont != 0);
    1458             : }
    1459             : 
    1460         319 : Color Window::GetControlForeground() const
    1461             : {
    1462         319 :     return mpWindowImpl->maControlForeground;
    1463             : }
    1464             : 
    1465       54281 : bool Window::IsControlForeground() const
    1466             : {
    1467       54281 :     return mpWindowImpl->mbControlForeground;
    1468             : }
    1469             : 
    1470         922 : Color Window::GetControlBackground() const
    1471             : {
    1472         922 :     return mpWindowImpl->maControlBackground;
    1473             : }
    1474             : 
    1475      103663 : bool Window::IsControlBackground() const
    1476             : {
    1477      103663 :     return mpWindowImpl->mbControlBackground;
    1478             : }
    1479             : 
    1480      117503 : bool Window::IsInPaint() const
    1481             : {
    1482      117503 :     return mpWindowImpl->mbInPaint;
    1483             : }
    1484             : 
    1485     8384203 : Window* Window::GetParent() const
    1486             : {
    1487     8384203 :     return mpWindowImpl->mpRealParent;
    1488             : }
    1489             : 
    1490      644808 : bool Window::IsVisible() const
    1491             : {
    1492      644808 :     return mpWindowImpl->mbVisible;
    1493             : }
    1494             : 
    1495     1452834 : bool Window::IsReallyVisible() const
    1496             : {
    1497     1452834 :     return mpWindowImpl->mbReallyVisible;
    1498             : }
    1499             : 
    1500       60015 : bool Window::IsReallyShown() const
    1501             : {
    1502       60015 :     return mpWindowImpl->mbReallyShown;
    1503             : }
    1504             : 
    1505           0 : bool Window::IsInInitShow() const
    1506             : {
    1507           0 :     return mpWindowImpl->mbInInitShow;
    1508             : }
    1509             : 
    1510      137986 : bool Window::IsEnabled() const
    1511             : {
    1512      137986 :     return !mpWindowImpl->mbDisabled;
    1513             : }
    1514             : 
    1515       23573 : bool Window::IsInputEnabled() const
    1516             : {
    1517       23573 :     return !mpWindowImpl->mbInputDisabled;
    1518             : }
    1519             : 
    1520           0 : bool Window::IsAlwaysEnableInput() const
    1521             : {
    1522           0 :     return mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled;
    1523             : }
    1524             : 
    1525        2328 : sal_uInt16 Window::GetActivateMode() const
    1526             : {
    1527        2328 :     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         105 : bool Window::IsDefaultSize() const
    1542             : {
    1543         105 :     return mpWindowImpl->mbDefSize;
    1544             : }
    1545             : 
    1546       12368 : void Window::EnablePaint( bool bEnable )
    1547             : {
    1548       12368 :     mpWindowImpl->mbPaintDisabled = !bEnable;
    1549       12368 : }
    1550             : 
    1551       45762 : bool Window::IsPaintEnabled() const
    1552             : {
    1553       45762 :     return !mpWindowImpl->mbPaintDisabled;
    1554             : }
    1555             : 
    1556      402773 : bool Window::IsUpdateMode() const
    1557             : {
    1558      402773 :     return !mpWindowImpl->mbNoUpdate;
    1559             : }
    1560             : 
    1561          96 : void Window::SetParentUpdateMode( bool bUpdate )
    1562             : {
    1563          96 :     mpWindowImpl->mbNoParentUpdate = !bUpdate;
    1564          96 : }
    1565             : 
    1566       22402 : bool Window::IsActive() const
    1567             : {
    1568       22402 :     return mpWindowImpl->mbActive;
    1569             : }
    1570             : 
    1571        2563 : sal_uInt16 Window::GetGetFocusFlags() const
    1572             : {
    1573        2563 :     return mpWindowImpl->mnGetFocusFlags;
    1574             : }
    1575             : 
    1576       26735 : bool Window::IsCompoundControl() const
    1577             : {
    1578       26735 :     return mpWindowImpl->mbCompoundControl;
    1579             : }
    1580             : 
    1581         283 : bool Window::IsWait() const
    1582             : {
    1583         283 :     return (mpWindowImpl->mnWaitCount != 0);
    1584             : }
    1585             : 
    1586       19691 : Cursor* Window::GetCursor() const
    1587             : {
    1588       19691 :     return mpWindowImpl->mpCursor;
    1589             : }
    1590             : 
    1591       72600 : const Fraction& Window::GetZoom() const
    1592             : {
    1593       72600 :     return mpWindowImpl->maZoom;
    1594             : }
    1595             : 
    1596        1067 : bool Window::IsZoom() const
    1597             : {
    1598        1067 :     return mpWindowImpl->maZoom.GetNumerator() != mpWindowImpl->maZoom.GetDenominator();
    1599             : }
    1600             : 
    1601          77 : void Window::SetHelpText( const OUString& rHelpText )
    1602             : {
    1603          77 :     mpWindowImpl->maHelpText = rHelpText;
    1604          77 :     mpWindowImpl->mbHelpTextDynamic = true;
    1605          77 : }
    1606             : 
    1607        7992 : void Window::SetQuickHelpText( const OUString& rHelpText )
    1608             : {
    1609        7992 :     mpWindowImpl->maQuickHelpText = rHelpText;
    1610        7992 : }
    1611             : 
    1612        3465 : const OUString& Window::GetQuickHelpText() const
    1613             : {
    1614        3465 :     return mpWindowImpl->maQuickHelpText;
    1615             : }
    1616             : 
    1617          63 : void Window::SetData( void* pNewData )
    1618             : {
    1619          63 :     mpWindowImpl->mpUserData = pNewData;
    1620          63 : }
    1621             : 
    1622          61 : void* Window::GetData() const
    1623             : {
    1624          61 :     return mpWindowImpl->mpUserData;
    1625             : }
    1626             : 
    1627        6289 : bool Window::IsCreatedWithToolkit() const
    1628             : {
    1629        6289 :     return mpWindowImpl->mbCreatedWithToolkit;
    1630             : }
    1631             : 
    1632       19054 : void Window::SetCreatedWithToolkit( bool b )
    1633             : {
    1634       19054 :     mpWindowImpl->mbCreatedWithToolkit = b;
    1635             : 
    1636       19054 : }
    1637           0 : const Pointer& Window::GetPointer() const
    1638             : {
    1639           0 :     return mpWindowImpl->maPointer;
    1640             : }
    1641             : 
    1642      413710 : VCLXWindow* Window::GetWindowPeer() const
    1643             : {
    1644      413710 :     return mpWindowImpl->mpVCLXWindow;
    1645             : }
    1646             : 
    1647       14932 : void Window::SetPosPixel( const Point& rNewPos )
    1648             : {
    1649       14932 :     setPosSizePixel( rNewPos.X(), rNewPos.Y(), 0, 0, WINDOW_POSSIZE_POS );
    1650       14932 : }
    1651             : 
    1652       73897 : void Window::SetSizePixel( const Size& rNewSize )
    1653             : {
    1654             :     setPosSizePixel( 0, 0, rNewSize.Width(), rNewSize.Height(),
    1655       73897 :                      WINDOW_POSSIZE_SIZE );
    1656       73897 : }
    1657             : 
    1658      113418 : void Window::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
    1659             : {
    1660             :     setPosSizePixel( rNewPos.X(), rNewPos.Y(),
    1661             :                      rNewSize.Width(), rNewSize.Height(),
    1662      113418 :                      WINDOW_POSSIZE_POSSIZE );
    1663      113418 : }
    1664             : 
    1665       20465 : void Window::SetOutputSizePixel( const Size& rNewSize )
    1666             : {
    1667       20465 :     SetSizePixel( Size( rNewSize.Width()+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder,
    1668       40930 :                         rNewSize.Height()+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ) );
    1669       20465 : }
    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     1052658 :     bool queue_ungrouped_resize(Window *pOrigWindow)
    1677             :     {
    1678     1052658 :         bool bSomeoneCares = false;
    1679             : 
    1680     1052658 :         Window *pWindow = pOrigWindow->GetParent();
    1681     1052658 :         if (pWindow)
    1682             :         {
    1683      806894 :             if (isContainerWindow(*pWindow))
    1684             :             {
    1685         245 :                 bSomeoneCares = true;
    1686             :             }
    1687      806649 :             else if (pWindow->GetType() == WINDOW_TABCONTROL)
    1688             :             {
    1689          42 :                 bSomeoneCares = true;
    1690             :             }
    1691      806894 :             pWindow->queue_resize();
    1692             :         }
    1693             : 
    1694     1052658 :         return bSomeoneCares;
    1695             :     }
    1696             : }
    1697             : 
    1698     1052658 : void Window::queue_resize()
    1699             : {
    1700     1052658 :     bool bSomeoneCares = queue_ungrouped_resize(this);
    1701             : 
    1702     1052658 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    1703     1052658 :     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     1052658 :     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         287 :         Window* pBorderWindow = ImplGetBorderWindow();
    1721         287 :         if (pBorderWindow)
    1722           0 :             pBorderWindow->Resize();
    1723             :     }
    1724     1052658 : }
    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         147 : bool Window::set_property(const OString &rKey, const OString &rValue)
    1804             : {
    1805         147 :     if ((rKey == "label") || (rKey == "title") || (rKey == "text") )
    1806             :     {
    1807          10 :         SetText(OStringToOUString(VclBuilder::convertMnemonicMarkup(rValue), RTL_TEXTENCODING_UTF8));
    1808             :     }
    1809         137 :     else if (rKey == "visible")
    1810          29 :         Show(toBool(rValue));
    1811         108 :     else if (rKey == "sensitive")
    1812           0 :         Enable(toBool(rValue));
    1813         108 :     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         108 :     else if (rKey == "xalign")
    1822             :     {
    1823           9 :         WinBits nBits = GetStyle();
    1824           9 :         nBits &= ~(WB_LEFT | WB_CENTER | WB_RIGHT);
    1825             : 
    1826           9 :         float f = rValue.toFloat();
    1827           9 :         if (f == 0.0)
    1828           9 :             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           9 :         SetStyle(nBits);
    1835             :     }
    1836          99 :     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          99 :     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          99 :     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          99 :     else if (rKey == "height-request")
    1874           0 :         set_height_request(rValue.toInt32());
    1875          99 :     else if (rKey == "width-request")
    1876           0 :         set_width_request(rValue.toInt32());
    1877          99 :     else if (rKey == "hexpand")
    1878           3 :         set_hexpand(toBool(rValue));
    1879          96 :     else if (rKey == "vexpand")
    1880           3 :         set_vexpand(toBool(rValue));
    1881          93 :     else if (rKey == "halign")
    1882           0 :         set_halign(toAlign(rValue));
    1883          93 :     else if (rKey == "valign")
    1884           0 :         set_valign(toAlign(rValue));
    1885          93 :     else if (rKey == "tooltip-markup")
    1886           0 :         SetQuickHelpText(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
    1887          93 :     else if (rKey == "tooltip-text")
    1888           0 :         SetQuickHelpText(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
    1889          93 :     else if (rKey == "border-width")
    1890           1 :         set_border_width(rValue.toInt32());
    1891          92 :     else if (rKey == "margin-left")
    1892          13 :         set_margin_left(rValue.toInt32());
    1893          79 :     else if (rKey == "margin-right")
    1894          12 :         set_margin_right(rValue.toInt32());
    1895          67 :     else if (rKey == "margin-top")
    1896           4 :         set_margin_top(rValue.toInt32());
    1897          63 :     else if (rKey == "margin-bottom")
    1898           4 :         set_margin_bottom(rValue.toInt32());
    1899          59 :     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          59 :     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          59 :     else if (rKey == "accessible-name")
    1920             :     {
    1921           0 :         SetAccessibleName(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
    1922             :     }
    1923          59 :     else if (rKey == "accessible-description")
    1924             :     {
    1925           0 :         SetAccessibleDescription(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
    1926             :     }
    1927          59 :     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          59 :         return false;
    1936             :     }
    1937          88 :     return true;
    1938             : }
    1939             : 
    1940         564 : void Window::set_height_request(sal_Int32 nHeightRequest)
    1941             : {
    1942             : 
    1943         564 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    1944             : 
    1945         564 :     if ( pWindowImpl->mnHeightRequest != nHeightRequest )
    1946             :     {
    1947         564 :         pWindowImpl->mnHeightRequest = nHeightRequest;
    1948         564 :         queue_resize();
    1949             :     }
    1950         564 : }
    1951             : 
    1952         566 : void Window::set_width_request(sal_Int32 nWidthRequest)
    1953             : {
    1954             : 
    1955         566 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    1956             : 
    1957         566 :     if ( pWindowImpl->mnWidthRequest != nWidthRequest )
    1958             :     {
    1959         565 :         pWindowImpl->mnWidthRequest = nWidthRequest;
    1960         565 :         queue_resize();
    1961             :     }
    1962         566 : }
    1963             : 
    1964             : namespace
    1965             : {
    1966         955 :     Size get_ungrouped_preferred_size(const Window &rWindow)
    1967             :     {
    1968         955 :         Size aRet(rWindow.get_width_request(), rWindow.get_height_request());
    1969         955 :         if (aRet.Width() == -1 || aRet.Height() == -1)
    1970             :         {
    1971         955 :             Size aOptimal = rWindow.GetOptimalSize();
    1972         955 :             if (aRet.Width() == -1)
    1973         953 :                 aRet.Width() = aOptimal.Width();
    1974         955 :             if (aRet.Height() == -1)
    1975         955 :                 aRet.Height() = aOptimal.Height();
    1976             :         }
    1977         955 :         return aRet;
    1978             :     }
    1979             : }
    1980             : 
    1981         955 : Size Window::get_preferred_size() const
    1982             : {
    1983         955 :     Size aRet(get_ungrouped_preferred_size(*this));
    1984             : 
    1985         955 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    1986         955 :     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         955 :     return aRet;
    2011             : }
    2012             : 
    2013          73 : VclAlign Window::get_halign() const
    2014             : {
    2015          73 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2016          73 :     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          73 : VclAlign Window::get_valign() const
    2026             : {
    2027          73 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2028          73 :     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          20 : bool Window::get_hexpand() const
    2038             : {
    2039          20 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2040          20 :     return pWindowImpl->mbHexpand;
    2041             : }
    2042             : 
    2043           3 : void Window::set_hexpand(bool bExpand)
    2044             : {
    2045           3 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2046           3 :     pWindowImpl->mbHexpand = bExpand;
    2047           3 : }
    2048             : 
    2049         112 : bool Window::get_vexpand() const
    2050             : {
    2051         112 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2052         112 :     return pWindowImpl->mbVexpand;
    2053             : }
    2054             : 
    2055           3 : void Window::set_vexpand(bool bExpand)
    2056             : {
    2057           3 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2058           3 :     pWindowImpl->mbVexpand = bExpand;
    2059           3 : }
    2060             : 
    2061         132 : bool Window::get_expand() const
    2062             : {
    2063         132 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2064         132 :     return pWindowImpl->mbExpand;
    2065             : }
    2066             : 
    2067          22 : void Window::set_expand(bool bExpand)
    2068             : {
    2069          22 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2070          22 :     pWindowImpl->mbExpand = bExpand;
    2071          22 : }
    2072             : 
    2073         120 : VclPackType Window::get_pack_type() const
    2074             : {
    2075         120 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2076         120 :     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         396 : sal_Int32 Window::get_padding() const
    2086             : {
    2087         396 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2088         396 :     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          68 : bool Window::get_fill() const
    2098             : {
    2099          68 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2100          68 :     return pWindowImpl->mbFill;
    2101             : }
    2102             : 
    2103          22 : void Window::set_fill(bool bFill)
    2104             : {
    2105          22 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2106          22 :     pWindowImpl->mbFill = bFill;
    2107          22 : }
    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          52 : sal_Int32 Window::get_grid_left_attach() const
    2122             : {
    2123          52 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2124          52 :     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          52 : sal_Int32 Window::get_grid_top_attach() const
    2146             : {
    2147          52 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2148          52 :     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           1 : void Window::set_border_width(sal_Int32 nBorderWidth)
    2158             : {
    2159           1 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2160           1 :     pWindowImpl->mnBorderWidth = nBorderWidth;
    2161           1 : }
    2162             : 
    2163         465 : sal_Int32 Window::get_border_width() const
    2164             : {
    2165         465 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2166         465 :     return pWindowImpl->mnBorderWidth;
    2167             : }
    2168             : 
    2169          13 : void Window::set_margin_left(sal_Int32 nWidth)
    2170             : {
    2171          13 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2172          13 :     pWindowImpl->mnMarginLeft = nWidth;
    2173          13 : }
    2174             : 
    2175         465 : sal_Int32 Window::get_margin_left() const
    2176             : {
    2177         465 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2178         465 :     return pWindowImpl->mnMarginLeft;
    2179             : }
    2180             : 
    2181          12 : void Window::set_margin_right(sal_Int32 nWidth)
    2182             : {
    2183          12 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2184          12 :     pWindowImpl->mnMarginRight = nWidth;
    2185          12 : }
    2186             : 
    2187         465 : sal_Int32 Window::get_margin_right() const
    2188             : {
    2189         465 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2190         465 :     return pWindowImpl->mnMarginRight;
    2191             : }
    2192             : 
    2193           4 : void Window::set_margin_top(sal_Int32 nWidth)
    2194             : {
    2195           4 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2196           4 :     pWindowImpl->mnMarginTop = nWidth;
    2197           4 : }
    2198             : 
    2199         465 : sal_Int32 Window::get_margin_top() const
    2200             : {
    2201         465 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2202         465 :     return pWindowImpl->mnMarginTop;
    2203             : }
    2204             : 
    2205           4 : void Window::set_margin_bottom(sal_Int32 nWidth)
    2206             : {
    2207           4 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2208           4 :     pWindowImpl->mnMarginBottom = nWidth;
    2209           4 : }
    2210             : 
    2211         465 : sal_Int32 Window::get_margin_bottom() const
    2212             : {
    2213         465 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2214         465 :     return pWindowImpl->mnMarginBottom;
    2215             : }
    2216             : 
    2217         956 : sal_Int32 Window::get_height_request() const
    2218             : {
    2219         956 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2220         956 :     return pWindowImpl->mnHeightRequest;
    2221             : }
    2222             : 
    2223       22635 : sal_Int32 Window::get_width_request() const
    2224             : {
    2225       22635 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2226       22635 :     return pWindowImpl->mnWidthRequest;
    2227             : }
    2228             : 
    2229          52 : bool Window::get_secondary() const
    2230             : {
    2231          52 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2232          52 :     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      116183 : void Window::remove_from_all_size_groups()
    2264             : {
    2265      116183 :     WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl;
    2266             :     //To-Do, multiple groups
    2267      116183 :     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      116183 : }
    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      118259 : std::vector<FixedText*> Window::list_mnemonic_labels() const
    2296             : {
    2297      118259 :     return mpWindowImpl->m_aMnemonicLabels;
    2298         516 : }
    2299             : 
    2300             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10