1cdf0e10cSrcweir /************************************************************************* 2cdf0e10cSrcweir * 3cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4cdf0e10cSrcweir * 5cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6cdf0e10cSrcweir * 7cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8cdf0e10cSrcweir * 9cdf0e10cSrcweir * This file is part of OpenOffice.org. 10cdf0e10cSrcweir * 11cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14cdf0e10cSrcweir * 15cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20cdf0e10cSrcweir * 21cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25cdf0e10cSrcweir * 26cdf0e10cSrcweir ************************************************************************/ 27cdf0e10cSrcweir 28cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29cdf0e10cSrcweir #include "precompiled_sfx2.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir #ifdef SOLARIS 32cdf0e10cSrcweir // HACK: prevent conflict between STLPORT and Workshop headers on Solaris 8 33cdf0e10cSrcweir #include <ctime> 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers 37cdf0e10cSrcweir 38cdf0e10cSrcweir #ifndef _WRKWIN_HXX //autogen 39cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir #include <unotools/viewoptions.hxx> 42cdf0e10cSrcweir #ifndef GCC 43cdf0e10cSrcweir #endif 44cdf0e10cSrcweir 45cdf0e10cSrcweir #include <vcl/timer.hxx> 46cdf0e10cSrcweir 47cdf0e10cSrcweir #include "splitwin.hxx" 48cdf0e10cSrcweir #include "workwin.hxx" 49cdf0e10cSrcweir #include <sfx2/dockwin.hxx> 50cdf0e10cSrcweir #include <sfx2/app.hxx> 51cdf0e10cSrcweir #include "dialog.hrc" 52cdf0e10cSrcweir #include "sfx2/sfxresid.hxx" 53cdf0e10cSrcweir #include <sfx2/mnumgr.hxx> 54cdf0e10cSrcweir #include "virtmenu.hxx" 55cdf0e10cSrcweir #include <sfx2/msgpool.hxx> 56cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 57cdf0e10cSrcweir 58cdf0e10cSrcweir using namespace ::com::sun::star::uno; 59cdf0e10cSrcweir using namespace ::rtl; 60cdf0e10cSrcweir 61cdf0e10cSrcweir #define VERSION 1 62cdf0e10cSrcweir #define nPixel 30L 63cdf0e10cSrcweir #define USERITEM_NAME OUString::createFromAscii( "UserItem" ) 64cdf0e10cSrcweir 65cdf0e10cSrcweir struct SfxDock_Impl 66cdf0e10cSrcweir { 67cdf0e10cSrcweir sal_uInt16 nType; 6896927939SAlexandro Colorado SfxDockingWindow* pWin; // This window has SplitWindow 69cdf0e10cSrcweir sal_Bool bNewLine; 7096927939SAlexandro Colorado sal_Bool bHide; // SplitWindow had this window 71cdf0e10cSrcweir long nSize; 72cdf0e10cSrcweir }; 73cdf0e10cSrcweir 74cdf0e10cSrcweir typedef SfxDock_Impl* SfxDockPtr; 75cdf0e10cSrcweir SV_DECL_PTRARR_DEL( SfxDockArr_Impl, SfxDockPtr, 4, 4) 76cdf0e10cSrcweir SV_IMPL_PTRARR( SfxDockArr_Impl, SfxDockPtr); 77cdf0e10cSrcweir 78cdf0e10cSrcweir class SfxEmptySplitWin_Impl : public SplitWindow 79cdf0e10cSrcweir { 80cdf0e10cSrcweir /* [Beschreibung] 81cdf0e10cSrcweir 82cefeec7bSAlexandro Colorado SfxEmptySplitWin_Impldow is an empty split window replacing the SfxSplitWindow 8396927939SAlexandro Colorado in AutoHide mode. It works as a placeholder to receive mouse MouseMoves. 84cefeec7bSAlexandro Colorado the actual light split window display 85cdf0e10cSrcweir */ 86cdf0e10cSrcweir friend class SfxSplitWindow; 87cdf0e10cSrcweir 88cdf0e10cSrcweir SfxSplitWindow* pOwner; 89cdf0e10cSrcweir sal_Bool bFadeIn; 90cdf0e10cSrcweir sal_Bool bAutoHide; 91cdf0e10cSrcweir sal_Bool bSplit; 92cdf0e10cSrcweir sal_Bool bEndAutoHide; 93cdf0e10cSrcweir Timer aTimer; 94cdf0e10cSrcweir Point aLastPos; 95cdf0e10cSrcweir sal_uInt16 nState; 96cdf0e10cSrcweir 97cdf0e10cSrcweir SfxEmptySplitWin_Impl( SfxSplitWindow *pParent ) 98cdf0e10cSrcweir : SplitWindow( pParent->GetParent(), WinBits( WB_BORDER | WB_3DLOOK ) ) 99cdf0e10cSrcweir , pOwner( pParent ) 100cdf0e10cSrcweir , bFadeIn( sal_False ) 101cdf0e10cSrcweir , bAutoHide( sal_False ) 102cdf0e10cSrcweir , bSplit( sal_False ) 103cdf0e10cSrcweir , bEndAutoHide( sal_False ) 104cdf0e10cSrcweir , nState( 1 ) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir aTimer.SetTimeoutHdl( 107cdf0e10cSrcweir LINK(pOwner, SfxSplitWindow, TimerHdl ) ); 108cdf0e10cSrcweir aTimer.SetTimeout( 200 ); 109cdf0e10cSrcweir // EnableDrop( sal_True ); 110cdf0e10cSrcweir SetAlign( pOwner->GetAlign() ); 111cdf0e10cSrcweir Actualize(); 112cdf0e10cSrcweir ShowAutoHideButton( pOwner->IsAutoHideButtonVisible() ); 113cdf0e10cSrcweir ShowFadeInHideButton( sal_True ); 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir ~SfxEmptySplitWin_Impl() 117cdf0e10cSrcweir { 118cdf0e10cSrcweir aTimer.Stop(); 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir virtual void MouseMove( const MouseEvent& ); 122cdf0e10cSrcweir virtual void AutoHide(); 123cdf0e10cSrcweir virtual void FadeIn(); 124cdf0e10cSrcweir void Actualize(); 125cdf0e10cSrcweir }; 126cdf0e10cSrcweir 127cdf0e10cSrcweir void SfxEmptySplitWin_Impl::Actualize() 128cdf0e10cSrcweir { 129cdf0e10cSrcweir Size aSize( pOwner->GetSizePixel() ); 130cdf0e10cSrcweir switch ( pOwner->GetAlign() ) 131cdf0e10cSrcweir { 132cdf0e10cSrcweir case WINDOWALIGN_LEFT: 133cdf0e10cSrcweir case WINDOWALIGN_RIGHT: 134cdf0e10cSrcweir aSize.Width() = GetFadeInSize(); 135cdf0e10cSrcweir break; 136cdf0e10cSrcweir case WINDOWALIGN_TOP: 137cdf0e10cSrcweir case WINDOWALIGN_BOTTOM: 138cdf0e10cSrcweir aSize.Height() = GetFadeInSize(); 139cdf0e10cSrcweir break; 140cdf0e10cSrcweir } 141cdf0e10cSrcweir 142cdf0e10cSrcweir SetSizePixel( aSize ); 143cdf0e10cSrcweir } 144cdf0e10cSrcweir 145cdf0e10cSrcweir void SfxEmptySplitWin_Impl::AutoHide() 146cdf0e10cSrcweir { 147cdf0e10cSrcweir pOwner->SetPinned_Impl( !pOwner->bPinned ); 148cdf0e10cSrcweir pOwner->SaveConfig_Impl(); 149cdf0e10cSrcweir bAutoHide = sal_True; 150cdf0e10cSrcweir FadeIn(); 151cdf0e10cSrcweir } 152cdf0e10cSrcweir 153cdf0e10cSrcweir void SfxEmptySplitWin_Impl::FadeIn() 154cdf0e10cSrcweir { 155cdf0e10cSrcweir if (!bAutoHide ) 156cdf0e10cSrcweir bAutoHide = IsFadeNoButtonMode(); 157cdf0e10cSrcweir pOwner->SetFadeIn_Impl( sal_True ); 158cdf0e10cSrcweir pOwner->Show_Impl(); 159cdf0e10cSrcweir if ( bAutoHide ) 160cdf0e10cSrcweir { 16196927939SAlexandro Colorado // Put timer to close; the caller must make sure it is, 16296927939SAlexandro Colorado // that the window does not stay or leave ( z.B. by setting the 16396927939SAlexandro Colorado // Focus mode or modal ) 164cdf0e10cSrcweir aLastPos = GetPointerPosPixel(); 165cdf0e10cSrcweir aTimer.Start(); 166cdf0e10cSrcweir } 167cdf0e10cSrcweir else 168cdf0e10cSrcweir pOwner->SaveConfig_Impl(); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir //------------------------------------------------------------------------- 172cdf0e10cSrcweir 173cdf0e10cSrcweir void SfxSplitWindow::MouseButtonDown( const MouseEvent& rMEvt ) 174cdf0e10cSrcweir { 175cdf0e10cSrcweir if ( rMEvt.GetClicks() != 2 ) 176cdf0e10cSrcweir SplitWindow::MouseButtonDown( rMEvt ); 177cdf0e10cSrcweir } 178cdf0e10cSrcweir 179cdf0e10cSrcweir void SfxEmptySplitWin_Impl::MouseMove( const MouseEvent& rMEvt ) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir SplitWindow::MouseMove( rMEvt ); 182cdf0e10cSrcweir } 183cdf0e10cSrcweir 184cdf0e10cSrcweir //------------------------------------------------------------------------- 185cdf0e10cSrcweir 186cdf0e10cSrcweir SfxSplitWindow::SfxSplitWindow( Window* pParent, SfxChildAlignment eAl, 187cdf0e10cSrcweir SfxWorkWindow *pW, sal_Bool bWithButtons, WinBits nBits ) 188cdf0e10cSrcweir 189cdf0e10cSrcweir /* [Beschreibung] 190cdf0e10cSrcweir 191cdf0e10cSrcweir Ein SfxSplitWindow verbirgt die rekursive Struktur des SV-Splitwindows 192cdf0e10cSrcweir nach au\sen, indem es einen tabellenartigen Aufbau mit Zeilen und Spalten 193cdf0e10cSrcweir ( also maximale Rekursionstiefe 2 ) simuliert. 194cdf0e10cSrcweir Au\erdem sichert es die Persistenz der Anordnung der SfxDockingWindows. 195cdf0e10cSrcweir */ 196cdf0e10cSrcweir 197cdf0e10cSrcweir : SplitWindow ( pParent, nBits | WB_HIDE ), 198cdf0e10cSrcweir eAlign(eAl), 199cdf0e10cSrcweir pWorkWin(pW), 200cdf0e10cSrcweir pDockArr( new SfxDockArr_Impl ), 201cdf0e10cSrcweir bLocked(sal_False), 202cdf0e10cSrcweir bPinned(sal_True), 203cdf0e10cSrcweir pEmptyWin(NULL), 204cdf0e10cSrcweir pActive(NULL) 205cdf0e10cSrcweir { 206cdf0e10cSrcweir if ( bWithButtons ) 207cdf0e10cSrcweir { 208cdf0e10cSrcweir ShowAutoHideButton( sal_False ); // no autohide button (pin) anymore 209cdf0e10cSrcweir ShowFadeOutButton( sal_True ); 210cdf0e10cSrcweir } 211cdf0e10cSrcweir 212cdf0e10cSrcweir // SV-Alignment setzen 213cdf0e10cSrcweir WindowAlign eTbxAlign; 214cdf0e10cSrcweir switch ( eAlign ) 215cdf0e10cSrcweir { 216cdf0e10cSrcweir case SFX_ALIGN_LEFT: 217cdf0e10cSrcweir eTbxAlign = WINDOWALIGN_LEFT; 218cdf0e10cSrcweir break; 219cdf0e10cSrcweir case SFX_ALIGN_RIGHT: 220cdf0e10cSrcweir eTbxAlign = WINDOWALIGN_RIGHT; 221cdf0e10cSrcweir break; 222cdf0e10cSrcweir case SFX_ALIGN_TOP: 223cdf0e10cSrcweir eTbxAlign = WINDOWALIGN_TOP; 224cdf0e10cSrcweir break; 225cdf0e10cSrcweir case SFX_ALIGN_BOTTOM: 226cdf0e10cSrcweir eTbxAlign = WINDOWALIGN_BOTTOM; 227cdf0e10cSrcweir bPinned = sal_True; 228cdf0e10cSrcweir break; 229cdf0e10cSrcweir default: 230cdf0e10cSrcweir eTbxAlign = WINDOWALIGN_TOP; // some sort of default... 231cdf0e10cSrcweir break; // -Wall lots not handled.. 232cdf0e10cSrcweir } 233cdf0e10cSrcweir 234cdf0e10cSrcweir SetAlign (eTbxAlign); 235cdf0e10cSrcweir pEmptyWin = new SfxEmptySplitWin_Impl( this ); 236cdf0e10cSrcweir if ( bPinned ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_True; 239cdf0e10cSrcweir pEmptyWin->nState = 2; 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir if ( bWithButtons ) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir // Konfiguration einlesen 245cdf0e10cSrcweir String aWindowId = String::CreateFromAscii("SplitWindow"); 246cdf0e10cSrcweir aWindowId += String::CreateFromInt32( (sal_Int32) eTbxAlign ); 247cdf0e10cSrcweir SvtViewOptions aWinOpt( E_WINDOW, aWindowId ); 248cdf0e10cSrcweir String aWinData; 249cdf0e10cSrcweir Any aUserItem = aWinOpt.GetUserItem( USERITEM_NAME ); 250cdf0e10cSrcweir OUString aTemp; 251cdf0e10cSrcweir if ( aUserItem >>= aTemp ) 252cdf0e10cSrcweir aWinData = String( aTemp ); 253cdf0e10cSrcweir if ( aWinData.Len() && aWinData.GetChar( (sal_uInt16) 0 ) == 'V' ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir pEmptyWin->nState = (sal_uInt16) aWinData.GetToken( 1, ',' ).ToInt32(); 256cdf0e10cSrcweir if ( pEmptyWin->nState & 2 ) 257cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_True; 258cdf0e10cSrcweir //bPinned = !( pEmptyWin->nState & 1 ); 259cdf0e10cSrcweir bPinned = sal_True; // always assume pinned - floating mode not used anymore 260cdf0e10cSrcweir 261cdf0e10cSrcweir sal_uInt16 i=2; 262cdf0e10cSrcweir sal_uInt16 nCount = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32(); 263cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir SfxDock_Impl *pDock = new SfxDock_Impl; 266cdf0e10cSrcweir pDock->pWin = 0; 267cdf0e10cSrcweir pDock->bNewLine = sal_False; 268cdf0e10cSrcweir pDock->bHide = sal_True; 269cdf0e10cSrcweir pDock->nType = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32(); 270cdf0e10cSrcweir if ( !pDock->nType ) 271cdf0e10cSrcweir { 272cdf0e10cSrcweir // K"onnte NewLine bedeuten 273cdf0e10cSrcweir pDock->nType = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32(); 274cdf0e10cSrcweir if ( !pDock->nType ) 275cdf0e10cSrcweir { 276cdf0e10cSrcweir // Lesefehler 277cdf0e10cSrcweir delete pDock; 278cdf0e10cSrcweir break; 279cdf0e10cSrcweir } 280cdf0e10cSrcweir else 281cdf0e10cSrcweir pDock->bNewLine = sal_True; 282cdf0e10cSrcweir } 283cdf0e10cSrcweir 284cdf0e10cSrcweir pDockArr->Insert(pDock,n); 285cdf0e10cSrcweir } 286cdf0e10cSrcweir } 287cdf0e10cSrcweir } 288cdf0e10cSrcweir else 289cdf0e10cSrcweir { 290cdf0e10cSrcweir bPinned = sal_True; 291cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_True; 292cdf0e10cSrcweir pEmptyWin->nState = 2; 293cdf0e10cSrcweir } 294cdf0e10cSrcweir 295cdf0e10cSrcweir SetAutoHideState( !bPinned ); 296cdf0e10cSrcweir pEmptyWin->SetAutoHideState( !bPinned ); 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir //------------------------------------------------------------------------- 300cdf0e10cSrcweir 301cdf0e10cSrcweir SfxSplitWindow::~SfxSplitWindow() 302cdf0e10cSrcweir { 303cdf0e10cSrcweir if ( !pWorkWin->GetParent_Impl() ) 304cdf0e10cSrcweir SaveConfig_Impl(); 305cdf0e10cSrcweir 306cdf0e10cSrcweir if ( pEmptyWin ) 307cdf0e10cSrcweir { 308cdf0e10cSrcweir // pOwner auf NULL setzen, sonst versucht pEmptyWin, nochmal zu 309cdf0e10cSrcweir // l"oschen; es wird n"amlich von au\sen immer das Fenster deleted, 310cdf0e10cSrcweir // das gerade angedockt ist 311cdf0e10cSrcweir pEmptyWin->pOwner = NULL; 312cdf0e10cSrcweir delete pEmptyWin; 313cdf0e10cSrcweir } 314cdf0e10cSrcweir 315cdf0e10cSrcweir delete pDockArr; 316cdf0e10cSrcweir } 317cdf0e10cSrcweir 318cdf0e10cSrcweir void SfxSplitWindow::SaveConfig_Impl() 319cdf0e10cSrcweir { 320cdf0e10cSrcweir // Konfiguration abspeichern 321cdf0e10cSrcweir String aWinData('V'); 322cdf0e10cSrcweir aWinData += String::CreateFromInt32( VERSION ); 323cdf0e10cSrcweir aWinData += ','; 324cdf0e10cSrcweir aWinData += String::CreateFromInt32( pEmptyWin->nState ); 325cdf0e10cSrcweir aWinData += ','; 326cdf0e10cSrcweir 327cdf0e10cSrcweir sal_uInt16 nCount = 0; 328cdf0e10cSrcweir sal_uInt16 n; 329cdf0e10cSrcweir for ( n=0; n<pDockArr->Count(); n++ ) 330cdf0e10cSrcweir { 331cdf0e10cSrcweir SfxDock_Impl *pDock = (*pDockArr)[n]; 332cdf0e10cSrcweir if ( pDock->bHide || pDock->pWin ) 333cdf0e10cSrcweir nCount++; 334cdf0e10cSrcweir } 335cdf0e10cSrcweir 336cdf0e10cSrcweir aWinData += String::CreateFromInt32( nCount ); 337cdf0e10cSrcweir 338cdf0e10cSrcweir for ( n=0; n<pDockArr->Count(); n++ ) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir SfxDock_Impl *pDock = (*pDockArr)[n]; 341cdf0e10cSrcweir if ( !pDock->bHide && !pDock->pWin ) 342cdf0e10cSrcweir continue; 343cdf0e10cSrcweir if ( pDock->bNewLine ) 344cdf0e10cSrcweir aWinData += DEFINE_CONST_UNICODE(",0"); 345cdf0e10cSrcweir aWinData += ','; 346cdf0e10cSrcweir aWinData += String::CreateFromInt32( pDock->nType); 347cdf0e10cSrcweir } 348cdf0e10cSrcweir 349cdf0e10cSrcweir String aWindowId = String::CreateFromAscii("SplitWindow"); 350cdf0e10cSrcweir aWindowId += String::CreateFromInt32( (sal_Int32) GetAlign() ); 351cdf0e10cSrcweir SvtViewOptions aWinOpt( E_WINDOW, aWindowId ); 352cdf0e10cSrcweir aWinOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aWinData ) ) ); 353cdf0e10cSrcweir } 354cdf0e10cSrcweir 355cdf0e10cSrcweir //------------------------------------------------------------------------- 356cdf0e10cSrcweir 357cdf0e10cSrcweir void SfxSplitWindow::StartSplit() 358cdf0e10cSrcweir { 359cdf0e10cSrcweir long nSize = 0; 360cdf0e10cSrcweir Size aSize = GetSizePixel(); 361cdf0e10cSrcweir 362cdf0e10cSrcweir if ( pEmptyWin ) 363cdf0e10cSrcweir { 364cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_True; 365cdf0e10cSrcweir pEmptyWin->bSplit = sal_True; 366cdf0e10cSrcweir } 367cdf0e10cSrcweir 368cdf0e10cSrcweir Rectangle aRect = pWorkWin->GetFreeArea( !bPinned ); 369cdf0e10cSrcweir switch ( GetAlign() ) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir case WINDOWALIGN_LEFT: 372cdf0e10cSrcweir case WINDOWALIGN_RIGHT: 373cdf0e10cSrcweir nSize = aSize.Width() + aRect.GetWidth(); 374cdf0e10cSrcweir break; 375cdf0e10cSrcweir case WINDOWALIGN_TOP: 376cdf0e10cSrcweir case WINDOWALIGN_BOTTOM: 377cdf0e10cSrcweir nSize = aSize.Height() + aRect.GetHeight(); 378cdf0e10cSrcweir break; 379cdf0e10cSrcweir } 380cdf0e10cSrcweir 381cdf0e10cSrcweir SetMaxSizePixel( nSize ); 382cdf0e10cSrcweir } 383cdf0e10cSrcweir 384cdf0e10cSrcweir //------------------------------------------------------------------------- 385cdf0e10cSrcweir 386cdf0e10cSrcweir void SfxSplitWindow::SplitResize() 387cdf0e10cSrcweir { 388cdf0e10cSrcweir if ( bPinned ) 389cdf0e10cSrcweir { 390cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 391cdf0e10cSrcweir pWorkWin->ShowChilds_Impl(); 392cdf0e10cSrcweir } 393cdf0e10cSrcweir else 394cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 395cdf0e10cSrcweir } 396cdf0e10cSrcweir 397cdf0e10cSrcweir //------------------------------------------------------------------------- 398cdf0e10cSrcweir 399cdf0e10cSrcweir void SfxSplitWindow::Split() 400cdf0e10cSrcweir { 401cdf0e10cSrcweir if ( pEmptyWin ) 402cdf0e10cSrcweir pEmptyWin->bSplit = sal_False; 403cdf0e10cSrcweir 404cdf0e10cSrcweir SplitWindow::Split(); 405cdf0e10cSrcweir 406cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count(); 407cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ ) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[n]; 410cdf0e10cSrcweir if ( pD->pWin ) 411cdf0e10cSrcweir { 412cdf0e10cSrcweir sal_uInt16 nId = pD->nType; 413cdf0e10cSrcweir long nSize = GetItemSize( nId, SWIB_FIXED ); 414cdf0e10cSrcweir long nSetSize = GetItemSize( GetSet( nId ) ); 415cdf0e10cSrcweir Size aSize; 416cdf0e10cSrcweir 417cdf0e10cSrcweir if ( IsHorizontal() ) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir aSize.Width() = nSize; 420cdf0e10cSrcweir aSize.Height() = nSetSize; 421cdf0e10cSrcweir } 422cdf0e10cSrcweir else 423cdf0e10cSrcweir { 424cdf0e10cSrcweir aSize.Width() = nSetSize; 425cdf0e10cSrcweir aSize.Height() = nSize; 426cdf0e10cSrcweir } 427cdf0e10cSrcweir 428cdf0e10cSrcweir pD->pWin->SetItemSize_Impl( aSize ); 429cdf0e10cSrcweir } 430cdf0e10cSrcweir } 431cdf0e10cSrcweir 432cdf0e10cSrcweir SaveConfig_Impl(); 433cdf0e10cSrcweir } 434cdf0e10cSrcweir 435cdf0e10cSrcweir //------------------------------------------------------------------------- 436cdf0e10cSrcweir 437cdf0e10cSrcweir void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize) 438cdf0e10cSrcweir 439cdf0e10cSrcweir /* [Beschreibung] 440cdf0e10cSrcweir 441cefeec7bSAlexandro Colorado To insert SfxDockingWindows with no position can also be transfered. 442cefeec7bSAlexandro Colorado The SfxSplitWindow then searches out the noted recently transfered 443cefeec7bSAlexandro Colorado to the newly SfxDockingWindow or it depends on the last. 444cdf0e10cSrcweir 445cdf0e10cSrcweir */ 446cdf0e10cSrcweir { 447cefeec7bSAlexandro Colorado short nLine = -1; // so first window can be set to 0 nLine high 448cdf0e10cSrcweir sal_uInt16 nL; 449cdf0e10cSrcweir sal_uInt16 nPos = 0; 450cdf0e10cSrcweir sal_Bool bNewLine = sal_True; 451cdf0e10cSrcweir sal_Bool bSaveConfig = sal_False; 452cdf0e10cSrcweir SfxDock_Impl *pFoundDock=0; 453cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count(); 454cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ ) 455cdf0e10cSrcweir { 456cdf0e10cSrcweir SfxDock_Impl *pDock = (*pDockArr)[n]; 457cdf0e10cSrcweir if ( pDock->bNewLine ) 458cdf0e10cSrcweir { 459cefeec7bSAlexandro Colorado // The window opens a new line 460cdf0e10cSrcweir if ( pFoundDock ) 461cefeec7bSAlexandro Colorado // But behind the window just inserted 462cdf0e10cSrcweir break; 463cdf0e10cSrcweir 464cefeec7bSAlexandro Colorado // new line 465cdf0e10cSrcweir nPos = 0; 466cdf0e10cSrcweir bNewLine = sal_True; 467cdf0e10cSrcweir } 468cdf0e10cSrcweir 469cdf0e10cSrcweir if ( pDock->pWin ) 470cdf0e10cSrcweir { 471cefeec7bSAlexandro Colorado // It is at this point just a window 472cdf0e10cSrcweir if ( bNewLine && !pFoundDock ) 473cdf0e10cSrcweir { 474cefeec7bSAlexandro Colorado // It is not known, in which real line is the one 475cdf0e10cSrcweir GetWindowPos( pDock->pWin, nL, nPos ); 476cdf0e10cSrcweir nLine = (short) nL; 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir if ( !pFoundDock ) 480cdf0e10cSrcweir { 481cefeec7bSAlexandro Colorado // before the window is attached 482cdf0e10cSrcweir nPos++; 483cdf0e10cSrcweir } 484cdf0e10cSrcweir 485cefeec7bSAlexandro Colorado // Line is now open 486cdf0e10cSrcweir bNewLine = sal_False; 487cdf0e10cSrcweir if ( pFoundDock ) 488cdf0e10cSrcweir break; 489cdf0e10cSrcweir } 490cdf0e10cSrcweir 491cdf0e10cSrcweir if ( pDock->nType == pDockWin->GetType() ) 492cdf0e10cSrcweir { 493cefeec7bSAlexandro Colorado DBG_ASSERT( !pFoundDock && !pDock->pWin, "Window is already available!"); 494cdf0e10cSrcweir pFoundDock = pDock; 495cdf0e10cSrcweir if ( !bNewLine ) 496cdf0e10cSrcweir break; 497cdf0e10cSrcweir else 498cdf0e10cSrcweir { 499cefeec7bSAlexandro Colorado // It was most recently a new series started, but not found a 500cefeec7bSAlexandro Colorado // window above it, so keep looking if nochein window follows 501cefeec7bSAlexandro Colorado // this line to bNewLine to set correctly. But it must be nLine 502cefeec7bSAlexandro Colorado // or nPos shouldn't be changed. 503cdf0e10cSrcweir nLine++; 504cdf0e10cSrcweir } 505cdf0e10cSrcweir } 506cdf0e10cSrcweir } 507cdf0e10cSrcweir 508cdf0e10cSrcweir if ( !pFoundDock ) 509cdf0e10cSrcweir { 510cdf0e10cSrcweir // Nicht gefunden, am Ende einf"ugen 511cdf0e10cSrcweir pFoundDock = new SfxDock_Impl; 512cdf0e10cSrcweir pFoundDock->bHide = sal_True; 513cdf0e10cSrcweir pDockArr->Insert( pFoundDock, nCount ); 514cdf0e10cSrcweir pFoundDock->nType = pDockWin->GetType(); 515cdf0e10cSrcweir nLine++; 516cdf0e10cSrcweir nPos = 0; 517cdf0e10cSrcweir bNewLine = sal_True; 518cdf0e10cSrcweir pFoundDock->bNewLine = bNewLine; 519cdf0e10cSrcweir bSaveConfig = sal_True; 520cdf0e10cSrcweir } 521cdf0e10cSrcweir 522cdf0e10cSrcweir pFoundDock->pWin = pDockWin; 523cdf0e10cSrcweir pFoundDock->bHide = sal_False; 524cdf0e10cSrcweir InsertWindow_Impl( pFoundDock, rSize, nLine, nPos, bNewLine ); 525cdf0e10cSrcweir if ( bSaveConfig ) 526cdf0e10cSrcweir SaveConfig_Impl(); 527cdf0e10cSrcweir } 528cdf0e10cSrcweir 529cdf0e10cSrcweir //------------------------------------------------------------------------- 530cdf0e10cSrcweir 531cdf0e10cSrcweir void SfxSplitWindow::ReleaseWindow_Impl(SfxDockingWindow *pDockWin, sal_Bool bSave) 532cdf0e10cSrcweir 533cdf0e10cSrcweir /* [Beschreibung] 534cdf0e10cSrcweir 535cefeec7bSAlexandro Colorado The DockinWindow is no longer stored in the internal data. 536cdf0e10cSrcweir */ 537cdf0e10cSrcweir 538cdf0e10cSrcweir { 539cdf0e10cSrcweir SfxDock_Impl *pDock=0; 540cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count(); 541cdf0e10cSrcweir sal_Bool bFound = sal_False; 542cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ ) 543cdf0e10cSrcweir { 544cdf0e10cSrcweir pDock = (*pDockArr)[n]; 545cdf0e10cSrcweir if ( pDock->nType == pDockWin->GetType() ) 546cdf0e10cSrcweir { 547cdf0e10cSrcweir if ( pDock->bNewLine && n<nCount-1 ) 548cdf0e10cSrcweir (*pDockArr)[n+1]->bNewLine = sal_True; 549cdf0e10cSrcweir 550cdf0e10cSrcweir // Fenster hat schon eine Position, die vergessen wir 551cdf0e10cSrcweir bFound = sal_True; 552cdf0e10cSrcweir pDockArr->Remove(n); 553cdf0e10cSrcweir break; 554cdf0e10cSrcweir } 555cdf0e10cSrcweir } 556cdf0e10cSrcweir 557cdf0e10cSrcweir if ( bFound ) 558cdf0e10cSrcweir delete pDock; 559cdf0e10cSrcweir 560cdf0e10cSrcweir if ( bSave ) 561cdf0e10cSrcweir SaveConfig_Impl(); 562cdf0e10cSrcweir } 563cdf0e10cSrcweir 564cdf0e10cSrcweir //------------------------------------------------------------------------- 565cdf0e10cSrcweir 566cdf0e10cSrcweir void SfxSplitWindow::MoveWindow( SfxDockingWindow* pDockWin, const Size& rSize, 567cdf0e10cSrcweir sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine) 568cdf0e10cSrcweir 569cdf0e10cSrcweir /* [Beschreibung] 570cdf0e10cSrcweir 571cdf0e10cSrcweir Das DockingWindow wird innerhalb des Splitwindows verschoben. 572cdf0e10cSrcweir 573cdf0e10cSrcweir */ 574cdf0e10cSrcweir 575cdf0e10cSrcweir { 576cdf0e10cSrcweir sal_uInt16 nL, nP; 577cdf0e10cSrcweir GetWindowPos( pDockWin, nL, nP ); 578cdf0e10cSrcweir 579cdf0e10cSrcweir if ( nLine > nL && GetItemCount( GetItemId( nL, 0 ) ) == 1 ) 580cdf0e10cSrcweir { 581cdf0e10cSrcweir // Wenn das letzte Fenster aus seiner Zeile entfernt wird, rutscht 582cdf0e10cSrcweir // alles eine Zeile nach vorne! 583cdf0e10cSrcweir nLine--; 584cdf0e10cSrcweir } 585cdf0e10cSrcweir /* 586cdf0e10cSrcweir else if ( nLine == nL && nPos > nP ) 587cdf0e10cSrcweir { 588cdf0e10cSrcweir nPos--; 589cdf0e10cSrcweir } 590cdf0e10cSrcweir */ 591cdf0e10cSrcweir RemoveWindow( pDockWin ); 592cdf0e10cSrcweir InsertWindow( pDockWin, rSize, nLine, nPos, bNewLine ); 593cdf0e10cSrcweir } 594cdf0e10cSrcweir 595cdf0e10cSrcweir //------------------------------------------------------------------------- 596cdf0e10cSrcweir 597cdf0e10cSrcweir void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize, 598cdf0e10cSrcweir sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine) 599cdf0e10cSrcweir 600cdf0e10cSrcweir /* [Beschreibung] 601cdf0e10cSrcweir 602cdf0e10cSrcweir Das DockingWindow wird in dieses Splitwindow geschoben und soll die 603cdf0e10cSrcweir "ubergebene Position und Gr"o\se haben. 604cdf0e10cSrcweir 605cdf0e10cSrcweir */ 606cdf0e10cSrcweir { 607cdf0e10cSrcweir ReleaseWindow_Impl( pDockWin, sal_False ); 608cdf0e10cSrcweir SfxDock_Impl *pDock = new SfxDock_Impl; 609cdf0e10cSrcweir pDock->bHide = sal_False; 610cdf0e10cSrcweir pDock->nType = pDockWin->GetType(); 611cdf0e10cSrcweir pDock->bNewLine = bNewLine; 612cdf0e10cSrcweir pDock->pWin = pDockWin; 613cdf0e10cSrcweir 614abd9d880SPedro Giffuni DBG_ASSERT( nPos==0 || !bNewLine, "Wrong Parameter!"); 615cdf0e10cSrcweir if ( bNewLine ) 616cdf0e10cSrcweir nPos = 0; 617cdf0e10cSrcweir 618b7d87b09SAlexandro Colorado // The window introduced before the first window are suffices that the 619b7d87b09SAlexandro Colorado // body or a greater position as the pDockWin. 620*0abcfe85SEric Bachard sal_uInt16 nCount = pDockArr->Count(); 621abd9d880SPedro Giffuni sal_uInt16 nLastWindowIdx(0); 622cdf0e10cSrcweir 623b7d87b09SAlexandro Colorado // If window not found, is inserted as the first 624cdf0e10cSrcweir sal_uInt16 nInsertPos = 0; 625cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ ) 626cdf0e10cSrcweir { 627cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[n]; 628cdf0e10cSrcweir 629cdf0e10cSrcweir if (pD->pWin) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir // Ein angedocktes Fenster wurde gefunden 632cdf0e10cSrcweir // Wenn kein geeignetes Fenster hinter der gew"unschten Einf"ugeposition 633cdf0e10cSrcweir // gefunden wird, wird am Ende eingef"ugt 634cdf0e10cSrcweir nInsertPos = nCount; 635abd9d880SPedro Giffuni nLastWindowIdx = n; 636cdf0e10cSrcweir sal_uInt16 nL=0, nP=0; 637cdf0e10cSrcweir GetWindowPos( pD->pWin, nL, nP ); 638cdf0e10cSrcweir 639cdf0e10cSrcweir if ( (nL == nLine && nP == nPos) || nL > nLine ) 640cdf0e10cSrcweir { 641abd9d880SPedro Giffuni DBG_ASSERT( nL == nLine || bNewLine || nPos > 0, "Wrong Parameter!" ); 642cdf0e10cSrcweir if ( nL == nLine && nPos == 0 && !bNewLine ) 643cdf0e10cSrcweir { 644abd9d880SPedro Giffuni DBG_ASSERT(pD->bNewLine, "No new line?"); 645cdf0e10cSrcweir 646cdf0e10cSrcweir // Das Fenster wird auf nPos==0 eingeschoben 647cdf0e10cSrcweir pD->bNewLine = sal_False; 648cdf0e10cSrcweir pDock->bNewLine = sal_True; 649cdf0e10cSrcweir } 650cdf0e10cSrcweir 651abd9d880SPedro Giffuni nInsertPos = n != 0 ? nLastWindowIdx + 1 : 0; // ignore all non-windows after the last window 652cdf0e10cSrcweir break; 653cdf0e10cSrcweir } 654cdf0e10cSrcweir } 655cdf0e10cSrcweir } 656abd9d880SPedro Giffuni if (nInsertPos == nCount && nLastWindowIdx != nCount - 1) 657abd9d880SPedro Giffuni { 658abd9d880SPedro Giffuni nInsertPos = nLastWindowIdx + 1; // ignore all non-windows after the last window 659abd9d880SPedro Giffuni } 660cdf0e10cSrcweir 661cdf0e10cSrcweir pDockArr->Insert(pDock, nInsertPos); 662cdf0e10cSrcweir InsertWindow_Impl( pDock, rSize, nLine, nPos, bNewLine ); 663cdf0e10cSrcweir SaveConfig_Impl(); 664cdf0e10cSrcweir } 665cdf0e10cSrcweir 666cdf0e10cSrcweir //------------------------------------------------------------------------- 667cdf0e10cSrcweir 668cdf0e10cSrcweir void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, 669cdf0e10cSrcweir const Size& rSize, 670cdf0e10cSrcweir sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine) 671cdf0e10cSrcweir 672cdf0e10cSrcweir /* [Beschreibung] 673cdf0e10cSrcweir 674cdf0e10cSrcweir F"ugt ein DockingWindow ein und veranla\st die Neuberechnung der Gr"o\se 675cdf0e10cSrcweir des Splitwindows. 676cdf0e10cSrcweir */ 677cdf0e10cSrcweir 678cdf0e10cSrcweir { 679cdf0e10cSrcweir SfxDockingWindow* pDockWin = pDock->pWin; 680cdf0e10cSrcweir 681cdf0e10cSrcweir sal_uInt16 nItemBits = pDockWin->GetWinBits_Impl(); 682cdf0e10cSrcweir 683cdf0e10cSrcweir long nWinSize, nSetSize; 684cdf0e10cSrcweir if ( IsHorizontal() ) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir nWinSize = rSize.Width(); 687cdf0e10cSrcweir nSetSize = rSize.Height(); 688cdf0e10cSrcweir } 689cdf0e10cSrcweir else 690cdf0e10cSrcweir { 691cdf0e10cSrcweir nSetSize = rSize.Width(); 692cdf0e10cSrcweir nWinSize = rSize.Height(); 693cdf0e10cSrcweir } 694cdf0e10cSrcweir 695cdf0e10cSrcweir pDock->nSize = nWinSize; 696cdf0e10cSrcweir 697cdf0e10cSrcweir sal_Bool bUpdateMode = IsUpdateMode(); 698cdf0e10cSrcweir if ( bUpdateMode ) 699cdf0e10cSrcweir SetUpdateMode( sal_False ); 700cdf0e10cSrcweir 701cdf0e10cSrcweir if ( bNewLine || nLine == GetItemCount( 0 ) ) 702cdf0e10cSrcweir { 703cdf0e10cSrcweir // Es soll nicht in eine vorhandene Zeile eingef"ugt werden, sondern 704cdf0e10cSrcweir // eine neue erzeugt werden 705cdf0e10cSrcweir 706cdf0e10cSrcweir sal_uInt16 nId = 1; 707cdf0e10cSrcweir for ( sal_uInt16 n=0; n<GetItemCount(0); n++ ) 708cdf0e10cSrcweir { 709cdf0e10cSrcweir if ( GetItemId(n) >= nId ) 710cdf0e10cSrcweir nId = GetItemId(n)+1; 711cdf0e10cSrcweir } 712cdf0e10cSrcweir 713cdf0e10cSrcweir // Eine neue nLine-te Zeile erzeugen 714cdf0e10cSrcweir sal_uInt16 nBits = nItemBits; 715cdf0e10cSrcweir if ( GetAlign() == WINDOWALIGN_TOP || GetAlign() == WINDOWALIGN_BOTTOM ) 716cdf0e10cSrcweir nBits |= SWIB_COLSET; 717cdf0e10cSrcweir InsertItem( nId, nSetSize, nLine, 0, nBits ); 718cdf0e10cSrcweir } 719cdf0e10cSrcweir 720cdf0e10cSrcweir // In Zeile mit Position nLine das Fenster einf"ugen 721cdf0e10cSrcweir // ItemWindowSize auf "Prozentual" setzen, da SV dann das Umgr"o\sern 722cdf0e10cSrcweir // so macht, wie man erwartet; "Pixel" macht eigentlich nur Sinn, wenn 723cdf0e10cSrcweir // auch Items mit prozentualen oder relativen Gr"o\sen dabei sind. 724cdf0e10cSrcweir nItemBits |= SWIB_PERCENTSIZE; 725cdf0e10cSrcweir bLocked = sal_True; 726cdf0e10cSrcweir sal_uInt16 nSet = GetItemId( nLine ); 727cdf0e10cSrcweir InsertItem( pDockWin->GetType(), pDockWin, nWinSize, nPos, nSet, nItemBits ); 728cdf0e10cSrcweir 729cdf0e10cSrcweir // Splitwindows werden im SFX einmal angelegt und beim Einf"ugen des ersten 730cdf0e10cSrcweir // DockingWindows sichtbar gemacht. 731cdf0e10cSrcweir if ( GetItemCount( 0 ) == 1 && GetItemCount( 1 ) == 1 ) 732cdf0e10cSrcweir { 733cdf0e10cSrcweir // Das Neuarrangieren am WorkWindow und ein Show() auf das SplitWindow 734cdf0e10cSrcweir // wird vom SfxDockingwindow veranla\st (->SfxWorkWindow::ConfigChild_Impl) 735cdf0e10cSrcweir if ( !bPinned && !IsFloatingMode() ) 736cdf0e10cSrcweir { 737cdf0e10cSrcweir bPinned = sal_True; 738cdf0e10cSrcweir sal_Bool bFadeIn = ( pEmptyWin->nState & 2 ) != 0; 739cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_False; 740cdf0e10cSrcweir SetPinned_Impl( sal_False ); 741cdf0e10cSrcweir pEmptyWin->Actualize(); 742cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" ); 743cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, sal_True )->nVisible = CHILD_VISIBLE; 744cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 745cdf0e10cSrcweir if ( bFadeIn ) 746cdf0e10cSrcweir FadeIn(); 747cdf0e10cSrcweir } 748cdf0e10cSrcweir else 749cdf0e10cSrcweir { 750cdf0e10cSrcweir sal_Bool bFadeIn = ( pEmptyWin->nState & 2 ) != 0; 751cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_False; 752cdf0e10cSrcweir pEmptyWin->Actualize(); 753cdf0e10cSrcweir #ifdef DBG_UTIL 754cdf0e10cSrcweir if ( !bPinned || !pEmptyWin->bFadeIn ) 755cdf0e10cSrcweir { 756cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" ); 757cdf0e10cSrcweir } 758cdf0e10cSrcweir else 759cdf0e10cSrcweir { 760cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering real Splitwindow" ); 761cdf0e10cSrcweir } 762cdf0e10cSrcweir #endif 763cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, sal_True )->nVisible = CHILD_VISIBLE; 764cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 765cdf0e10cSrcweir if ( bFadeIn ) 766cdf0e10cSrcweir FadeIn(); 767cdf0e10cSrcweir } 768cdf0e10cSrcweir 769cdf0e10cSrcweir pWorkWin->ShowChilds_Impl(); 770cdf0e10cSrcweir } 771cdf0e10cSrcweir 772cdf0e10cSrcweir if ( bUpdateMode ) 773cdf0e10cSrcweir SetUpdateMode( sal_True ); 774cdf0e10cSrcweir bLocked = sal_False; 775cdf0e10cSrcweir } 776cdf0e10cSrcweir 777cdf0e10cSrcweir //------------------------------------------------------------------------- 778cdf0e10cSrcweir 779cdf0e10cSrcweir void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, sal_Bool bHide ) 780cdf0e10cSrcweir 781cdf0e10cSrcweir /* [Beschreibung] 782cdf0e10cSrcweir 783cdf0e10cSrcweir Entfernt ein DockingWindow. Wenn es das letzte war, wird das SplitWindow 784cdf0e10cSrcweir gehidet. 785cdf0e10cSrcweir */ 786cdf0e10cSrcweir { 787cdf0e10cSrcweir sal_uInt16 nSet = GetSet( pDockWin->GetType() ); 788cdf0e10cSrcweir 789cdf0e10cSrcweir // Splitwindows werden im SFX einmal angelegt und nach dem Entfernen 790cdf0e10cSrcweir // des letzten DockingWindows unsichtbar gemacht. 791cdf0e10cSrcweir if ( GetItemCount( nSet ) == 1 && GetItemCount( 0 ) == 1 ) 792cdf0e10cSrcweir { 793cdf0e10cSrcweir // Das Neuarrangieren am WorkWindow wird vom SfxDockingwindow 794cdf0e10cSrcweir // veranla\st! 795cdf0e10cSrcweir Hide(); 796cdf0e10cSrcweir pEmptyWin->aTimer.Stop(); 797cdf0e10cSrcweir sal_uInt16 nRealState = pEmptyWin->nState; 798cdf0e10cSrcweir FadeOut_Impl(); 799cdf0e10cSrcweir pEmptyWin->Hide(); 800cdf0e10cSrcweir #ifdef DBG_UTIL 801cdf0e10cSrcweir if ( !bPinned || !pEmptyWin->bFadeIn ) 802cdf0e10cSrcweir { 803cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::RemoveWindow - releasing empty Splitwindow" ); 804cdf0e10cSrcweir } 805cdf0e10cSrcweir else 806cdf0e10cSrcweir { 807cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::RemoveWindow - releasing real Splitwindow" ); 808cdf0e10cSrcweir } 809cdf0e10cSrcweir #endif 810cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *GetSplitWindow() ); 811cdf0e10cSrcweir pEmptyWin->nState = nRealState; 812cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 813cdf0e10cSrcweir } 814cdf0e10cSrcweir 815cdf0e10cSrcweir SfxDock_Impl *pDock=0; 816cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count(); 817cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ ) 818cdf0e10cSrcweir { 819cdf0e10cSrcweir pDock = (*pDockArr)[n]; 820cdf0e10cSrcweir if ( pDock->nType == pDockWin->GetType() ) 821cdf0e10cSrcweir { 822cdf0e10cSrcweir pDock->pWin = 0; 823cdf0e10cSrcweir pDock->bHide = bHide; 824cdf0e10cSrcweir break; 825cdf0e10cSrcweir } 826cdf0e10cSrcweir } 827cdf0e10cSrcweir 828cdf0e10cSrcweir // Fenster removen, und wenn es das letzte der Zeile war, auch die Zeile 829cdf0e10cSrcweir // ( Zeile = ItemSet ) 830cdf0e10cSrcweir sal_Bool bUpdateMode = IsUpdateMode(); 831cdf0e10cSrcweir if ( bUpdateMode ) 832cdf0e10cSrcweir SetUpdateMode( sal_False ); 833cdf0e10cSrcweir bLocked = sal_True; 834cdf0e10cSrcweir 835cdf0e10cSrcweir RemoveItem( pDockWin->GetType() ); 836cdf0e10cSrcweir 837cdf0e10cSrcweir if ( nSet && !GetItemCount( nSet ) ) 838cdf0e10cSrcweir RemoveItem( nSet ); 839cdf0e10cSrcweir 840cdf0e10cSrcweir if ( bUpdateMode ) 841cdf0e10cSrcweir SetUpdateMode( sal_True ); 842cdf0e10cSrcweir bLocked = sal_False; 843cdf0e10cSrcweir }; 844cdf0e10cSrcweir 845cdf0e10cSrcweir //------------------------------------------------------------------------- 846cdf0e10cSrcweir 847cdf0e10cSrcweir sal_Bool SfxSplitWindow::GetWindowPos( const SfxDockingWindow* pWindow, 848cdf0e10cSrcweir sal_uInt16& rLine, sal_uInt16& rPos ) const 849cdf0e10cSrcweir /* [Beschreibung] 850cdf0e10cSrcweir 851cdf0e10cSrcweir Liefert die Id des Itemsets und die des Items f"ur das "ubergebene 852cdf0e10cSrcweir DockingWindow in der alten Zeilen/Spalten-Bezeichnung zur"uck. 853cdf0e10cSrcweir */ 854cdf0e10cSrcweir 855cdf0e10cSrcweir { 856cdf0e10cSrcweir sal_uInt16 nSet = GetSet ( pWindow->GetType() ); 857cdf0e10cSrcweir if ( nSet == SPLITWINDOW_ITEM_NOTFOUND ) 858cdf0e10cSrcweir return sal_False; 859cdf0e10cSrcweir 860cdf0e10cSrcweir rPos = GetItemPos( pWindow->GetType(), nSet ); 861cdf0e10cSrcweir rLine = GetItemPos( nSet ); 862cdf0e10cSrcweir return sal_True; 863cdf0e10cSrcweir } 864cdf0e10cSrcweir 865cdf0e10cSrcweir //------------------------------------------------------------------------- 866cdf0e10cSrcweir 867cdf0e10cSrcweir sal_Bool SfxSplitWindow::GetWindowPos( const Point& rTestPos, 868cdf0e10cSrcweir sal_uInt16& rLine, sal_uInt16& rPos ) const 869cdf0e10cSrcweir /* [Beschreibung] 870cdf0e10cSrcweir 871cdf0e10cSrcweir Liefert die Id des Itemsets und die des Items f"ur das DockingWindow 872cdf0e10cSrcweir an der "ubergebenen Position in der alten Zeilen/Spalten-Bezeichnung 873cdf0e10cSrcweir zur"uck. 874cdf0e10cSrcweir */ 875cdf0e10cSrcweir 876cdf0e10cSrcweir { 877cdf0e10cSrcweir sal_uInt16 nId = GetItemId( rTestPos ); 878cdf0e10cSrcweir if ( nId == 0 ) 879cdf0e10cSrcweir return sal_False; 880cdf0e10cSrcweir 881cdf0e10cSrcweir sal_uInt16 nSet = GetSet ( nId ); 882cdf0e10cSrcweir rPos = GetItemPos( nId, nSet ); 883cdf0e10cSrcweir rLine = GetItemPos( nSet ); 884cdf0e10cSrcweir return sal_True; 885cdf0e10cSrcweir } 886cdf0e10cSrcweir 887cdf0e10cSrcweir //------------------------------------------------------------------------- 888cdf0e10cSrcweir 889cdf0e10cSrcweir sal_uInt16 SfxSplitWindow::GetLineCount() const 890cdf0e10cSrcweir 891cdf0e10cSrcweir /* [Beschreibung] 892cdf0e10cSrcweir 893cdf0e10cSrcweir Liefert die Zeilenzahl = Zahl der Sub-Itemsets im Root-Set. 894cdf0e10cSrcweir */ 895cdf0e10cSrcweir { 896cdf0e10cSrcweir return GetItemCount( 0 ); 897cdf0e10cSrcweir } 898cdf0e10cSrcweir 899cdf0e10cSrcweir //------------------------------------------------------------------------- 900cdf0e10cSrcweir 901cdf0e10cSrcweir long SfxSplitWindow::GetLineSize( sal_uInt16 nLine ) const 902cdf0e10cSrcweir 903cdf0e10cSrcweir /* [Beschreibung] 904cdf0e10cSrcweir 905cdf0e10cSrcweir Liefert die "Zeilenh"ohe" des nLine-ten Itemsets. 906cdf0e10cSrcweir */ 907cdf0e10cSrcweir { 908cdf0e10cSrcweir sal_uInt16 nId = GetItemId( nLine ); 909cdf0e10cSrcweir return GetItemSize( nId ); 910cdf0e10cSrcweir } 911cdf0e10cSrcweir 912cdf0e10cSrcweir //------------------------------------------------------------------------- 913cdf0e10cSrcweir 914cdf0e10cSrcweir sal_uInt16 SfxSplitWindow::GetWindowCount( sal_uInt16 nLine ) const 915cdf0e10cSrcweir 916cdf0e10cSrcweir /* [Beschreibung] 917cdf0e10cSrcweir 918cdf0e10cSrcweir Liefert die 919cdf0e10cSrcweir */ 920cdf0e10cSrcweir { 921cdf0e10cSrcweir sal_uInt16 nId = GetItemId( nLine ); 922cdf0e10cSrcweir return GetItemCount( nId ); 923cdf0e10cSrcweir } 924cdf0e10cSrcweir 925cdf0e10cSrcweir //------------------------------------------------------------------------- 926cdf0e10cSrcweir 927cdf0e10cSrcweir sal_uInt16 SfxSplitWindow::GetWindowCount() const 928cdf0e10cSrcweir 929cdf0e10cSrcweir /* [Beschreibung] 930cdf0e10cSrcweir 931cdf0e10cSrcweir Liefert die Gesamtzahl aller Fenstert 932cdf0e10cSrcweir */ 933cdf0e10cSrcweir { 934cdf0e10cSrcweir return GetItemCount( 0 ); 935cdf0e10cSrcweir } 936cdf0e10cSrcweir 937cdf0e10cSrcweir //------------------------------------------------------------------------- 938cdf0e10cSrcweir 939cdf0e10cSrcweir void SfxSplitWindow::Command( const CommandEvent& rCEvt ) 940cdf0e10cSrcweir { 941cdf0e10cSrcweir SplitWindow::Command( rCEvt ); 942cdf0e10cSrcweir } 943cdf0e10cSrcweir 944cdf0e10cSrcweir //------------------------------------------------------------------------- 945cdf0e10cSrcweir 946cdf0e10cSrcweir IMPL_LINK( SfxSplitWindow, TimerHdl, Timer*, pTimer) 947cdf0e10cSrcweir { 948cdf0e10cSrcweir if ( pTimer ) 949cdf0e10cSrcweir pTimer->Stop(); 950cdf0e10cSrcweir 951cdf0e10cSrcweir if ( CursorIsOverRect( sal_False ) || !pTimer ) 952cdf0e10cSrcweir { 953cdf0e10cSrcweir // Wenn der Mauszeiger innerhalb des Fensters liegt, SplitWindow anzeigen 954cdf0e10cSrcweir // und Timer zum Schlie\sen aufsetzen 955cdf0e10cSrcweir pEmptyWin->bAutoHide = sal_True; 956cdf0e10cSrcweir if ( !IsVisible() ) 957cdf0e10cSrcweir pEmptyWin->FadeIn(); 958cdf0e10cSrcweir 959cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel(); 960cdf0e10cSrcweir pEmptyWin->aTimer.Start(); 961cdf0e10cSrcweir } 962cdf0e10cSrcweir else if ( pEmptyWin->bAutoHide ) 963cdf0e10cSrcweir { 964cdf0e10cSrcweir if ( GetPointerPosPixel() != pEmptyWin->aLastPos ) 965cdf0e10cSrcweir { 966cdf0e10cSrcweir // Die Maus wurd innerhalb der Timerlaugzeit bewegt, also erst einmal 967cdf0e10cSrcweir // nichts tun 968cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel(); 969cdf0e10cSrcweir pEmptyWin->aTimer.Start(); 970cdf0e10cSrcweir return 0L; 971cdf0e10cSrcweir } 972cdf0e10cSrcweir 973cdf0e10cSrcweir // Speziell f"ur TF_AUTOSHOW_ON_MOUSEMOVE : 974cdf0e10cSrcweir // Wenn das Fenster nicht sichtbar ist, gibt es nichts zu tun 975cdf0e10cSrcweir // (Benutzer ist einfach mit der Maus "uber pEmptyWin gefahren) 976cdf0e10cSrcweir if ( IsVisible() ) 977cdf0e10cSrcweir { 978cdf0e10cSrcweir pEmptyWin->bEndAutoHide = sal_False; 979cdf0e10cSrcweir if ( !Application::IsInModalMode() && 980cdf0e10cSrcweir !PopupMenu::IsInExecute() && 981cdf0e10cSrcweir !pEmptyWin->bSplit && !HasChildPathFocus( sal_True ) ) 982cdf0e10cSrcweir { 983cdf0e10cSrcweir // W"ahrend ein modaler Dialog oder ein Popupmenu offen sind 984cdf0e10cSrcweir // oder w"ahrend des Splittens auf keinen Fall zumachen; auch 985cdf0e10cSrcweir // solange eines der Children den Focus hat, bleibt das 986cdf0e10cSrcweir // das Fenster offen 987cdf0e10cSrcweir pEmptyWin->bEndAutoHide = sal_True; 988cdf0e10cSrcweir } 989cdf0e10cSrcweir 990cdf0e10cSrcweir if ( pEmptyWin->bEndAutoHide ) 991cdf0e10cSrcweir { 992cdf0e10cSrcweir // Von mir aus kann Schlu\s sein mit AutoShow 993cdf0e10cSrcweir // Aber vielleicht will noch ein anderes SfxSplitWindow offen bleiben, 994cdf0e10cSrcweir // dann bleiben auch alle anderen offen 995cdf0e10cSrcweir if ( !pWorkWin->IsAutoHideMode( this ) ) 996cdf0e10cSrcweir { 997cdf0e10cSrcweir FadeOut_Impl(); 998cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 999cdf0e10cSrcweir } 1000cdf0e10cSrcweir else 1001cdf0e10cSrcweir { 1002cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel(); 1003cdf0e10cSrcweir pEmptyWin->aTimer.Start(); 1004cdf0e10cSrcweir } 1005cdf0e10cSrcweir } 1006cdf0e10cSrcweir else 1007cdf0e10cSrcweir { 1008cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel(); 1009cdf0e10cSrcweir pEmptyWin->aTimer.Start(); 1010cdf0e10cSrcweir } 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir } 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir return 0L; 1015cdf0e10cSrcweir } 1016cdf0e10cSrcweir 1017cdf0e10cSrcweir //------------------------------------------------------------------------- 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir sal_Bool SfxSplitWindow::CursorIsOverRect( sal_Bool bForceAdding ) const 1020cdf0e10cSrcweir { 1021cdf0e10cSrcweir sal_Bool bVisible = IsVisible(); 1022cdf0e10cSrcweir 1023cdf0e10cSrcweir // Auch das kollabierte SplitWindow ber"ucksichtigen 1024cdf0e10cSrcweir Point aPos = pEmptyWin->GetParent()->OutputToScreenPixel( pEmptyWin->GetPosPixel() ); 1025cdf0e10cSrcweir Size aSize = pEmptyWin->GetSizePixel(); 1026cdf0e10cSrcweir 1027cdf0e10cSrcweir if ( bForceAdding ) 1028cdf0e10cSrcweir { 1029cdf0e10cSrcweir // Um +/- ein paar Pixel erweitern, sonst ist es zu nerv"os 1030cdf0e10cSrcweir aPos.X() -= nPixel; 1031cdf0e10cSrcweir aPos.Y() -= nPixel; 1032cdf0e10cSrcweir aSize.Width() += 2 * nPixel; 1033cdf0e10cSrcweir aSize.Height() += 2 * nPixel; 1034cdf0e10cSrcweir } 1035cdf0e10cSrcweir 1036cdf0e10cSrcweir Rectangle aRect( aPos, aSize ); 1037cdf0e10cSrcweir 1038cdf0e10cSrcweir if ( bVisible ) 1039cdf0e10cSrcweir { 1040cdf0e10cSrcweir Point aVisPos = GetPosPixel(); 1041cdf0e10cSrcweir Size aVisSize = GetSizePixel(); 1042cdf0e10cSrcweir 1043cdf0e10cSrcweir // Um +/- ein paar Pixel erweitern, sonst ist es zu nerv"os 1044cdf0e10cSrcweir aVisPos.X() -= nPixel; 1045cdf0e10cSrcweir aVisPos.Y() -= nPixel; 1046cdf0e10cSrcweir aVisSize.Width() += 2 * nPixel; 1047cdf0e10cSrcweir aVisSize.Height() += 2 * nPixel; 1048cdf0e10cSrcweir 1049cdf0e10cSrcweir Rectangle aVisRect( aVisPos, aVisSize ); 1050cdf0e10cSrcweir aRect = aRect.GetUnion( aVisRect ); 1051cdf0e10cSrcweir } 1052cdf0e10cSrcweir 1053cdf0e10cSrcweir if ( aRect.IsInside( OutputToScreenPixel( ((Window*)this)->GetPointerPosPixel() ) ) ) 1054cdf0e10cSrcweir return sal_True; 1055cdf0e10cSrcweir return sal_False; 1056cdf0e10cSrcweir } 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir //------------------------------------------------------------------------- 1059cdf0e10cSrcweir 1060cdf0e10cSrcweir SplitWindow* SfxSplitWindow::GetSplitWindow() 1061cdf0e10cSrcweir { 1062cdf0e10cSrcweir if ( !bPinned || !pEmptyWin->bFadeIn ) 1063cdf0e10cSrcweir return pEmptyWin; 1064cdf0e10cSrcweir return this; 1065cdf0e10cSrcweir } 1066cdf0e10cSrcweir 1067cdf0e10cSrcweir //------------------------------------------------------------------------- 1068cdf0e10cSrcweir sal_Bool SfxSplitWindow::IsFadeIn() const 1069cdf0e10cSrcweir { 1070cdf0e10cSrcweir return pEmptyWin->bFadeIn; 1071cdf0e10cSrcweir } 1072cdf0e10cSrcweir 1073cdf0e10cSrcweir sal_Bool SfxSplitWindow::IsAutoHide( sal_Bool bSelf ) const 1074cdf0e10cSrcweir { 1075cdf0e10cSrcweir return bSelf ? pEmptyWin->bAutoHide && !pEmptyWin->bEndAutoHide : pEmptyWin->bAutoHide; 1076cdf0e10cSrcweir } 1077cdf0e10cSrcweir 1078cdf0e10cSrcweir //------------------------------------------------------------------------- 1079cdf0e10cSrcweir 1080cdf0e10cSrcweir void SfxSplitWindow::SetPinned_Impl( sal_Bool bOn ) 1081cdf0e10cSrcweir { 1082cdf0e10cSrcweir if ( bPinned == bOn ) 1083cdf0e10cSrcweir return; 1084cdf0e10cSrcweir 1085cdf0e10cSrcweir bPinned = bOn; 1086cdf0e10cSrcweir if ( GetItemCount( 0 ) == 0 ) 1087cdf0e10cSrcweir return; 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir if ( !bOn ) 1090cdf0e10cSrcweir { 1091cdf0e10cSrcweir pEmptyWin->nState |= 1; 1092cdf0e10cSrcweir if ( pEmptyWin->bFadeIn ) 1093cdf0e10cSrcweir { 1094cdf0e10cSrcweir // Ersatzfenster anmelden 1095cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing real Splitwindow" ); 1096cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *this ); 1097cdf0e10cSrcweir Hide(); 1098cdf0e10cSrcweir pEmptyWin->Actualize(); 1099cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - registering empty Splitwindow" ); 1100cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, sal_True )->nVisible = CHILD_VISIBLE; 1101cdf0e10cSrcweir } 1102cdf0e10cSrcweir 1103cdf0e10cSrcweir Point aPos( GetPosPixel() ); 1104cdf0e10cSrcweir aPos = GetParent()->OutputToScreenPixel( aPos ); 1105cdf0e10cSrcweir SetFloatingPos( aPos ); 1106cdf0e10cSrcweir SetFloatingMode( sal_True ); 1107cdf0e10cSrcweir GetFloatingWindow()->SetOutputSizePixel( GetOutputSizePixel() ); 1108cdf0e10cSrcweir 1109cdf0e10cSrcweir if ( pEmptyWin->bFadeIn ) 1110cdf0e10cSrcweir Show(); 1111cdf0e10cSrcweir } 1112cdf0e10cSrcweir else 1113cdf0e10cSrcweir { 1114cdf0e10cSrcweir pEmptyWin->nState &= ~1; 1115cdf0e10cSrcweir SetOutputSizePixel( GetFloatingWindow()->GetOutputSizePixel() ); 1116cdf0e10cSrcweir SetFloatingMode( sal_False ); 1117cdf0e10cSrcweir 1118cdf0e10cSrcweir if ( pEmptyWin->bFadeIn ) 1119cdf0e10cSrcweir { 1120cdf0e10cSrcweir // Ersatzfenster abmelden 1121cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing empty Splitwindow" ); 1122cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *pEmptyWin ); 1123cdf0e10cSrcweir pEmptyWin->Hide(); 1124cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - registering real Splitwindow" ); 1125cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *this, eAlign, sal_True )->nVisible = CHILD_VISIBLE; 1126cdf0e10cSrcweir } 1127cdf0e10cSrcweir } 1128cdf0e10cSrcweir 1129cdf0e10cSrcweir SetAutoHideState( !bPinned ); 1130cdf0e10cSrcweir pEmptyWin->SetAutoHideState( !bPinned ); 1131cdf0e10cSrcweir } 1132cdf0e10cSrcweir 1133cdf0e10cSrcweir //------------------------------------------------------------------------- 1134cdf0e10cSrcweir 1135cdf0e10cSrcweir void SfxSplitWindow::SetFadeIn_Impl( sal_Bool bOn ) 1136cdf0e10cSrcweir { 1137cdf0e10cSrcweir if ( bOn == pEmptyWin->bFadeIn ) 1138cdf0e10cSrcweir return; 1139cdf0e10cSrcweir 1140cdf0e10cSrcweir if ( GetItemCount( 0 ) == 0 ) 1141cdf0e10cSrcweir return; 1142cdf0e10cSrcweir 1143cdf0e10cSrcweir pEmptyWin->bFadeIn = bOn; 1144cdf0e10cSrcweir if ( bOn ) 1145cdf0e10cSrcweir { 1146cdf0e10cSrcweir pEmptyWin->nState |= 2; 1147cdf0e10cSrcweir if ( IsFloatingMode() ) 1148cdf0e10cSrcweir { 1149cdf0e10cSrcweir // FloatingWindow ist nicht sichtbar, also anzeigen 1150cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 1151cdf0e10cSrcweir Show(); 1152cdf0e10cSrcweir } 1153cdf0e10cSrcweir else 1154cdf0e10cSrcweir { 1155cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing empty Splitwindow" ); 1156cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *pEmptyWin ); 1157cdf0e10cSrcweir pEmptyWin->Hide(); 1158cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering real Splitwindow" ); 1159cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *this, eAlign, sal_True )->nVisible = CHILD_VISIBLE; 1160cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 1161cdf0e10cSrcweir pWorkWin->ShowChilds_Impl(); 1162cdf0e10cSrcweir } 1163cdf0e10cSrcweir } 1164cdf0e10cSrcweir else 1165cdf0e10cSrcweir { 1166cdf0e10cSrcweir pEmptyWin->bAutoHide = sal_False; 1167cdf0e10cSrcweir pEmptyWin->nState &= ~2; 1168cdf0e10cSrcweir if ( !IsFloatingMode() ) 1169cdf0e10cSrcweir { 1170cdf0e10cSrcweir // Das Fenster "schwebt" nicht, soll aber ausgeblendet werden, 1171cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing real Splitwindow" ); 1172cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *this ); 1173cdf0e10cSrcweir Hide(); 1174cdf0e10cSrcweir pEmptyWin->Actualize(); 1175cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering empty Splitwindow" ); 1176cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, sal_True )->nVisible = CHILD_VISIBLE; 1177cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 1178cdf0e10cSrcweir pWorkWin->ShowChilds_Impl(); 1179cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 1180cdf0e10cSrcweir } 1181cdf0e10cSrcweir else 1182cdf0e10cSrcweir { 1183cdf0e10cSrcweir Hide(); 1184cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 1185cdf0e10cSrcweir } 1186cdf0e10cSrcweir } 1187cdf0e10cSrcweir } 1188cdf0e10cSrcweir 1189cdf0e10cSrcweir void SfxSplitWindow::AutoHide() 1190cdf0e10cSrcweir { 1191cdf0e10cSrcweir // Wenn dieser Handler am "echten" SplitWindow aufgerufen wird, ist es 1192cdf0e10cSrcweir // entweder angedockt und soll "schwebend" angezeigt werden oder umgekehrt 1193cdf0e10cSrcweir if ( !bPinned ) 1194cdf0e10cSrcweir { 1195cdf0e10cSrcweir // Es "schwebt", also wieder andocken 1196cdf0e10cSrcweir SetPinned_Impl( sal_True ); 1197cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 1198cdf0e10cSrcweir } 1199cdf0e10cSrcweir else 1200cdf0e10cSrcweir { 1201cdf0e10cSrcweir // In den "Schwebezustand" bringen 1202cdf0e10cSrcweir SetPinned_Impl( sal_False ); 1203cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 1204cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 1205cdf0e10cSrcweir } 1206cdf0e10cSrcweir 1207cdf0e10cSrcweir pWorkWin->ShowChilds_Impl(); 1208cdf0e10cSrcweir SaveConfig_Impl(); 1209cdf0e10cSrcweir } 1210cdf0e10cSrcweir 1211cdf0e10cSrcweir void SfxSplitWindow::FadeOut_Impl() 1212cdf0e10cSrcweir { 1213cdf0e10cSrcweir if ( pEmptyWin->aTimer.IsActive() ) 1214cdf0e10cSrcweir { 1215cdf0e10cSrcweir pEmptyWin->bAutoHide = sal_False; 1216cdf0e10cSrcweir pEmptyWin->aTimer.Stop(); 1217cdf0e10cSrcweir } 1218cdf0e10cSrcweir 1219cdf0e10cSrcweir SetFadeIn_Impl( sal_False ); 1220cdf0e10cSrcweir Show_Impl(); 1221cdf0e10cSrcweir } 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir void SfxSplitWindow::FadeOut() 1224cdf0e10cSrcweir { 1225cdf0e10cSrcweir FadeOut_Impl(); 1226cdf0e10cSrcweir SaveConfig_Impl(); 1227cdf0e10cSrcweir } 1228cdf0e10cSrcweir 1229cdf0e10cSrcweir void SfxSplitWindow::FadeIn() 1230cdf0e10cSrcweir { 1231cdf0e10cSrcweir SetFadeIn_Impl( sal_True ); 1232cdf0e10cSrcweir Show_Impl(); 1233cdf0e10cSrcweir } 1234cdf0e10cSrcweir 1235cdf0e10cSrcweir void SfxSplitWindow::Show_Impl() 1236cdf0e10cSrcweir { 1237cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count(); 1238cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ ) 1239cdf0e10cSrcweir { 1240cdf0e10cSrcweir SfxDock_Impl *pDock = (*pDockArr)[n]; 1241cdf0e10cSrcweir if ( pDock->pWin ) 1242cdf0e10cSrcweir pDock->pWin->FadeIn( pEmptyWin->bFadeIn ); 1243cdf0e10cSrcweir } 1244cdf0e10cSrcweir } 1245cdf0e10cSrcweir /* 1246cdf0e10cSrcweir void SfxSplitWindow::Pin_Impl( sal_Bool bPin ) 1247cdf0e10cSrcweir { 1248cdf0e10cSrcweir if ( bPinned != bPin ) 1249cdf0e10cSrcweir AutoHide(); 1250cdf0e10cSrcweir } 1251cdf0e10cSrcweir */ 1252cdf0e10cSrcweir sal_Bool SfxSplitWindow::ActivateNextChild_Impl( sal_Bool bForward ) 1253cdf0e10cSrcweir { 1254cdf0e10cSrcweir // Wenn kein pActive, auf erstes bzw. letztes Fenster gehen ( bei !bForward wird erst in der loop dekrementiert ) 1255cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count(); 1256cdf0e10cSrcweir sal_uInt16 n = bForward ? 0 : nCount; 1257cdf0e10cSrcweir 1258cdf0e10cSrcweir // Wenn Focus innerhalb, dann ein Fenster vor oder zur"uck, wenn m"oglich 1259cdf0e10cSrcweir if ( pActive ) 1260cdf0e10cSrcweir { 1261cdf0e10cSrcweir // Aktives Fenster ermitteln 1262cdf0e10cSrcweir for ( n=0; n<nCount; n++ ) 1263cdf0e10cSrcweir { 1264cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[n]; 1265cdf0e10cSrcweir if ( pD->pWin && pD->pWin->HasChildPathFocus() ) 1266cdf0e10cSrcweir break; 1267cdf0e10cSrcweir } 1268cdf0e10cSrcweir 1269cdf0e10cSrcweir if ( bForward ) 1270cdf0e10cSrcweir // ein Fenster weiter ( wenn dann n>nCount, wird die Schleife unten gar nicht durchlaufen ) 1271cdf0e10cSrcweir n++; 1272cdf0e10cSrcweir } 1273cdf0e10cSrcweir 1274cdf0e10cSrcweir if ( bForward ) 1275cdf0e10cSrcweir { 1276cdf0e10cSrcweir // N"achstes Fenster suchen 1277cdf0e10cSrcweir for ( sal_uInt16 nNext=n; nNext<nCount; nNext++ ) 1278cdf0e10cSrcweir { 1279cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[nNext]; 1280cdf0e10cSrcweir if ( pD->pWin ) 1281cdf0e10cSrcweir { 1282cdf0e10cSrcweir pD->pWin->GrabFocus(); 1283cdf0e10cSrcweir return sal_True; 1284cdf0e10cSrcweir } 1285cdf0e10cSrcweir } 1286cdf0e10cSrcweir } 1287cdf0e10cSrcweir else 1288cdf0e10cSrcweir { 1289cdf0e10cSrcweir // Vorheriges Fenster suchen 1290cdf0e10cSrcweir for ( sal_uInt16 nNext=n; nNext--; ) 1291cdf0e10cSrcweir { 1292cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[nNext]; 1293cdf0e10cSrcweir if ( pD->pWin ) 1294cdf0e10cSrcweir { 1295cdf0e10cSrcweir pD->pWin->GrabFocus(); 1296cdf0e10cSrcweir return sal_True; 1297cdf0e10cSrcweir } 1298cdf0e10cSrcweir } 1299cdf0e10cSrcweir } 1300cdf0e10cSrcweir 1301cdf0e10cSrcweir return sal_False; 1302cdf0e10cSrcweir } 1303cdf0e10cSrcweir 1304cdf0e10cSrcweir void SfxSplitWindow::SetActiveWindow_Impl( SfxDockingWindow* pWin ) 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir pActive = pWin; 1307cdf0e10cSrcweir pWorkWin->SetActiveChild_Impl( this ); 1308cdf0e10cSrcweir } 1309cdf0e10cSrcweir 1310cdf0e10cSrcweir 1311