1d119d52dSAndrew Rist /************************************************************** 2*3b720757SAriel Constenla-Haile * 3d119d52dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4d119d52dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5d119d52dSAndrew Rist * distributed with this work for additional information 6d119d52dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7d119d52dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8d119d52dSAndrew Rist * "License"); you may not use this file except in compliance 9d119d52dSAndrew Rist * with the License. You may obtain a copy of the License at 10*3b720757SAriel Constenla-Haile * 11d119d52dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*3b720757SAriel Constenla-Haile * 13d119d52dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14d119d52dSAndrew Rist * software distributed under the License is distributed on an 15d119d52dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16d119d52dSAndrew Rist * KIND, either express or implied. See the License for the 17d119d52dSAndrew Rist * specific language governing permissions and limitations 18d119d52dSAndrew Rist * under the License. 19*3b720757SAriel Constenla-Haile * 20d119d52dSAndrew Rist *************************************************************/ 21d119d52dSAndrew Rist 22d119d52dSAndrew 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; 64*3b720757SAriel Constenla-Haile SfxDockingWindow* pWin; // SplitWindow hat dieses Fenster 65cdf0e10cSrcweir sal_Bool bNewLine; 66*3b720757SAriel Constenla-Haile sal_Bool bHide; // SplitWindow hatte dieses Fenster 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 78*3b720757SAriel Constenla-Haile Das SfxEmptySplitWin_Impldow ist ein leeres SplitWindow, das das SfxSplitWindow 79*3b720757SAriel Constenla-Haile im AutoHide-Modus ersetzt. Es dient nur als Platzhalter, um MouseMoves 80*3b720757SAriel Constenla-Haile zu empfangen und ggf. das eigentlichte SplitWindow einzublenden 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 { 157*3b720757SAriel Constenla-Haile // Timer zum Schlie\sen aufsetzen; der Aufrufer mu\s selbst sicherstellen, 158*3b720757SAriel Constenla-Haile // da\s das Window nicht gleich wieder zu geht ( z.B. durch Setzen des 159*3b720757SAriel Constenla-Haile // Focus oder einen modal mode ) 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 437*3b720757SAriel Constenla-Haile Zum Einf"ugen von SfxDockingWindows kann auch keine Position "ubergeben 438*3b720757SAriel Constenla-Haile werden. Das SfxSplitWindow sucht dann die zuletzt gemerkte zu dem 439*3b720757SAriel Constenla-Haile "ubergebenen SfxDockingWindow heraus oder h"angt es als letztes neu an. 440cdf0e10cSrcweir 441cdf0e10cSrcweir */ 442cdf0e10cSrcweir { 443*3b720757SAriel Constenla-Haile short nLine = -1; // damit erstes Fenster nLine auf 0 hochsetzen kann 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 { 455*3b720757SAriel Constenla-Haile // Das Fenster er"offnet eine neue Zeile 456cdf0e10cSrcweir if ( pFoundDock ) 457*3b720757SAriel Constenla-Haile // Aber hinter dem gerade eingef"ugten Fenster 458cdf0e10cSrcweir break; 459cdf0e10cSrcweir 460*3b720757SAriel Constenla-Haile // Neue Zeile 461cdf0e10cSrcweir nPos = 0; 462cdf0e10cSrcweir bNewLine = sal_True; 463cdf0e10cSrcweir } 464cdf0e10cSrcweir 465cdf0e10cSrcweir if ( pDock->pWin ) 466cdf0e10cSrcweir { 467*3b720757SAriel Constenla-Haile // Es gibt an dieser Stelle gerade ein Fenster 468cdf0e10cSrcweir if ( bNewLine && !pFoundDock ) 469cdf0e10cSrcweir { 470*3b720757SAriel Constenla-Haile // Bisher ist nicht bekannt, in welcher realen Zeile es liegt 471cdf0e10cSrcweir GetWindowPos( pDock->pWin, nL, nPos ); 472cdf0e10cSrcweir nLine = (short) nL; 473cdf0e10cSrcweir } 474cdf0e10cSrcweir 475cdf0e10cSrcweir if ( !pFoundDock ) 476cdf0e10cSrcweir { 477*3b720757SAriel Constenla-Haile // Fenster liegt vor dem eingef"ugten 478cdf0e10cSrcweir nPos++; 479cdf0e10cSrcweir } 480cdf0e10cSrcweir 481*3b720757SAriel Constenla-Haile // Zeile ist schon er"offnet 482cdf0e10cSrcweir bNewLine = sal_False; 483cdf0e10cSrcweir if ( pFoundDock ) 484cdf0e10cSrcweir break; 485cdf0e10cSrcweir } 486cdf0e10cSrcweir 487cdf0e10cSrcweir if ( pDock->nType == pDockWin->GetType() ) 488cdf0e10cSrcweir { 489*3b720757SAriel Constenla-Haile DBG_ASSERT( !pFoundDock && !pDock->pWin, "Fenster ist schon vorhanden!"); 490cdf0e10cSrcweir pFoundDock = pDock; 491cdf0e10cSrcweir if ( !bNewLine ) 492cdf0e10cSrcweir break; 493cdf0e10cSrcweir else 494cdf0e10cSrcweir { 495*3b720757SAriel Constenla-Haile // Es wurde zuletzt eine neue Reihe gestartet, aber noch kein 496*3b720757SAriel Constenla-Haile // darin liegendes Fenster gefunden; daher weitersuchen, ob noch 497*3b720757SAriel Constenla-Haile // ein Fenster in dieser Zeile folgt, um bNewLine korrekt zu setzen. 498*3b720757SAriel Constenla-Haile // Dabei darf aber nLine oder nPos nicht mehr ver"andert werden! 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 531*3b720757SAriel Constenla-Haile Das DockingWindow wird nicht mehr in den internen Daten gespeichert. 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 610*3b720757SAriel Constenla-Haile DBG_ASSERT( nPos==0 || !bNewLine, "Falsche Paramenter!"); 611cdf0e10cSrcweir if ( bNewLine ) 612cdf0e10cSrcweir nPos = 0; 613cdf0e10cSrcweir 614*3b720757SAriel Constenla-Haile // Das Fenster mu\s vor dem ersten Fenster eingef"ugt werden, das die 615*3b720757SAriel Constenla-Haile // gleiche oder eine gr"o\sere Position hat als pDockWin. 6160abcfe85SEric Bachard sal_uInt16 nCount = pDockArr->Count(); 617cdf0e10cSrcweir 618*3b720757SAriel Constenla-Haile // Wenn gar kein Fenster gefunden wird, wird als erstes eingef"ugt 619cdf0e10cSrcweir sal_uInt16 nInsertPos = 0; 620cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ ) 621cdf0e10cSrcweir { 622cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[n]; 623cdf0e10cSrcweir 624cdf0e10cSrcweir if (pD->pWin) 625cdf0e10cSrcweir { 626cdf0e10cSrcweir // Ein angedocktes Fenster wurde gefunden 627cdf0e10cSrcweir // Wenn kein geeignetes Fenster hinter der gew"unschten Einf"ugeposition 628cdf0e10cSrcweir // gefunden wird, wird am Ende eingef"ugt 629cdf0e10cSrcweir nInsertPos = nCount; 630cdf0e10cSrcweir sal_uInt16 nL=0, nP=0; 631cdf0e10cSrcweir GetWindowPos( pD->pWin, nL, nP ); 632cdf0e10cSrcweir 633cdf0e10cSrcweir if ( (nL == nLine && nP == nPos) || nL > nLine ) 634cdf0e10cSrcweir { 635*3b720757SAriel Constenla-Haile DBG_ASSERT( nL == nLine || bNewLine || nPos > 0, "Falsche Parameter!" ); 636cdf0e10cSrcweir if ( nL == nLine && nPos == 0 && !bNewLine ) 637cdf0e10cSrcweir { 638*3b720757SAriel Constenla-Haile DBG_ASSERT(pD->bNewLine, "Keine neue Zeile?"); 639cdf0e10cSrcweir 640cdf0e10cSrcweir // Das Fenster wird auf nPos==0 eingeschoben 641cdf0e10cSrcweir pD->bNewLine = sal_False; 642cdf0e10cSrcweir pDock->bNewLine = sal_True; 643cdf0e10cSrcweir } 644cdf0e10cSrcweir 645*3b720757SAriel Constenla-Haile nInsertPos = n; 646cdf0e10cSrcweir break; 647cdf0e10cSrcweir } 648cdf0e10cSrcweir } 649cdf0e10cSrcweir } 650cdf0e10cSrcweir 651cdf0e10cSrcweir pDockArr->Insert(pDock, nInsertPos); 652cdf0e10cSrcweir InsertWindow_Impl( pDock, rSize, nLine, nPos, bNewLine ); 653cdf0e10cSrcweir SaveConfig_Impl(); 654cdf0e10cSrcweir } 655cdf0e10cSrcweir 656cdf0e10cSrcweir //------------------------------------------------------------------------- 657cdf0e10cSrcweir 658cdf0e10cSrcweir void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, 659cdf0e10cSrcweir const Size& rSize, 660cdf0e10cSrcweir sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine) 661cdf0e10cSrcweir 662cdf0e10cSrcweir /* [Beschreibung] 663cdf0e10cSrcweir 664cdf0e10cSrcweir F"ugt ein DockingWindow ein und veranla\st die Neuberechnung der Gr"o\se 665cdf0e10cSrcweir des Splitwindows. 666cdf0e10cSrcweir */ 667cdf0e10cSrcweir 668cdf0e10cSrcweir { 669cdf0e10cSrcweir SfxDockingWindow* pDockWin = pDock->pWin; 670cdf0e10cSrcweir 671cdf0e10cSrcweir sal_uInt16 nItemBits = pDockWin->GetWinBits_Impl(); 672cdf0e10cSrcweir 673cdf0e10cSrcweir long nWinSize, nSetSize; 674cdf0e10cSrcweir if ( IsHorizontal() ) 675cdf0e10cSrcweir { 676cdf0e10cSrcweir nWinSize = rSize.Width(); 677cdf0e10cSrcweir nSetSize = rSize.Height(); 678cdf0e10cSrcweir } 679cdf0e10cSrcweir else 680cdf0e10cSrcweir { 681cdf0e10cSrcweir nSetSize = rSize.Width(); 682cdf0e10cSrcweir nWinSize = rSize.Height(); 683cdf0e10cSrcweir } 684cdf0e10cSrcweir 685cdf0e10cSrcweir pDock->nSize = nWinSize; 686cdf0e10cSrcweir 687cdf0e10cSrcweir sal_Bool bUpdateMode = IsUpdateMode(); 688cdf0e10cSrcweir if ( bUpdateMode ) 689cdf0e10cSrcweir SetUpdateMode( sal_False ); 690cdf0e10cSrcweir 691cdf0e10cSrcweir if ( bNewLine || nLine == GetItemCount( 0 ) ) 692cdf0e10cSrcweir { 693cdf0e10cSrcweir // Es soll nicht in eine vorhandene Zeile eingef"ugt werden, sondern 694cdf0e10cSrcweir // eine neue erzeugt werden 695cdf0e10cSrcweir 696cdf0e10cSrcweir sal_uInt16 nId = 1; 697cdf0e10cSrcweir for ( sal_uInt16 n=0; n<GetItemCount(0); n++ ) 698cdf0e10cSrcweir { 699cdf0e10cSrcweir if ( GetItemId(n) >= nId ) 700cdf0e10cSrcweir nId = GetItemId(n)+1; 701cdf0e10cSrcweir } 702cdf0e10cSrcweir 703cdf0e10cSrcweir // Eine neue nLine-te Zeile erzeugen 704cdf0e10cSrcweir sal_uInt16 nBits = nItemBits; 705cdf0e10cSrcweir if ( GetAlign() == WINDOWALIGN_TOP || GetAlign() == WINDOWALIGN_BOTTOM ) 706cdf0e10cSrcweir nBits |= SWIB_COLSET; 707cdf0e10cSrcweir InsertItem( nId, nSetSize, nLine, 0, nBits ); 708cdf0e10cSrcweir } 709cdf0e10cSrcweir 710cdf0e10cSrcweir // In Zeile mit Position nLine das Fenster einf"ugen 711cdf0e10cSrcweir // ItemWindowSize auf "Prozentual" setzen, da SV dann das Umgr"o\sern 712cdf0e10cSrcweir // so macht, wie man erwartet; "Pixel" macht eigentlich nur Sinn, wenn 713cdf0e10cSrcweir // auch Items mit prozentualen oder relativen Gr"o\sen dabei sind. 714cdf0e10cSrcweir nItemBits |= SWIB_PERCENTSIZE; 715cdf0e10cSrcweir bLocked = sal_True; 716cdf0e10cSrcweir sal_uInt16 nSet = GetItemId( nLine ); 717cdf0e10cSrcweir InsertItem( pDockWin->GetType(), pDockWin, nWinSize, nPos, nSet, nItemBits ); 718cdf0e10cSrcweir 719cdf0e10cSrcweir // Splitwindows werden im SFX einmal angelegt und beim Einf"ugen des ersten 720cdf0e10cSrcweir // DockingWindows sichtbar gemacht. 721cdf0e10cSrcweir if ( GetItemCount( 0 ) == 1 && GetItemCount( 1 ) == 1 ) 722cdf0e10cSrcweir { 723cdf0e10cSrcweir // Das Neuarrangieren am WorkWindow und ein Show() auf das SplitWindow 724cdf0e10cSrcweir // wird vom SfxDockingwindow veranla\st (->SfxWorkWindow::ConfigChild_Impl) 725cdf0e10cSrcweir if ( !bPinned && !IsFloatingMode() ) 726cdf0e10cSrcweir { 727cdf0e10cSrcweir bPinned = sal_True; 728cdf0e10cSrcweir sal_Bool bFadeIn = ( pEmptyWin->nState & 2 ) != 0; 729cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_False; 730cdf0e10cSrcweir SetPinned_Impl( sal_False ); 731cdf0e10cSrcweir pEmptyWin->Actualize(); 732cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" ); 733cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, sal_True )->nVisible = CHILD_VISIBLE; 734cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 735cdf0e10cSrcweir if ( bFadeIn ) 736cdf0e10cSrcweir FadeIn(); 737cdf0e10cSrcweir } 738cdf0e10cSrcweir else 739cdf0e10cSrcweir { 740cdf0e10cSrcweir sal_Bool bFadeIn = ( pEmptyWin->nState & 2 ) != 0; 741cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_False; 742cdf0e10cSrcweir pEmptyWin->Actualize(); 743cdf0e10cSrcweir #ifdef DBG_UTIL 744cdf0e10cSrcweir if ( !bPinned || !pEmptyWin->bFadeIn ) 745cdf0e10cSrcweir { 746cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" ); 747cdf0e10cSrcweir } 748cdf0e10cSrcweir else 749cdf0e10cSrcweir { 750cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering real Splitwindow" ); 751cdf0e10cSrcweir } 752cdf0e10cSrcweir #endif 753cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, sal_True )->nVisible = CHILD_VISIBLE; 754cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 755cdf0e10cSrcweir if ( bFadeIn ) 756cdf0e10cSrcweir FadeIn(); 757cdf0e10cSrcweir } 758cdf0e10cSrcweir 759cdf0e10cSrcweir pWorkWin->ShowChilds_Impl(); 760cdf0e10cSrcweir } 761cdf0e10cSrcweir 762cdf0e10cSrcweir if ( bUpdateMode ) 763cdf0e10cSrcweir SetUpdateMode( sal_True ); 764cdf0e10cSrcweir bLocked = sal_False; 765cdf0e10cSrcweir } 766cdf0e10cSrcweir 767cdf0e10cSrcweir //------------------------------------------------------------------------- 768cdf0e10cSrcweir 769cdf0e10cSrcweir void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, sal_Bool bHide ) 770cdf0e10cSrcweir 771cdf0e10cSrcweir /* [Beschreibung] 772cdf0e10cSrcweir 773cdf0e10cSrcweir Entfernt ein DockingWindow. Wenn es das letzte war, wird das SplitWindow 774cdf0e10cSrcweir gehidet. 775cdf0e10cSrcweir */ 776cdf0e10cSrcweir { 777cdf0e10cSrcweir sal_uInt16 nSet = GetSet( pDockWin->GetType() ); 778cdf0e10cSrcweir 779cdf0e10cSrcweir // Splitwindows werden im SFX einmal angelegt und nach dem Entfernen 780cdf0e10cSrcweir // des letzten DockingWindows unsichtbar gemacht. 781cdf0e10cSrcweir if ( GetItemCount( nSet ) == 1 && GetItemCount( 0 ) == 1 ) 782cdf0e10cSrcweir { 783cdf0e10cSrcweir // Das Neuarrangieren am WorkWindow wird vom SfxDockingwindow 784cdf0e10cSrcweir // veranla\st! 785cdf0e10cSrcweir Hide(); 786cdf0e10cSrcweir pEmptyWin->aTimer.Stop(); 787cdf0e10cSrcweir sal_uInt16 nRealState = pEmptyWin->nState; 788cdf0e10cSrcweir FadeOut_Impl(); 789cdf0e10cSrcweir pEmptyWin->Hide(); 790cdf0e10cSrcweir #ifdef DBG_UTIL 791cdf0e10cSrcweir if ( !bPinned || !pEmptyWin->bFadeIn ) 792cdf0e10cSrcweir { 793cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::RemoveWindow - releasing empty Splitwindow" ); 794cdf0e10cSrcweir } 795cdf0e10cSrcweir else 796cdf0e10cSrcweir { 797cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::RemoveWindow - releasing real Splitwindow" ); 798cdf0e10cSrcweir } 799cdf0e10cSrcweir #endif 800cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *GetSplitWindow() ); 801cdf0e10cSrcweir pEmptyWin->nState = nRealState; 802cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 803cdf0e10cSrcweir } 804cdf0e10cSrcweir 805cdf0e10cSrcweir SfxDock_Impl *pDock=0; 806cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count(); 807cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ ) 808cdf0e10cSrcweir { 809cdf0e10cSrcweir pDock = (*pDockArr)[n]; 810cdf0e10cSrcweir if ( pDock->nType == pDockWin->GetType() ) 811cdf0e10cSrcweir { 812cdf0e10cSrcweir pDock->pWin = 0; 813cdf0e10cSrcweir pDock->bHide = bHide; 814cdf0e10cSrcweir break; 815cdf0e10cSrcweir } 816cdf0e10cSrcweir } 817cdf0e10cSrcweir 818cdf0e10cSrcweir // Fenster removen, und wenn es das letzte der Zeile war, auch die Zeile 819cdf0e10cSrcweir // ( Zeile = ItemSet ) 820cdf0e10cSrcweir sal_Bool bUpdateMode = IsUpdateMode(); 821cdf0e10cSrcweir if ( bUpdateMode ) 822cdf0e10cSrcweir SetUpdateMode( sal_False ); 823cdf0e10cSrcweir bLocked = sal_True; 824cdf0e10cSrcweir 825cdf0e10cSrcweir RemoveItem( pDockWin->GetType() ); 826cdf0e10cSrcweir 827cdf0e10cSrcweir if ( nSet && !GetItemCount( nSet ) ) 828cdf0e10cSrcweir RemoveItem( nSet ); 829cdf0e10cSrcweir 830cdf0e10cSrcweir if ( bUpdateMode ) 831cdf0e10cSrcweir SetUpdateMode( sal_True ); 832cdf0e10cSrcweir bLocked = sal_False; 833cdf0e10cSrcweir }; 834cdf0e10cSrcweir 835cdf0e10cSrcweir //------------------------------------------------------------------------- 836cdf0e10cSrcweir 837cdf0e10cSrcweir sal_Bool SfxSplitWindow::GetWindowPos( const SfxDockingWindow* pWindow, 838cdf0e10cSrcweir sal_uInt16& rLine, sal_uInt16& rPos ) const 839cdf0e10cSrcweir /* [Beschreibung] 840cdf0e10cSrcweir 841cdf0e10cSrcweir Liefert die Id des Itemsets und die des Items f"ur das "ubergebene 842cdf0e10cSrcweir DockingWindow in der alten Zeilen/Spalten-Bezeichnung zur"uck. 843cdf0e10cSrcweir */ 844cdf0e10cSrcweir 845cdf0e10cSrcweir { 846cdf0e10cSrcweir sal_uInt16 nSet = GetSet ( pWindow->GetType() ); 847cdf0e10cSrcweir if ( nSet == SPLITWINDOW_ITEM_NOTFOUND ) 848cdf0e10cSrcweir return sal_False; 849cdf0e10cSrcweir 850cdf0e10cSrcweir rPos = GetItemPos( pWindow->GetType(), nSet ); 851cdf0e10cSrcweir rLine = GetItemPos( nSet ); 852cdf0e10cSrcweir return sal_True; 853cdf0e10cSrcweir } 854cdf0e10cSrcweir 855cdf0e10cSrcweir //------------------------------------------------------------------------- 856cdf0e10cSrcweir 857cdf0e10cSrcweir sal_Bool SfxSplitWindow::GetWindowPos( const Point& rTestPos, 858cdf0e10cSrcweir sal_uInt16& rLine, sal_uInt16& rPos ) const 859cdf0e10cSrcweir /* [Beschreibung] 860cdf0e10cSrcweir 861cdf0e10cSrcweir Liefert die Id des Itemsets und die des Items f"ur das DockingWindow 862cdf0e10cSrcweir an der "ubergebenen Position in der alten Zeilen/Spalten-Bezeichnung 863cdf0e10cSrcweir zur"uck. 864cdf0e10cSrcweir */ 865cdf0e10cSrcweir 866cdf0e10cSrcweir { 867cdf0e10cSrcweir sal_uInt16 nId = GetItemId( rTestPos ); 868cdf0e10cSrcweir if ( nId == 0 ) 869cdf0e10cSrcweir return sal_False; 870cdf0e10cSrcweir 871cdf0e10cSrcweir sal_uInt16 nSet = GetSet ( nId ); 872cdf0e10cSrcweir rPos = GetItemPos( nId, nSet ); 873cdf0e10cSrcweir rLine = GetItemPos( nSet ); 874cdf0e10cSrcweir return sal_True; 875cdf0e10cSrcweir } 876cdf0e10cSrcweir 877cdf0e10cSrcweir //------------------------------------------------------------------------- 878cdf0e10cSrcweir 879cdf0e10cSrcweir sal_uInt16 SfxSplitWindow::GetLineCount() const 880cdf0e10cSrcweir 881cdf0e10cSrcweir /* [Beschreibung] 882cdf0e10cSrcweir 883cdf0e10cSrcweir Liefert die Zeilenzahl = Zahl der Sub-Itemsets im Root-Set. 884cdf0e10cSrcweir */ 885cdf0e10cSrcweir { 886cdf0e10cSrcweir return GetItemCount( 0 ); 887cdf0e10cSrcweir } 888cdf0e10cSrcweir 889cdf0e10cSrcweir //------------------------------------------------------------------------- 890cdf0e10cSrcweir 891cdf0e10cSrcweir long SfxSplitWindow::GetLineSize( sal_uInt16 nLine ) const 892cdf0e10cSrcweir 893cdf0e10cSrcweir /* [Beschreibung] 894cdf0e10cSrcweir 895cdf0e10cSrcweir Liefert die "Zeilenh"ohe" des nLine-ten Itemsets. 896cdf0e10cSrcweir */ 897cdf0e10cSrcweir { 898cdf0e10cSrcweir sal_uInt16 nId = GetItemId( nLine ); 899cdf0e10cSrcweir return GetItemSize( nId ); 900cdf0e10cSrcweir } 901cdf0e10cSrcweir 902cdf0e10cSrcweir //------------------------------------------------------------------------- 903cdf0e10cSrcweir 904cdf0e10cSrcweir sal_uInt16 SfxSplitWindow::GetWindowCount( sal_uInt16 nLine ) const 905cdf0e10cSrcweir 906cdf0e10cSrcweir /* [Beschreibung] 907cdf0e10cSrcweir 908cdf0e10cSrcweir Liefert die 909cdf0e10cSrcweir */ 910cdf0e10cSrcweir { 911cdf0e10cSrcweir sal_uInt16 nId = GetItemId( nLine ); 912cdf0e10cSrcweir return GetItemCount( nId ); 913cdf0e10cSrcweir } 914cdf0e10cSrcweir 915cdf0e10cSrcweir //------------------------------------------------------------------------- 916cdf0e10cSrcweir 917cdf0e10cSrcweir sal_uInt16 SfxSplitWindow::GetWindowCount() const 918cdf0e10cSrcweir 919cdf0e10cSrcweir /* [Beschreibung] 920cdf0e10cSrcweir 921cdf0e10cSrcweir Liefert die Gesamtzahl aller Fenstert 922cdf0e10cSrcweir */ 923cdf0e10cSrcweir { 924cdf0e10cSrcweir return GetItemCount( 0 ); 925cdf0e10cSrcweir } 926cdf0e10cSrcweir 927cdf0e10cSrcweir //------------------------------------------------------------------------- 928cdf0e10cSrcweir 929cdf0e10cSrcweir void SfxSplitWindow::Command( const CommandEvent& rCEvt ) 930cdf0e10cSrcweir { 931cdf0e10cSrcweir SplitWindow::Command( rCEvt ); 932cdf0e10cSrcweir } 933cdf0e10cSrcweir 934cdf0e10cSrcweir //------------------------------------------------------------------------- 935cdf0e10cSrcweir 936cdf0e10cSrcweir IMPL_LINK( SfxSplitWindow, TimerHdl, Timer*, pTimer) 937cdf0e10cSrcweir { 938cdf0e10cSrcweir if ( pTimer ) 939cdf0e10cSrcweir pTimer->Stop(); 940cdf0e10cSrcweir 941cdf0e10cSrcweir if ( CursorIsOverRect( sal_False ) || !pTimer ) 942cdf0e10cSrcweir { 943cdf0e10cSrcweir // Wenn der Mauszeiger innerhalb des Fensters liegt, SplitWindow anzeigen 944cdf0e10cSrcweir // und Timer zum Schlie\sen aufsetzen 945cdf0e10cSrcweir pEmptyWin->bAutoHide = sal_True; 946cdf0e10cSrcweir if ( !IsVisible() ) 947cdf0e10cSrcweir pEmptyWin->FadeIn(); 948cdf0e10cSrcweir 949cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel(); 950cdf0e10cSrcweir pEmptyWin->aTimer.Start(); 951cdf0e10cSrcweir } 952cdf0e10cSrcweir else if ( pEmptyWin->bAutoHide ) 953cdf0e10cSrcweir { 954cdf0e10cSrcweir if ( GetPointerPosPixel() != pEmptyWin->aLastPos ) 955cdf0e10cSrcweir { 956cdf0e10cSrcweir // Die Maus wurd innerhalb der Timerlaugzeit bewegt, also erst einmal 957cdf0e10cSrcweir // nichts tun 958cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel(); 959cdf0e10cSrcweir pEmptyWin->aTimer.Start(); 960cdf0e10cSrcweir return 0L; 961cdf0e10cSrcweir } 962cdf0e10cSrcweir 963cdf0e10cSrcweir // Speziell f"ur TF_AUTOSHOW_ON_MOUSEMOVE : 964cdf0e10cSrcweir // Wenn das Fenster nicht sichtbar ist, gibt es nichts zu tun 965cdf0e10cSrcweir // (Benutzer ist einfach mit der Maus "uber pEmptyWin gefahren) 966cdf0e10cSrcweir if ( IsVisible() ) 967cdf0e10cSrcweir { 968cdf0e10cSrcweir pEmptyWin->bEndAutoHide = sal_False; 969cdf0e10cSrcweir if ( !Application::IsInModalMode() && 970cdf0e10cSrcweir !PopupMenu::IsInExecute() && 971cdf0e10cSrcweir !pEmptyWin->bSplit && !HasChildPathFocus( sal_True ) ) 972cdf0e10cSrcweir { 973cdf0e10cSrcweir // W"ahrend ein modaler Dialog oder ein Popupmenu offen sind 974cdf0e10cSrcweir // oder w"ahrend des Splittens auf keinen Fall zumachen; auch 975cdf0e10cSrcweir // solange eines der Children den Focus hat, bleibt das 976cdf0e10cSrcweir // das Fenster offen 977cdf0e10cSrcweir pEmptyWin->bEndAutoHide = sal_True; 978cdf0e10cSrcweir } 979cdf0e10cSrcweir 980cdf0e10cSrcweir if ( pEmptyWin->bEndAutoHide ) 981cdf0e10cSrcweir { 982cdf0e10cSrcweir // Von mir aus kann Schlu\s sein mit AutoShow 983cdf0e10cSrcweir // Aber vielleicht will noch ein anderes SfxSplitWindow offen bleiben, 984cdf0e10cSrcweir // dann bleiben auch alle anderen offen 985cdf0e10cSrcweir if ( !pWorkWin->IsAutoHideMode( this ) ) 986cdf0e10cSrcweir { 987cdf0e10cSrcweir FadeOut_Impl(); 988cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 989cdf0e10cSrcweir } 990cdf0e10cSrcweir else 991cdf0e10cSrcweir { 992cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel(); 993cdf0e10cSrcweir pEmptyWin->aTimer.Start(); 994cdf0e10cSrcweir } 995cdf0e10cSrcweir } 996cdf0e10cSrcweir else 997cdf0e10cSrcweir { 998cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel(); 999cdf0e10cSrcweir pEmptyWin->aTimer.Start(); 1000cdf0e10cSrcweir } 1001cdf0e10cSrcweir } 1002cdf0e10cSrcweir } 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir return 0L; 1005cdf0e10cSrcweir } 1006cdf0e10cSrcweir 1007cdf0e10cSrcweir //------------------------------------------------------------------------- 1008cdf0e10cSrcweir 1009cdf0e10cSrcweir sal_Bool SfxSplitWindow::CursorIsOverRect( sal_Bool bForceAdding ) const 1010cdf0e10cSrcweir { 1011cdf0e10cSrcweir sal_Bool bVisible = IsVisible(); 1012cdf0e10cSrcweir 1013cdf0e10cSrcweir // Auch das kollabierte SplitWindow ber"ucksichtigen 1014cdf0e10cSrcweir Point aPos = pEmptyWin->GetParent()->OutputToScreenPixel( pEmptyWin->GetPosPixel() ); 1015cdf0e10cSrcweir Size aSize = pEmptyWin->GetSizePixel(); 1016cdf0e10cSrcweir 1017cdf0e10cSrcweir if ( bForceAdding ) 1018cdf0e10cSrcweir { 1019cdf0e10cSrcweir // Um +/- ein paar Pixel erweitern, sonst ist es zu nerv"os 1020cdf0e10cSrcweir aPos.X() -= nPixel; 1021cdf0e10cSrcweir aPos.Y() -= nPixel; 1022cdf0e10cSrcweir aSize.Width() += 2 * nPixel; 1023cdf0e10cSrcweir aSize.Height() += 2 * nPixel; 1024cdf0e10cSrcweir } 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir Rectangle aRect( aPos, aSize ); 1027cdf0e10cSrcweir 1028cdf0e10cSrcweir if ( bVisible ) 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir Point aVisPos = GetPosPixel(); 1031cdf0e10cSrcweir Size aVisSize = GetSizePixel(); 1032cdf0e10cSrcweir 1033cdf0e10cSrcweir // Um +/- ein paar Pixel erweitern, sonst ist es zu nerv"os 1034cdf0e10cSrcweir aVisPos.X() -= nPixel; 1035cdf0e10cSrcweir aVisPos.Y() -= nPixel; 1036cdf0e10cSrcweir aVisSize.Width() += 2 * nPixel; 1037cdf0e10cSrcweir aVisSize.Height() += 2 * nPixel; 1038cdf0e10cSrcweir 1039cdf0e10cSrcweir Rectangle aVisRect( aVisPos, aVisSize ); 1040cdf0e10cSrcweir aRect = aRect.GetUnion( aVisRect ); 1041cdf0e10cSrcweir } 1042cdf0e10cSrcweir 1043cdf0e10cSrcweir if ( aRect.IsInside( OutputToScreenPixel( ((Window*)this)->GetPointerPosPixel() ) ) ) 1044cdf0e10cSrcweir return sal_True; 1045cdf0e10cSrcweir return sal_False; 1046cdf0e10cSrcweir } 1047cdf0e10cSrcweir 1048cdf0e10cSrcweir //------------------------------------------------------------------------- 1049cdf0e10cSrcweir 1050cdf0e10cSrcweir SplitWindow* SfxSplitWindow::GetSplitWindow() 1051cdf0e10cSrcweir { 1052cdf0e10cSrcweir if ( !bPinned || !pEmptyWin->bFadeIn ) 1053cdf0e10cSrcweir return pEmptyWin; 1054cdf0e10cSrcweir return this; 1055cdf0e10cSrcweir } 1056cdf0e10cSrcweir 1057cdf0e10cSrcweir //------------------------------------------------------------------------- 1058cdf0e10cSrcweir sal_Bool SfxSplitWindow::IsFadeIn() const 1059cdf0e10cSrcweir { 1060cdf0e10cSrcweir return pEmptyWin->bFadeIn; 1061cdf0e10cSrcweir } 1062cdf0e10cSrcweir 1063cdf0e10cSrcweir sal_Bool SfxSplitWindow::IsAutoHide( sal_Bool bSelf ) const 1064cdf0e10cSrcweir { 1065cdf0e10cSrcweir return bSelf ? pEmptyWin->bAutoHide && !pEmptyWin->bEndAutoHide : pEmptyWin->bAutoHide; 1066cdf0e10cSrcweir } 1067cdf0e10cSrcweir 1068cdf0e10cSrcweir //------------------------------------------------------------------------- 1069cdf0e10cSrcweir 1070cdf0e10cSrcweir void SfxSplitWindow::SetPinned_Impl( sal_Bool bOn ) 1071cdf0e10cSrcweir { 1072cdf0e10cSrcweir if ( bPinned == bOn ) 1073cdf0e10cSrcweir return; 1074cdf0e10cSrcweir 1075cdf0e10cSrcweir bPinned = bOn; 1076cdf0e10cSrcweir if ( GetItemCount( 0 ) == 0 ) 1077cdf0e10cSrcweir return; 1078cdf0e10cSrcweir 1079cdf0e10cSrcweir if ( !bOn ) 1080cdf0e10cSrcweir { 1081cdf0e10cSrcweir pEmptyWin->nState |= 1; 1082cdf0e10cSrcweir if ( pEmptyWin->bFadeIn ) 1083cdf0e10cSrcweir { 1084cdf0e10cSrcweir // Ersatzfenster anmelden 1085cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing real Splitwindow" ); 1086cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *this ); 1087cdf0e10cSrcweir Hide(); 1088cdf0e10cSrcweir pEmptyWin->Actualize(); 1089cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - registering empty Splitwindow" ); 1090cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, sal_True )->nVisible = CHILD_VISIBLE; 1091cdf0e10cSrcweir } 1092cdf0e10cSrcweir 1093cdf0e10cSrcweir Point aPos( GetPosPixel() ); 1094cdf0e10cSrcweir aPos = GetParent()->OutputToScreenPixel( aPos ); 1095cdf0e10cSrcweir SetFloatingPos( aPos ); 1096cdf0e10cSrcweir SetFloatingMode( sal_True ); 1097cdf0e10cSrcweir GetFloatingWindow()->SetOutputSizePixel( GetOutputSizePixel() ); 1098cdf0e10cSrcweir 1099cdf0e10cSrcweir if ( pEmptyWin->bFadeIn ) 1100cdf0e10cSrcweir Show(); 1101cdf0e10cSrcweir } 1102cdf0e10cSrcweir else 1103cdf0e10cSrcweir { 1104cdf0e10cSrcweir pEmptyWin->nState &= ~1; 1105cdf0e10cSrcweir SetOutputSizePixel( GetFloatingWindow()->GetOutputSizePixel() ); 1106cdf0e10cSrcweir SetFloatingMode( sal_False ); 1107cdf0e10cSrcweir 1108cdf0e10cSrcweir if ( pEmptyWin->bFadeIn ) 1109cdf0e10cSrcweir { 1110cdf0e10cSrcweir // Ersatzfenster abmelden 1111cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing empty Splitwindow" ); 1112cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *pEmptyWin ); 1113cdf0e10cSrcweir pEmptyWin->Hide(); 1114cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - registering real Splitwindow" ); 1115cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *this, eAlign, sal_True )->nVisible = CHILD_VISIBLE; 1116cdf0e10cSrcweir } 1117cdf0e10cSrcweir } 1118cdf0e10cSrcweir 1119cdf0e10cSrcweir SetAutoHideState( !bPinned ); 1120cdf0e10cSrcweir pEmptyWin->SetAutoHideState( !bPinned ); 1121cdf0e10cSrcweir } 1122cdf0e10cSrcweir 1123cdf0e10cSrcweir //------------------------------------------------------------------------- 1124cdf0e10cSrcweir 1125cdf0e10cSrcweir void SfxSplitWindow::SetFadeIn_Impl( sal_Bool bOn ) 1126cdf0e10cSrcweir { 1127cdf0e10cSrcweir if ( bOn == pEmptyWin->bFadeIn ) 1128cdf0e10cSrcweir return; 1129cdf0e10cSrcweir 1130cdf0e10cSrcweir if ( GetItemCount( 0 ) == 0 ) 1131cdf0e10cSrcweir return; 1132cdf0e10cSrcweir 1133cdf0e10cSrcweir pEmptyWin->bFadeIn = bOn; 1134cdf0e10cSrcweir if ( bOn ) 1135cdf0e10cSrcweir { 1136cdf0e10cSrcweir pEmptyWin->nState |= 2; 1137cdf0e10cSrcweir if ( IsFloatingMode() ) 1138cdf0e10cSrcweir { 1139cdf0e10cSrcweir // FloatingWindow ist nicht sichtbar, also anzeigen 1140cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 1141cdf0e10cSrcweir Show(); 1142cdf0e10cSrcweir } 1143cdf0e10cSrcweir else 1144cdf0e10cSrcweir { 1145cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing empty Splitwindow" ); 1146cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *pEmptyWin ); 1147cdf0e10cSrcweir pEmptyWin->Hide(); 1148cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering real Splitwindow" ); 1149cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *this, eAlign, sal_True )->nVisible = CHILD_VISIBLE; 1150cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 1151cdf0e10cSrcweir pWorkWin->ShowChilds_Impl(); 1152cdf0e10cSrcweir } 1153cdf0e10cSrcweir } 1154cdf0e10cSrcweir else 1155cdf0e10cSrcweir { 1156cdf0e10cSrcweir pEmptyWin->bAutoHide = sal_False; 1157cdf0e10cSrcweir pEmptyWin->nState &= ~2; 1158cdf0e10cSrcweir if ( !IsFloatingMode() ) 1159cdf0e10cSrcweir { 1160cdf0e10cSrcweir // Das Fenster "schwebt" nicht, soll aber ausgeblendet werden, 1161cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing real Splitwindow" ); 1162cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *this ); 1163cdf0e10cSrcweir Hide(); 1164cdf0e10cSrcweir pEmptyWin->Actualize(); 1165cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering empty Splitwindow" ); 1166cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, sal_True )->nVisible = CHILD_VISIBLE; 1167cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 1168cdf0e10cSrcweir pWorkWin->ShowChilds_Impl(); 1169cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 1170cdf0e10cSrcweir } 1171cdf0e10cSrcweir else 1172cdf0e10cSrcweir { 1173cdf0e10cSrcweir Hide(); 1174cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 1175cdf0e10cSrcweir } 1176cdf0e10cSrcweir } 1177cdf0e10cSrcweir } 1178cdf0e10cSrcweir 1179cdf0e10cSrcweir void SfxSplitWindow::AutoHide() 1180cdf0e10cSrcweir { 1181cdf0e10cSrcweir // Wenn dieser Handler am "echten" SplitWindow aufgerufen wird, ist es 1182cdf0e10cSrcweir // entweder angedockt und soll "schwebend" angezeigt werden oder umgekehrt 1183cdf0e10cSrcweir if ( !bPinned ) 1184cdf0e10cSrcweir { 1185cdf0e10cSrcweir // Es "schwebt", also wieder andocken 1186cdf0e10cSrcweir SetPinned_Impl( sal_True ); 1187cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 1188cdf0e10cSrcweir } 1189cdf0e10cSrcweir else 1190cdf0e10cSrcweir { 1191cdf0e10cSrcweir // In den "Schwebezustand" bringen 1192cdf0e10cSrcweir SetPinned_Impl( sal_False ); 1193cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl(); 1194cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this ); 1195cdf0e10cSrcweir } 1196cdf0e10cSrcweir 1197cdf0e10cSrcweir pWorkWin->ShowChilds_Impl(); 1198cdf0e10cSrcweir SaveConfig_Impl(); 1199cdf0e10cSrcweir } 1200cdf0e10cSrcweir 1201cdf0e10cSrcweir void SfxSplitWindow::FadeOut_Impl() 1202cdf0e10cSrcweir { 1203cdf0e10cSrcweir if ( pEmptyWin->aTimer.IsActive() ) 1204cdf0e10cSrcweir { 1205cdf0e10cSrcweir pEmptyWin->bAutoHide = sal_False; 1206cdf0e10cSrcweir pEmptyWin->aTimer.Stop(); 1207cdf0e10cSrcweir } 1208cdf0e10cSrcweir 1209cdf0e10cSrcweir SetFadeIn_Impl( sal_False ); 1210cdf0e10cSrcweir Show_Impl(); 1211cdf0e10cSrcweir } 1212cdf0e10cSrcweir 1213cdf0e10cSrcweir void SfxSplitWindow::FadeOut() 1214cdf0e10cSrcweir { 1215cdf0e10cSrcweir FadeOut_Impl(); 1216cdf0e10cSrcweir SaveConfig_Impl(); 1217cdf0e10cSrcweir } 1218cdf0e10cSrcweir 1219cdf0e10cSrcweir void SfxSplitWindow::FadeIn() 1220cdf0e10cSrcweir { 1221cdf0e10cSrcweir SetFadeIn_Impl( sal_True ); 1222cdf0e10cSrcweir Show_Impl(); 1223cdf0e10cSrcweir } 1224cdf0e10cSrcweir 1225cdf0e10cSrcweir void SfxSplitWindow::Show_Impl() 1226cdf0e10cSrcweir { 1227cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count(); 1228cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ ) 1229cdf0e10cSrcweir { 1230cdf0e10cSrcweir SfxDock_Impl *pDock = (*pDockArr)[n]; 1231cdf0e10cSrcweir if ( pDock->pWin ) 1232cdf0e10cSrcweir pDock->pWin->FadeIn( pEmptyWin->bFadeIn ); 1233cdf0e10cSrcweir } 1234cdf0e10cSrcweir } 1235cdf0e10cSrcweir /* 1236cdf0e10cSrcweir void SfxSplitWindow::Pin_Impl( sal_Bool bPin ) 1237cdf0e10cSrcweir { 1238cdf0e10cSrcweir if ( bPinned != bPin ) 1239cdf0e10cSrcweir AutoHide(); 1240cdf0e10cSrcweir } 1241cdf0e10cSrcweir */ 1242cdf0e10cSrcweir sal_Bool SfxSplitWindow::ActivateNextChild_Impl( sal_Bool bForward ) 1243cdf0e10cSrcweir { 1244cdf0e10cSrcweir // Wenn kein pActive, auf erstes bzw. letztes Fenster gehen ( bei !bForward wird erst in der loop dekrementiert ) 1245cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count(); 1246cdf0e10cSrcweir sal_uInt16 n = bForward ? 0 : nCount; 1247cdf0e10cSrcweir 1248cdf0e10cSrcweir // Wenn Focus innerhalb, dann ein Fenster vor oder zur"uck, wenn m"oglich 1249cdf0e10cSrcweir if ( pActive ) 1250cdf0e10cSrcweir { 1251cdf0e10cSrcweir // Aktives Fenster ermitteln 1252cdf0e10cSrcweir for ( n=0; n<nCount; n++ ) 1253cdf0e10cSrcweir { 1254cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[n]; 1255cdf0e10cSrcweir if ( pD->pWin && pD->pWin->HasChildPathFocus() ) 1256cdf0e10cSrcweir break; 1257cdf0e10cSrcweir } 1258cdf0e10cSrcweir 1259cdf0e10cSrcweir if ( bForward ) 1260cdf0e10cSrcweir // ein Fenster weiter ( wenn dann n>nCount, wird die Schleife unten gar nicht durchlaufen ) 1261cdf0e10cSrcweir n++; 1262cdf0e10cSrcweir } 1263cdf0e10cSrcweir 1264cdf0e10cSrcweir if ( bForward ) 1265cdf0e10cSrcweir { 1266cdf0e10cSrcweir // N"achstes Fenster suchen 1267cdf0e10cSrcweir for ( sal_uInt16 nNext=n; nNext<nCount; nNext++ ) 1268cdf0e10cSrcweir { 1269cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[nNext]; 1270cdf0e10cSrcweir if ( pD->pWin ) 1271cdf0e10cSrcweir { 1272cdf0e10cSrcweir pD->pWin->GrabFocus(); 1273cdf0e10cSrcweir return sal_True; 1274cdf0e10cSrcweir } 1275cdf0e10cSrcweir } 1276cdf0e10cSrcweir } 1277cdf0e10cSrcweir else 1278cdf0e10cSrcweir { 1279cdf0e10cSrcweir // Vorheriges Fenster suchen 1280cdf0e10cSrcweir for ( sal_uInt16 nNext=n; nNext--; ) 1281cdf0e10cSrcweir { 1282cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[nNext]; 1283cdf0e10cSrcweir if ( pD->pWin ) 1284cdf0e10cSrcweir { 1285cdf0e10cSrcweir pD->pWin->GrabFocus(); 1286cdf0e10cSrcweir return sal_True; 1287cdf0e10cSrcweir } 1288cdf0e10cSrcweir } 1289cdf0e10cSrcweir } 1290cdf0e10cSrcweir 1291cdf0e10cSrcweir return sal_False; 1292cdf0e10cSrcweir } 1293cdf0e10cSrcweir 1294cdf0e10cSrcweir void SfxSplitWindow::SetActiveWindow_Impl( SfxDockingWindow* pWin ) 1295cdf0e10cSrcweir { 1296cdf0e10cSrcweir pActive = pWin; 1297cdf0e10cSrcweir pWorkWin->SetActiveChild_Impl( this ); 1298cdf0e10cSrcweir } 1299cdf0e10cSrcweir 1300cdf0e10cSrcweir 1301