1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_vcl.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <tools/time.hxx> 32*cdf0e10cSrcweir #ifndef _SV_RC_H 33*cdf0e10cSrcweir #include <tools/rc.h> 34*cdf0e10cSrcweir #endif 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include <brdwin.hxx> 37*cdf0e10cSrcweir #include <svdata.hxx> 38*cdf0e10cSrcweir #include <salframe.hxx> 39*cdf0e10cSrcweir #include <window.h> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #include <vcl/event.hxx> 42*cdf0e10cSrcweir #include <vcl/floatwin.hxx> 43*cdf0e10cSrcweir #include <vcl/dockwin.hxx> 44*cdf0e10cSrcweir #include <vcl/toolbox.hxx> 45*cdf0e10cSrcweir #include <vcl/svapp.hxx> 46*cdf0e10cSrcweir #include <vcl/timer.hxx> 47*cdf0e10cSrcweir #include <vcl/lineinfo.hxx> 48*cdf0e10cSrcweir #include <vcl/unowrap.hxx> 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir // ======================================================================= 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir #define DOCKWIN_FLOATSTYLES (WB_SIZEABLE | WB_MOVEABLE | WB_CLOSEABLE | WB_STANDALONE | WB_PINABLE | WB_ROLLABLE ) 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir // ======================================================================= 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir // ======================================================================= 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir class ImplDockFloatWin2 : public FloatingWindow 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir private: 63*cdf0e10cSrcweir ImplDockingWindowWrapper* mpDockWin; 64*cdf0e10cSrcweir sal_uLong mnLastTicks; 65*cdf0e10cSrcweir Timer maDockTimer; 66*cdf0e10cSrcweir Timer maEndDockTimer; 67*cdf0e10cSrcweir Point maDockPos; 68*cdf0e10cSrcweir Rectangle maDockRect; 69*cdf0e10cSrcweir sal_Bool mbInMove; 70*cdf0e10cSrcweir sal_uLong mnLastUserEvent; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir DECL_LINK( DockingHdl, ImplDockFloatWin2* ); 73*cdf0e10cSrcweir DECL_LINK( DockTimerHdl, ImplDockFloatWin2* ); 74*cdf0e10cSrcweir DECL_LINK( EndDockTimerHdl, ImplDockFloatWin2* ); 75*cdf0e10cSrcweir public: 76*cdf0e10cSrcweir ImplDockFloatWin2( Window* pParent, WinBits nWinBits, 77*cdf0e10cSrcweir ImplDockingWindowWrapper* pDockingWin ); 78*cdf0e10cSrcweir ~ImplDockFloatWin2(); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir virtual void Move(); 81*cdf0e10cSrcweir virtual void Resize(); 82*cdf0e10cSrcweir virtual void TitleButtonClick( sal_uInt16 nButton ); 83*cdf0e10cSrcweir virtual void Pin(); 84*cdf0e10cSrcweir virtual void Roll(); 85*cdf0e10cSrcweir virtual void PopupModeEnd(); 86*cdf0e10cSrcweir virtual void Resizing( Size& rSize ); 87*cdf0e10cSrcweir virtual sal_Bool Close(); 88*cdf0e10cSrcweir using Window::SetPosSizePixel; 89*cdf0e10cSrcweir virtual void SetPosSizePixel( long nX, long nY, 90*cdf0e10cSrcweir long nWidth, long nHeight, 91*cdf0e10cSrcweir sal_uInt16 nFlags = WINDOW_POSSIZE_ALL ); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir sal_uLong GetLastTicks() const { return mnLastTicks; } 94*cdf0e10cSrcweir }; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir // ======================================================================= 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir ImplDockFloatWin2::ImplDockFloatWin2( Window* pParent, WinBits nWinBits, 99*cdf0e10cSrcweir ImplDockingWindowWrapper* pDockingWin ) : 100*cdf0e10cSrcweir FloatingWindow( pParent, nWinBits ), 101*cdf0e10cSrcweir mpDockWin( pDockingWin ), 102*cdf0e10cSrcweir mnLastTicks( Time::GetSystemTicks() ), 103*cdf0e10cSrcweir mbInMove( sal_False ), 104*cdf0e10cSrcweir mnLastUserEvent( 0 ) 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir // Daten vom DockingWindow uebernehmen 107*cdf0e10cSrcweir if ( pDockingWin ) 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir SetSettings( pDockingWin->GetWindow()->GetSettings() ); 110*cdf0e10cSrcweir Enable( pDockingWin->GetWindow()->IsEnabled(), sal_False ); 111*cdf0e10cSrcweir EnableInput( pDockingWin->GetWindow()->IsInputEnabled(), sal_False ); 112*cdf0e10cSrcweir AlwaysEnableInput( pDockingWin->GetWindow()->IsAlwaysEnableInput(), sal_False ); 113*cdf0e10cSrcweir EnableAlwaysOnTop( pDockingWin->GetWindow()->IsAlwaysOnTopEnabled() ); 114*cdf0e10cSrcweir SetActivateMode( pDockingWin->GetWindow()->GetActivateMode() ); 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir SetBackground( GetSettings().GetStyleSettings().GetFaceColor() ); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir maDockTimer.SetTimeoutHdl( LINK( this, ImplDockFloatWin2, DockTimerHdl ) ); 120*cdf0e10cSrcweir maDockTimer.SetTimeout( 50 ); 121*cdf0e10cSrcweir maEndDockTimer.SetTimeoutHdl( LINK( this, ImplDockFloatWin2, EndDockTimerHdl ) ); 122*cdf0e10cSrcweir maEndDockTimer.SetTimeout( 50 ); 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir // ----------------------------------------------------------------------- 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir ImplDockFloatWin2::~ImplDockFloatWin2() 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir if( mnLastUserEvent ) 130*cdf0e10cSrcweir Application::RemoveUserEvent( mnLastUserEvent ); 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir // ----------------------------------------------------------------------- 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir IMPL_LINK( ImplDockFloatWin2, DockTimerHdl, ImplDockFloatWin2*, EMPTYARG ) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir DBG_ASSERT( mpDockWin->IsFloatingMode(), "docktimer called but not floating" ); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir maDockTimer.Stop(); 140*cdf0e10cSrcweir PointerState aState = GetPointerState(); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir if( aState.mnState & KEY_MOD1 ) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir // i43499 CTRL disables docking now 145*cdf0e10cSrcweir mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking(); 146*cdf0e10cSrcweir if( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) 147*cdf0e10cSrcweir maDockTimer.Start(); 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir else if( ! ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) ) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking(); 152*cdf0e10cSrcweir mpDockWin->EndDocking( maDockRect, sal_False ); 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir else 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect, SHOWTRACK_BIG | SHOWTRACK_WINDOW ); 157*cdf0e10cSrcweir maDockTimer.Start(); 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir return 0; 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir IMPL_LINK( ImplDockFloatWin2, EndDockTimerHdl, ImplDockFloatWin2*, EMPTYARG ) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir DBG_ASSERT( mpDockWin->IsFloatingMode(), "enddocktimer called but not floating" ); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir maEndDockTimer.Stop(); 168*cdf0e10cSrcweir PointerState aState = GetPointerState(); 169*cdf0e10cSrcweir if( ! ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) ) 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking(); 172*cdf0e10cSrcweir mpDockWin->EndDocking( maDockRect, sal_True ); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir else 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir maEndDockTimer.Start(); 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir return 0; 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir IMPL_LINK( ImplDockFloatWin2, DockingHdl, ImplDockFloatWin2*, EMPTYARG ) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir // called during move of a floating window 186*cdf0e10cSrcweir mnLastUserEvent = 0; 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir Window *pDockingArea = mpDockWin->GetWindow()->GetParent(); 189*cdf0e10cSrcweir PointerState aState = pDockingArea->GetPointerState(); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir sal_Bool bRealMove = sal_True; 192*cdf0e10cSrcweir if( GetStyle() & WB_OWNERDRAWDECORATION ) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir // for windows with ownerdraw decoration 195*cdf0e10cSrcweir // we allow docking only when the window was moved 196*cdf0e10cSrcweir // by dragging its caption 197*cdf0e10cSrcweir // and ignore move request due to resizing 198*cdf0e10cSrcweir Window *pBorder = GetWindow( WINDOW_BORDER ); 199*cdf0e10cSrcweir if( pBorder != this ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir Point aPt; 202*cdf0e10cSrcweir Rectangle aBorderRect( aPt, pBorder->GetSizePixel() ); 203*cdf0e10cSrcweir sal_Int32 nLeft, nTop, nRight, nBottom; 204*cdf0e10cSrcweir GetBorder( nLeft, nTop, nRight, nBottom ); 205*cdf0e10cSrcweir // limit borderrect to the caption part only and without the resizing borders 206*cdf0e10cSrcweir aBorderRect.nBottom = aBorderRect.nTop + nTop; 207*cdf0e10cSrcweir aBorderRect.nLeft += nLeft; 208*cdf0e10cSrcweir aBorderRect.nRight -= nRight; 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir PointerState aBorderState = pBorder->GetPointerState(); 211*cdf0e10cSrcweir if( aBorderRect.IsInside( aBorderState.maPos ) ) 212*cdf0e10cSrcweir bRealMove = sal_True; 213*cdf0e10cSrcweir else 214*cdf0e10cSrcweir bRealMove = sal_False; 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir if( mpDockWin->IsDockable() && 219*cdf0e10cSrcweir mpDockWin->GetWindow()->IsVisible() && 220*cdf0e10cSrcweir (Time::GetSystemTicks() - mnLastTicks > 500) && 221*cdf0e10cSrcweir ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) && 222*cdf0e10cSrcweir !(aState.mnState & KEY_MOD1) && // i43499 CTRL disables docking now 223*cdf0e10cSrcweir bRealMove ) 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir maDockPos = Point( pDockingArea->OutputToScreenPixel( pDockingArea->AbsoluteScreenToOutputPixel( OutputToAbsoluteScreenPixel( Point() ) ) ) ); 226*cdf0e10cSrcweir maDockRect = Rectangle( maDockPos, mpDockWin->GetSizePixel() ); 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir // mouse pos in screen pixels 229*cdf0e10cSrcweir Point aMousePos = pDockingArea->OutputToScreenPixel( aState.maPos ); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir if( ! mpDockWin->IsDocking() ) 232*cdf0e10cSrcweir mpDockWin->StartDocking( aMousePos, maDockRect ); 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir sal_Bool bFloatMode = mpDockWin->Docking( aMousePos, maDockRect ); 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir if( ! bFloatMode ) 237*cdf0e10cSrcweir { 238*cdf0e10cSrcweir // indicates that the window could be docked at maDockRect 239*cdf0e10cSrcweir maDockRect.SetPos( mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->ScreenToOutputPixel( 240*cdf0e10cSrcweir maDockRect.TopLeft() ) ); 241*cdf0e10cSrcweir mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect, SHOWTRACK_BIG | SHOWTRACK_WINDOW ); 242*cdf0e10cSrcweir maEndDockTimer.Stop(); 243*cdf0e10cSrcweir DockTimerHdl( this ); 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir else 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking(); 248*cdf0e10cSrcweir maDockTimer.Stop(); 249*cdf0e10cSrcweir EndDockTimerHdl( this ); 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir mbInMove = sal_False; 253*cdf0e10cSrcweir return 0; 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir // ----------------------------------------------------------------------- 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir void ImplDockFloatWin2::Move() 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir if( mbInMove ) 260*cdf0e10cSrcweir return; 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir mbInMove = sal_True; 263*cdf0e10cSrcweir FloatingWindow::Move(); 264*cdf0e10cSrcweir mpDockWin->GetWindow()->Move(); 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir /* 267*cdf0e10cSrcweir * note: the window should only dock if KEY_MOD1 is pressed 268*cdf0e10cSrcweir * and the user releases all mouse buttons. The real problem here 269*cdf0e10cSrcweir * is that we don't get mouse events (at least not on X) 270*cdf0e10cSrcweir * if the mouse is on the decoration. So we have to start an 271*cdf0e10cSrcweir * awkward timer based process that polls the modifier/buttons 272*cdf0e10cSrcweir * to see whether they are in the right condition shortly after the 273*cdf0e10cSrcweir * last Move message. 274*cdf0e10cSrcweir */ 275*cdf0e10cSrcweir if( ! mnLastUserEvent ) 276*cdf0e10cSrcweir mnLastUserEvent = Application::PostUserEvent( LINK( this, ImplDockFloatWin2, DockingHdl ) ); 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir // ----------------------------------------------------------------------- 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir void ImplDockFloatWin2::Resize() 282*cdf0e10cSrcweir { 283*cdf0e10cSrcweir // forwarding of resize only required if we have no borderwindow ( GetWindow() then returns 'this' ) 284*cdf0e10cSrcweir if( GetWindow( WINDOW_BORDER ) == this ) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir FloatingWindow::Resize(); 287*cdf0e10cSrcweir Size aSize( GetSizePixel() ); 288*cdf0e10cSrcweir mpDockWin->GetWindow()->ImplPosSizeWindow( 0, 0, aSize.Width(), aSize.Height(), WINDOW_POSSIZE_POSSIZE ); // is this needed ??? 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir void ImplDockFloatWin2::SetPosSizePixel( long nX, long nY, 293*cdf0e10cSrcweir long nWidth, long nHeight, 294*cdf0e10cSrcweir sal_uInt16 nFlags ) 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir FloatingWindow::SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags ); 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir // ----------------------------------------------------------------------- 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir void ImplDockFloatWin2::TitleButtonClick( sal_uInt16 nButton ) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir FloatingWindow::TitleButtonClick( nButton ); 305*cdf0e10cSrcweir mpDockWin->TitleButtonClick( nButton ); 306*cdf0e10cSrcweir } 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir // ----------------------------------------------------------------------- 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir void ImplDockFloatWin2::Pin() 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir FloatingWindow::Pin(); 313*cdf0e10cSrcweir mpDockWin->Pin(); 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir // ----------------------------------------------------------------------- 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir void ImplDockFloatWin2::Roll() 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir FloatingWindow::Roll(); 321*cdf0e10cSrcweir mpDockWin->Roll(); 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir // ----------------------------------------------------------------------- 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir void ImplDockFloatWin2::PopupModeEnd() 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir FloatingWindow::PopupModeEnd(); 329*cdf0e10cSrcweir mpDockWin->PopupModeEnd(); 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir // ----------------------------------------------------------------------- 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir void ImplDockFloatWin2::Resizing( Size& rSize ) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir FloatingWindow::Resizing( rSize ); 337*cdf0e10cSrcweir mpDockWin->Resizing( rSize ); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir // ----------------------------------------------------------------------- 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir sal_Bool ImplDockFloatWin2::Close() 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir return mpDockWin->Close(); 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir // ======================================================================= 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir DockingManager::DockingManager() 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir DockingManager::~DockingManager() 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir ::std::vector< ImplDockingWindowWrapper* >::iterator p; 356*cdf0e10cSrcweir p = mDockingWindows.begin(); 357*cdf0e10cSrcweir for(; p != mDockingWindows.end(); ++p ) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir delete (*p); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir mDockingWindows.clear(); 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir ImplDockingWindowWrapper* DockingManager::GetDockingWindowWrapper( const Window *pWindow ) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir ::std::vector< ImplDockingWindowWrapper* >::iterator p; 367*cdf0e10cSrcweir p = mDockingWindows.begin(); 368*cdf0e10cSrcweir while( p != mDockingWindows.end() ) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir if( (*p)->mpDockingWindow == pWindow ) 371*cdf0e10cSrcweir return (*p); 372*cdf0e10cSrcweir else 373*cdf0e10cSrcweir p++; 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir return NULL; 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir sal_Bool DockingManager::IsDockable( const Window *pWindow ) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir /* 383*cdf0e10cSrcweir if( pWindow->HasDockingHandler() ) 384*cdf0e10cSrcweir return sal_True; 385*cdf0e10cSrcweir */ 386*cdf0e10cSrcweir return (pWrapper != NULL); 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir sal_Bool DockingManager::IsFloating( const Window *pWindow ) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 392*cdf0e10cSrcweir if( pWrapper ) 393*cdf0e10cSrcweir return pWrapper->IsFloatingMode(); 394*cdf0e10cSrcweir else 395*cdf0e10cSrcweir return sal_False; 396*cdf0e10cSrcweir } 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir sal_Bool DockingManager::IsLocked( const Window *pWindow ) 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 401*cdf0e10cSrcweir if( pWrapper && pWrapper->IsLocked() ) 402*cdf0e10cSrcweir return sal_True; 403*cdf0e10cSrcweir else 404*cdf0e10cSrcweir return sal_False; 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir void DockingManager::Lock( const Window *pWindow ) 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 410*cdf0e10cSrcweir if( pWrapper ) 411*cdf0e10cSrcweir pWrapper->Lock(); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir void DockingManager::Unlock( const Window *pWindow ) 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 417*cdf0e10cSrcweir if( pWrapper ) 418*cdf0e10cSrcweir pWrapper->Unlock(); 419*cdf0e10cSrcweir } 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir void DockingManager::SetFloatingMode( const Window *pWindow, sal_Bool bFloating ) 422*cdf0e10cSrcweir { 423*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 424*cdf0e10cSrcweir if( pWrapper ) 425*cdf0e10cSrcweir pWrapper->SetFloatingMode( bFloating ); 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow, sal_uLong nFlags ) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 431*cdf0e10cSrcweir if( pWrapper ) 432*cdf0e10cSrcweir pWrapper->StartPopupMode( pParentToolBox, nFlags ); 433*cdf0e10cSrcweir } 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const Window *pWindow ) 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir StartPopupMode( pParentToolBox, pWindow, FLOATWIN_POPUPMODE_ALLOWTEAROFF | 438*cdf0e10cSrcweir FLOATWIN_POPUPMODE_NOFOCUSCLOSE | 439*cdf0e10cSrcweir FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE | 440*cdf0e10cSrcweir FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir sal_Bool DockingManager::IsInPopupMode( const Window *pWindow ) 444*cdf0e10cSrcweir { 445*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 446*cdf0e10cSrcweir if( pWrapper && pWrapper->IsInPopupMode() ) 447*cdf0e10cSrcweir return sal_True; 448*cdf0e10cSrcweir else 449*cdf0e10cSrcweir return sal_False; 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir // ----------------------------------------------------------------------- 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir void DockingManager::EndPopupMode( const Window *pWin ) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir ImplDockingWindowWrapper *pWrapper = GetDockingWindowWrapper( pWin ); 457*cdf0e10cSrcweir if( pWrapper && pWrapper->GetFloatingWindow() && pWrapper->GetFloatingWindow()->IsInPopupMode() ) 458*cdf0e10cSrcweir pWrapper->GetFloatingWindow()->EndPopupMode(); 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir // ----------------------------------------------------------------------- 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir void DockingManager::AddWindow( const Window *pWindow ) 464*cdf0e10cSrcweir { 465*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 466*cdf0e10cSrcweir if( pWrapper ) 467*cdf0e10cSrcweir return; 468*cdf0e10cSrcweir else 469*cdf0e10cSrcweir pWrapper = new ImplDockingWindowWrapper( pWindow ); 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir mDockingWindows.push_back( pWrapper ); 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir void DockingManager::RemoveWindow( const Window *pWindow ) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir ::std::vector< ImplDockingWindowWrapper* >::iterator p; 477*cdf0e10cSrcweir p = mDockingWindows.begin(); 478*cdf0e10cSrcweir while( p != mDockingWindows.end() ) 479*cdf0e10cSrcweir { 480*cdf0e10cSrcweir if( (*p)->mpDockingWindow == pWindow ) 481*cdf0e10cSrcweir { 482*cdf0e10cSrcweir delete (*p); 483*cdf0e10cSrcweir mDockingWindows.erase( p ); 484*cdf0e10cSrcweir break; 485*cdf0e10cSrcweir } 486*cdf0e10cSrcweir else 487*cdf0e10cSrcweir p++; 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir void DockingManager::SetPosSizePixel( Window *pWindow, long nX, long nY, 492*cdf0e10cSrcweir long nWidth, long nHeight, 493*cdf0e10cSrcweir sal_uInt16 nFlags ) 494*cdf0e10cSrcweir { 495*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 496*cdf0e10cSrcweir if( pWrapper ) 497*cdf0e10cSrcweir pWrapper->SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags ); 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir Rectangle DockingManager::GetPosSizePixel( const Window *pWindow ) 501*cdf0e10cSrcweir { 502*cdf0e10cSrcweir Rectangle aRect; 503*cdf0e10cSrcweir ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); 504*cdf0e10cSrcweir if( pWrapper ) 505*cdf0e10cSrcweir aRect = Rectangle( pWrapper->GetPosPixel(), pWrapper->GetSizePixel() ); 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir return aRect; 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir // ======================================================================= 511*cdf0e10cSrcweir // special floating window for popup mode 512*cdf0e10cSrcweir // main purpose: provides tear-off area for undocking 513*cdf0e10cSrcweir // ======================================================================= 514*cdf0e10cSrcweir 515*cdf0e10cSrcweir // if TEAROFF_DASHED defined a single dashed line is used 516*cdf0e10cSrcweir // otherwise multiple smaller lines will be painted 517*cdf0e10cSrcweir //#define TEAROFF_DASHED 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir // size of the drag area 520*cdf0e10cSrcweir #ifdef TEAROFF_DASHED 521*cdf0e10cSrcweir #define POPUP_DRAGBORDER 2 522*cdf0e10cSrcweir #define POPUP_DRAGGRIP 5 523*cdf0e10cSrcweir #else 524*cdf0e10cSrcweir #define POPUP_DRAGBORDER 3 525*cdf0e10cSrcweir #define POPUP_DRAGGRIP 5 526*cdf0e10cSrcweir #endif 527*cdf0e10cSrcweir #define POPUP_DRAGHEIGHT (POPUP_DRAGGRIP+POPUP_DRAGBORDER+POPUP_DRAGBORDER) 528*cdf0e10cSrcweir #define POPUP_DRAGWIDTH 20 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir class ImplPopupFloatWin : public FloatingWindow 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir private: 533*cdf0e10cSrcweir ImplDockingWindowWrapper* mpDockingWin; 534*cdf0e10cSrcweir sal_Bool mbHighlight; 535*cdf0e10cSrcweir sal_Bool mbMoving; 536*cdf0e10cSrcweir bool mbTrackingEnabled; 537*cdf0e10cSrcweir Point maDelta; 538*cdf0e10cSrcweir Point maTearOffPosition; 539*cdf0e10cSrcweir bool mbGripAtBottom; 540*cdf0e10cSrcweir bool mbHasGrip; 541*cdf0e10cSrcweir void ImplSetBorder(); 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir public: 544*cdf0e10cSrcweir ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip ); 545*cdf0e10cSrcweir ~ImplPopupFloatWin(); 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); 548*cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 549*cdf0e10cSrcweir virtual void MouseMove( const MouseEvent& rMEvt ); 550*cdf0e10cSrcweir virtual void MouseButtonDown( const MouseEvent& rMEvt ); 551*cdf0e10cSrcweir virtual void MouseButtonUp( const MouseEvent& rMEvt ); 552*cdf0e10cSrcweir virtual void Tracking( const TrackingEvent& rTEvt ); 553*cdf0e10cSrcweir virtual void Resize(); 554*cdf0e10cSrcweir virtual Window* GetPreferredKeyInputWindow(); 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir Rectangle GetDragRect() const; 557*cdf0e10cSrcweir Point GetToolboxPosition() const; 558*cdf0e10cSrcweir Point GetTearOffPosition() const; 559*cdf0e10cSrcweir void DrawGrip(); 560*cdf0e10cSrcweir void DrawBorder(); 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir bool hasGrip() const { return mbHasGrip; } 563*cdf0e10cSrcweir }; 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir ImplPopupFloatWin::ImplPopupFloatWin( Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip ) : 566*cdf0e10cSrcweir FloatingWindow( pParent, WB_NOBORDER | WB_SYSTEMWINDOW | WB_NOSHADOW) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir mpWindowImpl->mbToolbarFloatingWindow = sal_True; // indicate window type, required for accessibility 569*cdf0e10cSrcweir // which should not see this window as a toplevel window 570*cdf0e10cSrcweir mpDockingWin = pDockingWin; 571*cdf0e10cSrcweir mbHighlight = sal_False; 572*cdf0e10cSrcweir mbMoving = sal_False; 573*cdf0e10cSrcweir mbTrackingEnabled = sal_False; 574*cdf0e10cSrcweir mbGripAtBottom = sal_True; 575*cdf0e10cSrcweir mbHasGrip = bHasGrip; 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir ImplSetBorder(); 578*cdf0e10cSrcweir } 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir ImplPopupFloatWin::~ImplPopupFloatWin() 581*cdf0e10cSrcweir { 582*cdf0e10cSrcweir mpDockingWin = NULL; 583*cdf0e10cSrcweir } 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > ImplPopupFloatWin::CreateAccessible() 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir // switch off direct accessibilty support for this window 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir // this is to avoid appearance of this window as standalone window in the accessibility hierarchy 590*cdf0e10cSrcweir // as this window is only used as a helper for subtoolbars that are not teared-off, the parent toolbar 591*cdf0e10cSrcweir // has to provide accessibility support (as implemented in the toolkit) 592*cdf0e10cSrcweir // so the contained toolbar should appear as child of the correponsing toolbar item of the parent toolbar 593*cdf0e10cSrcweir return ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >(); 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir Window* ImplPopupFloatWin::GetPreferredKeyInputWindow() 597*cdf0e10cSrcweir { 598*cdf0e10cSrcweir if( mpWindowImpl->mpClientWindow ) 599*cdf0e10cSrcweir return mpWindowImpl->mpClientWindow; 600*cdf0e10cSrcweir else 601*cdf0e10cSrcweir return FloatingWindow::GetPreferredKeyInputWindow(); 602*cdf0e10cSrcweir } 603*cdf0e10cSrcweir 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir void ImplPopupFloatWin::ImplSetBorder() 606*cdf0e10cSrcweir { 607*cdf0e10cSrcweir // although we have no border in the sense of a borderwindow 608*cdf0e10cSrcweir // we're using a special border for the grip 609*cdf0e10cSrcweir // by setting those members the method SetOutputSizePixel() can 610*cdf0e10cSrcweir // be used to set the proper window size 611*cdf0e10cSrcweir mpWindowImpl->mnTopBorder = 1; 612*cdf0e10cSrcweir if( hasGrip() ) 613*cdf0e10cSrcweir mpWindowImpl->mnTopBorder += POPUP_DRAGHEIGHT+2; 614*cdf0e10cSrcweir mpWindowImpl->mnBottomBorder = 1; 615*cdf0e10cSrcweir mpWindowImpl->mnLeftBorder = 1; 616*cdf0e10cSrcweir mpWindowImpl->mnRightBorder = 1; 617*cdf0e10cSrcweir } 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir void ImplPopupFloatWin::Resize() 620*cdf0e10cSrcweir { 621*cdf0e10cSrcweir // the borderview overwrites the border during resize so restore it 622*cdf0e10cSrcweir ImplSetBorder(); 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir Rectangle ImplPopupFloatWin::GetDragRect() const 626*cdf0e10cSrcweir { 627*cdf0e10cSrcweir Rectangle aRect; 628*cdf0e10cSrcweir if( hasGrip() ) 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir aRect = Rectangle( 1,1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT ); 631*cdf0e10cSrcweir if( mbGripAtBottom ) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir int height = GetOutputSizePixel().Height(); 634*cdf0e10cSrcweir aRect.Top() = height - 3 - POPUP_DRAGHEIGHT; 635*cdf0e10cSrcweir aRect.Bottom() = aRect.Top() + 1 + POPUP_DRAGHEIGHT; 636*cdf0e10cSrcweir } 637*cdf0e10cSrcweir } 638*cdf0e10cSrcweir return aRect; 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir Point ImplPopupFloatWin::GetToolboxPosition() const 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir // return inner position where a toolbox could be placed 644*cdf0e10cSrcweir Point aPt( 1, 1 + ((mbGripAtBottom || !hasGrip()) ? 0 : GetDragRect().getHeight()) ); // grip + border 645*cdf0e10cSrcweir 646*cdf0e10cSrcweir return aPt; 647*cdf0e10cSrcweir } 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir Point ImplPopupFloatWin::GetTearOffPosition() const 650*cdf0e10cSrcweir { 651*cdf0e10cSrcweir Point aPt( maTearOffPosition ); 652*cdf0e10cSrcweir //aPt += GetToolboxPosition(); // remove 'decoration' 653*cdf0e10cSrcweir return aPt; 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir void ImplPopupFloatWin::DrawBorder() 657*cdf0e10cSrcweir { 658*cdf0e10cSrcweir SetFillColor(); 659*cdf0e10cSrcweir Point aPt; 660*cdf0e10cSrcweir Rectangle aRect( aPt, GetOutputSizePixel() ); 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir Region oldClipRgn( GetClipRegion( ) ); 663*cdf0e10cSrcweir Region aClipRgn( aRect ); 664*cdf0e10cSrcweir Rectangle aItemClipRect( ImplGetItemEdgeClipRect() ); 665*cdf0e10cSrcweir if( !aItemClipRect.IsEmpty() ) 666*cdf0e10cSrcweir { 667*cdf0e10cSrcweir aItemClipRect.SetPos( AbsoluteScreenToOutputPixel( aItemClipRect.TopLeft() ) ); 668*cdf0e10cSrcweir 669*cdf0e10cSrcweir // draw the excluded border part with the background color of a toolbox 670*cdf0e10cSrcweir SetClipRegion( Region( aItemClipRect ) ); 671*cdf0e10cSrcweir SetLineColor( GetSettings().GetStyleSettings().GetFaceColor() ); 672*cdf0e10cSrcweir DrawRect( aRect ); 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir aClipRgn.Exclude( aItemClipRect ); 675*cdf0e10cSrcweir SetClipRegion( aClipRgn ); 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); 678*cdf0e10cSrcweir DrawRect( aRect ); 679*cdf0e10cSrcweir SetClipRegion( oldClipRgn ); 680*cdf0e10cSrcweir } 681*cdf0e10cSrcweir 682*cdf0e10cSrcweir void ImplPopupFloatWin::DrawGrip() 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir sal_Bool bLinecolor = IsLineColor(); 685*cdf0e10cSrcweir Color aLinecolor = GetLineColor(); 686*cdf0e10cSrcweir sal_Bool bFillcolor = IsFillColor(); 687*cdf0e10cSrcweir Color aFillcolor = GetFillColor(); 688*cdf0e10cSrcweir 689*cdf0e10cSrcweir // draw background 690*cdf0e10cSrcweir Rectangle aRect( GetDragRect() ); 691*cdf0e10cSrcweir aRect.nTop += POPUP_DRAGBORDER; 692*cdf0e10cSrcweir aRect.nBottom -= POPUP_DRAGBORDER; 693*cdf0e10cSrcweir aRect.nLeft+=3; 694*cdf0e10cSrcweir aRect.nRight-=3; 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir if( mbHighlight ) 697*cdf0e10cSrcweir { 698*cdf0e10cSrcweir Erase( aRect ); 699*cdf0e10cSrcweir DrawSelectionBackground( aRect, 2, sal_False, sal_True, sal_False ); 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir else 702*cdf0e10cSrcweir { 703*cdf0e10cSrcweir SetFillColor( GetSettings().GetStyleSettings().GetFaceColor() ); 704*cdf0e10cSrcweir SetLineColor(); 705*cdf0e10cSrcweir DrawRect( aRect ); 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir if( !ToolBox::AlwaysLocked() ) // no grip if toolboxes are locked 709*cdf0e10cSrcweir { 710*cdf0e10cSrcweir #ifdef TEAROFF_DASHED 711*cdf0e10cSrcweir // draw single dashed line 712*cdf0e10cSrcweir LineInfo aLineInfo( LINE_DASH ); 713*cdf0e10cSrcweir aLineInfo.SetDistance( 4 ); 714*cdf0e10cSrcweir aLineInfo.SetDashLen( 12 ); 715*cdf0e10cSrcweir aLineInfo.SetDashCount( 1 ); 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir aRect.nLeft+=2; aRect.nRight-=2; 718*cdf0e10cSrcweir 719*cdf0e10cSrcweir aRect.nTop+=2; 720*cdf0e10cSrcweir aRect.nBottom = aRect.nTop; 721*cdf0e10cSrcweir SetLineColor( GetSettings().GetStyleSettings().GetDarkShadowColor() ); 722*cdf0e10cSrcweir DrawLine( aRect.TopLeft(), aRect.TopRight(), aLineInfo ); 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir if( !mbHighlight ) 725*cdf0e10cSrcweir { 726*cdf0e10cSrcweir aRect.nTop++; aRect.nBottom++; 727*cdf0e10cSrcweir SetLineColor( GetSettings().GetStyleSettings().GetLightColor() ); 728*cdf0e10cSrcweir DrawLine( aRect.TopLeft(), aRect.TopRight(), aLineInfo ); 729*cdf0e10cSrcweir } 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir #else 732*cdf0e10cSrcweir // draw several grip lines 733*cdf0e10cSrcweir SetFillColor( GetSettings().GetStyleSettings().GetShadowColor() ); 734*cdf0e10cSrcweir aRect.nTop++; 735*cdf0e10cSrcweir aRect.nBottom = aRect.nTop; 736*cdf0e10cSrcweir 737*cdf0e10cSrcweir int width = POPUP_DRAGWIDTH; 738*cdf0e10cSrcweir while( width >= aRect.getWidth() ) 739*cdf0e10cSrcweir width -= 4; 740*cdf0e10cSrcweir if( width <= 0 ) 741*cdf0e10cSrcweir width = aRect.getWidth(); 742*cdf0e10cSrcweir //aRect.nLeft = aRect.nLeft + (aRect.getWidth() - width) / 2; 743*cdf0e10cSrcweir aRect.nLeft = (aRect.nLeft + aRect.nRight - width) / 2; 744*cdf0e10cSrcweir aRect.nRight = aRect.nLeft + width; 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir int i=0; 747*cdf0e10cSrcweir while( i< POPUP_DRAGGRIP ) 748*cdf0e10cSrcweir { 749*cdf0e10cSrcweir DrawRect( aRect ); 750*cdf0e10cSrcweir aRect.nTop+=2; 751*cdf0e10cSrcweir aRect.nBottom+=2; 752*cdf0e10cSrcweir i+=2; 753*cdf0e10cSrcweir } 754*cdf0e10cSrcweir #endif 755*cdf0e10cSrcweir } 756*cdf0e10cSrcweir 757*cdf0e10cSrcweir if( bLinecolor ) 758*cdf0e10cSrcweir SetLineColor( aLinecolor ); 759*cdf0e10cSrcweir else 760*cdf0e10cSrcweir SetLineColor(); 761*cdf0e10cSrcweir if( bFillcolor ) 762*cdf0e10cSrcweir SetFillColor( aFillcolor ); 763*cdf0e10cSrcweir else 764*cdf0e10cSrcweir SetFillColor(); 765*cdf0e10cSrcweir } 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir void ImplPopupFloatWin::Paint( const Rectangle& ) 768*cdf0e10cSrcweir { 769*cdf0e10cSrcweir Point aPt; 770*cdf0e10cSrcweir Rectangle aRect( aPt, GetOutputSizePixel() ); 771*cdf0e10cSrcweir DrawWallpaper( aRect, Wallpaper( GetSettings().GetStyleSettings().GetFaceGradientColor() ) ); 772*cdf0e10cSrcweir DrawBorder(); 773*cdf0e10cSrcweir if( hasGrip() ) 774*cdf0e10cSrcweir DrawGrip(); 775*cdf0e10cSrcweir } 776*cdf0e10cSrcweir 777*cdf0e10cSrcweir void ImplPopupFloatWin::MouseMove( const MouseEvent& rMEvt ) 778*cdf0e10cSrcweir { 779*cdf0e10cSrcweir Point aMousePos = rMEvt.GetPosPixel(); 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir if( !ToolBox::AlwaysLocked() ) // no tear off if locking is enabled 782*cdf0e10cSrcweir { 783*cdf0e10cSrcweir if( mbTrackingEnabled && rMEvt.IsLeft() && GetDragRect().IsInside( aMousePos ) ) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir // start window move 786*cdf0e10cSrcweir mbMoving = sal_True; 787*cdf0e10cSrcweir StartTracking( STARTTRACK_NOKEYCANCEL ); 788*cdf0e10cSrcweir return; 789*cdf0e10cSrcweir } 790*cdf0e10cSrcweir if( !mbHighlight && GetDragRect().IsInside( aMousePos ) ) 791*cdf0e10cSrcweir { 792*cdf0e10cSrcweir mbHighlight = sal_True; 793*cdf0e10cSrcweir DrawGrip(); 794*cdf0e10cSrcweir } 795*cdf0e10cSrcweir if( mbHighlight && ( rMEvt.IsLeaveWindow() || !GetDragRect().IsInside( aMousePos ) ) ) 796*cdf0e10cSrcweir { 797*cdf0e10cSrcweir mbHighlight = sal_False; 798*cdf0e10cSrcweir DrawGrip(); 799*cdf0e10cSrcweir } 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir } 802*cdf0e10cSrcweir 803*cdf0e10cSrcweir void ImplPopupFloatWin::MouseButtonUp( const MouseEvent& rMEvt ) 804*cdf0e10cSrcweir { 805*cdf0e10cSrcweir mbTrackingEnabled = false; 806*cdf0e10cSrcweir FloatingWindow::MouseButtonUp( rMEvt ); 807*cdf0e10cSrcweir } 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir void ImplPopupFloatWin::MouseButtonDown( const MouseEvent& rMEvt ) 810*cdf0e10cSrcweir { 811*cdf0e10cSrcweir Point aMousePos = rMEvt.GetPosPixel(); 812*cdf0e10cSrcweir if( GetDragRect().IsInside( aMousePos ) ) 813*cdf0e10cSrcweir { 814*cdf0e10cSrcweir // get mouse pos at a static window to have a fixed reference point 815*cdf0e10cSrcweir PointerState aState = GetParent()->GetPointerState(); 816*cdf0e10cSrcweir if (ImplHasMirroredGraphics() && IsRTLEnabled()) 817*cdf0e10cSrcweir ImplMirrorFramePos(aState.maPos); 818*cdf0e10cSrcweir maTearOffPosition = GetWindow( WINDOW_BORDER )->GetPosPixel(); 819*cdf0e10cSrcweir maDelta = aState.maPos - maTearOffPosition; 820*cdf0e10cSrcweir mbTrackingEnabled = true; 821*cdf0e10cSrcweir } 822*cdf0e10cSrcweir else 823*cdf0e10cSrcweir { 824*cdf0e10cSrcweir mbTrackingEnabled = false; 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir } 827*cdf0e10cSrcweir 828*cdf0e10cSrcweir void ImplPopupFloatWin::Tracking( const TrackingEvent& rTEvt ) 829*cdf0e10cSrcweir { 830*cdf0e10cSrcweir if( mbMoving ) 831*cdf0e10cSrcweir { 832*cdf0e10cSrcweir if ( rTEvt.IsTrackingEnded() ) 833*cdf0e10cSrcweir { 834*cdf0e10cSrcweir mbMoving = sal_False; 835*cdf0e10cSrcweir EndPopupMode( FLOATWIN_POPUPMODEEND_TEAROFF ); 836*cdf0e10cSrcweir } 837*cdf0e10cSrcweir else if ( !rTEvt.GetMouseEvent().IsSynthetic() ) 838*cdf0e10cSrcweir { 839*cdf0e10cSrcweir // move the window according to mouse pos 840*cdf0e10cSrcweir PointerState aState = GetParent()->GetPointerState(); 841*cdf0e10cSrcweir if (ImplHasMirroredGraphics() && IsRTLEnabled()) 842*cdf0e10cSrcweir ImplMirrorFramePos(aState.maPos); 843*cdf0e10cSrcweir maTearOffPosition = aState.maPos - maDelta; 844*cdf0e10cSrcweir GetWindow( WINDOW_BORDER )->SetPosPixel( maTearOffPosition ); 845*cdf0e10cSrcweir } 846*cdf0e10cSrcweir } 847*cdf0e10cSrcweir } 848*cdf0e10cSrcweir 849*cdf0e10cSrcweir 850*cdf0e10cSrcweir // ======================================================================= 851*cdf0e10cSrcweir 852*cdf0e10cSrcweir ImplDockingWindowWrapper::ImplDockingWindowWrapper( const Window *pWindow ) 853*cdf0e10cSrcweir { 854*cdf0e10cSrcweir ImplInitData(); 855*cdf0e10cSrcweir 856*cdf0e10cSrcweir mpDockingWindow = (Window*) pWindow; 857*cdf0e10cSrcweir mpParent = pWindow->GetParent(); 858*cdf0e10cSrcweir mbDockable = sal_True; 859*cdf0e10cSrcweir mbLocked = sal_False; 860*cdf0e10cSrcweir mnFloatBits = WB_BORDER | WB_CLOSEABLE | WB_SIZEABLE | (pWindow->GetStyle() & DOCKWIN_FLOATSTYLES); 861*cdf0e10cSrcweir DockingWindow *pDockWin = dynamic_cast< DockingWindow* > ( mpDockingWindow ); 862*cdf0e10cSrcweir if( pDockWin ) 863*cdf0e10cSrcweir mnFloatBits = pDockWin->GetFloatStyle(); 864*cdf0e10cSrcweir 865*cdf0e10cSrcweir // must be enabled in Window::Notify to prevent permanent docking during mouse move 866*cdf0e10cSrcweir mbStartDockingEnabled = sal_False; 867*cdf0e10cSrcweir } 868*cdf0e10cSrcweir 869*cdf0e10cSrcweir ImplDockingWindowWrapper::~ImplDockingWindowWrapper() 870*cdf0e10cSrcweir { 871*cdf0e10cSrcweir if ( IsFloatingMode() ) 872*cdf0e10cSrcweir { 873*cdf0e10cSrcweir GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); 874*cdf0e10cSrcweir SetFloatingMode( sal_False ); 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir } 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir // ----------------------------------------------------------------------- 879*cdf0e10cSrcweir 880*cdf0e10cSrcweir sal_Bool ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos ) 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir if ( !mbDockable ) 883*cdf0e10cSrcweir return sal_False; 884*cdf0e10cSrcweir 885*cdf0e10cSrcweir if( !mbStartDockingEnabled ) 886*cdf0e10cSrcweir return sal_False; 887*cdf0e10cSrcweir 888*cdf0e10cSrcweir maMouseOff = rPos; 889*cdf0e10cSrcweir maMouseStart = maMouseOff; 890*cdf0e10cSrcweir mbDocking = sal_True; 891*cdf0e10cSrcweir mbLastFloatMode = IsFloatingMode(); 892*cdf0e10cSrcweir mbStartFloat = mbLastFloatMode; 893*cdf0e10cSrcweir 894*cdf0e10cSrcweir // FloatingBorder berechnen 895*cdf0e10cSrcweir FloatingWindow* pWin; 896*cdf0e10cSrcweir if ( mpFloatWin ) 897*cdf0e10cSrcweir pWin = mpFloatWin; 898*cdf0e10cSrcweir else 899*cdf0e10cSrcweir pWin = new ImplDockFloatWin2( mpParent, mnFloatBits, NULL ); 900*cdf0e10cSrcweir pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom ); 901*cdf0e10cSrcweir if ( !mpFloatWin ) 902*cdf0e10cSrcweir delete pWin; 903*cdf0e10cSrcweir 904*cdf0e10cSrcweir Point aPos = GetWindow()->ImplOutputToFrame( Point() ); 905*cdf0e10cSrcweir Size aSize = GetWindow()->GetOutputSizePixel(); 906*cdf0e10cSrcweir mnTrackX = aPos.X(); 907*cdf0e10cSrcweir mnTrackY = aPos.Y(); 908*cdf0e10cSrcweir mnTrackWidth = aSize.Width(); 909*cdf0e10cSrcweir mnTrackHeight = aSize.Height(); 910*cdf0e10cSrcweir 911*cdf0e10cSrcweir if ( mbLastFloatMode ) 912*cdf0e10cSrcweir { 913*cdf0e10cSrcweir maMouseOff.X() += mnDockLeft; 914*cdf0e10cSrcweir maMouseOff.Y() += mnDockTop; 915*cdf0e10cSrcweir mnTrackX -= mnDockLeft; 916*cdf0e10cSrcweir mnTrackY -= mnDockTop; 917*cdf0e10cSrcweir mnTrackWidth += mnDockLeft+mnDockRight; 918*cdf0e10cSrcweir mnTrackHeight += mnDockTop+mnDockBottom; 919*cdf0e10cSrcweir } 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir Window *pDockingArea = GetWindow()->GetParent(); 922*cdf0e10cSrcweir Window::PointerState aState = pDockingArea->GetPointerState(); 923*cdf0e10cSrcweir 924*cdf0e10cSrcweir // mouse pos in screen pixels 925*cdf0e10cSrcweir Point aMousePos = pDockingArea->OutputToScreenPixel( aState.maPos ); 926*cdf0e10cSrcweir Point aDockPos = Point( pDockingArea->AbsoluteScreenToOutputPixel( GetWindow()->OutputToAbsoluteScreenPixel( GetWindow()->GetPosPixel() ) ) ); 927*cdf0e10cSrcweir Rectangle aDockRect( aDockPos, GetWindow()->GetSizePixel() ); 928*cdf0e10cSrcweir StartDocking( aMousePos, aDockRect ); 929*cdf0e10cSrcweir 930*cdf0e10cSrcweir GetWindow()->ImplUpdateAll(); 931*cdf0e10cSrcweir GetWindow()->ImplGetFrameWindow()->ImplUpdateAll(); 932*cdf0e10cSrcweir 933*cdf0e10cSrcweir GetWindow()->StartTracking( STARTTRACK_KEYMOD ); 934*cdf0e10cSrcweir return sal_True; 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir 937*cdf0e10cSrcweir // ======================================================================= 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir void ImplDockingWindowWrapper::ImplInitData() 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir mpDockingWindow = NULL; 942*cdf0e10cSrcweir 943*cdf0e10cSrcweir //GetWindow()->mpWindowImpl->mbDockWin = sal_True; // TODO: must be eliminated 944*cdf0e10cSrcweir mpFloatWin = NULL; 945*cdf0e10cSrcweir mbDockCanceled = sal_False; 946*cdf0e10cSrcweir mbFloatPrevented = sal_False; 947*cdf0e10cSrcweir mbDocking = sal_False; 948*cdf0e10cSrcweir mbPined = sal_False; 949*cdf0e10cSrcweir mbRollUp = sal_False; 950*cdf0e10cSrcweir mbDockBtn = sal_False; 951*cdf0e10cSrcweir mbHideBtn = sal_False; 952*cdf0e10cSrcweir maMaxOutSize = Size( SHRT_MAX, SHRT_MAX ); 953*cdf0e10cSrcweir } 954*cdf0e10cSrcweir 955*cdf0e10cSrcweir // ----------------------------------------------------------------------- 956*cdf0e10cSrcweir 957*cdf0e10cSrcweir void ImplDockingWindowWrapper::Tracking( const TrackingEvent& rTEvt ) 958*cdf0e10cSrcweir { 959*cdf0e10cSrcweir // used during docking of a currently docked window 960*cdf0e10cSrcweir if ( mbDocking ) 961*cdf0e10cSrcweir { 962*cdf0e10cSrcweir if ( rTEvt.IsTrackingEnded() ) 963*cdf0e10cSrcweir { 964*cdf0e10cSrcweir mbDocking = sal_False; 965*cdf0e10cSrcweir GetWindow()->HideTracking(); 966*cdf0e10cSrcweir if ( rTEvt.IsTrackingCanceled() ) 967*cdf0e10cSrcweir { 968*cdf0e10cSrcweir mbDockCanceled = sal_True; 969*cdf0e10cSrcweir EndDocking( Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode ); 970*cdf0e10cSrcweir mbDockCanceled = sal_False; 971*cdf0e10cSrcweir } 972*cdf0e10cSrcweir else 973*cdf0e10cSrcweir EndDocking( Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode ); 974*cdf0e10cSrcweir } 975*cdf0e10cSrcweir // Docking only upon non-synthetic MouseEvents 976*cdf0e10cSrcweir else if ( !rTEvt.GetMouseEvent().IsSynthetic() || rTEvt.GetMouseEvent().IsModifierChanged() ) 977*cdf0e10cSrcweir { 978*cdf0e10cSrcweir Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel(); 979*cdf0e10cSrcweir Point aFrameMousePos = GetWindow()->ImplOutputToFrame( aMousePos ); 980*cdf0e10cSrcweir Size aFrameSize = GetWindow()->ImplGetFrameWindow()->GetOutputSizePixel(); 981*cdf0e10cSrcweir if ( aFrameMousePos.X() < 0 ) 982*cdf0e10cSrcweir aFrameMousePos.X() = 0; 983*cdf0e10cSrcweir if ( aFrameMousePos.Y() < 0 ) 984*cdf0e10cSrcweir aFrameMousePos.Y() = 0; 985*cdf0e10cSrcweir if ( aFrameMousePos.X() > aFrameSize.Width()-1 ) 986*cdf0e10cSrcweir aFrameMousePos.X() = aFrameSize.Width()-1; 987*cdf0e10cSrcweir if ( aFrameMousePos.Y() > aFrameSize.Height()-1 ) 988*cdf0e10cSrcweir aFrameMousePos.Y() = aFrameSize.Height()-1; 989*cdf0e10cSrcweir aMousePos = GetWindow()->ImplFrameToOutput( aFrameMousePos ); 990*cdf0e10cSrcweir aMousePos.X() -= maMouseOff.X(); 991*cdf0e10cSrcweir aMousePos.Y() -= maMouseOff.Y(); 992*cdf0e10cSrcweir Point aPos = GetWindow()->ImplOutputToFrame( aMousePos ); 993*cdf0e10cSrcweir Rectangle aTrackRect( aPos, Size( mnTrackWidth, mnTrackHeight ) ); 994*cdf0e10cSrcweir Rectangle aCompRect = aTrackRect; 995*cdf0e10cSrcweir aPos.X() += maMouseOff.X(); 996*cdf0e10cSrcweir aPos.Y() += maMouseOff.Y(); 997*cdf0e10cSrcweir 998*cdf0e10cSrcweir sal_Bool bFloatMode = Docking( aPos, aTrackRect ); 999*cdf0e10cSrcweir 1000*cdf0e10cSrcweir mbFloatPrevented = sal_False; 1001*cdf0e10cSrcweir if ( mbLastFloatMode != bFloatMode ) 1002*cdf0e10cSrcweir { 1003*cdf0e10cSrcweir if ( bFloatMode ) 1004*cdf0e10cSrcweir { 1005*cdf0e10cSrcweir aTrackRect.Left() -= mnDockLeft; 1006*cdf0e10cSrcweir aTrackRect.Top() -= mnDockTop; 1007*cdf0e10cSrcweir aTrackRect.Right() += mnDockRight; 1008*cdf0e10cSrcweir aTrackRect.Bottom() += mnDockBottom; 1009*cdf0e10cSrcweir } 1010*cdf0e10cSrcweir else 1011*cdf0e10cSrcweir { 1012*cdf0e10cSrcweir if ( aCompRect == aTrackRect ) 1013*cdf0e10cSrcweir { 1014*cdf0e10cSrcweir aTrackRect.Left() += mnDockLeft; 1015*cdf0e10cSrcweir aTrackRect.Top() += mnDockTop; 1016*cdf0e10cSrcweir aTrackRect.Right() -= mnDockRight; 1017*cdf0e10cSrcweir aTrackRect.Bottom() -= mnDockBottom; 1018*cdf0e10cSrcweir } 1019*cdf0e10cSrcweir } 1020*cdf0e10cSrcweir mbLastFloatMode = bFloatMode; 1021*cdf0e10cSrcweir } 1022*cdf0e10cSrcweir 1023*cdf0e10cSrcweir sal_uInt16 nTrackStyle; 1024*cdf0e10cSrcweir if ( bFloatMode ) 1025*cdf0e10cSrcweir nTrackStyle = SHOWTRACK_OBJECT; 1026*cdf0e10cSrcweir else 1027*cdf0e10cSrcweir nTrackStyle = SHOWTRACK_BIG; 1028*cdf0e10cSrcweir Rectangle aShowTrackRect = aTrackRect; 1029*cdf0e10cSrcweir aShowTrackRect.SetPos( GetWindow()->ImplFrameToOutput( aShowTrackRect.TopLeft() ) ); 1030*cdf0e10cSrcweir //if( bFloatMode ) 1031*cdf0e10cSrcweir GetWindow()->ShowTracking( aShowTrackRect, nTrackStyle ); 1032*cdf0e10cSrcweir /*else 1033*cdf0e10cSrcweir { 1034*cdf0e10cSrcweir GetWindow()->HideTracking(); 1035*cdf0e10cSrcweir Point aPt( GetWindow()->GetParent()->ScreenToOutputPixel( aTrackRect.TopLeft() ) ); 1036*cdf0e10cSrcweir GetWindow()->SetPosPixel( aPt ); 1037*cdf0e10cSrcweir }*/ 1038*cdf0e10cSrcweir 1039*cdf0e10cSrcweir // Maus-Offset neu berechnen, da Rechteck veraendert werden 1040*cdf0e10cSrcweir // konnte 1041*cdf0e10cSrcweir maMouseOff.X() = aPos.X() - aTrackRect.Left(); 1042*cdf0e10cSrcweir maMouseOff.Y() = aPos.Y() - aTrackRect.Top(); 1043*cdf0e10cSrcweir 1044*cdf0e10cSrcweir mnTrackX = aTrackRect.Left(); 1045*cdf0e10cSrcweir mnTrackY = aTrackRect.Top(); 1046*cdf0e10cSrcweir mnTrackWidth = aTrackRect.GetWidth(); 1047*cdf0e10cSrcweir mnTrackHeight = aTrackRect.GetHeight(); 1048*cdf0e10cSrcweir } 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir } 1051*cdf0e10cSrcweir 1052*cdf0e10cSrcweir 1053*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir void ImplDockingWindowWrapper::StartDocking( const Point& rPoint, Rectangle& rRect ) 1056*cdf0e10cSrcweir { 1057*cdf0e10cSrcweir DockingData data( rPoint, rRect, IsFloatingMode() ); 1058*cdf0e10cSrcweir 1059*cdf0e10cSrcweir GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_STARTDOCKING, &data ); 1060*cdf0e10cSrcweir mbDocking = sal_True; 1061*cdf0e10cSrcweir } 1062*cdf0e10cSrcweir 1063*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1064*cdf0e10cSrcweir 1065*cdf0e10cSrcweir sal_Bool ImplDockingWindowWrapper::Docking( const Point& rPoint, Rectangle& rRect ) 1066*cdf0e10cSrcweir { 1067*cdf0e10cSrcweir DockingData data( rPoint, rRect, IsFloatingMode() ); 1068*cdf0e10cSrcweir 1069*cdf0e10cSrcweir GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_DOCKING, &data ); 1070*cdf0e10cSrcweir rRect = data.maTrackRect; 1071*cdf0e10cSrcweir return data.mbFloating; 1072*cdf0e10cSrcweir } 1073*cdf0e10cSrcweir 1074*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1075*cdf0e10cSrcweir 1076*cdf0e10cSrcweir void ImplDockingWindowWrapper::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) 1077*cdf0e10cSrcweir { 1078*cdf0e10cSrcweir Rectangle aRect( rRect ); 1079*cdf0e10cSrcweir 1080*cdf0e10cSrcweir if ( !IsDockingCanceled() ) 1081*cdf0e10cSrcweir { 1082*cdf0e10cSrcweir sal_Bool bShow = sal_False; 1083*cdf0e10cSrcweir if ( bFloatMode != IsFloatingMode() ) 1084*cdf0e10cSrcweir { 1085*cdf0e10cSrcweir GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); 1086*cdf0e10cSrcweir SetFloatingMode( bFloatMode ); 1087*cdf0e10cSrcweir bShow = sal_True; 1088*cdf0e10cSrcweir if ( bFloatMode ) 1089*cdf0e10cSrcweir { 1090*cdf0e10cSrcweir // #i44800# always use outputsize - as in all other places 1091*cdf0e10cSrcweir mpFloatWin->SetOutputSizePixel( aRect.GetSize() ); 1092*cdf0e10cSrcweir mpFloatWin->SetPosPixel( aRect.TopLeft() ); 1093*cdf0e10cSrcweir } 1094*cdf0e10cSrcweir } 1095*cdf0e10cSrcweir if ( !bFloatMode ) 1096*cdf0e10cSrcweir { 1097*cdf0e10cSrcweir Point aPos = aRect.TopLeft(); 1098*cdf0e10cSrcweir aPos = GetWindow()->GetParent()->ScreenToOutputPixel( aPos ); 1099*cdf0e10cSrcweir GetWindow()->SetPosSizePixel( aPos, aRect.GetSize() ); 1100*cdf0e10cSrcweir } 1101*cdf0e10cSrcweir 1102*cdf0e10cSrcweir if ( bShow ) 1103*cdf0e10cSrcweir GetWindow()->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); 1104*cdf0e10cSrcweir } 1105*cdf0e10cSrcweir 1106*cdf0e10cSrcweir EndDockingData data( aRect, IsFloatingMode(), IsDockingCanceled() ); 1107*cdf0e10cSrcweir GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_ENDDOCKING, &data ); 1108*cdf0e10cSrcweir 1109*cdf0e10cSrcweir mbDocking = sal_False; 1110*cdf0e10cSrcweir 1111*cdf0e10cSrcweir // must be enabled in Window::Notify to prevent permanent docking during mouse move 1112*cdf0e10cSrcweir mbStartDockingEnabled = sal_False; 1113*cdf0e10cSrcweir } 1114*cdf0e10cSrcweir 1115*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1116*cdf0e10cSrcweir 1117*cdf0e10cSrcweir sal_Bool ImplDockingWindowWrapper::PrepareToggleFloatingMode() 1118*cdf0e10cSrcweir { 1119*cdf0e10cSrcweir sal_Bool bFloating = sal_True; 1120*cdf0e10cSrcweir GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_PREPARETOGGLEFLOATING, &bFloating ); 1121*cdf0e10cSrcweir return bFloating; 1122*cdf0e10cSrcweir } 1123*cdf0e10cSrcweir 1124*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1125*cdf0e10cSrcweir 1126*cdf0e10cSrcweir sal_Bool ImplDockingWindowWrapper::Close() 1127*cdf0e10cSrcweir { 1128*cdf0e10cSrcweir // TODO: send event 1129*cdf0e10cSrcweir /* 1130*cdf0e10cSrcweir ImplDelData aDelData; 1131*cdf0e10cSrcweir ImplAddDel( &aDelData ); 1132*cdf0e10cSrcweir GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE ); 1133*cdf0e10cSrcweir if ( aDelData.IsDelete() ) 1134*cdf0e10cSrcweir return sal_False; 1135*cdf0e10cSrcweir ImplRemoveDel( &aDelData ); 1136*cdf0e10cSrcweir 1137*cdf0e10cSrcweir if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() ) 1138*cdf0e10cSrcweir return sal_False; 1139*cdf0e10cSrcweir 1140*cdf0e10cSrcweir GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); 1141*cdf0e10cSrcweir */ 1142*cdf0e10cSrcweir return sal_True; 1143*cdf0e10cSrcweir } 1144*cdf0e10cSrcweir 1145*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir void ImplDockingWindowWrapper::ToggleFloatingMode() 1148*cdf0e10cSrcweir { 1149*cdf0e10cSrcweir // notify dockingwindow/toolbox 1150*cdf0e10cSrcweir // note: this must be done *before* notifying the 1151*cdf0e10cSrcweir // listeners to have the toolbox in the proper state 1152*cdf0e10cSrcweir if( GetWindow()->ImplIsDockingWindow() ) 1153*cdf0e10cSrcweir ((DockingWindow*) GetWindow())->ToggleFloatingMode(); 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir // now notify listeners 1156*cdf0e10cSrcweir GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_TOGGLEFLOATING ); 1157*cdf0e10cSrcweir 1158*cdf0e10cSrcweir // must be enabled in Window::Notify to prevent permanent docking during mouse move 1159*cdf0e10cSrcweir mbStartDockingEnabled = sal_False; 1160*cdf0e10cSrcweir } 1161*cdf0e10cSrcweir 1162*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1163*cdf0e10cSrcweir 1164*cdf0e10cSrcweir void ImplDockingWindowWrapper::TitleButtonClick( sal_uInt16 nType ) 1165*cdf0e10cSrcweir { 1166*cdf0e10cSrcweir if( nType == TITLE_BUTTON_MENU ) 1167*cdf0e10cSrcweir { 1168*cdf0e10cSrcweir ToolBox *pToolBox = dynamic_cast< ToolBox* >( GetWindow() ); 1169*cdf0e10cSrcweir if( pToolBox ) 1170*cdf0e10cSrcweir { 1171*cdf0e10cSrcweir pToolBox->ExecuteCustomMenu(); 1172*cdf0e10cSrcweir } 1173*cdf0e10cSrcweir } 1174*cdf0e10cSrcweir if( nType == TITLE_BUTTON_DOCKING ) 1175*cdf0e10cSrcweir { 1176*cdf0e10cSrcweir SetFloatingMode( !IsFloatingMode() ); 1177*cdf0e10cSrcweir } 1178*cdf0e10cSrcweir } 1179*cdf0e10cSrcweir 1180*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1181*cdf0e10cSrcweir 1182*cdf0e10cSrcweir void ImplDockingWindowWrapper::Pin() 1183*cdf0e10cSrcweir { 1184*cdf0e10cSrcweir // TODO: send event 1185*cdf0e10cSrcweir } 1186*cdf0e10cSrcweir 1187*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1188*cdf0e10cSrcweir 1189*cdf0e10cSrcweir void ImplDockingWindowWrapper::Roll() 1190*cdf0e10cSrcweir { 1191*cdf0e10cSrcweir // TODO: send event 1192*cdf0e10cSrcweir } 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1195*cdf0e10cSrcweir 1196*cdf0e10cSrcweir void ImplDockingWindowWrapper::PopupModeEnd() 1197*cdf0e10cSrcweir { 1198*cdf0e10cSrcweir // TODO: send event 1199*cdf0e10cSrcweir } 1200*cdf0e10cSrcweir 1201*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1202*cdf0e10cSrcweir 1203*cdf0e10cSrcweir void ImplDockingWindowWrapper::Resizing( Size& rSize ) 1204*cdf0e10cSrcweir { 1205*cdf0e10cSrcweir // TODO: add virtual Resizing() to class Window, so we can get rid of class DockingWindow 1206*cdf0e10cSrcweir DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >( GetWindow() ); 1207*cdf0e10cSrcweir if( pDockingWindow ) 1208*cdf0e10cSrcweir pDockingWindow->Resizing( rSize ); 1209*cdf0e10cSrcweir } 1210*cdf0e10cSrcweir 1211*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1212*cdf0e10cSrcweir 1213*cdf0e10cSrcweir void ImplDockingWindowWrapper::ShowTitleButton( sal_uInt16 nButton, sal_Bool bVisible ) 1214*cdf0e10cSrcweir { 1215*cdf0e10cSrcweir if ( mpFloatWin ) 1216*cdf0e10cSrcweir mpFloatWin->ShowTitleButton( nButton, bVisible ); 1217*cdf0e10cSrcweir else 1218*cdf0e10cSrcweir { 1219*cdf0e10cSrcweir if ( nButton == TITLE_BUTTON_DOCKING ) 1220*cdf0e10cSrcweir mbDockBtn = bVisible; 1221*cdf0e10cSrcweir else // if ( nButton == TITLE_BUTTON_HIDE ) 1222*cdf0e10cSrcweir mbHideBtn = bVisible; 1223*cdf0e10cSrcweir } 1224*cdf0e10cSrcweir } 1225*cdf0e10cSrcweir 1226*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1227*cdf0e10cSrcweir 1228*cdf0e10cSrcweir sal_Bool ImplDockingWindowWrapper::IsTitleButtonVisible( sal_uInt16 nButton ) const 1229*cdf0e10cSrcweir { 1230*cdf0e10cSrcweir if ( mpFloatWin ) 1231*cdf0e10cSrcweir return mpFloatWin->IsTitleButtonVisible( nButton ); 1232*cdf0e10cSrcweir else 1233*cdf0e10cSrcweir { 1234*cdf0e10cSrcweir if ( nButton == TITLE_BUTTON_DOCKING ) 1235*cdf0e10cSrcweir return mbDockBtn; 1236*cdf0e10cSrcweir else // if ( nButton == TITLE_BUTTON_HIDE ) 1237*cdf0e10cSrcweir return mbHideBtn; 1238*cdf0e10cSrcweir } 1239*cdf0e10cSrcweir } 1240*cdf0e10cSrcweir 1241*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1242*cdf0e10cSrcweir 1243*cdf0e10cSrcweir void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, sal_uLong nFlags ) 1244*cdf0e10cSrcweir { 1245*cdf0e10cSrcweir // do nothing if window is floating 1246*cdf0e10cSrcweir if( IsFloatingMode() ) 1247*cdf0e10cSrcweir return; 1248*cdf0e10cSrcweir 1249*cdf0e10cSrcweir GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); 1250*cdf0e10cSrcweir 1251*cdf0e10cSrcweir // prepare reparenting 1252*cdf0e10cSrcweir Window* pRealParent = GetWindow()->GetWindow( WINDOW_PARENT ); 1253*cdf0e10cSrcweir mpOldBorderWin = GetWindow()->GetWindow( WINDOW_BORDER ); 1254*cdf0e10cSrcweir if( mpOldBorderWin == GetWindow() ) 1255*cdf0e10cSrcweir mpOldBorderWin = NULL; // no border window found 1256*cdf0e10cSrcweir 1257*cdf0e10cSrcweir // the new parent for popup mode 1258*cdf0e10cSrcweir ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this, (nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) != 0 ); 1259*cdf0e10cSrcweir 1260*cdf0e10cSrcweir pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) ); 1261*cdf0e10cSrcweir pWin->SetText( GetWindow()->GetText() ); 1262*cdf0e10cSrcweir 1263*cdf0e10cSrcweir pWin->SetOutputSizePixel( GetWindow()->GetSizePixel() ); 1264*cdf0e10cSrcweir 1265*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpBorderWindow = NULL; 1266*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnLeftBorder = 0; 1267*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnTopBorder = 0; 1268*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnRightBorder = 0; 1269*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnBottomBorder = 0; 1270*cdf0e10cSrcweir 1271*cdf0e10cSrcweir // position toolbox below dragrect 1272*cdf0e10cSrcweir GetWindow()->SetPosPixel( pWin->GetToolboxPosition() ); 1273*cdf0e10cSrcweir 1274*cdf0e10cSrcweir // reparent borderwindow and window 1275*cdf0e10cSrcweir if ( mpOldBorderWin ) 1276*cdf0e10cSrcweir mpOldBorderWin->SetParent( pWin ); 1277*cdf0e10cSrcweir GetWindow()->SetParent( pWin ); 1278*cdf0e10cSrcweir 1279*cdf0e10cSrcweir // correct border window pointers 1280*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpBorderWindow = pWin; 1281*cdf0e10cSrcweir pWin->mpWindowImpl->mpClientWindow = GetWindow(); 1282*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpRealParent = pRealParent; 1283*cdf0e10cSrcweir 1284*cdf0e10cSrcweir // set mpFloatWin not until all window positioning is done !!! 1285*cdf0e10cSrcweir // (SetPosPixel etc. check for valid mpFloatWin pointer) 1286*cdf0e10cSrcweir mpFloatWin = pWin; 1287*cdf0e10cSrcweir 1288*cdf0e10cSrcweir // if the subtoolbar was opened via keyboard make sure that key events 1289*cdf0e10cSrcweir // will go into subtoolbar 1290*cdf0e10cSrcweir if( pParentToolBox->IsKeyEvent() ) 1291*cdf0e10cSrcweir nFlags |= FLOATWIN_POPUPMODE_GRABFOCUS; 1292*cdf0e10cSrcweir 1293*cdf0e10cSrcweir mpFloatWin->StartPopupMode( pParentToolBox, nFlags ); 1294*cdf0e10cSrcweir GetWindow()->Show(); 1295*cdf0e10cSrcweir 1296*cdf0e10cSrcweir if( pParentToolBox->IsKeyEvent() ) 1297*cdf0e10cSrcweir { 1298*cdf0e10cSrcweir // send HOME key to subtoolbar in order to select first item 1299*cdf0e10cSrcweir KeyEvent aEvent( 0, KeyCode( KEY_HOME ) ); 1300*cdf0e10cSrcweir mpFloatWin->GetPreferredKeyInputWindow()->KeyInput( aEvent ); 1301*cdf0e10cSrcweir } 1302*cdf0e10cSrcweir } 1303*cdf0e10cSrcweir 1304*cdf0e10cSrcweir IMPL_LINK( ImplDockingWindowWrapper, PopupModeEnd, void*, EMPTYARG ) 1305*cdf0e10cSrcweir { 1306*cdf0e10cSrcweir GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); 1307*cdf0e10cSrcweir 1308*cdf0e10cSrcweir // set parameter for handler before destroying floating window 1309*cdf0e10cSrcweir ImplPopupFloatWin *pPopupFloatWin = (ImplPopupFloatWin*) mpFloatWin; 1310*cdf0e10cSrcweir EndPopupModeData aData( pPopupFloatWin->GetTearOffPosition(), mpFloatWin->IsPopupModeTearOff() ); 1311*cdf0e10cSrcweir 1312*cdf0e10cSrcweir // before deleting change parent back, so we can delete the floating window alone 1313*cdf0e10cSrcweir Window* pRealParent = GetWindow()->GetWindow( WINDOW_PARENT ); 1314*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpBorderWindow = NULL; 1315*cdf0e10cSrcweir if ( mpOldBorderWin ) 1316*cdf0e10cSrcweir { 1317*cdf0e10cSrcweir GetWindow()->SetParent( mpOldBorderWin ); 1318*cdf0e10cSrcweir ((ImplBorderWindow*)mpOldBorderWin)->GetBorder( 1319*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnLeftBorder, GetWindow()->mpWindowImpl->mnTopBorder, 1320*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnRightBorder, GetWindow()->mpWindowImpl->mnBottomBorder ); 1321*cdf0e10cSrcweir mpOldBorderWin->Resize(); 1322*cdf0e10cSrcweir } 1323*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpBorderWindow = mpOldBorderWin; 1324*cdf0e10cSrcweir GetWindow()->SetParent( pRealParent ); 1325*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpRealParent = pRealParent; 1326*cdf0e10cSrcweir 1327*cdf0e10cSrcweir delete mpFloatWin; 1328*cdf0e10cSrcweir mpFloatWin = NULL; 1329*cdf0e10cSrcweir 1330*cdf0e10cSrcweir // call handler - which will destroy the window and thus the wrapper as well ! 1331*cdf0e10cSrcweir GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_ENDPOPUPMODE, &aData ); 1332*cdf0e10cSrcweir 1333*cdf0e10cSrcweir return 0; 1334*cdf0e10cSrcweir } 1335*cdf0e10cSrcweir 1336*cdf0e10cSrcweir 1337*cdf0e10cSrcweir sal_Bool ImplDockingWindowWrapper::IsInPopupMode() const 1338*cdf0e10cSrcweir { 1339*cdf0e10cSrcweir if( GetFloatingWindow() ) 1340*cdf0e10cSrcweir return GetFloatingWindow()->IsInPopupMode(); 1341*cdf0e10cSrcweir else 1342*cdf0e10cSrcweir return sal_False; 1343*cdf0e10cSrcweir } 1344*cdf0e10cSrcweir 1345*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1346*cdf0e10cSrcweir 1347*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetFloatingMode( sal_Bool bFloatMode ) 1348*cdf0e10cSrcweir { 1349*cdf0e10cSrcweir // do nothing if window is docked and locked 1350*cdf0e10cSrcweir if( !IsFloatingMode() && IsLocked() ) 1351*cdf0e10cSrcweir return; 1352*cdf0e10cSrcweir 1353*cdf0e10cSrcweir if ( IsFloatingMode() != bFloatMode ) 1354*cdf0e10cSrcweir { 1355*cdf0e10cSrcweir if ( PrepareToggleFloatingMode() ) 1356*cdf0e10cSrcweir { 1357*cdf0e10cSrcweir sal_Bool bVisible = GetWindow()->IsVisible(); 1358*cdf0e10cSrcweir 1359*cdf0e10cSrcweir if ( bFloatMode ) 1360*cdf0e10cSrcweir { 1361*cdf0e10cSrcweir GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); 1362*cdf0e10cSrcweir 1363*cdf0e10cSrcweir maDockPos = GetWindow()->GetPosPixel(); 1364*cdf0e10cSrcweir 1365*cdf0e10cSrcweir Window* pRealParent = GetWindow()->GetWindow( WINDOW_PARENT ); 1366*cdf0e10cSrcweir mpOldBorderWin = GetWindow()->GetWindow( WINDOW_BORDER ); 1367*cdf0e10cSrcweir if( mpOldBorderWin == mpDockingWindow ) 1368*cdf0e10cSrcweir mpOldBorderWin = NULL; // no border window found 1369*cdf0e10cSrcweir 1370*cdf0e10cSrcweir ImplDockFloatWin2* pWin = 1371*cdf0e10cSrcweir new ImplDockFloatWin2( 1372*cdf0e10cSrcweir mpParent, 1373*cdf0e10cSrcweir mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ? 1374*cdf0e10cSrcweir mnFloatBits | WB_SYSTEMWINDOW 1375*cdf0e10cSrcweir //#ifdef __USE_OWNERDRAWDECORATION__ 1376*cdf0e10cSrcweir | WB_OWNERDRAWDECORATION 1377*cdf0e10cSrcweir //#endif 1378*cdf0e10cSrcweir : mnFloatBits, 1379*cdf0e10cSrcweir this ); 1380*cdf0e10cSrcweir 1381*cdf0e10cSrcweir // reduce the border width for seamless NWF painting 1382*cdf0e10cSrcweir // (especially for the toolbar gradient on Windows XP) 1383*cdf0e10cSrcweir /*AllSettings aSettings( pWin->GetSettings() ); 1384*cdf0e10cSrcweir StyleSettings aStyleSettings( aSettings.GetStyleSettings() ); 1385*cdf0e10cSrcweir aStyleSettings.SetBorderSize( 0 ); 1386*cdf0e10cSrcweir aSettings.SetStyleSettings( aStyleSettings ); 1387*cdf0e10cSrcweir pWin->SetSettings( aSettings );*/ 1388*cdf0e10cSrcweir 1389*cdf0e10cSrcweir // mpFloatWin = pWin; 1390*cdf0e10cSrcweir 1391*cdf0e10cSrcweir 1392*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpBorderWindow = NULL; 1393*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnLeftBorder = 0; 1394*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnTopBorder = 0; 1395*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnRightBorder = 0; 1396*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnBottomBorder = 0; 1397*cdf0e10cSrcweir 1398*cdf0e10cSrcweir // Falls Parent zerstoert wird, muessen wir auch vom 1399*cdf0e10cSrcweir // BorderWindow den Parent umsetzen 1400*cdf0e10cSrcweir if ( mpOldBorderWin ) 1401*cdf0e10cSrcweir mpOldBorderWin->SetParent( pWin ); 1402*cdf0e10cSrcweir GetWindow()->SetParent( pWin ); 1403*cdf0e10cSrcweir pWin->SetPosPixel( Point() ); 1404*cdf0e10cSrcweir 1405*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpBorderWindow = pWin; 1406*cdf0e10cSrcweir pWin->mpWindowImpl->mpClientWindow = mpDockingWindow; 1407*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpRealParent = pRealParent; 1408*cdf0e10cSrcweir 1409*cdf0e10cSrcweir pWin->SetText( GetWindow()->GetText() ); 1410*cdf0e10cSrcweir pWin->SetOutputSizePixel( GetWindow()->GetSizePixel() ); 1411*cdf0e10cSrcweir pWin->SetPosPixel( maFloatPos ); 1412*cdf0e10cSrcweir // DockingDaten ans FloatingWindow weiterreichen 1413*cdf0e10cSrcweir pWin->ShowTitleButton( TITLE_BUTTON_DOCKING, mbDockBtn ); 1414*cdf0e10cSrcweir pWin->ShowTitleButton( TITLE_BUTTON_HIDE, mbHideBtn ); 1415*cdf0e10cSrcweir pWin->SetPin( mbPined ); 1416*cdf0e10cSrcweir if ( mbRollUp ) 1417*cdf0e10cSrcweir pWin->RollUp(); 1418*cdf0e10cSrcweir else 1419*cdf0e10cSrcweir pWin->RollDown(); 1420*cdf0e10cSrcweir pWin->SetRollUpOutputSizePixel( maRollUpOutSize ); 1421*cdf0e10cSrcweir pWin->SetMinOutputSizePixel( maMinOutSize ); 1422*cdf0e10cSrcweir pWin->SetMaxOutputSizePixel( maMaxOutSize ); 1423*cdf0e10cSrcweir 1424*cdf0e10cSrcweir mpFloatWin = pWin; 1425*cdf0e10cSrcweir 1426*cdf0e10cSrcweir if ( bVisible ) 1427*cdf0e10cSrcweir GetWindow()->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); 1428*cdf0e10cSrcweir 1429*cdf0e10cSrcweir ToggleFloatingMode(); 1430*cdf0e10cSrcweir } 1431*cdf0e10cSrcweir else 1432*cdf0e10cSrcweir { 1433*cdf0e10cSrcweir GetWindow()->Show( sal_False, SHOW_NOFOCUSCHANGE ); 1434*cdf0e10cSrcweir 1435*cdf0e10cSrcweir // FloatingDaten wird im FloatingWindow speichern 1436*cdf0e10cSrcweir maFloatPos = mpFloatWin->GetPosPixel(); 1437*cdf0e10cSrcweir mbDockBtn = mpFloatWin->IsTitleButtonVisible( TITLE_BUTTON_DOCKING ); 1438*cdf0e10cSrcweir mbHideBtn = mpFloatWin->IsTitleButtonVisible( TITLE_BUTTON_HIDE ); 1439*cdf0e10cSrcweir mbPined = mpFloatWin->IsPined(); 1440*cdf0e10cSrcweir mbRollUp = mpFloatWin->IsRollUp(); 1441*cdf0e10cSrcweir maRollUpOutSize = mpFloatWin->GetRollUpOutputSizePixel(); 1442*cdf0e10cSrcweir maMinOutSize = mpFloatWin->GetMinOutputSizePixel(); 1443*cdf0e10cSrcweir maMaxOutSize = mpFloatWin->GetMaxOutputSizePixel(); 1444*cdf0e10cSrcweir 1445*cdf0e10cSrcweir Window* pRealParent = GetWindow()->GetWindow( WINDOW_PARENT ); //mpWindowImpl->mpRealParent; 1446*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpBorderWindow = NULL; 1447*cdf0e10cSrcweir if ( mpOldBorderWin ) 1448*cdf0e10cSrcweir { 1449*cdf0e10cSrcweir GetWindow()->SetParent( mpOldBorderWin ); 1450*cdf0e10cSrcweir ((ImplBorderWindow*)mpOldBorderWin)->GetBorder( 1451*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnLeftBorder, GetWindow()->mpWindowImpl->mnTopBorder, 1452*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mnRightBorder, GetWindow()->mpWindowImpl->mnBottomBorder ); 1453*cdf0e10cSrcweir mpOldBorderWin->Resize(); 1454*cdf0e10cSrcweir } 1455*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpBorderWindow = mpOldBorderWin; 1456*cdf0e10cSrcweir GetWindow()->SetParent( pRealParent ); 1457*cdf0e10cSrcweir GetWindow()->mpWindowImpl->mpRealParent = pRealParent; 1458*cdf0e10cSrcweir 1459*cdf0e10cSrcweir delete static_cast<ImplDockFloatWin2*>(mpFloatWin); 1460*cdf0e10cSrcweir mpFloatWin = NULL; 1461*cdf0e10cSrcweir GetWindow()->SetPosPixel( maDockPos ); 1462*cdf0e10cSrcweir 1463*cdf0e10cSrcweir if ( bVisible ) 1464*cdf0e10cSrcweir GetWindow()->Show(); 1465*cdf0e10cSrcweir 1466*cdf0e10cSrcweir ToggleFloatingMode(); 1467*cdf0e10cSrcweir 1468*cdf0e10cSrcweir } 1469*cdf0e10cSrcweir } 1470*cdf0e10cSrcweir } 1471*cdf0e10cSrcweir } 1472*cdf0e10cSrcweir 1473*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1474*cdf0e10cSrcweir 1475*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetFloatStyle( WinBits nStyle ) 1476*cdf0e10cSrcweir { 1477*cdf0e10cSrcweir mnFloatBits = nStyle; 1478*cdf0e10cSrcweir } 1479*cdf0e10cSrcweir 1480*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1481*cdf0e10cSrcweir 1482*cdf0e10cSrcweir WinBits ImplDockingWindowWrapper::GetFloatStyle() const 1483*cdf0e10cSrcweir { 1484*cdf0e10cSrcweir return mnFloatBits; 1485*cdf0e10cSrcweir } 1486*cdf0e10cSrcweir 1487*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1488*cdf0e10cSrcweir 1489*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetTabStop() 1490*cdf0e10cSrcweir { 1491*cdf0e10cSrcweir GetWindow()->SetStyle( GetWindow()->GetStyle() | (WB_GROUP | WB_TABSTOP) ); 1492*cdf0e10cSrcweir } 1493*cdf0e10cSrcweir 1494*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1495*cdf0e10cSrcweir 1496*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetPosSizePixel( long nX, long nY, 1497*cdf0e10cSrcweir long nWidth, long nHeight, 1498*cdf0e10cSrcweir sal_uInt16 nFlags ) 1499*cdf0e10cSrcweir { 1500*cdf0e10cSrcweir if ( mpFloatWin ) 1501*cdf0e10cSrcweir mpFloatWin->SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags ); 1502*cdf0e10cSrcweir else 1503*cdf0e10cSrcweir GetWindow()->SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags ); 1504*cdf0e10cSrcweir } 1505*cdf0e10cSrcweir 1506*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1507*cdf0e10cSrcweir 1508*cdf0e10cSrcweir Point ImplDockingWindowWrapper::GetPosPixel() const 1509*cdf0e10cSrcweir { 1510*cdf0e10cSrcweir if ( mpFloatWin ) 1511*cdf0e10cSrcweir return mpFloatWin->GetPosPixel(); 1512*cdf0e10cSrcweir else 1513*cdf0e10cSrcweir return mpDockingWindow->GetPosPixel(); 1514*cdf0e10cSrcweir } 1515*cdf0e10cSrcweir 1516*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1517*cdf0e10cSrcweir 1518*cdf0e10cSrcweir Size ImplDockingWindowWrapper::GetSizePixel() const 1519*cdf0e10cSrcweir { 1520*cdf0e10cSrcweir if ( mpFloatWin ) 1521*cdf0e10cSrcweir return mpFloatWin->GetSizePixel(); 1522*cdf0e10cSrcweir else 1523*cdf0e10cSrcweir return mpDockingWindow->GetSizePixel(); 1524*cdf0e10cSrcweir } 1525*cdf0e10cSrcweir 1526*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1527*cdf0e10cSrcweir 1528*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetOutputSizePixel( const Size& rNewSize ) 1529*cdf0e10cSrcweir { 1530*cdf0e10cSrcweir if ( mpFloatWin ) 1531*cdf0e10cSrcweir mpFloatWin->SetOutputSizePixel( rNewSize ); 1532*cdf0e10cSrcweir else 1533*cdf0e10cSrcweir GetWindow()->SetOutputSizePixel( rNewSize ); 1534*cdf0e10cSrcweir } 1535*cdf0e10cSrcweir 1536*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1537*cdf0e10cSrcweir 1538*cdf0e10cSrcweir Size ImplDockingWindowWrapper::GetOutputSizePixel() const 1539*cdf0e10cSrcweir { 1540*cdf0e10cSrcweir if ( mpFloatWin ) 1541*cdf0e10cSrcweir return mpFloatWin->GetOutputSizePixel(); 1542*cdf0e10cSrcweir else 1543*cdf0e10cSrcweir return mpDockingWindow->GetOutputSizePixel(); 1544*cdf0e10cSrcweir } 1545*cdf0e10cSrcweir 1546*cdf0e10cSrcweir Point ImplDockingWindowWrapper::GetFloatingPos() const 1547*cdf0e10cSrcweir { 1548*cdf0e10cSrcweir if ( mpFloatWin ) 1549*cdf0e10cSrcweir { 1550*cdf0e10cSrcweir //Rectangle aRect = mpFloatWin->GetWindow( WINDOW_CLIENT)->GetWindowExtentsRelative( mpFloatWin->GetParent() ); 1551*cdf0e10cSrcweir WindowStateData aData; 1552*cdf0e10cSrcweir aData.SetMask( WINDOWSTATE_MASK_POS ); 1553*cdf0e10cSrcweir mpFloatWin->GetWindowStateData( aData ); 1554*cdf0e10cSrcweir Point aPos( aData.GetX(), aData.GetY() ); 1555*cdf0e10cSrcweir aPos = mpFloatWin->GetParent()->ImplGetFrameWindow()->AbsoluteScreenToOutputPixel( aPos ); 1556*cdf0e10cSrcweir return aPos; 1557*cdf0e10cSrcweir } 1558*cdf0e10cSrcweir else 1559*cdf0e10cSrcweir return maFloatPos; 1560*cdf0e10cSrcweir } 1561*cdf0e10cSrcweir 1562*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1563*cdf0e10cSrcweir // old inlines from DockingWindow 1564*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1565*cdf0e10cSrcweir 1566*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetPin( sal_Bool bPin ) 1567*cdf0e10cSrcweir { 1568*cdf0e10cSrcweir if ( mpFloatWin ) 1569*cdf0e10cSrcweir mpFloatWin->SetPin( bPin ); 1570*cdf0e10cSrcweir mbPined = bPin; 1571*cdf0e10cSrcweir } 1572*cdf0e10cSrcweir 1573*cdf0e10cSrcweir sal_Bool ImplDockingWindowWrapper::IsPined() const 1574*cdf0e10cSrcweir { 1575*cdf0e10cSrcweir if ( mpFloatWin ) 1576*cdf0e10cSrcweir return mpFloatWin->IsPined(); 1577*cdf0e10cSrcweir return mbPined; 1578*cdf0e10cSrcweir } 1579*cdf0e10cSrcweir 1580*cdf0e10cSrcweir void ImplDockingWindowWrapper::RollUp() 1581*cdf0e10cSrcweir { 1582*cdf0e10cSrcweir if ( mpFloatWin ) 1583*cdf0e10cSrcweir mpFloatWin->RollUp(); 1584*cdf0e10cSrcweir mbRollUp = sal_True; 1585*cdf0e10cSrcweir } 1586*cdf0e10cSrcweir 1587*cdf0e10cSrcweir void ImplDockingWindowWrapper::RollDown() 1588*cdf0e10cSrcweir { 1589*cdf0e10cSrcweir if ( mpFloatWin ) 1590*cdf0e10cSrcweir mpFloatWin->RollDown(); 1591*cdf0e10cSrcweir mbRollUp = sal_False; 1592*cdf0e10cSrcweir } 1593*cdf0e10cSrcweir 1594*cdf0e10cSrcweir sal_Bool ImplDockingWindowWrapper::IsRollUp() const 1595*cdf0e10cSrcweir { 1596*cdf0e10cSrcweir if ( mpFloatWin ) 1597*cdf0e10cSrcweir return mpFloatWin->IsRollUp(); 1598*cdf0e10cSrcweir return mbRollUp; 1599*cdf0e10cSrcweir } 1600*cdf0e10cSrcweir 1601*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetRollUpOutputSizePixel( const Size& rSize ) 1602*cdf0e10cSrcweir { 1603*cdf0e10cSrcweir if ( mpFloatWin ) 1604*cdf0e10cSrcweir mpFloatWin->SetRollUpOutputSizePixel( rSize ); 1605*cdf0e10cSrcweir maRollUpOutSize = rSize; 1606*cdf0e10cSrcweir } 1607*cdf0e10cSrcweir 1608*cdf0e10cSrcweir Size ImplDockingWindowWrapper::GetRollUpOutputSizePixel() const 1609*cdf0e10cSrcweir { 1610*cdf0e10cSrcweir if ( mpFloatWin ) 1611*cdf0e10cSrcweir return mpFloatWin->GetRollUpOutputSizePixel(); 1612*cdf0e10cSrcweir return maRollUpOutSize; 1613*cdf0e10cSrcweir } 1614*cdf0e10cSrcweir 1615*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetMinOutputSizePixel( const Size& rSize ) 1616*cdf0e10cSrcweir { 1617*cdf0e10cSrcweir if ( mpFloatWin ) 1618*cdf0e10cSrcweir mpFloatWin->SetMinOutputSizePixel( rSize ); 1619*cdf0e10cSrcweir maMinOutSize = rSize; 1620*cdf0e10cSrcweir } 1621*cdf0e10cSrcweir 1622*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetMaxOutputSizePixel( const Size& rSize ) 1623*cdf0e10cSrcweir { 1624*cdf0e10cSrcweir if ( mpFloatWin ) 1625*cdf0e10cSrcweir mpFloatWin->SetMaxOutputSizePixel( rSize ); 1626*cdf0e10cSrcweir maMaxOutSize = rSize; 1627*cdf0e10cSrcweir } 1628*cdf0e10cSrcweir 1629*cdf0e10cSrcweir const Size& ImplDockingWindowWrapper::GetMinOutputSizePixel() const 1630*cdf0e10cSrcweir { 1631*cdf0e10cSrcweir if ( mpFloatWin ) 1632*cdf0e10cSrcweir return mpFloatWin->GetMinOutputSizePixel(); 1633*cdf0e10cSrcweir return maMinOutSize; 1634*cdf0e10cSrcweir } 1635*cdf0e10cSrcweir 1636*cdf0e10cSrcweir const Size& ImplDockingWindowWrapper::GetMaxOutputSizePixel() const 1637*cdf0e10cSrcweir { 1638*cdf0e10cSrcweir if ( mpFloatWin ) 1639*cdf0e10cSrcweir return mpFloatWin->GetMaxOutputSizePixel(); 1640*cdf0e10cSrcweir return maMaxOutSize; 1641*cdf0e10cSrcweir } 1642*cdf0e10cSrcweir 1643*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetFloatingPos( const Point& rNewPos ) 1644*cdf0e10cSrcweir { 1645*cdf0e10cSrcweir if ( mpFloatWin ) 1646*cdf0e10cSrcweir mpFloatWin->SetPosPixel( rNewPos ); 1647*cdf0e10cSrcweir else 1648*cdf0e10cSrcweir maFloatPos = rNewPos; 1649*cdf0e10cSrcweir } 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir sal_Bool ImplDockingWindowWrapper::IsFloatingMode() const 1652*cdf0e10cSrcweir { 1653*cdf0e10cSrcweir return (mpFloatWin != NULL); 1654*cdf0e10cSrcweir } 1655*cdf0e10cSrcweir 1656*cdf0e10cSrcweir 1657*cdf0e10cSrcweir void ImplDockingWindowWrapper::SetDragArea( const Rectangle& rRect ) 1658*cdf0e10cSrcweir { 1659*cdf0e10cSrcweir maDragArea = rRect; 1660*cdf0e10cSrcweir } 1661*cdf0e10cSrcweir 1662*cdf0e10cSrcweir Rectangle ImplDockingWindowWrapper::GetDragArea() const 1663*cdf0e10cSrcweir { 1664*cdf0e10cSrcweir return maDragArea; 1665*cdf0e10cSrcweir } 1666*cdf0e10cSrcweir 1667*cdf0e10cSrcweir void ImplDockingWindowWrapper::Lock() 1668*cdf0e10cSrcweir { 1669*cdf0e10cSrcweir mbLocked = sal_True; 1670*cdf0e10cSrcweir // only toolbars support locking 1671*cdf0e10cSrcweir ToolBox *pToolBox = dynamic_cast< ToolBox * >( GetWindow() ); 1672*cdf0e10cSrcweir if( pToolBox ) 1673*cdf0e10cSrcweir pToolBox->Lock( mbLocked ); 1674*cdf0e10cSrcweir } 1675*cdf0e10cSrcweir 1676*cdf0e10cSrcweir void ImplDockingWindowWrapper::Unlock() 1677*cdf0e10cSrcweir { 1678*cdf0e10cSrcweir mbLocked = sal_False; 1679*cdf0e10cSrcweir // only toolbars support locking 1680*cdf0e10cSrcweir ToolBox *pToolBox = dynamic_cast< ToolBox * >( GetWindow() ); 1681*cdf0e10cSrcweir if( pToolBox ) 1682*cdf0e10cSrcweir pToolBox->Lock( mbLocked ); 1683*cdf0e10cSrcweir } 1684*cdf0e10cSrcweir 1685*cdf0e10cSrcweir sal_Bool ImplDockingWindowWrapper::IsLocked() const 1686*cdf0e10cSrcweir { 1687*cdf0e10cSrcweir return mbLocked; 1688*cdf0e10cSrcweir } 1689