LCOV - code coverage report
Current view: top level - vcl/source/window - event.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 117 280 41.8 %
Date: 2014-11-03 Functions: 14 22 63.6 %
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 <vcl/event.hxx>
      21             : #include <vcl/window.hxx>
      22             : #include <vcl/dockwin.hxx>
      23             : #include <vcl/layout.hxx>
      24             : 
      25             : #include <window.h>
      26             : #include <svdata.hxx>
      27             : #include <salframe.hxx>
      28             : 
      29             : #include <com/sun/star/awt/MouseEvent.hpp>
      30             : #include <com/sun/star/awt/KeyModifier.hpp>
      31             : #include <com/sun/star/awt/MouseButton.hpp>
      32             : 
      33             : namespace vcl {
      34             : 
      35       13379 : void Window::DataChanged( const DataChangedEvent& )
      36             : {
      37       13379 : }
      38             : 
      39           0 : void Window::NotifyAllChildren( DataChangedEvent& rDCEvt )
      40             : {
      41             : 
      42           0 :     DataChanged( rDCEvt );
      43             : 
      44           0 :     vcl::Window* pChild = mpWindowImpl->mpFirstChild;
      45           0 :     while ( pChild )
      46             :     {
      47           0 :         pChild->NotifyAllChildren( rDCEvt );
      48           0 :         pChild = pChild->mpWindowImpl->mpNext;
      49             :     }
      50           0 : }
      51             : 
      52      227903 : bool Window::PreNotify( NotifyEvent& rNEvt )
      53             : {
      54      227903 :     bool bDone = false;
      55      227903 :     if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() )
      56      172014 :         bDone = mpWindowImpl->mpParent->PreNotify( rNEvt );
      57             : 
      58      227903 :     if ( !bDone )
      59             :     {
      60      227903 :         if( rNEvt.GetType() == EVENT_GETFOCUS )
      61             :         {
      62      119032 :             bool bCompoundFocusChanged = false;
      63      119032 :             if ( mpWindowImpl->mbCompoundControl && !mpWindowImpl->mbCompoundControlHasFocus && HasChildPathFocus() )
      64             :             {
      65           4 :                 mpWindowImpl->mbCompoundControlHasFocus = true;
      66           4 :                 bCompoundFocusChanged = true;
      67             :             }
      68             : 
      69      119032 :             if ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) )
      70       30444 :                 ImplCallEventListeners( VCLEVENT_WINDOW_GETFOCUS );
      71             :         }
      72      108871 :         else if( rNEvt.GetType() == EVENT_LOSEFOCUS )
      73             :         {
      74      108871 :             bool bCompoundFocusChanged = false;
      75      108871 :             if ( mpWindowImpl->mbCompoundControl && mpWindowImpl->mbCompoundControlHasFocus && !HasChildPathFocus() )
      76             :             {
      77           4 :                 mpWindowImpl->mbCompoundControlHasFocus = false ;
      78           4 :                 bCompoundFocusChanged = true;
      79             :             }
      80             : 
      81      108871 :             if ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) )
      82       25449 :                 ImplCallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS );
      83             :         }
      84             : 
      85             :         // #82968# mouse and key events will be notified after processing ( in ImplNotifyKeyMouseCommandEventListeners() )!
      86             :         //    see also ImplHandleMouseEvent(), ImplHandleKey()
      87             : 
      88             :     }
      89             : 
      90      227903 :     return bDone;
      91             : }
      92             : 
      93     1941117 : bool Window::Notify( NotifyEvent& rNEvt )
      94             : {
      95     1941117 :     bool nRet = false;
      96             : 
      97             :     // check for docking window
      98             :     // but do nothing if window is docked and locked
      99     1941117 :     ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
     100     1941117 :     if( pWrapper && !( !pWrapper->IsFloatingMode() && pWrapper->IsLocked() ) )
     101             :     {
     102       26256 :         if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
     103             :         {
     104           0 :             const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
     105           0 :             bool bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() );
     106           0 :             if ( pMEvt->IsLeft() )
     107             :             {
     108           0 :                 if ( pMEvt->IsMod1() && (pMEvt->GetClicks() == 2) )
     109             :                 {
     110             :                     // ctrl double click toggles floating mode
     111           0 :                     pWrapper->SetFloatingMode( !pWrapper->IsFloatingMode() );
     112           0 :                     return true;
     113             :                 }
     114           0 :                 else if ( pMEvt->GetClicks() == 1 && bHit)
     115             :                 {
     116             :                     // allow start docking during mouse move
     117           0 :                     pWrapper->ImplEnableStartDocking();
     118           0 :                     return true;
     119             :                 }
     120             :             }
     121             :         }
     122       26256 :         else if ( rNEvt.GetType() == EVENT_MOUSEMOVE )
     123             :         {
     124           0 :             const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
     125           0 :             bool bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() );
     126           0 :             if ( pMEvt->IsLeft() )
     127             :             {
     128             :                 // check if a single click initiated this sequence ( ImplStartDockingEnabled() )
     129             :                 // check if window is docked and
     130           0 :                 if( pWrapper->ImplStartDockingEnabled() && !pWrapper->IsFloatingMode() &&
     131           0 :                     !pWrapper->IsDocking() && bHit )
     132             :                 {
     133           0 :                     Point   aPos = pMEvt->GetPosPixel();
     134           0 :                     vcl::Window* pWindow = rNEvt.GetWindow();
     135           0 :                     if ( pWindow != this )
     136             :                     {
     137           0 :                         aPos = pWindow->OutputToScreenPixel( aPos );
     138           0 :                         aPos = ScreenToOutputPixel( aPos );
     139             :                     }
     140           0 :                     pWrapper->ImplStartDocking( aPos );
     141             :                 }
     142           0 :                 return true;
     143             :             }
     144             :         }
     145       26256 :         else if( rNEvt.GetType() == EVENT_KEYINPUT )
     146             :         {
     147           0 :             const vcl::KeyCode& rKey = rNEvt.GetKeyEvent()->GetKeyCode();
     148           0 :             if( rKey.GetCode() == KEY_F10 && rKey.GetModifier() &&
     149           0 :                 rKey.IsShift() && rKey.IsMod1() )
     150             :             {
     151           0 :                 pWrapper->SetFloatingMode( !pWrapper->IsFloatingMode() );
     152             :                 /* At this point the floating toolbar frame does not have the
     153             :                  * input focus since these frames don't get the focus per default
     154             :                  * To enable keyboard handling of this toolbar set the input focus
     155             :                  * to the frame. This needs to be done with ToTop since GrabFocus
     156             :                  * would not notice any change since "this" already has the focus.
     157             :                  */
     158           0 :                 if( pWrapper->IsFloatingMode() )
     159           0 :                     ToTop( TOTOP_GRABFOCUSONLY );
     160           0 :                 return true;
     161             :             }
     162             :         }
     163             :     }
     164             : 
     165             :     // manage the dialogs
     166     1941117 :     if ( (GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL )
     167             :     {
     168             :         // if the parent also has dialog control activated, the parent takes over control
     169      560676 :         if ( (rNEvt.GetType() == EVENT_KEYINPUT) || (rNEvt.GetType() == EVENT_KEYUP) )
     170             :         {
     171           0 :             if ( ImplIsOverlapWindow() ||
     172           0 :                  ((getNonLayoutRealParent(this)->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
     173             :             {
     174           0 :                 nRet = ImplDlgCtrl( *rNEvt.GetKeyEvent(), rNEvt.GetType() == EVENT_KEYINPUT );
     175             :             }
     176             :         }
     177      560676 :         else if ( (rNEvt.GetType() == EVENT_GETFOCUS) || (rNEvt.GetType() == EVENT_LOSEFOCUS) )
     178             :         {
     179       13694 :             ImplDlgCtrlFocusChanged( rNEvt.GetWindow(), rNEvt.GetType() == EVENT_GETFOCUS );
     180       43507 :             if ( (rNEvt.GetWindow() == this) && (rNEvt.GetType() == EVENT_GETFOCUS) &&
     181       24382 :                  !(GetStyle() & WB_TABSTOP) && !(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) )
     182             :             {
     183         510 :                 sal_uInt16 n = 0;
     184         510 :                 vcl::Window* pFirstChild = ImplGetDlgWindow( n, DLGWINDOW_FIRST );
     185         510 :                 if ( pFirstChild )
     186         136 :                     pFirstChild->ImplControlFocus();
     187             :             }
     188             :         }
     189             :     }
     190             : 
     191     1941117 :     if ( !nRet )
     192             :     {
     193     1941117 :         if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() )
     194     1701281 :             nRet = mpWindowImpl->mpParent->Notify( rNEvt );
     195             :     }
     196             : 
     197     1941117 :     return nRet;
     198             : }
     199             : 
     200     5142747 : void Window::ImplCallEventListeners( sal_uLong nEvent, void* pData )
     201             : {
     202             :     // The implementation was moved to CallEventListeners(),
     203             :     // because derived classes in svtools must be able to
     204             :     // call the event listeners and ImplCallEventListeners()
     205             :     // is not exported.
     206             :     // TODO: replace ImplCallEventListeners() by CallEventListeners() in vcl
     207             : 
     208     5142747 :     CallEventListeners( nEvent, pData );
     209     5142747 : }
     210             : 
     211     5429360 : void Window::CallEventListeners( sal_uLong nEvent, void* pData )
     212             : {
     213     5429360 :     VclWindowEvent aEvent( this, nEvent, pData );
     214             : 
     215    10858720 :     ImplDelData aDelData;
     216     5429360 :     ImplAddDel( &aDelData );
     217             : 
     218     5429360 :     Application::ImplCallEventListeners( &aEvent );
     219             : 
     220     5429360 :     if ( aDelData.IsDead() )
     221           0 :         return;
     222             : 
     223     5429360 :     mpWindowImpl->maEventListeners.Call( &aEvent );
     224             : 
     225     5429360 :     if ( aDelData.IsDead() )
     226           0 :         return;
     227             : 
     228     5429360 :     ImplRemoveDel( &aDelData );
     229             : 
     230     5429360 :     vcl::Window* pWindow = this;
     231    42580173 :     while ( pWindow )
     232             :     {
     233    31721453 :         pWindow->ImplAddDel( &aDelData );
     234             : 
     235    31721453 :         pWindow->mpWindowImpl->maChildEventListeners.Call( &aEvent );
     236             : 
     237    31721453 :         if ( aDelData.IsDead() )
     238           0 :             return;
     239             : 
     240    31721453 :         pWindow->ImplRemoveDel( &aDelData );
     241             : 
     242    31721453 :         pWindow = pWindow->GetParent();
     243     5429360 :     }
     244             : }
     245             : 
     246           0 : void Window::FireVclEvent( VclSimpleEvent* pEvent )
     247             : {
     248           0 :     Application::ImplCallEventListeners(pEvent);
     249           0 : }
     250             : 
     251      201301 : void Window::AddEventListener( const Link& rEventListener )
     252             : {
     253      201301 :     mpWindowImpl->maEventListeners.addListener( rEventListener );
     254      201301 : }
     255             : 
     256      273834 : void Window::RemoveEventListener( const Link& rEventListener )
     257             : {
     258      273834 :     mpWindowImpl->maEventListeners.removeListener( rEventListener );
     259      273834 : }
     260             : 
     261       16950 : void Window::AddChildEventListener( const Link& rEventListener )
     262             : {
     263       16950 :     mpWindowImpl->maChildEventListeners.addListener( rEventListener );
     264       16950 : }
     265             : 
     266       16966 : void Window::RemoveChildEventListener( const Link& rEventListener )
     267             : {
     268       16966 :     mpWindowImpl->maChildEventListeners.removeListener( rEventListener );
     269       16966 : }
     270             : 
     271           0 : ImplSVEvent * Window::PostUserEvent( const Link& rLink, void* pCaller )
     272             : {
     273           0 :     ImplSVEvent* pSVEvent = new ImplSVEvent;
     274           0 :     pSVEvent->mpData    = pCaller;
     275           0 :     pSVEvent->mpLink    = new Link( rLink );
     276           0 :     pSVEvent->mpWindow  = this;
     277           0 :     pSVEvent->mbCall    = true;
     278           0 :     ImplAddDel( &(pSVEvent->maDelData) );
     279           0 :     if ( !mpWindowImpl->mpFrame->PostEvent( pSVEvent ) )
     280             :     {
     281           0 :         ImplRemoveDel( &(pSVEvent->maDelData) );
     282           0 :         delete pSVEvent->mpLink;
     283           0 :         delete pSVEvent;
     284           0 :         pSVEvent = 0;
     285             :     }
     286           0 :     return pSVEvent;
     287             : }
     288             : 
     289           0 : void Window::RemoveUserEvent( ImplSVEvent * nUserEvent )
     290             : {
     291             :     DBG_ASSERT( nUserEvent->mpWindow == this,
     292             :                 "Window::RemoveUserEvent(): Event doesn't send to this window or is already removed" );
     293             :     DBG_ASSERT( nUserEvent->mbCall,
     294             :                 "Window::RemoveUserEvent(): Event is already removed" );
     295             : 
     296           0 :     if ( nUserEvent->mpWindow )
     297             :     {
     298           0 :         nUserEvent->mpWindow->ImplRemoveDel( &(nUserEvent->maDelData) );
     299           0 :         nUserEvent->mpWindow = NULL;
     300             :     }
     301             : 
     302           0 :     nUserEvent->mbCall = false;
     303           0 : }
     304             : 
     305             : 
     306           0 : MouseEvent ImplTranslateMouseEvent( const MouseEvent& rE, vcl::Window* pSource, vcl::Window* pDest )
     307             : {
     308           0 :     Point aPos = pSource->OutputToScreenPixel( rE.GetPosPixel() );
     309           0 :     aPos = pDest->ScreenToOutputPixel( aPos );
     310           0 :     return MouseEvent( aPos, rE.GetClicks(), rE.GetMode(), rE.GetButtons(), rE.GetModifier() );
     311             : }
     312             : 
     313           0 : CommandEvent ImplTranslateCommandEvent( const CommandEvent& rCEvt, vcl::Window* pSource, vcl::Window* pDest )
     314             : {
     315           0 :     if ( !rCEvt.IsMouseEvent() )
     316           0 :         return rCEvt;
     317             : 
     318           0 :     Point aPos = pSource->OutputToScreenPixel( rCEvt.GetMousePosPixel() );
     319           0 :     aPos = pDest->ScreenToOutputPixel( aPos );
     320           0 :     return CommandEvent( aPos, rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() );
     321             : }
     322             : 
     323           0 : void Window::ImplNotifyKeyMouseCommandEventListeners( NotifyEvent& rNEvt )
     324             : {
     325           0 :     if( rNEvt.GetType() == EVENT_COMMAND )
     326             :     {
     327           0 :         const CommandEvent* pCEvt = rNEvt.GetCommandEvent();
     328           0 :         if ( pCEvt->GetCommand() != COMMAND_CONTEXTMENU )
     329             :             // non context menu events are not to be notified up the chain
     330             :             // so we return immediately
     331           0 :             return;
     332             : 
     333           0 :         if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
     334             :         {
     335           0 :             if ( rNEvt.GetWindow() == this )
     336             :                 // not interested in: The event listeners are already called in ::Command,
     337             :                 // and calling them here a second time doesn't make sense
     338             :                 ;
     339             :             else
     340             :             {
     341           0 :                 CommandEvent aCommandEvent = ImplTranslateCommandEvent( *pCEvt, rNEvt.GetWindow(), this );
     342           0 :                 ImplCallEventListeners( VCLEVENT_WINDOW_COMMAND, &aCommandEvent );
     343             :             }
     344             :         }
     345             :     }
     346             : 
     347             :     // #82968# notify event listeners for mouse and key events separately and
     348             :     // not in PreNotify ( as for focus listeners )
     349             :     // this allows for processing those events internally first and pass it to
     350             :     // the toolkit later
     351             : 
     352           0 :     ImplDelData aDelData;
     353           0 :     ImplAddDel( &aDelData );
     354             : 
     355           0 :     if( rNEvt.GetType() == EVENT_MOUSEMOVE )
     356             :     {
     357           0 :         if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
     358             :         {
     359           0 :             if ( rNEvt.GetWindow() == this )
     360           0 :                 ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, (void*)rNEvt.GetMouseEvent() );
     361             :             else
     362             :             {
     363           0 :                 MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this );
     364           0 :                 ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, &aMouseEvent );
     365             :             }
     366             :         }
     367             :     }
     368           0 :     else if( rNEvt.GetType() == EVENT_MOUSEBUTTONUP )
     369             :     {
     370           0 :         if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
     371             :         {
     372           0 :             if ( rNEvt.GetWindow() == this )
     373           0 :                 ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, (void*)rNEvt.GetMouseEvent() );
     374             :             else
     375             :             {
     376           0 :                 MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this );
     377           0 :                 ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, &aMouseEvent );
     378             :             }
     379             :         }
     380             :     }
     381           0 :     else if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
     382             :     {
     383           0 :         if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
     384             :         {
     385           0 :             if ( rNEvt.GetWindow() == this )
     386           0 :                 ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, (void*)rNEvt.GetMouseEvent() );
     387             :             else
     388             :             {
     389           0 :                 MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this );
     390           0 :                 ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, &aMouseEvent );
     391             :             }
     392             :         }
     393             :     }
     394           0 :     else if( rNEvt.GetType() == EVENT_KEYINPUT )
     395             :     {
     396           0 :         if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
     397           0 :             ImplCallEventListeners( VCLEVENT_WINDOW_KEYINPUT, (void*)rNEvt.GetKeyEvent() );
     398             :     }
     399           0 :     else if( rNEvt.GetType() == EVENT_KEYUP )
     400             :     {
     401           0 :         if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
     402           0 :             ImplCallEventListeners( VCLEVENT_WINDOW_KEYUP, (void*)rNEvt.GetKeyEvent() );
     403             :     }
     404             : 
     405           0 :     if ( aDelData.IsDead() )
     406           0 :         return;
     407           0 :     ImplRemoveDel( &aDelData );
     408             : 
     409             :     // #106721# check if we're part of a compound control and notify
     410           0 :     vcl::Window *pParent = ImplGetParent();
     411           0 :     while( pParent )
     412             :     {
     413           0 :         if( pParent->IsCompoundControl() )
     414             :         {
     415           0 :             pParent->ImplNotifyKeyMouseCommandEventListeners( rNEvt );
     416           0 :             break;
     417             :         }
     418           0 :         pParent = pParent->ImplGetParent();
     419           0 :     }
     420             : }
     421             : 
     422      270666 : void Window::ImplCallInitShow()
     423             : {
     424      270666 :     mpWindowImpl->mbReallyShown   = true;
     425      270666 :     mpWindowImpl->mbInInitShow    = true;
     426      270666 :     StateChanged( StateChangedType::INITSHOW );
     427      270666 :     mpWindowImpl->mbInInitShow    = false;
     428             : 
     429      270666 :     vcl::Window* pWindow = mpWindowImpl->mpFirstOverlap;
     430      541332 :     while ( pWindow )
     431             :     {
     432           0 :         if ( pWindow->mpWindowImpl->mbVisible )
     433           0 :             pWindow->ImplCallInitShow();
     434           0 :         pWindow = pWindow->mpWindowImpl->mpNext;
     435             :     }
     436             : 
     437      270666 :     pWindow = mpWindowImpl->mpFirstChild;
     438      815680 :     while ( pWindow )
     439             :     {
     440      274348 :         if ( pWindow->mpWindowImpl->mbVisible )
     441      182259 :             pWindow->ImplCallInitShow();
     442      274348 :         pWindow = pWindow->mpWindowImpl->mpNext;
     443             :     }
     444      270666 : }
     445             : 
     446             : 
     447      736401 : void Window::ImplCallResize()
     448             : {
     449      736401 :     mpWindowImpl->mbCallResize = false;
     450             : 
     451      736401 :     if( GetBackground().IsGradient() )
     452       74576 :         Invalidate();
     453             : 
     454      736401 :     Resize();
     455             : 
     456             :     // #88419# Most classes don't call the base class in Resize() and Move(),
     457             :     // => Call ImpleResize/Move instead of Resize/Move directly...
     458      736401 :     ImplCallEventListeners( VCLEVENT_WINDOW_RESIZE );
     459      736401 : }
     460             : 
     461      755579 : void Window::ImplCallMove()
     462             : {
     463      755579 :     mpWindowImpl->mbCallMove = false;
     464             : 
     465      755579 :     if( mpWindowImpl->mbFrame )
     466             :     {
     467             :         // update frame position
     468        5560 :         SalFrame *pParentFrame = NULL;
     469        5560 :         vcl::Window *pParent = ImplGetParent();
     470       11120 :         while( pParent )
     471             :         {
     472          56 :             if( pParent->mpWindowImpl->mpFrame != mpWindowImpl->mpFrame )
     473             :             {
     474          56 :                 pParentFrame = pParent->mpWindowImpl->mpFrame;
     475          56 :                 break;
     476             :             }
     477           0 :             pParent = pParent->GetParent();
     478             :         }
     479             : 
     480        5560 :         SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
     481        5560 :         mpWindowImpl->maPos = Point( g.nX, g.nY );
     482        5560 :         if( pParentFrame )
     483             :         {
     484          56 :             g = pParentFrame->GetGeometry();
     485          56 :             mpWindowImpl->maPos -= Point( g.nX, g.nY );
     486             :         }
     487             :         // the client window and and all its subclients have the same position as the borderframe
     488             :         // this is important for floating toolbars where the borderwindow is a floating window
     489             :         // which has another borderwindow (ie the system floating window)
     490        5560 :         vcl::Window *pClientWin = mpWindowImpl->mpClientWindow;
     491       16632 :         while( pClientWin )
     492             :         {
     493        5512 :             pClientWin->mpWindowImpl->maPos = mpWindowImpl->maPos;
     494        5512 :             pClientWin = pClientWin->mpWindowImpl->mpClientWindow;
     495             :         }
     496             :     }
     497             : 
     498      755579 :     Move();
     499             : 
     500      755579 :     ImplCallEventListeners( VCLEVENT_WINDOW_MOVE );
     501      755579 : }
     502             : 
     503           0 : void Window::ImplCallFocusChangeActivate( vcl::Window* pNewOverlapWindow,
     504             :                                           vcl::Window* pOldOverlapWindow )
     505             : {
     506           0 :     ImplSVData* pSVData = ImplGetSVData();
     507             :     vcl::Window*     pNewRealWindow;
     508             :     vcl::Window*     pOldRealWindow;
     509           0 :     bool bCallActivate = true;
     510           0 :     bool bCallDeactivate = true;
     511             : 
     512           0 :     pOldRealWindow = pOldOverlapWindow->ImplGetWindow();
     513           0 :     pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
     514           0 :     if ( (pOldRealWindow->GetType() != WINDOW_FLOATINGWINDOW) ||
     515           0 :          pOldRealWindow->GetActivateMode() )
     516             :     {
     517           0 :         if ( (pNewRealWindow->GetType() == WINDOW_FLOATINGWINDOW) &&
     518           0 :              !pNewRealWindow->GetActivateMode() )
     519             :         {
     520           0 :             pSVData->maWinData.mpLastDeacWin = pOldOverlapWindow;
     521           0 :             bCallDeactivate = false;
     522             :         }
     523             :     }
     524           0 :     else if ( (pNewRealWindow->GetType() != WINDOW_FLOATINGWINDOW) ||
     525           0 :               pNewRealWindow->GetActivateMode() )
     526             :     {
     527           0 :         if ( pSVData->maWinData.mpLastDeacWin )
     528             :         {
     529           0 :             if ( pSVData->maWinData.mpLastDeacWin == pNewOverlapWindow )
     530           0 :                 bCallActivate = false;
     531             :             else
     532             :             {
     533           0 :                 vcl::Window* pLastRealWindow = pSVData->maWinData.mpLastDeacWin->ImplGetWindow();
     534           0 :                 pSVData->maWinData.mpLastDeacWin->mpWindowImpl->mbActive = false;
     535           0 :                 pSVData->maWinData.mpLastDeacWin->Deactivate();
     536           0 :                 if ( pLastRealWindow != pSVData->maWinData.mpLastDeacWin )
     537             :                 {
     538           0 :                     pLastRealWindow->mpWindowImpl->mbActive = true;
     539           0 :                     pLastRealWindow->Activate();
     540             :                 }
     541             :             }
     542           0 :             pSVData->maWinData.mpLastDeacWin = NULL;
     543             :         }
     544             :     }
     545             : 
     546           0 :     if ( bCallDeactivate )
     547             :     {
     548           0 :         if( pOldOverlapWindow->mpWindowImpl->mbActive )
     549             :         {
     550           0 :             pOldOverlapWindow->mpWindowImpl->mbActive = false;
     551           0 :             pOldOverlapWindow->Deactivate();
     552             :         }
     553           0 :         if ( pOldRealWindow != pOldOverlapWindow )
     554             :         {
     555           0 :             if( pOldRealWindow->mpWindowImpl->mbActive )
     556             :             {
     557           0 :                 pOldRealWindow->mpWindowImpl->mbActive = false;
     558           0 :                 pOldRealWindow->Deactivate();
     559             :             }
     560             :         }
     561             :     }
     562           0 :     if ( bCallActivate && ! pNewOverlapWindow->mpWindowImpl->mbActive )
     563             :     {
     564           0 :         if( ! pNewOverlapWindow->mpWindowImpl->mbActive )
     565             :         {
     566           0 :             pNewOverlapWindow->mpWindowImpl->mbActive = true;
     567           0 :             pNewOverlapWindow->Activate();
     568             :         }
     569           0 :         if ( pNewRealWindow != pNewOverlapWindow )
     570             :         {
     571           0 :             if( ! pNewRealWindow->mpWindowImpl->mbActive )
     572             :             {
     573           0 :                 pNewRealWindow->mpWindowImpl->mbActive = true;
     574           0 :                 pNewRealWindow->Activate();
     575             :             }
     576             :         }
     577             :     }
     578           0 : }
     579             : 
     580        1233 : } /* namespace vcl */
     581             : 
     582             : 
     583             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10