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