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

Generated by: LCOV version 1.11