1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sfx2.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <svl/eitem.hxx> 32*cdf0e10cSrcweir #include <vcl/decoview.hxx> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <vcl/svapp.hxx> 35*cdf0e10cSrcweir #include <vcl/timer.hxx> 36*cdf0e10cSrcweir #include <rtl/instance.hxx> 37*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 38*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include <sfx2/dockwin.hxx> 41*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 42*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 43*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 44*cdf0e10cSrcweir #include "workwin.hxx" 45*cdf0e10cSrcweir #include "splitwin.hxx" 46*cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 47*cdf0e10cSrcweir #include "sfx2/sfxhelp.hxx" 48*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 49*cdf0e10cSrcweir #include <sfx2/msgpool.hxx> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 52*cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp> 53*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleComponentFactory.hpp> 54*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 55*cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 56*cdf0e10cSrcweir #include <com/sun/star/frame/XModuleManager.hpp> 57*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir #define MAX_TOGGLEAREA_WIDTH 20 60*cdf0e10cSrcweir #define MAX_TOGGLEAREA_HEIGHT 20 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir using namespace ::com::sun::star; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir // implemented in 'sfx2/source/appl/childwin.cxx' 65*cdf0e10cSrcweir extern sal_Bool GetPosSizeFromString( const String& rStr, Point& rPos, Size& rSize ); 66*cdf0e10cSrcweir extern sal_Bool GetSplitSizeFromString( const String& rStr, Size& rSize ); 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir // If you want to change the number you also have to: 69*cdf0e10cSrcweir // - Add new slot ids to sfxsids.hrc 70*cdf0e10cSrcweir // - Add new slots to frmslots.sdi 71*cdf0e10cSrcweir // - Add new slot definitions to sfx.sdi 72*cdf0e10cSrcweir static const int NUM_OF_DOCKINGWINDOWS = 10; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir class SfxTitleDockingWindow; 75*cdf0e10cSrcweir class SfxTitleDockingWindow : public SfxDockingWindow 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir Window* m_pWrappedWindow; 78*cdf0e10cSrcweir sal_uInt16 m_nID; 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir public: 81*cdf0e10cSrcweir SfxTitleDockingWindow( 82*cdf0e10cSrcweir SfxBindings* pBindings , 83*cdf0e10cSrcweir SfxChildWindow* pChildWin , 84*cdf0e10cSrcweir Window* pParent , 85*cdf0e10cSrcweir WinBits nBits, 86*cdf0e10cSrcweir sal_uInt16 nID); 87*cdf0e10cSrcweir virtual ~SfxTitleDockingWindow(); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir Window* GetWrappedWindow() const { return m_pWrappedWindow; } 90*cdf0e10cSrcweir void SetWrappedWindow(Window* const pWindow); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir virtual void StateChanged( StateChangedType nType ); 93*cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 94*cdf0e10cSrcweir virtual void Resize(); 95*cdf0e10cSrcweir virtual void Resizing( Size& rSize ); 96*cdf0e10cSrcweir virtual sal_Bool Close(); 97*cdf0e10cSrcweir }; 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir namespace 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir struct WindowState 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir ::rtl::OUString sTitle; 104*cdf0e10cSrcweir }; 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir static uno::WeakReference< container::XNameAccess > m_xWindowStateConfiguration; 108*cdf0e10cSrcweir static uno::WeakReference< frame::XModuleManager > m_xModuleManager; 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir static bool lcl_getWindowState( const uno::Reference< container::XNameAccess >& xWindowStateMgr, const ::rtl::OUString& rResourceURL, WindowState& rWindowState ) 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir bool bResult = false; 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir try 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir uno::Any a; 117*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aWindowState; 118*cdf0e10cSrcweir a = xWindowStateMgr->getByName( rResourceURL ); 119*cdf0e10cSrcweir if ( a >>= aWindowState ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir for ( sal_Int32 n = 0; n < aWindowState.getLength(); n++ ) 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir if ( aWindowState[n].Name.equalsAscii( "UIName" )) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir aWindowState[n].Value >>= rWindowState.sTitle; 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir bResult = true; 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir catch ( container::NoSuchElementException& ) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir bResult = false; 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir return bResult; 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd , 141*cdf0e10cSrcweir sal_uInt16 nId , 142*cdf0e10cSrcweir SfxBindings* pBindings , 143*cdf0e10cSrcweir SfxChildWinInfo* pInfo ) 144*cdf0e10cSrcweir : SfxChildWindow( pParentWnd , nId ) 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); 147*cdf0e10cSrcweir const rtl::OUString aDockWindowResourceURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/dockingwindow/" )); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir SfxTitleDockingWindow* pTitleDockWindow = new SfxTitleDockingWindow( pBindings, this, pParentWnd, 150*cdf0e10cSrcweir WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE, nId); 151*cdf0e10cSrcweir pWindow = pTitleDockWindow; 152*cdf0e10cSrcweir eChildAlignment = SFX_ALIGN_NOALIGNMENT; 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir // Use factory manager to retrieve XWindow factory. That can be used to instanciate 155*cdf0e10cSrcweir // the real window factory. 156*cdf0e10cSrcweir uno::Reference< lang::XSingleComponentFactory > xFactoryMgr( 157*cdf0e10cSrcweir xServiceManager->createInstance( 158*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 159*cdf0e10cSrcweir "com.sun.star.ui.WindowContentFactoryManager"))), 160*cdf0e10cSrcweir uno::UNO_QUERY ); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir if (xFactoryMgr.is()) 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir SfxDispatcher* pDispatcher = pBindings->GetDispatcher(); 165*cdf0e10cSrcweir uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); 166*cdf0e10cSrcweir uno::Sequence< uno::Any > aArgs(2); 167*cdf0e10cSrcweir beans::PropertyValue aPropValue; 168*cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); 169*cdf0e10cSrcweir aPropValue.Value = uno::makeAny( xFrame ); 170*cdf0e10cSrcweir aArgs[0] <<= aPropValue; 171*cdf0e10cSrcweir aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" )); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir // create a resource URL from the nId provided by the sfx2 174*cdf0e10cSrcweir ::rtl::OUString aResourceURL( aDockWindowResourceURL ); 175*cdf0e10cSrcweir aResourceURL += ::rtl::OUString::valueOf(sal_Int32(nId)); 176*cdf0e10cSrcweir aPropValue.Value = uno::makeAny( aResourceURL ); 177*cdf0e10cSrcweir aArgs[1] <<= aPropValue; 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir uno::Reference< awt::XWindow > xWindow; 180*cdf0e10cSrcweir try 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( xServiceManager, uno::UNO_QUERY ); 183*cdf0e10cSrcweir uno::Reference< uno::XComponentContext > xContext; 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir if ( xProps.is() ) 186*cdf0e10cSrcweir xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext; 187*cdf0e10cSrcweir if ( xContext.is() ) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir xWindow = uno::Reference< awt::XWindow>( 190*cdf0e10cSrcweir xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ), 191*cdf0e10cSrcweir uno::UNO_QUERY ); 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir uno::Reference< frame::XModuleManager > xModuleManager( m_xModuleManager ); 195*cdf0e10cSrcweir if ( !xModuleManager.is() ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir xModuleManager = uno::Reference< frame::XModuleManager >( 198*cdf0e10cSrcweir xServiceManager->createInstance( 199*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ))), 200*cdf0e10cSrcweir uno::UNO_QUERY ); 201*cdf0e10cSrcweir m_xModuleManager = xModuleManager; 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir uno::Reference< container::XNameAccess > xWindowStateConfiguration( m_xWindowStateConfiguration ); 205*cdf0e10cSrcweir if ( !xWindowStateConfiguration.is() ) 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir xWindowStateConfiguration = uno::Reference< container::XNameAccess >( 208*cdf0e10cSrcweir xServiceManager->createInstance( 209*cdf0e10cSrcweir rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.WindowStateConfiguration" ))), 210*cdf0e10cSrcweir uno::UNO_QUERY ); 211*cdf0e10cSrcweir m_xWindowStateConfiguration = xWindowStateConfiguration; 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir ::rtl::OUString sModuleIdentifier = xModuleManager->identify( xFrame ); 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir uno::Reference< container::XNameAccess > xModuleWindowState( 217*cdf0e10cSrcweir xWindowStateConfiguration->getByName( sModuleIdentifier ), 218*cdf0e10cSrcweir uno::UNO_QUERY ); 219*cdf0e10cSrcweir if ( xModuleWindowState.is() ) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir WindowState aDockWinState; 222*cdf0e10cSrcweir if ( lcl_getWindowState( xModuleWindowState, aResourceURL, aDockWinState )) 223*cdf0e10cSrcweir pTitleDockWindow->SetText( aDockWinState.sTitle ); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir catch ( beans::UnknownPropertyException& ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir catch ( uno::RuntimeException& ) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir catch ( uno::Exception& ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir Window* pContentWindow = VCLUnoHelper::GetWindow(xWindow); 237*cdf0e10cSrcweir if ( pContentWindow ) 238*cdf0e10cSrcweir pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL ); 239*cdf0e10cSrcweir pTitleDockWindow->SetWrappedWindow(pContentWindow); 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir pWindow->SetOutputSizePixel( Size( 270, 240 ) ); 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir ( ( SfxDockingWindow* ) pWindow )->Initialize( pInfo ); 245*cdf0e10cSrcweir SetHideNotDelete( sal_True ); 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir SfxChildWindow* SfxDockingWrapper::CreateImpl( 249*cdf0e10cSrcweir Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo ) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir SfxChildWindow *pWin = new SfxDockingWrapper(pParent, nId, pBindings, pInfo); return pWin; 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir sal_uInt16 SfxDockingWrapper::GetChildWindowId () 255*cdf0e10cSrcweir { 256*cdf0e10cSrcweir DBG_ASSERT( false, "This method shouldn't be called!" ); 257*cdf0e10cSrcweir return 0; 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir void SfxDockingWrapper::RegisterChildWindow (sal_Bool bVis, SfxModule *pMod, sal_uInt16 nFlags) 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir // pre-register a couple of docking windows 263*cdf0e10cSrcweir for (int i=0; i < NUM_OF_DOCKINGWINDOWS; i++ ) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir sal_uInt16 nID = sal_uInt16(SID_DOCKWIN_START+i); 266*cdf0e10cSrcweir SfxChildWinFactory *pFact = new SfxChildWinFactory( SfxDockingWrapper::CreateImpl, nID, 0xffff ); 267*cdf0e10cSrcweir pFact->aInfo.nFlags |= nFlags; 268*cdf0e10cSrcweir pFact->aInfo.bVisible = bVis; 269*cdf0e10cSrcweir SfxChildWindow::RegisterChildWindow(pMod, pFact); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir SfxChildWinInfo SfxDockingWrapper::GetInfo() const 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); 276*cdf0e10cSrcweir ((SfxDockingWindow*)GetWindow())->FillInfo( aInfo ); 277*cdf0e10cSrcweir return aInfo; 278*cdf0e10cSrcweir }; 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir SfxTitleDockingWindow::SfxTitleDockingWindow( SfxBindings* pBind , 281*cdf0e10cSrcweir SfxChildWindow* pChildWin , 282*cdf0e10cSrcweir Window* pParent , 283*cdf0e10cSrcweir WinBits nBits, 284*cdf0e10cSrcweir sal_uInt16 nID ) : 285*cdf0e10cSrcweir SfxDockingWindow( pBind , 286*cdf0e10cSrcweir pChildWin , 287*cdf0e10cSrcweir pParent , 288*cdf0e10cSrcweir nBits ), 289*cdf0e10cSrcweir m_pWrappedWindow(0), 290*cdf0e10cSrcweir m_nID(nID) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir SfxTitleDockingWindow::~SfxTitleDockingWindow() 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir delete m_pWrappedWindow; 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir void SfxTitleDockingWindow::SetWrappedWindow( Window* const pWindow ) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir m_pWrappedWindow = pWindow; 302*cdf0e10cSrcweir if (m_pWrappedWindow) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir m_pWrappedWindow->SetParent(this); 305*cdf0e10cSrcweir m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() ); 306*cdf0e10cSrcweir m_pWrappedWindow->Show(); 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir long SfxTitleDockingWindow::Notify( NotifyEvent& rNEvt ) 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir return SfxDockingWindow::Notify( rNEvt ); 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir void SfxTitleDockingWindow::StateChanged( StateChangedType nType ) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir if ( nType == STATE_CHANGE_INITSHOW ) 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir Window* pWindow = GetWrappedWindow(); 320*cdf0e10cSrcweir if ( pWindow ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir pWindow->SetSizePixel( GetOutputSizePixel() ); 323*cdf0e10cSrcweir pWindow->Show(); 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir } 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir SfxDockingWindow::StateChanged(nType); 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir void SfxTitleDockingWindow::Resize() 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir SfxDockingWindow::Resize(); 333*cdf0e10cSrcweir if (m_pWrappedWindow) 334*cdf0e10cSrcweir m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() ); 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir void SfxTitleDockingWindow::Resizing( Size &rSize ) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir SfxDockingWindow::Resizing( rSize ); 340*cdf0e10cSrcweir if (m_pWrappedWindow) 341*cdf0e10cSrcweir m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() ); 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir sal_Bool SfxTitleDockingWindow::Close() 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir return SfxDockingWindow::Close(); 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir namespace 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir struct ChildrenRegisteredMap : public rtl::Static< bool, ChildrenRegisteredMap > {}; 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir static bool lcl_checkDockingWindowID( sal_uInt16 nID ) 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir if (nID < SID_DOCKWIN_START || nID >= sal_uInt16(SID_DOCKWIN_START+NUM_OF_DOCKINGWINDOWS)) 357*cdf0e10cSrcweir return false; 358*cdf0e10cSrcweir else 359*cdf0e10cSrcweir return true; 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir static SfxWorkWindow* lcl_getWorkWindowFromXFrame( const uno::Reference< frame::XFrame >& rFrame ) 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir // We need to find the corresponding SfxFrame of our XFrame 365*cdf0e10cSrcweir SfxFrame* pFrame = SfxFrame::GetFirst(); 366*cdf0e10cSrcweir SfxFrame* pXFrame = 0; 367*cdf0e10cSrcweir while ( pFrame ) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir uno::Reference< frame::XFrame > xViewShellFrame( pFrame->GetFrameInterface() ); 370*cdf0e10cSrcweir if ( xViewShellFrame == rFrame ) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir pXFrame = pFrame; 373*cdf0e10cSrcweir break; 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir else 376*cdf0e10cSrcweir pFrame = SfxFrame::GetNext( *pFrame ); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir // If we have a SfxFrame we can retrieve the work window (Sfx layout manager for docking windows) 380*cdf0e10cSrcweir if ( pXFrame ) 381*cdf0e10cSrcweir return pXFrame->GetWorkWindow_Impl(); 382*cdf0e10cSrcweir else 383*cdf0e10cSrcweir return NULL; 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir /* 387*cdf0e10cSrcweir Factory function used by the framework layout manager to "create" a docking window with a special name. 388*cdf0e10cSrcweir The string rDockingWindowName MUST BE a valid ID! The ID is pre-defined by a certain slot range located 389*cdf0e10cSrcweir in sfxsids.hrc (currently SID_DOCKWIN_START = 9800). 390*cdf0e10cSrcweir */ 391*cdf0e10cSrcweir void SAL_CALL SfxDockingWindowFactory( const uno::Reference< frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName ) 392*cdf0e10cSrcweir { 393*cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 394*cdf0e10cSrcweir sal_uInt16 nID = sal_uInt16(rDockingWindowName.toInt32()); 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir // Check the range of the provided ID otherwise nothing will happen 397*cdf0e10cSrcweir if ( lcl_checkDockingWindowID( nID )) 398*cdf0e10cSrcweir { 399*cdf0e10cSrcweir SfxWorkWindow* pWorkWindow = lcl_getWorkWindowFromXFrame( rFrame ); 400*cdf0e10cSrcweir if ( pWorkWindow ) 401*cdf0e10cSrcweir { 402*cdf0e10cSrcweir SfxChildWindow* pChildWindow = pWorkWindow->GetChildWindow_Impl(nID); 403*cdf0e10cSrcweir if ( !pChildWindow ) 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir // Register window at the workwindow child window list 406*cdf0e10cSrcweir pWorkWindow->SetChildWindow_Impl( nID, true, false ); 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir /* 413*cdf0e10cSrcweir Function used by the framework layout manager to determine the visibility state of a docking window with 414*cdf0e10cSrcweir a special name. The string rDockingWindowName MUST BE a valid ID! The ID is pre-defined by a certain slot 415*cdf0e10cSrcweir range located in sfxsids.hrc (currently SID_DOCKWIN_START = 9800). 416*cdf0e10cSrcweir */ 417*cdf0e10cSrcweir bool SAL_CALL IsDockingWindowVisible( const uno::Reference< frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName ) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir sal_uInt16 nID = sal_uInt16(rDockingWindowName.toInt32()); 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir // Check the range of the provided ID otherwise nothing will happen 424*cdf0e10cSrcweir if ( lcl_checkDockingWindowID( nID )) 425*cdf0e10cSrcweir { 426*cdf0e10cSrcweir SfxWorkWindow* pWorkWindow = lcl_getWorkWindowFromXFrame( rFrame ); 427*cdf0e10cSrcweir if ( pWorkWindow ) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir SfxChildWindow* pChildWindow = pWorkWindow->GetChildWindow_Impl(nID); 430*cdf0e10cSrcweir if ( pChildWindow ) 431*cdf0e10cSrcweir return true; 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir } 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir return false; 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir class SfxDockingWindow_Impl 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir friend class SfxDockingWindow; 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir SfxChildAlignment eLastAlignment; 443*cdf0e10cSrcweir SfxChildAlignment eDockAlignment; 444*cdf0e10cSrcweir sal_Bool bConstructed; 445*cdf0e10cSrcweir Size aMinSize; 446*cdf0e10cSrcweir SfxSplitWindow* pSplitWin; 447*cdf0e10cSrcweir sal_Bool bSplitable; 448*cdf0e10cSrcweir // sal_Bool bAutoHide; 449*cdf0e10cSrcweir Timer aMoveTimer; 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir // Folgende members sind nur in der Zeit von StartDocking bis EndDocking 452*cdf0e10cSrcweir // g"ultig: 453*cdf0e10cSrcweir sal_Bool bEndDocked; 454*cdf0e10cSrcweir Size aSplitSize; 455*cdf0e10cSrcweir long nHorizontalSize; 456*cdf0e10cSrcweir long nVerticalSize; 457*cdf0e10cSrcweir sal_uInt16 nLine; 458*cdf0e10cSrcweir sal_uInt16 nPos; 459*cdf0e10cSrcweir sal_uInt16 nDockLine; 460*cdf0e10cSrcweir sal_uInt16 nDockPos; 461*cdf0e10cSrcweir sal_Bool bNewLine; 462*cdf0e10cSrcweir sal_Bool bDockingPrevented; 463*cdf0e10cSrcweir ByteString aWinState; 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir SfxChildAlignment GetLastAlignment() const 466*cdf0e10cSrcweir { return eLastAlignment; } 467*cdf0e10cSrcweir void SetLastAlignment(SfxChildAlignment eAlign) 468*cdf0e10cSrcweir { eLastAlignment = eAlign; } 469*cdf0e10cSrcweir SfxChildAlignment GetDockAlignment() const 470*cdf0e10cSrcweir { return eDockAlignment; } 471*cdf0e10cSrcweir void SetDockAlignment(SfxChildAlignment eAlign) 472*cdf0e10cSrcweir { eDockAlignment = eAlign; } 473*cdf0e10cSrcweir }; 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir //------------------------------------------------------------------------- 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir void SfxDockingWindow::Resize() 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir /* [Beschreibung] 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir Diese virtuelle Methode der Klasse DockingWindow merkt sich ggf. eine 482*cdf0e10cSrcweir ver"anderte FloatingSize. 483*cdf0e10cSrcweir Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s 484*cdf0e10cSrcweir auch SfxDockingWindow::Resize() gerufen werden. 485*cdf0e10cSrcweir */ 486*cdf0e10cSrcweir { 487*cdf0e10cSrcweir DockingWindow::Resize(); 488*cdf0e10cSrcweir Invalidate(); 489*cdf0e10cSrcweir if ( pImp->bConstructed && pMgr ) 490*cdf0e10cSrcweir { 491*cdf0e10cSrcweir if ( IsFloatingMode() ) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir // start timer for saving window status information 494*cdf0e10cSrcweir pImp->aMoveTimer.Start(); 495*cdf0e10cSrcweir } 496*cdf0e10cSrcweir else 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir Size aSize( GetSizePixel() ); 499*cdf0e10cSrcweir switch ( pImp->GetDockAlignment() ) 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir case SFX_ALIGN_LEFT: 502*cdf0e10cSrcweir case SFX_ALIGN_FIRSTLEFT: 503*cdf0e10cSrcweir case SFX_ALIGN_LASTLEFT: 504*cdf0e10cSrcweir case SFX_ALIGN_RIGHT: 505*cdf0e10cSrcweir case SFX_ALIGN_FIRSTRIGHT: 506*cdf0e10cSrcweir case SFX_ALIGN_LASTRIGHT: 507*cdf0e10cSrcweir pImp->nHorizontalSize = aSize.Width(); 508*cdf0e10cSrcweir pImp->aSplitSize = aSize; 509*cdf0e10cSrcweir break; 510*cdf0e10cSrcweir case SFX_ALIGN_TOP: 511*cdf0e10cSrcweir case SFX_ALIGN_LOWESTTOP: 512*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTTOP: 513*cdf0e10cSrcweir case SFX_ALIGN_BOTTOM: 514*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTBOTTOM: 515*cdf0e10cSrcweir case SFX_ALIGN_LOWESTBOTTOM: 516*cdf0e10cSrcweir pImp->nVerticalSize = aSize.Height(); 517*cdf0e10cSrcweir pImp->aSplitSize = aSize; 518*cdf0e10cSrcweir break; 519*cdf0e10cSrcweir default: 520*cdf0e10cSrcweir break; 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir } 523*cdf0e10cSrcweir } 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir //------------------------------------------------------------------------- 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir sal_Bool SfxDockingWindow::PrepareToggleFloatingMode() 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir /* [Beschreibung] 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir Diese virtuelle Methode der Klasse DockingWindow erm"oglicht ein Eingreifen 533*cdf0e10cSrcweir in das Umschalten des floating mode. 534*cdf0e10cSrcweir Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s 535*cdf0e10cSrcweir danach SfxDockingWindow::PrepareToggleFloatingMode() gerufen werden, 536*cdf0e10cSrcweir wenn nicht FALSE zur"uckgegeben wird. 537*cdf0e10cSrcweir */ 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir { 540*cdf0e10cSrcweir if (!pImp->bConstructed) 541*cdf0e10cSrcweir return sal_True; 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir if ( (Application::IsInModalMode() && IsFloatingMode()) || !pMgr ) 544*cdf0e10cSrcweir return sal_False; 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir if ( pImp->bDockingPrevented ) 547*cdf0e10cSrcweir return sal_False; 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir if (!IsFloatingMode()) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir // Testen, ob FloatingMode erlaubt ist 552*cdf0e10cSrcweir if ( CheckAlignment(GetAlignment(),SFX_ALIGN_NOALIGNMENT) != SFX_ALIGN_NOALIGNMENT ) 553*cdf0e10cSrcweir return sal_False; 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir if ( pImp->pSplitWin ) 556*cdf0e10cSrcweir { 557*cdf0e10cSrcweir // Das DockingWindow sitzt in einem SplitWindow und wird abgerissen 558*cdf0e10cSrcweir pImp->pSplitWin->RemoveWindow(this/*, sal_False*/); 559*cdf0e10cSrcweir pImp->pSplitWin = 0; 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir else if ( pMgr ) 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir pImp->aWinState = GetFloatingWindow()->GetWindowState(); 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir // Testen, ob es erlaubt ist, anzudocken 567*cdf0e10cSrcweir if (CheckAlignment(GetAlignment(),pImp->GetLastAlignment()) == SFX_ALIGN_NOALIGNMENT) 568*cdf0e10cSrcweir return sal_False; 569*cdf0e10cSrcweir 570*cdf0e10cSrcweir // Testen, ob das Workwindow gerade ein Andocken erlaubt 571*cdf0e10cSrcweir SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); 572*cdf0e10cSrcweir if ( !pWorkWin->IsDockingAllowed() || !pWorkWin->IsInternalDockingAllowed() ) 573*cdf0e10cSrcweir return sal_False; 574*cdf0e10cSrcweir } 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir return sal_True; 577*cdf0e10cSrcweir } 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir //------------------------------------------------------------------------- 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir void SfxDockingWindow::ToggleFloatingMode() 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir /* [Beschreibung] 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir Diese virtuelle Methode der Klasse DockingWindow setzt die internen 586*cdf0e10cSrcweir Daten des SfxDockingWindow und sorgt f"ur korrektes Alignment am 587*cdf0e10cSrcweir parent window. 588*cdf0e10cSrcweir Durch PrepareToggleFloatMode und Initialize ist sichergestellt, da\s 589*cdf0e10cSrcweir pImp->GetLastAlignment() immer eine erlaubtes Alignment liefert. 590*cdf0e10cSrcweir Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s 591*cdf0e10cSrcweir zuerst SfxDockingWindow::ToggleFloatingMode() gerufen werden. 592*cdf0e10cSrcweir */ 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir if ( !pImp->bConstructed || !pMgr ) 595*cdf0e10cSrcweir return; // Kein Handler-Aufruf 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir // Altes Alignment merken und dann umschalten. 598*cdf0e10cSrcweir // Sv hat jetzt schon umgeschaltet, aber Alignment am SfxDockingWindow 599*cdf0e10cSrcweir // ist noch das alte! 600*cdf0e10cSrcweir // Was war ich bisher ? 601*cdf0e10cSrcweir SfxChildAlignment eLastAlign = GetAlignment(); 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); 604*cdf0e10cSrcweir SfxChildIdentifier eIdent = SFX_CHILDWIN_DOCKINGWINDOW; 605*cdf0e10cSrcweir if ( pImp->bSplitable ) 606*cdf0e10cSrcweir eIdent = SFX_CHILDWIN_SPLITWINDOW; 607*cdf0e10cSrcweir 608*cdf0e10cSrcweir if (IsFloatingMode()) 609*cdf0e10cSrcweir { 610*cdf0e10cSrcweir SetAlignment(SFX_ALIGN_NOALIGNMENT); 611*cdf0e10cSrcweir if ( pImp->aWinState.Len() ) 612*cdf0e10cSrcweir GetFloatingWindow()->SetWindowState( pImp->aWinState ); 613*cdf0e10cSrcweir else 614*cdf0e10cSrcweir GetFloatingWindow()->SetOutputSizePixel( GetFloatingSize() ); 615*cdf0e10cSrcweir /* 616*cdf0e10cSrcweir if ( pImp->bSplitable && !pImp->bEndDocked ) 617*cdf0e10cSrcweir // Wenn das Fenster vorher in einem SplitWindow lag, kommt von 618*cdf0e10cSrcweir // Sv kein Show 619*cdf0e10cSrcweir Show(); 620*cdf0e10cSrcweir */ 621*cdf0e10cSrcweir } 622*cdf0e10cSrcweir else 623*cdf0e10cSrcweir { 624*cdf0e10cSrcweir if (pImp->GetDockAlignment() == eLastAlign) 625*cdf0e10cSrcweir { 626*cdf0e10cSrcweir // Wenn ToggleFloatingMode aufgerufen wurde, das DockAlignment 627*cdf0e10cSrcweir // aber noch unver"andert ist, mu\s das ein Toggeln durch DClick 628*cdf0e10cSrcweir // gewesen sein, also LastAlignment verwenden 629*cdf0e10cSrcweir SetAlignment (pImp->GetLastAlignment()); 630*cdf0e10cSrcweir if ( !pImp->bSplitable ) 631*cdf0e10cSrcweir SetSizePixel( CalcDockingSize(GetAlignment()) ); 632*cdf0e10cSrcweir } 633*cdf0e10cSrcweir else 634*cdf0e10cSrcweir { 635*cdf0e10cSrcweir // Toggeln wurde durch Draggen ausgel"ost 636*cdf0e10cSrcweir pImp->nLine = pImp->nDockLine; 637*cdf0e10cSrcweir pImp->nPos = pImp->nDockPos; 638*cdf0e10cSrcweir SetAlignment (pImp->GetDockAlignment()); 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir if ( pImp->bSplitable ) 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir // Das DockingWindow kommt jetzt in ein SplitWindow 644*cdf0e10cSrcweir pImp->pSplitWin = pWorkWin->GetSplitWindow_Impl(GetAlignment()); 645*cdf0e10cSrcweir 646*cdf0e10cSrcweir // Das LastAlignment ist jetzt immer noch das zuletzt angedockte 647*cdf0e10cSrcweir SfxSplitWindow *pSplit = pWorkWin->GetSplitWindow_Impl(pImp->GetLastAlignment()); 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir DBG_ASSERT( pSplit, "LastAlignment kann nicht stimmen!" ); 650*cdf0e10cSrcweir if ( pSplit && pSplit != pImp->pSplitWin ) 651*cdf0e10cSrcweir pSplit->ReleaseWindow_Impl(this); 652*cdf0e10cSrcweir if ( pImp->GetDockAlignment() == eLastAlign ) 653*cdf0e10cSrcweir pImp->pSplitWin->InsertWindow( this, pImp->aSplitSize ); 654*cdf0e10cSrcweir else 655*cdf0e10cSrcweir pImp->pSplitWin->InsertWindow( this, pImp->aSplitSize, pImp->nLine, pImp->nPos, pImp->bNewLine ); 656*cdf0e10cSrcweir if ( !pImp->pSplitWin->IsFadeIn() ) 657*cdf0e10cSrcweir pImp->pSplitWin->FadeIn(); 658*cdf0e10cSrcweir } 659*cdf0e10cSrcweir } 660*cdf0e10cSrcweir 661*cdf0e10cSrcweir // altes Alignment festhalten f"ur n"achstes Togglen; erst jetzt setzen 662*cdf0e10cSrcweir // wg. Abmelden beim SplitWindow! 663*cdf0e10cSrcweir pImp->SetLastAlignment(eLastAlign); 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir // DockAlignment zur"ucksetzen, falls noch EndDocking gerufen wird 666*cdf0e10cSrcweir pImp->SetDockAlignment(GetAlignment()); 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir // SfxChildWindow korrekt andocken bzw. entdocken 669*cdf0e10cSrcweir if ( pMgr ) 670*cdf0e10cSrcweir pWorkWin->ConfigChild_Impl( eIdent, SFX_TOGGLEFLOATMODE, pMgr->GetType() ); 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir //------------------------------------------------------------------------- 674*cdf0e10cSrcweir 675*cdf0e10cSrcweir void SfxDockingWindow::StartDocking() 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir /* [Beschreibung] 678*cdf0e10cSrcweir 679*cdf0e10cSrcweir Diese virtuelle Methode der Klasse DockingWindow holt vom parent window 680*cdf0e10cSrcweir das innere und "au\sere docking rectangle. 681*cdf0e10cSrcweir Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s 682*cdf0e10cSrcweir am Ende SfxDockingWindow::StartDocking() gerufen werden. 683*cdf0e10cSrcweir */ 684*cdf0e10cSrcweir { 685*cdf0e10cSrcweir if ( !pImp->bConstructed || !pMgr ) 686*cdf0e10cSrcweir return; 687*cdf0e10cSrcweir SfxChildIdentifier eIdent = SFX_CHILDWIN_DOCKINGWINDOW; 688*cdf0e10cSrcweir if ( pImp->bSplitable ) 689*cdf0e10cSrcweir eIdent = SFX_CHILDWIN_SPLITWINDOW; 690*cdf0e10cSrcweir SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); 691*cdf0e10cSrcweir pWorkWin->ConfigChild_Impl( eIdent, SFX_SETDOCKINGRECTS, pMgr->GetType() ); 692*cdf0e10cSrcweir pImp->SetDockAlignment(GetAlignment()); 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir if ( pImp->pSplitWin ) 695*cdf0e10cSrcweir { 696*cdf0e10cSrcweir // Die aktuellen Docking-Daten besorgen 697*cdf0e10cSrcweir pImp->pSplitWin->GetWindowPos(this, pImp->nLine, pImp->nPos); 698*cdf0e10cSrcweir pImp->nDockLine = pImp->nLine; 699*cdf0e10cSrcweir pImp->nDockPos = pImp->nPos; 700*cdf0e10cSrcweir pImp->bNewLine = sal_False; 701*cdf0e10cSrcweir } 702*cdf0e10cSrcweir } 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir //------------------------------------------------------------------------- 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir sal_Bool SfxDockingWindow::Docking( const Point& rPos, Rectangle& rRect ) 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir /* [Beschreibung] 709*cdf0e10cSrcweir 710*cdf0e10cSrcweir Diese virtuelle Methode der Klasse DockingWindow berechnet das aktuelle 711*cdf0e10cSrcweir tracking rectangle. Dazu benutzt sie die Methode CalcAlignment(rPos,rRect), 712*cdf0e10cSrcweir deren Verhalten von abgeleiteten Klassen beeinflu\st werden kann (s.u.). 713*cdf0e10cSrcweir Diese Methode sollte nach M"oglichkeit nicht "uberschrieben werden. 714*cdf0e10cSrcweir */ 715*cdf0e10cSrcweir { 716*cdf0e10cSrcweir if ( Application::IsInModalMode() ) 717*cdf0e10cSrcweir return sal_True; 718*cdf0e10cSrcweir 719*cdf0e10cSrcweir if ( !pImp->bConstructed || !pMgr ) 720*cdf0e10cSrcweir { 721*cdf0e10cSrcweir rRect.SetSize( Size() ); 722*cdf0e10cSrcweir return IsFloatingMode(); 723*cdf0e10cSrcweir } 724*cdf0e10cSrcweir 725*cdf0e10cSrcweir SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); 726*cdf0e10cSrcweir if ( pImp->bDockingPrevented || !pWorkWin->IsInternalDockingAllowed() ) 727*cdf0e10cSrcweir return sal_False; 728*cdf0e10cSrcweir 729*cdf0e10cSrcweir sal_Bool bFloatMode = sal_False; 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir if ( GetOuterRect().IsInside( rPos ) && !IsDockingPrevented() ) 732*cdf0e10cSrcweir { 733*cdf0e10cSrcweir // Maus innerhalb OuterRect : Alignment und Rectangle berechnen 734*cdf0e10cSrcweir SfxChildAlignment eAlign = CalcAlignment(rPos, rRect); 735*cdf0e10cSrcweir if (eAlign == SFX_ALIGN_NOALIGNMENT) 736*cdf0e10cSrcweir bFloatMode = sal_True; 737*cdf0e10cSrcweir pImp->SetDockAlignment(eAlign); 738*cdf0e10cSrcweir } 739*cdf0e10cSrcweir else 740*cdf0e10cSrcweir { 741*cdf0e10cSrcweir // Maus nicht innerhalb OuterRect : muss FloatingWindow sein 742*cdf0e10cSrcweir // Ist das erlaubt ? 743*cdf0e10cSrcweir if (CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_NOALIGNMENT) != SFX_ALIGN_NOALIGNMENT) 744*cdf0e10cSrcweir return sal_False; 745*cdf0e10cSrcweir bFloatMode = sal_True; 746*cdf0e10cSrcweir if ( SFX_ALIGN_NOALIGNMENT != pImp->GetDockAlignment() ) 747*cdf0e10cSrcweir { 748*cdf0e10cSrcweir // wg. SV-Bug darf rRect nur ver"andert werden, wenn sich das 749*cdf0e10cSrcweir // Alignment "andert ! 750*cdf0e10cSrcweir pImp->SetDockAlignment(SFX_ALIGN_NOALIGNMENT); 751*cdf0e10cSrcweir rRect.SetSize(CalcDockingSize(SFX_ALIGN_NOALIGNMENT)); 752*cdf0e10cSrcweir } 753*cdf0e10cSrcweir } 754*cdf0e10cSrcweir 755*cdf0e10cSrcweir if ( !pImp->bSplitable ) 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir // Bei individuell angedocktem Window wird die Position durch das 758*cdf0e10cSrcweir // Alignment und die docking rects festgelegt. 759*cdf0e10cSrcweir Size aSize = rRect.GetSize(); 760*cdf0e10cSrcweir Point aPos; 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir switch ( pImp->GetDockAlignment() ) 763*cdf0e10cSrcweir { 764*cdf0e10cSrcweir case SFX_ALIGN_LEFT: 765*cdf0e10cSrcweir case SFX_ALIGN_FIRSTLEFT: 766*cdf0e10cSrcweir case SFX_ALIGN_LASTLEFT: 767*cdf0e10cSrcweir aPos = aInnerRect.TopLeft(); 768*cdf0e10cSrcweir if ( pImp->GetDockAlignment() == GetAlignment() ) 769*cdf0e10cSrcweir aPos.X() -= aSize.Width(); 770*cdf0e10cSrcweir break; 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir case SFX_ALIGN_TOP: 773*cdf0e10cSrcweir case SFX_ALIGN_LOWESTTOP: 774*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTTOP: 775*cdf0e10cSrcweir aPos = Point(aOuterRect.Left(), aInnerRect.Top()); 776*cdf0e10cSrcweir if ( pImp->GetDockAlignment() == GetAlignment() ) 777*cdf0e10cSrcweir aPos.Y() -= aSize.Height(); 778*cdf0e10cSrcweir break; 779*cdf0e10cSrcweir 780*cdf0e10cSrcweir case SFX_ALIGN_RIGHT: 781*cdf0e10cSrcweir case SFX_ALIGN_FIRSTRIGHT: 782*cdf0e10cSrcweir case SFX_ALIGN_LASTRIGHT: 783*cdf0e10cSrcweir aPos = Point(aInnerRect.Right() - rRect.GetSize().Width(), 784*cdf0e10cSrcweir aInnerRect.Top()); 785*cdf0e10cSrcweir if ( pImp->GetDockAlignment() == GetAlignment() ) 786*cdf0e10cSrcweir aPos.X() += aSize.Width(); 787*cdf0e10cSrcweir break; 788*cdf0e10cSrcweir 789*cdf0e10cSrcweir case SFX_ALIGN_BOTTOM: 790*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTBOTTOM: 791*cdf0e10cSrcweir case SFX_ALIGN_LOWESTBOTTOM: 792*cdf0e10cSrcweir aPos = Point(aOuterRect.Left(), 793*cdf0e10cSrcweir aInnerRect.Bottom() - rRect.GetSize().Height()); 794*cdf0e10cSrcweir if ( pImp->GetDockAlignment() == GetAlignment() ) 795*cdf0e10cSrcweir aPos.Y() += aSize.Height(); 796*cdf0e10cSrcweir break; 797*cdf0e10cSrcweir default: 798*cdf0e10cSrcweir break; 799*cdf0e10cSrcweir } 800*cdf0e10cSrcweir 801*cdf0e10cSrcweir rRect.SetPos(aPos); 802*cdf0e10cSrcweir } 803*cdf0e10cSrcweir 804*cdf0e10cSrcweir return bFloatMode; 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir //------------------------------------------------------------------------- 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir void SfxDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) 810*cdf0e10cSrcweir 811*cdf0e10cSrcweir /* [Beschreibung] 812*cdf0e10cSrcweir 813*cdf0e10cSrcweir Diese virtuelle Methode der Klasse DockingWindow sorgt f"ur das korrekte 814*cdf0e10cSrcweir Alignment am parent window. 815*cdf0e10cSrcweir Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s 816*cdf0e10cSrcweir zuerst SfxDockingWindow::EndDocking() gerufen werden. 817*cdf0e10cSrcweir */ 818*cdf0e10cSrcweir { 819*cdf0e10cSrcweir if ( !pImp->bConstructed || IsDockingCanceled() || !pMgr ) 820*cdf0e10cSrcweir return; 821*cdf0e10cSrcweir 822*cdf0e10cSrcweir SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); 823*cdf0e10cSrcweir sal_Bool bReArrange = sal_False; 824*cdf0e10cSrcweir SfxChildIdentifier eIdent = SFX_CHILDWIN_DOCKINGWINDOW; 825*cdf0e10cSrcweir if ( pImp->bSplitable ) 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir eIdent = SFX_CHILDWIN_SPLITWINDOW; 828*cdf0e10cSrcweir 829*cdf0e10cSrcweir // Wenn sich das Alignment "andert und das Fenster befindet sich 830*cdf0e10cSrcweir // im angedockten Zustand in einem SplitWindow, mu\s umgemeldet werden 831*cdf0e10cSrcweir // Wenn neu angedockt wird, machen PrepareToggleFloatingMode() 832*cdf0e10cSrcweir // und ToggleFloatingMode() das Ummelden. 833*cdf0e10cSrcweir if ( !bFloatMode ) 834*cdf0e10cSrcweir bReArrange = sal_True; 835*cdf0e10cSrcweir } 836*cdf0e10cSrcweir 837*cdf0e10cSrcweir if ( bReArrange ) 838*cdf0e10cSrcweir { 839*cdf0e10cSrcweir if ( GetAlignment() != pImp->GetDockAlignment() ) 840*cdf0e10cSrcweir { 841*cdf0e10cSrcweir // Vor dem Show() mu\s das Ummelden passiert sein, daher kann nicht 842*cdf0e10cSrcweir // die Basisklasse gerufen werden 843*cdf0e10cSrcweir if ( IsFloatingMode() || !pImp->bSplitable ) 844*cdf0e10cSrcweir Show( sal_False, SHOW_NOFOCUSCHANGE ); 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir // Die Gr"o\se f"urs Toggeln setzen 847*cdf0e10cSrcweir pImp->aSplitSize = rRect.GetSize(); 848*cdf0e10cSrcweir if ( IsFloatingMode() ) 849*cdf0e10cSrcweir { 850*cdf0e10cSrcweir SetFloatingMode( bFloatMode ); 851*cdf0e10cSrcweir if ( IsFloatingMode() || !pImp->bSplitable ) 852*cdf0e10cSrcweir Show( sal_True, SHOW_NOFOCUSCHANGE ); 853*cdf0e10cSrcweir } 854*cdf0e10cSrcweir else 855*cdf0e10cSrcweir { 856*cdf0e10cSrcweir pImp->pSplitWin->RemoveWindow(this,sal_False); 857*cdf0e10cSrcweir pImp->nLine = pImp->nDockLine; 858*cdf0e10cSrcweir pImp->nPos = pImp->nDockPos; 859*cdf0e10cSrcweir pImp->pSplitWin->ReleaseWindow_Impl(this); 860*cdf0e10cSrcweir pImp->pSplitWin = pWorkWin->GetSplitWindow_Impl(pImp->GetDockAlignment()); 861*cdf0e10cSrcweir pImp->pSplitWin->InsertWindow( this, pImp->aSplitSize, pImp->nDockLine, pImp->nDockPos, pImp->bNewLine ); 862*cdf0e10cSrcweir if ( !pImp->pSplitWin->IsFadeIn() ) 863*cdf0e10cSrcweir pImp->pSplitWin->FadeIn(); 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir } 866*cdf0e10cSrcweir else if ( pImp->nLine != pImp->nDockLine || pImp->nPos != pImp->nDockPos || pImp->bNewLine ) 867*cdf0e10cSrcweir { 868*cdf0e10cSrcweir // Ich wurde innerhalb meines Splitwindows verschoben. 869*cdf0e10cSrcweir if ( pImp->nLine != pImp->nDockLine ) 870*cdf0e10cSrcweir pImp->aSplitSize = rRect.GetSize(); 871*cdf0e10cSrcweir pImp->pSplitWin->MoveWindow( this, pImp->aSplitSize, pImp->nDockLine, pImp->nDockPos, pImp->bNewLine ); 872*cdf0e10cSrcweir } 873*cdf0e10cSrcweir } 874*cdf0e10cSrcweir else 875*cdf0e10cSrcweir { 876*cdf0e10cSrcweir pImp->bEndDocked = sal_True; 877*cdf0e10cSrcweir DockingWindow::EndDocking(rRect, bFloatMode); 878*cdf0e10cSrcweir pImp->bEndDocked = sal_False; 879*cdf0e10cSrcweir } 880*cdf0e10cSrcweir 881*cdf0e10cSrcweir SetAlignment( IsFloatingMode() ? SFX_ALIGN_NOALIGNMENT : pImp->GetDockAlignment() ); 882*cdf0e10cSrcweir } 883*cdf0e10cSrcweir 884*cdf0e10cSrcweir //------------------------------------------------------------------------- 885*cdf0e10cSrcweir 886*cdf0e10cSrcweir void SfxDockingWindow::Resizing( Size& /*rSize*/ ) 887*cdf0e10cSrcweir 888*cdf0e10cSrcweir /* [Beschreibung] 889*cdf0e10cSrcweir 890*cdf0e10cSrcweir Virtuelle Methode der Klasse DockingWindow. 891*cdf0e10cSrcweir Hier kann das interaktive Umgr"o\sern im FloatingMode beeinflu\t werden, 892*cdf0e10cSrcweir z.B. indem nur diskrete Werte f"ur Breite und/oder H"ohe zugelassen werden. 893*cdf0e10cSrcweir Die Basisimplementation verhindert, da\s die OutputSize kleiner wird als 894*cdf0e10cSrcweir eine mit SetMinOutputSizePixel() gesetzte Gr"o\se. 895*cdf0e10cSrcweir */ 896*cdf0e10cSrcweir 897*cdf0e10cSrcweir { 898*cdf0e10cSrcweir /* 899*cdf0e10cSrcweir if(rSize.Width() < pImp->aMinSize.Width()) 900*cdf0e10cSrcweir rSize.Width() = pImp->aMinSize.Width(); 901*cdf0e10cSrcweir if(rSize.Height() < pImp->aMinSize.Height()) 902*cdf0e10cSrcweir rSize.Height() = pImp->aMinSize.Height(); 903*cdf0e10cSrcweir */ 904*cdf0e10cSrcweir } 905*cdf0e10cSrcweir 906*cdf0e10cSrcweir //------------------------------------------------------------------------- 907*cdf0e10cSrcweir 908*cdf0e10cSrcweir SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, 909*cdf0e10cSrcweir Window* pParent, WinBits nWinBits) : 910*cdf0e10cSrcweir DockingWindow (pParent, nWinBits), 911*cdf0e10cSrcweir pBindings(pBindinx), 912*cdf0e10cSrcweir pMgr(pCW), 913*cdf0e10cSrcweir pImp(NULL) 914*cdf0e10cSrcweir 915*cdf0e10cSrcweir /* [Beschreibung] 916*cdf0e10cSrcweir 917*cdf0e10cSrcweir ctor der Klasse SfxDockingWindow. Es wird ein SfxChildWindow ben"otigt, 918*cdf0e10cSrcweir da das Andocken im Sfx "uber SfxChildWindows realisiert wird. 919*cdf0e10cSrcweir */ 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir { 922*cdf0e10cSrcweir if ( GetHelpId().getLength() ) 923*cdf0e10cSrcweir { 924*cdf0e10cSrcweir SetUniqueId( GetHelpId() ); 925*cdf0e10cSrcweir SetHelpId(""); 926*cdf0e10cSrcweir } 927*cdf0e10cSrcweir else 928*cdf0e10cSrcweir { 929*cdf0e10cSrcweir SfxViewFrame* pViewFrame = pBindings->GetDispatcher()->GetFrame(); 930*cdf0e10cSrcweir SfxSlotPool* pSlotPool = pViewFrame->GetObjectShell()->GetModule()->GetSlotPool(); 931*cdf0e10cSrcweir const SfxSlot* pSlot = pSlotPool->GetSlot( pCW->GetType() ); 932*cdf0e10cSrcweir if ( pSlot ) 933*cdf0e10cSrcweir { 934*cdf0e10cSrcweir rtl::OString aCmd("SFXDOCKINGWINDOW_"); 935*cdf0e10cSrcweir aCmd += pSlot->GetUnoName(); 936*cdf0e10cSrcweir SetUniqueId( aCmd ); 937*cdf0e10cSrcweir } 938*cdf0e10cSrcweir } 939*cdf0e10cSrcweir 940*cdf0e10cSrcweir pImp = new SfxDockingWindow_Impl; 941*cdf0e10cSrcweir pImp->bConstructed = sal_False; 942*cdf0e10cSrcweir pImp->pSplitWin = 0; 943*cdf0e10cSrcweir pImp->bEndDocked = sal_False; 944*cdf0e10cSrcweir pImp->bDockingPrevented = sal_False; 945*cdf0e10cSrcweir 946*cdf0e10cSrcweir pImp->bSplitable = sal_True; 947*cdf0e10cSrcweir // pImp->bAutoHide = sal_False; 948*cdf0e10cSrcweir 949*cdf0e10cSrcweir // Zun"achst auf Defaults setzen; das Alignment wird in der Subklasse gesetzt 950*cdf0e10cSrcweir pImp->nLine = pImp->nDockLine = 0; 951*cdf0e10cSrcweir pImp->nPos = pImp->nDockPos = 0; 952*cdf0e10cSrcweir pImp->bNewLine = sal_False; 953*cdf0e10cSrcweir pImp->SetLastAlignment(SFX_ALIGN_NOALIGNMENT); 954*cdf0e10cSrcweir pImp->aMoveTimer.SetTimeout(50); 955*cdf0e10cSrcweir pImp->aMoveTimer.SetTimeoutHdl(LINK(this,SfxDockingWindow,TimerHdl)); 956*cdf0e10cSrcweir 957*cdf0e10cSrcweir // DBG_ASSERT(pMgr,"DockingWindow erfordert ein SfxChildWindow!"); 958*cdf0e10cSrcweir } 959*cdf0e10cSrcweir 960*cdf0e10cSrcweir //------------------------------------------------------------------------- 961*cdf0e10cSrcweir 962*cdf0e10cSrcweir SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, 963*cdf0e10cSrcweir Window* pParent, const ResId& rResId) : 964*cdf0e10cSrcweir DockingWindow(pParent, rResId), 965*cdf0e10cSrcweir pBindings(pBindinx), 966*cdf0e10cSrcweir pMgr(pCW), 967*cdf0e10cSrcweir pImp(NULL) 968*cdf0e10cSrcweir 969*cdf0e10cSrcweir /* [Beschreibung] 970*cdf0e10cSrcweir 971*cdf0e10cSrcweir ctor der Klasse SfxDockingWindow. Es wird ein SfxChildWindow ben"otigt, 972*cdf0e10cSrcweir da das Andocken im Sfx "uber SfxChildWindows realisiert wird. 973*cdf0e10cSrcweir */ 974*cdf0e10cSrcweir 975*cdf0e10cSrcweir { 976*cdf0e10cSrcweir if ( GetHelpId().getLength() ) 977*cdf0e10cSrcweir { 978*cdf0e10cSrcweir SetUniqueId( GetHelpId() ); 979*cdf0e10cSrcweir SetHelpId(""); 980*cdf0e10cSrcweir } 981*cdf0e10cSrcweir else 982*cdf0e10cSrcweir { 983*cdf0e10cSrcweir SfxViewFrame* pViewFrame = pBindings->GetDispatcher()->GetFrame(); 984*cdf0e10cSrcweir SfxSlotPool* pSlotPool = pViewFrame->GetObjectShell()->GetModule()->GetSlotPool(); 985*cdf0e10cSrcweir const SfxSlot* pSlot = pSlotPool->GetSlot( pCW->GetType() ); 986*cdf0e10cSrcweir if ( pSlot ) 987*cdf0e10cSrcweir { 988*cdf0e10cSrcweir rtl::OString aCmd("SFXDOCKINGWINDOW_"); 989*cdf0e10cSrcweir aCmd += pSlot->GetUnoName(); 990*cdf0e10cSrcweir SetUniqueId( aCmd ); 991*cdf0e10cSrcweir } 992*cdf0e10cSrcweir } 993*cdf0e10cSrcweir 994*cdf0e10cSrcweir pImp = new SfxDockingWindow_Impl; 995*cdf0e10cSrcweir pImp->bConstructed = sal_False; 996*cdf0e10cSrcweir pImp->pSplitWin = 0; 997*cdf0e10cSrcweir pImp->bEndDocked = sal_False; 998*cdf0e10cSrcweir pImp->bDockingPrevented = sal_False; 999*cdf0e10cSrcweir 1000*cdf0e10cSrcweir pImp->bSplitable = sal_True; 1001*cdf0e10cSrcweir // pImp->bAutoHide = sal_False; 1002*cdf0e10cSrcweir 1003*cdf0e10cSrcweir // Zun"achst auf Defaults setzen; das Alignment wird in der Subklasse gesetzt 1004*cdf0e10cSrcweir pImp->nLine = pImp->nDockLine = 0; 1005*cdf0e10cSrcweir pImp->nPos = pImp->nDockPos = 0; 1006*cdf0e10cSrcweir pImp->bNewLine = sal_False; 1007*cdf0e10cSrcweir pImp->SetLastAlignment(SFX_ALIGN_NOALIGNMENT); 1008*cdf0e10cSrcweir pImp->aMoveTimer.SetTimeout(50); 1009*cdf0e10cSrcweir pImp->aMoveTimer.SetTimeoutHdl(LINK(this,SfxDockingWindow,TimerHdl)); 1010*cdf0e10cSrcweir 1011*cdf0e10cSrcweir // DBG_ASSERT(pMgr,"DockingWindow erfordert ein SfxChildWindow!"); 1012*cdf0e10cSrcweir } 1013*cdf0e10cSrcweir 1014*cdf0e10cSrcweir //------------------------------------------------------------------------- 1015*cdf0e10cSrcweir 1016*cdf0e10cSrcweir void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo) 1017*cdf0e10cSrcweir /* [Beschreibung] 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir Initialisierung der Klasse SfxDockingWindow "uber ein SfxChildWinInfo. 1020*cdf0e10cSrcweir Die Initialisierung erfolgt erst in einem 2.Schritt nach dem ctor und sollte 1021*cdf0e10cSrcweir vom ctor der abgeleiteten Klasse oder vom ctor des SfxChildWindows 1022*cdf0e10cSrcweir aufgerufen werden. 1023*cdf0e10cSrcweir */ 1024*cdf0e10cSrcweir { 1025*cdf0e10cSrcweir if ( !pMgr ) 1026*cdf0e10cSrcweir { 1027*cdf0e10cSrcweir // Bugfix #39771 1028*cdf0e10cSrcweir pImp->SetDockAlignment( SFX_ALIGN_NOALIGNMENT ); 1029*cdf0e10cSrcweir pImp->bConstructed = sal_True; 1030*cdf0e10cSrcweir return; 1031*cdf0e10cSrcweir } 1032*cdf0e10cSrcweir 1033*cdf0e10cSrcweir if ( pInfo->nFlags & SFX_CHILDWIN_FORCEDOCK ) 1034*cdf0e10cSrcweir pImp->bDockingPrevented = sal_True; 1035*cdf0e10cSrcweir 1036*cdf0e10cSrcweir pImp->aSplitSize = GetOutputSizePixel(); 1037*cdf0e10cSrcweir if ( !GetFloatingSize().Width() ) 1038*cdf0e10cSrcweir { 1039*cdf0e10cSrcweir Size aMinSize( GetMinOutputSizePixel() ); 1040*cdf0e10cSrcweir SetFloatingSize( pImp->aSplitSize ); 1041*cdf0e10cSrcweir if ( pImp->aSplitSize.Width() < aMinSize.Width() ) 1042*cdf0e10cSrcweir pImp->aSplitSize.Width() = aMinSize.Width(); 1043*cdf0e10cSrcweir if ( pImp->aSplitSize.Height() < aMinSize.Height() ) 1044*cdf0e10cSrcweir pImp->aSplitSize.Height() = aMinSize.Height(); 1045*cdf0e10cSrcweir } 1046*cdf0e10cSrcweir 1047*cdf0e10cSrcweir sal_Bool bVertHorzRead( sal_False ); 1048*cdf0e10cSrcweir if ( pInfo->aExtraString.Len() ) 1049*cdf0e10cSrcweir { 1050*cdf0e10cSrcweir // get information about alignment, split size and position in SplitWindow 1051*cdf0e10cSrcweir String aStr; 1052*cdf0e10cSrcweir sal_uInt16 nPos = pInfo->aExtraString.SearchAscii("AL:"); 1053*cdf0e10cSrcweir if ( nPos != STRING_NOTFOUND ) 1054*cdf0e10cSrcweir { 1055*cdf0e10cSrcweir // alignment information 1056*cdf0e10cSrcweir sal_uInt16 n1 = pInfo->aExtraString.Search('(', nPos); 1057*cdf0e10cSrcweir if ( n1 != STRING_NOTFOUND ) 1058*cdf0e10cSrcweir { 1059*cdf0e10cSrcweir sal_uInt16 n2 = pInfo->aExtraString.Search(')', n1); 1060*cdf0e10cSrcweir if ( n2 != STRING_NOTFOUND ) 1061*cdf0e10cSrcweir { 1062*cdf0e10cSrcweir // extract alignment information from extrastring 1063*cdf0e10cSrcweir aStr = pInfo->aExtraString.Copy(nPos, n2 - nPos + 1); 1064*cdf0e10cSrcweir pInfo->aExtraString.Erase(nPos, n2 - nPos + 1); 1065*cdf0e10cSrcweir aStr.Erase(nPos, n1-nPos+1); 1066*cdf0e10cSrcweir } 1067*cdf0e10cSrcweir } 1068*cdf0e10cSrcweir } 1069*cdf0e10cSrcweir 1070*cdf0e10cSrcweir if ( aStr.Len() ) 1071*cdf0e10cSrcweir { 1072*cdf0e10cSrcweir // accept window state only if alignment is also set 1073*cdf0e10cSrcweir pImp->aWinState = pInfo->aWinState; 1074*cdf0e10cSrcweir 1075*cdf0e10cSrcweir // check for valid alignment 1076*cdf0e10cSrcweir SfxChildAlignment eLocalAlignment = (SfxChildAlignment) (sal_uInt16) aStr.ToInt32(); 1077*cdf0e10cSrcweir if ( pImp->bDockingPrevented ) 1078*cdf0e10cSrcweir // docking prevented, ignore old configuration and take alignment from default 1079*cdf0e10cSrcweir aStr.Erase(); 1080*cdf0e10cSrcweir else 1081*cdf0e10cSrcweir SetAlignment( eLocalAlignment ); 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir SfxChildAlignment eAlign = CheckAlignment(GetAlignment(),GetAlignment()); 1084*cdf0e10cSrcweir if ( eAlign != GetAlignment() ) 1085*cdf0e10cSrcweir { 1086*cdf0e10cSrcweir DBG_ERROR("Invalid Alignment!"); 1087*cdf0e10cSrcweir SetAlignment( eAlign ); 1088*cdf0e10cSrcweir aStr.Erase(); 1089*cdf0e10cSrcweir } 1090*cdf0e10cSrcweir 1091*cdf0e10cSrcweir // get last alignment (for toggeling) 1092*cdf0e10cSrcweir nPos = aStr.Search(','); 1093*cdf0e10cSrcweir if ( nPos != STRING_NOTFOUND ) 1094*cdf0e10cSrcweir { 1095*cdf0e10cSrcweir aStr.Erase(0, nPos+1); 1096*cdf0e10cSrcweir pImp->SetLastAlignment( (SfxChildAlignment) (sal_uInt16) aStr.ToInt32() ); 1097*cdf0e10cSrcweir } 1098*cdf0e10cSrcweir 1099*cdf0e10cSrcweir nPos = aStr.Search(','); 1100*cdf0e10cSrcweir if ( nPos != STRING_NOTFOUND ) 1101*cdf0e10cSrcweir { 1102*cdf0e10cSrcweir // get split size and position in SplitWindow 1103*cdf0e10cSrcweir Point aPos; 1104*cdf0e10cSrcweir aStr.Erase(0, nPos+1); 1105*cdf0e10cSrcweir if ( GetPosSizeFromString( aStr, aPos, pImp->aSplitSize ) ) 1106*cdf0e10cSrcweir { 1107*cdf0e10cSrcweir pImp->nLine = pImp->nDockLine = (sal_uInt16) aPos.X(); 1108*cdf0e10cSrcweir pImp->nPos = pImp->nDockPos = (sal_uInt16) aPos.Y(); 1109*cdf0e10cSrcweir pImp->nVerticalSize = pImp->aSplitSize.Height(); 1110*cdf0e10cSrcweir pImp->nHorizontalSize = pImp->aSplitSize.Width(); 1111*cdf0e10cSrcweir if ( GetSplitSizeFromString( aStr, pImp->aSplitSize )) 1112*cdf0e10cSrcweir bVertHorzRead = sal_True; 1113*cdf0e10cSrcweir } 1114*cdf0e10cSrcweir } 1115*cdf0e10cSrcweir } 1116*cdf0e10cSrcweir else { 1117*cdf0e10cSrcweir DBG_ERROR( "Information is missing!" ); 1118*cdf0e10cSrcweir } 1119*cdf0e10cSrcweir } 1120*cdf0e10cSrcweir 1121*cdf0e10cSrcweir if ( !bVertHorzRead ) 1122*cdf0e10cSrcweir { 1123*cdf0e10cSrcweir pImp->nVerticalSize = pImp->aSplitSize.Height(); 1124*cdf0e10cSrcweir pImp->nHorizontalSize = pImp->aSplitSize.Width(); 1125*cdf0e10cSrcweir } 1126*cdf0e10cSrcweir 1127*cdf0e10cSrcweir SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); 1128*cdf0e10cSrcweir if ( GetAlignment() != SFX_ALIGN_NOALIGNMENT ) 1129*cdf0e10cSrcweir { 1130*cdf0e10cSrcweir // check if SfxWorkWindow is able to allow docking at its border 1131*cdf0e10cSrcweir if ( 1132*cdf0e10cSrcweir !pWorkWin->IsDockingAllowed() || 1133*cdf0e10cSrcweir !pWorkWin->IsInternalDockingAllowed() || 1134*cdf0e10cSrcweir ( (GetFloatStyle() & WB_STANDALONE) && Application::IsInModalMode()) ) 1135*cdf0e10cSrcweir { 1136*cdf0e10cSrcweir SetAlignment( SFX_ALIGN_NOALIGNMENT ); 1137*cdf0e10cSrcweir } 1138*cdf0e10cSrcweir } 1139*cdf0e10cSrcweir 1140*cdf0e10cSrcweir // detect floating mode 1141*cdf0e10cSrcweir // toggeling mode will not execute code in handlers, because pImp->bConstructed is not set yet 1142*cdf0e10cSrcweir sal_Bool bFloatMode = IsFloatingMode(); 1143*cdf0e10cSrcweir if ( bFloatMode != ((GetAlignment() == SFX_ALIGN_NOALIGNMENT)) ) 1144*cdf0e10cSrcweir { 1145*cdf0e10cSrcweir bFloatMode = !bFloatMode; 1146*cdf0e10cSrcweir SetFloatingMode( bFloatMode ); 1147*cdf0e10cSrcweir if ( bFloatMode ) 1148*cdf0e10cSrcweir { 1149*cdf0e10cSrcweir if ( pImp->aWinState.Len() ) 1150*cdf0e10cSrcweir GetFloatingWindow()->SetWindowState( pImp->aWinState ); 1151*cdf0e10cSrcweir else 1152*cdf0e10cSrcweir GetFloatingWindow()->SetOutputSizePixel( GetFloatingSize() ); 1153*cdf0e10cSrcweir } 1154*cdf0e10cSrcweir } 1155*cdf0e10cSrcweir 1156*cdf0e10cSrcweir if ( IsFloatingMode() ) 1157*cdf0e10cSrcweir { 1158*cdf0e10cSrcweir // validate last alignment 1159*cdf0e10cSrcweir SfxChildAlignment eLastAlign = pImp->GetLastAlignment(); 1160*cdf0e10cSrcweir if ( eLastAlign == SFX_ALIGN_NOALIGNMENT) 1161*cdf0e10cSrcweir eLastAlign = CheckAlignment(eLastAlign, SFX_ALIGN_LEFT); 1162*cdf0e10cSrcweir if ( eLastAlign == SFX_ALIGN_NOALIGNMENT) 1163*cdf0e10cSrcweir eLastAlign = CheckAlignment(eLastAlign, SFX_ALIGN_RIGHT); 1164*cdf0e10cSrcweir if ( eLastAlign == SFX_ALIGN_NOALIGNMENT) 1165*cdf0e10cSrcweir eLastAlign = CheckAlignment(eLastAlign, SFX_ALIGN_TOP); 1166*cdf0e10cSrcweir if ( eLastAlign == SFX_ALIGN_NOALIGNMENT) 1167*cdf0e10cSrcweir eLastAlign = CheckAlignment(eLastAlign, SFX_ALIGN_BOTTOM); 1168*cdf0e10cSrcweir pImp->SetLastAlignment(eLastAlign); 1169*cdf0e10cSrcweir } 1170*cdf0e10cSrcweir else 1171*cdf0e10cSrcweir { 1172*cdf0e10cSrcweir // docked window must have NOALIGNMENT as last alignment 1173*cdf0e10cSrcweir pImp->SetLastAlignment(SFX_ALIGN_NOALIGNMENT); 1174*cdf0e10cSrcweir 1175*cdf0e10cSrcweir if ( pImp->bSplitable ) 1176*cdf0e10cSrcweir { 1177*cdf0e10cSrcweir // pImp->bAutoHide = ( pInfo->nFlags & SFX_CHILDWIN_AUTOHIDE) != 0; 1178*cdf0e10cSrcweir pImp->pSplitWin = pWorkWin->GetSplitWindow_Impl(GetAlignment()); 1179*cdf0e10cSrcweir pImp->pSplitWin->InsertWindow(this, pImp->aSplitSize); 1180*cdf0e10cSrcweir } 1181*cdf0e10cSrcweir else 1182*cdf0e10cSrcweir { 1183*cdf0e10cSrcweir //?????? Currently not supported 1184*cdf0e10cSrcweir // Fenster ist individuell angedockt; Gr"o\se berechnen. 1185*cdf0e10cSrcweir // Dazu mu\s sie mit der FloatingSize initialisiert werden, falls 1186*cdf0e10cSrcweir // irgendwer sich darauf verl"a\st, da\s eine vern"unftige Gr"o\se 1187*cdf0e10cSrcweir // gesetzt ist 1188*cdf0e10cSrcweir SetSizePixel(GetFloatingSize()); 1189*cdf0e10cSrcweir SetSizePixel(CalcDockingSize(GetAlignment())); 1190*cdf0e10cSrcweir } 1191*cdf0e10cSrcweir } 1192*cdf0e10cSrcweir 1193*cdf0e10cSrcweir // save alignment 1194*cdf0e10cSrcweir pImp->SetDockAlignment( GetAlignment() ); 1195*cdf0e10cSrcweir } 1196*cdf0e10cSrcweir 1197*cdf0e10cSrcweir void SfxDockingWindow::Initialize_Impl() 1198*cdf0e10cSrcweir { 1199*cdf0e10cSrcweir if ( !pMgr ) 1200*cdf0e10cSrcweir { 1201*cdf0e10cSrcweir // Bugfix #39771 1202*cdf0e10cSrcweir pImp->bConstructed = sal_True; 1203*cdf0e10cSrcweir return; 1204*cdf0e10cSrcweir } 1205*cdf0e10cSrcweir 1206*cdf0e10cSrcweir FloatingWindow* pFloatWin = GetFloatingWindow(); 1207*cdf0e10cSrcweir sal_Bool bSet = sal_False; 1208*cdf0e10cSrcweir if ( pFloatWin ) 1209*cdf0e10cSrcweir { 1210*cdf0e10cSrcweir bSet = !pFloatWin->IsDefaultPos(); 1211*cdf0e10cSrcweir } 1212*cdf0e10cSrcweir else 1213*cdf0e10cSrcweir { 1214*cdf0e10cSrcweir Point aPos = GetFloatingPos(); 1215*cdf0e10cSrcweir if ( aPos != Point() ) 1216*cdf0e10cSrcweir bSet = sal_True; 1217*cdf0e10cSrcweir } 1218*cdf0e10cSrcweir 1219*cdf0e10cSrcweir if ( !bSet) 1220*cdf0e10cSrcweir { 1221*cdf0e10cSrcweir SfxViewFrame *pFrame = pBindings->GetDispatcher_Impl()->GetFrame(); 1222*cdf0e10cSrcweir Window* pEditWin = pFrame->GetViewShell()->GetWindow(); 1223*cdf0e10cSrcweir Point aPos = pEditWin->OutputToScreenPixel( pEditWin->GetPosPixel() ); 1224*cdf0e10cSrcweir aPos = GetParent()->ScreenToOutputPixel( aPos ); 1225*cdf0e10cSrcweir SetFloatingPos( aPos ); 1226*cdf0e10cSrcweir } 1227*cdf0e10cSrcweir 1228*cdf0e10cSrcweir if ( pFloatWin ) 1229*cdf0e10cSrcweir { 1230*cdf0e10cSrcweir // initialize floating window 1231*cdf0e10cSrcweir if ( !pImp->aWinState.Len() ) 1232*cdf0e10cSrcweir // window state never set before, get if from defaults 1233*cdf0e10cSrcweir pImp->aWinState = pFloatWin->GetWindowState(); 1234*cdf0e10cSrcweir 1235*cdf0e10cSrcweir // trick: use VCL method SetWindowState to adjust position and size 1236*cdf0e10cSrcweir pFloatWin->SetWindowState( pImp->aWinState ); 1237*cdf0e10cSrcweir 1238*cdf0e10cSrcweir // remember floating size for calculating alignment and tracking rectangle 1239*cdf0e10cSrcweir SetFloatingSize( pFloatWin->GetSizePixel() ); 1240*cdf0e10cSrcweir 1241*cdf0e10cSrcweir // some versions of VCL didn't call resize in the current situation 1242*cdf0e10cSrcweir //Resize(); 1243*cdf0e10cSrcweir } 1244*cdf0e10cSrcweir 1245*cdf0e10cSrcweir // allow calling of docking handlers 1246*cdf0e10cSrcweir pImp->bConstructed = sal_True; 1247*cdf0e10cSrcweir } 1248*cdf0e10cSrcweir 1249*cdf0e10cSrcweir //------------------------------------------------------------------------- 1250*cdf0e10cSrcweir 1251*cdf0e10cSrcweir void SfxDockingWindow::FillInfo(SfxChildWinInfo& rInfo) const 1252*cdf0e10cSrcweir 1253*cdf0e10cSrcweir /* [Beschreibung] 1254*cdf0e10cSrcweir 1255*cdf0e10cSrcweir F"ullt ein SfxChildWinInfo mit f"ur SfxDockingWindow spezifischen Daten, 1256*cdf0e10cSrcweir damit sie in die INI-Datei geschrieben werden koennen. 1257*cdf0e10cSrcweir Es wird angenommen, da\s rInfo alle anderen evt. relevanten Daten in 1258*cdf0e10cSrcweir der ChildWindow-Klasse erh"alt. 1259*cdf0e10cSrcweir Eingetragen werden hier gemerkten Gr"o\sen, das ZoomIn-Flag und die 1260*cdf0e10cSrcweir f"ur das Docking relevanten Informationen. 1261*cdf0e10cSrcweir Wird diese Methode "uberschrieben, mu\s zuerst die Basisimplementierung 1262*cdf0e10cSrcweir gerufen werden. 1263*cdf0e10cSrcweir */ 1264*cdf0e10cSrcweir 1265*cdf0e10cSrcweir { 1266*cdf0e10cSrcweir if ( !pMgr ) 1267*cdf0e10cSrcweir return; 1268*cdf0e10cSrcweir 1269*cdf0e10cSrcweir if ( GetFloatingWindow() && pImp->bConstructed ) 1270*cdf0e10cSrcweir pImp->aWinState = GetFloatingWindow()->GetWindowState(); 1271*cdf0e10cSrcweir 1272*cdf0e10cSrcweir rInfo.aWinState = pImp->aWinState; 1273*cdf0e10cSrcweir rInfo.aExtraString = DEFINE_CONST_UNICODE("AL:("); 1274*cdf0e10cSrcweir rInfo.aExtraString += String::CreateFromInt32((sal_uInt16) GetAlignment()); 1275*cdf0e10cSrcweir rInfo.aExtraString += ','; 1276*cdf0e10cSrcweir rInfo.aExtraString += String::CreateFromInt32 ((sal_uInt16) pImp->GetLastAlignment()); 1277*cdf0e10cSrcweir if ( pImp->bSplitable ) 1278*cdf0e10cSrcweir { 1279*cdf0e10cSrcweir Point aPos(pImp->nLine, pImp->nPos); 1280*cdf0e10cSrcweir rInfo.aExtraString += ','; 1281*cdf0e10cSrcweir rInfo.aExtraString += String::CreateFromInt32( aPos.X() ); 1282*cdf0e10cSrcweir rInfo.aExtraString += '/'; 1283*cdf0e10cSrcweir rInfo.aExtraString += String::CreateFromInt32( aPos.Y() ); 1284*cdf0e10cSrcweir rInfo.aExtraString += '/'; 1285*cdf0e10cSrcweir rInfo.aExtraString += String::CreateFromInt32( pImp->nHorizontalSize ); 1286*cdf0e10cSrcweir rInfo.aExtraString += '/'; 1287*cdf0e10cSrcweir rInfo.aExtraString += String::CreateFromInt32( pImp->nVerticalSize ); 1288*cdf0e10cSrcweir rInfo.aExtraString += ','; 1289*cdf0e10cSrcweir rInfo.aExtraString += String::CreateFromInt32( pImp->aSplitSize.Width() ); 1290*cdf0e10cSrcweir rInfo.aExtraString += ';'; 1291*cdf0e10cSrcweir rInfo.aExtraString += String::CreateFromInt32( pImp->aSplitSize.Height() ); 1292*cdf0e10cSrcweir } 1293*cdf0e10cSrcweir 1294*cdf0e10cSrcweir rInfo.aExtraString += ')'; 1295*cdf0e10cSrcweir } 1296*cdf0e10cSrcweir 1297*cdf0e10cSrcweir //------------------------------------------------------------------------- 1298*cdf0e10cSrcweir 1299*cdf0e10cSrcweir SfxDockingWindow::~SfxDockingWindow() 1300*cdf0e10cSrcweir { 1301*cdf0e10cSrcweir ReleaseChildWindow_Impl(); 1302*cdf0e10cSrcweir delete pImp; 1303*cdf0e10cSrcweir } 1304*cdf0e10cSrcweir 1305*cdf0e10cSrcweir void SfxDockingWindow::ReleaseChildWindow_Impl() 1306*cdf0e10cSrcweir { 1307*cdf0e10cSrcweir if ( pMgr && pMgr->GetFrame() == pBindings->GetActiveFrame() ) 1308*cdf0e10cSrcweir pBindings->SetActiveFrame( NULL ); 1309*cdf0e10cSrcweir 1310*cdf0e10cSrcweir if ( pMgr && pImp->pSplitWin && pImp->pSplitWin->IsItemValid( GetType() ) ) 1311*cdf0e10cSrcweir pImp->pSplitWin->RemoveWindow(this); 1312*cdf0e10cSrcweir 1313*cdf0e10cSrcweir pMgr=NULL; 1314*cdf0e10cSrcweir } 1315*cdf0e10cSrcweir 1316*cdf0e10cSrcweir //------------------------------------------------------------------------- 1317*cdf0e10cSrcweir 1318*cdf0e10cSrcweir SfxChildAlignment SfxDockingWindow::CalcAlignment(const Point& rPos, Rectangle& rRect) 1319*cdf0e10cSrcweir 1320*cdf0e10cSrcweir /* [Beschreibung] 1321*cdf0e10cSrcweir 1322*cdf0e10cSrcweir Diese Methode berechnet f"ur gegebene Mausposition und tracking rectangle, 1323*cdf0e10cSrcweir welches Alignment sich daraus ergeben w"urde. Beim Wechsel des Alignments 1324*cdf0e10cSrcweir kann sich auch das tracking rectangle "andern, so dass ein ver"andertes 1325*cdf0e10cSrcweir rectangle zur"uckgegeben wird. 1326*cdf0e10cSrcweir 1327*cdf0e10cSrcweir Der Klassenbenutzer kann das Verhalten dieser Methode und damit das Verhalten 1328*cdf0e10cSrcweir seiner DockinWindow-Klasse beim Docken beeinflussen, indem er die hier 1329*cdf0e10cSrcweir aufgerufene virtuelle Methode 1330*cdf0e10cSrcweir 1331*cdf0e10cSrcweir SfxDockingWindow::CalcDockingSize(SfxChildAlignment eAlign) 1332*cdf0e10cSrcweir 1333*cdf0e10cSrcweir "uberschreibt (s.u.). 1334*cdf0e10cSrcweir */ 1335*cdf0e10cSrcweir 1336*cdf0e10cSrcweir { 1337*cdf0e10cSrcweir // calculate hypothetical sizes for different modes 1338*cdf0e10cSrcweir Size aFloatingSize(CalcDockingSize(SFX_ALIGN_NOALIGNMENT)); 1339*cdf0e10cSrcweir Size aVerticalSize(CalcDockingSize(SFX_ALIGN_LEFT)); 1340*cdf0e10cSrcweir Size aHorizontalSize(CalcDockingSize(SFX_ALIGN_TOP)); 1341*cdf0e10cSrcweir 1342*cdf0e10cSrcweir // check if docking is permitted 1343*cdf0e10cSrcweir SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); 1344*cdf0e10cSrcweir if ( !pWorkWin->IsDockingAllowed() ) 1345*cdf0e10cSrcweir { 1346*cdf0e10cSrcweir rRect.SetSize( aFloatingSize ); 1347*cdf0e10cSrcweir return pImp->GetDockAlignment(); 1348*cdf0e10cSrcweir } 1349*cdf0e10cSrcweir 1350*cdf0e10cSrcweir // calculate borders to shrink inner area before checking for intersection with tracking rectangle 1351*cdf0e10cSrcweir long nLRBorder, nTBBorder; 1352*cdf0e10cSrcweir if ( pImp->bSplitable ) 1353*cdf0e10cSrcweir { 1354*cdf0e10cSrcweir // take the smaller size of docked and floating mode 1355*cdf0e10cSrcweir Size aSize = pImp->aSplitSize; 1356*cdf0e10cSrcweir if ( GetFloatingSize().Height() < aSize.Height() ) 1357*cdf0e10cSrcweir aSize.Height() = GetFloatingSize().Height(); 1358*cdf0e10cSrcweir if ( GetFloatingSize().Width() < aSize.Width() ) 1359*cdf0e10cSrcweir aSize.Width() = GetFloatingSize().Width(); 1360*cdf0e10cSrcweir 1361*cdf0e10cSrcweir nLRBorder = aSize.Width(); 1362*cdf0e10cSrcweir nTBBorder = aSize.Height(); 1363*cdf0e10cSrcweir } 1364*cdf0e10cSrcweir else 1365*cdf0e10cSrcweir { 1366*cdf0e10cSrcweir nLRBorder = aVerticalSize.Width(); 1367*cdf0e10cSrcweir nTBBorder = aHorizontalSize.Height(); 1368*cdf0e10cSrcweir } 1369*cdf0e10cSrcweir 1370*cdf0e10cSrcweir // limit border to predefined constant values 1371*cdf0e10cSrcweir if ( nLRBorder > MAX_TOGGLEAREA_WIDTH ) 1372*cdf0e10cSrcweir nLRBorder = MAX_TOGGLEAREA_WIDTH; 1373*cdf0e10cSrcweir if ( nTBBorder > MAX_TOGGLEAREA_WIDTH ) 1374*cdf0e10cSrcweir nTBBorder = MAX_TOGGLEAREA_WIDTH; 1375*cdf0e10cSrcweir 1376*cdf0e10cSrcweir // shrink area for floating mode if possible 1377*cdf0e10cSrcweir Rectangle aInRect = GetInnerRect(); 1378*cdf0e10cSrcweir if ( aInRect.GetWidth() > nLRBorder ) 1379*cdf0e10cSrcweir aInRect.Left() += nLRBorder/2; 1380*cdf0e10cSrcweir if ( aInRect.GetWidth() > nLRBorder ) 1381*cdf0e10cSrcweir aInRect.Right() -= nLRBorder/2; 1382*cdf0e10cSrcweir if ( aInRect.GetHeight() > nTBBorder ) 1383*cdf0e10cSrcweir aInRect.Top() += nTBBorder/2; 1384*cdf0e10cSrcweir if ( aInRect.GetHeight() > nTBBorder ) 1385*cdf0e10cSrcweir aInRect.Bottom() -= nTBBorder/2; 1386*cdf0e10cSrcweir 1387*cdf0e10cSrcweir // calculate alignment resulting from docking rectangle 1388*cdf0e10cSrcweir sal_Bool bBecomesFloating = sal_False; 1389*cdf0e10cSrcweir SfxChildAlignment eDockAlign = pImp->GetDockAlignment(); 1390*cdf0e10cSrcweir Rectangle aDockingRect( rRect ); 1391*cdf0e10cSrcweir if ( !IsFloatingMode() ) 1392*cdf0e10cSrcweir { 1393*cdf0e10cSrcweir // don't use tracking rectangle for alignment check, because it will be too large 1394*cdf0e10cSrcweir // to get a floating mode as result - switch to floating size 1395*cdf0e10cSrcweir // so the calculation only depends on the position of the rectangle, not the current 1396*cdf0e10cSrcweir // docking state of the window 1397*cdf0e10cSrcweir aDockingRect.SetSize( GetFloatingSize() ); 1398*cdf0e10cSrcweir 1399*cdf0e10cSrcweir // in this mode docking is never done by keyboard, so it's OK to use the mouse position 1400*cdf0e10cSrcweir aDockingRect.SetPos( pWorkWin->GetWindow()->OutputToScreenPixel( pWorkWin->GetWindow()->GetPointerPosPixel() ) ); 1401*cdf0e10cSrcweir } 1402*cdf0e10cSrcweir 1403*cdf0e10cSrcweir Point aPos = aDockingRect.TopLeft(); 1404*cdf0e10cSrcweir Rectangle aIntersect = GetOuterRect().GetIntersection( aDockingRect ); 1405*cdf0e10cSrcweir if ( aIntersect.IsEmpty() ) 1406*cdf0e10cSrcweir // docking rectangle completely outside docking area -> floating mode 1407*cdf0e10cSrcweir bBecomesFloating = sal_True; 1408*cdf0e10cSrcweir else 1409*cdf0e10cSrcweir { 1410*cdf0e10cSrcweir // create a small test rect around the mouse position and use this one 1411*cdf0e10cSrcweir // instead of the passed rRect to not dock too easily or by accident 1412*cdf0e10cSrcweir Rectangle aSmallDockingRect; 1413*cdf0e10cSrcweir aSmallDockingRect.SetSize( Size( MAX_TOGGLEAREA_WIDTH, MAX_TOGGLEAREA_HEIGHT ) ); 1414*cdf0e10cSrcweir Point aNewPos(rPos); 1415*cdf0e10cSrcweir aNewPos.X() -= aSmallDockingRect.GetWidth()/2; 1416*cdf0e10cSrcweir aNewPos.Y() -= aSmallDockingRect.GetHeight()/2; 1417*cdf0e10cSrcweir aSmallDockingRect.SetPos(rPos); 1418*cdf0e10cSrcweir Rectangle aIntersectRect = aInRect.GetIntersection( aSmallDockingRect ); 1419*cdf0e10cSrcweir if ( aIntersectRect == aSmallDockingRect ) 1420*cdf0e10cSrcweir // docking rectangle completely inside (shrinked) inner area -> floating mode 1421*cdf0e10cSrcweir bBecomesFloating = sal_True; 1422*cdf0e10cSrcweir } 1423*cdf0e10cSrcweir 1424*cdf0e10cSrcweir if ( bBecomesFloating ) 1425*cdf0e10cSrcweir { 1426*cdf0e10cSrcweir eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_NOALIGNMENT); 1427*cdf0e10cSrcweir } 1428*cdf0e10cSrcweir else 1429*cdf0e10cSrcweir { 1430*cdf0e10cSrcweir // docking rectangle is in the "sensible area" 1431*cdf0e10cSrcweir Point aInPosTL( aPos.X()-aInRect.Left(), aPos.Y()-aInRect.Top() ); 1432*cdf0e10cSrcweir Point aInPosBR( aPos.X()-aInRect.Left() + aDockingRect.GetWidth(), aPos.Y()-aInRect.Top() + aDockingRect.GetHeight() ); 1433*cdf0e10cSrcweir Size aInSize = aInRect.GetSize(); 1434*cdf0e10cSrcweir sal_Bool bNoChange = sal_False; 1435*cdf0e10cSrcweir 1436*cdf0e10cSrcweir // check if alignment is still unchanged 1437*cdf0e10cSrcweir switch ( GetAlignment() ) 1438*cdf0e10cSrcweir { 1439*cdf0e10cSrcweir case SFX_ALIGN_LEFT: 1440*cdf0e10cSrcweir case SFX_ALIGN_FIRSTLEFT: 1441*cdf0e10cSrcweir case SFX_ALIGN_LASTLEFT: 1442*cdf0e10cSrcweir if (aInPosTL.X() <= 0) 1443*cdf0e10cSrcweir { 1444*cdf0e10cSrcweir eDockAlign = GetAlignment(); 1445*cdf0e10cSrcweir bNoChange = sal_True; 1446*cdf0e10cSrcweir } 1447*cdf0e10cSrcweir break; 1448*cdf0e10cSrcweir case SFX_ALIGN_TOP: 1449*cdf0e10cSrcweir case SFX_ALIGN_LOWESTTOP: 1450*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTTOP: 1451*cdf0e10cSrcweir if ( aInPosTL.Y() <= 0) 1452*cdf0e10cSrcweir { 1453*cdf0e10cSrcweir eDockAlign = GetAlignment(); 1454*cdf0e10cSrcweir bNoChange = sal_True; 1455*cdf0e10cSrcweir } 1456*cdf0e10cSrcweir break; 1457*cdf0e10cSrcweir case SFX_ALIGN_RIGHT: 1458*cdf0e10cSrcweir case SFX_ALIGN_FIRSTRIGHT: 1459*cdf0e10cSrcweir case SFX_ALIGN_LASTRIGHT: 1460*cdf0e10cSrcweir if ( aInPosBR.X() >= aInSize.Width()) 1461*cdf0e10cSrcweir { 1462*cdf0e10cSrcweir eDockAlign = GetAlignment(); 1463*cdf0e10cSrcweir bNoChange = sal_True; 1464*cdf0e10cSrcweir } 1465*cdf0e10cSrcweir break; 1466*cdf0e10cSrcweir case SFX_ALIGN_BOTTOM: 1467*cdf0e10cSrcweir case SFX_ALIGN_LOWESTBOTTOM: 1468*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTBOTTOM: 1469*cdf0e10cSrcweir if ( aInPosBR.Y() >= aInSize.Height()) 1470*cdf0e10cSrcweir { 1471*cdf0e10cSrcweir eDockAlign = GetAlignment(); 1472*cdf0e10cSrcweir bNoChange = sal_True; 1473*cdf0e10cSrcweir } 1474*cdf0e10cSrcweir break; 1475*cdf0e10cSrcweir default: 1476*cdf0e10cSrcweir break; 1477*cdf0e10cSrcweir } 1478*cdf0e10cSrcweir 1479*cdf0e10cSrcweir if ( !bNoChange ) 1480*cdf0e10cSrcweir { 1481*cdf0e10cSrcweir // alignment will change, test alignment according to distance of the docking rectangles edges 1482*cdf0e10cSrcweir sal_Bool bForbidden = sal_True; 1483*cdf0e10cSrcweir if ( aInPosTL.X() <= 0) 1484*cdf0e10cSrcweir { 1485*cdf0e10cSrcweir eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_LEFT); 1486*cdf0e10cSrcweir bForbidden = ( eDockAlign != SFX_ALIGN_LEFT && 1487*cdf0e10cSrcweir eDockAlign != SFX_ALIGN_FIRSTLEFT && 1488*cdf0e10cSrcweir eDockAlign != SFX_ALIGN_LASTLEFT ); 1489*cdf0e10cSrcweir } 1490*cdf0e10cSrcweir 1491*cdf0e10cSrcweir if ( bForbidden && aInPosTL.Y() <= 0) 1492*cdf0e10cSrcweir { 1493*cdf0e10cSrcweir eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_TOP); 1494*cdf0e10cSrcweir bForbidden = ( eDockAlign != SFX_ALIGN_TOP && 1495*cdf0e10cSrcweir eDockAlign != SFX_ALIGN_HIGHESTTOP && 1496*cdf0e10cSrcweir eDockAlign != SFX_ALIGN_LOWESTTOP ); 1497*cdf0e10cSrcweir } 1498*cdf0e10cSrcweir 1499*cdf0e10cSrcweir if ( bForbidden && aInPosBR.X() >= aInSize.Width()) 1500*cdf0e10cSrcweir { 1501*cdf0e10cSrcweir eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_RIGHT); 1502*cdf0e10cSrcweir bForbidden = ( eDockAlign != SFX_ALIGN_RIGHT && 1503*cdf0e10cSrcweir eDockAlign != SFX_ALIGN_FIRSTRIGHT && 1504*cdf0e10cSrcweir eDockAlign != SFX_ALIGN_LASTRIGHT ); 1505*cdf0e10cSrcweir } 1506*cdf0e10cSrcweir 1507*cdf0e10cSrcweir if ( bForbidden && aInPosBR.Y() >= aInSize.Height()) 1508*cdf0e10cSrcweir { 1509*cdf0e10cSrcweir eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_BOTTOM); 1510*cdf0e10cSrcweir bForbidden = ( eDockAlign != SFX_ALIGN_BOTTOM && 1511*cdf0e10cSrcweir eDockAlign != SFX_ALIGN_HIGHESTBOTTOM && 1512*cdf0e10cSrcweir eDockAlign != SFX_ALIGN_LOWESTBOTTOM ); 1513*cdf0e10cSrcweir } 1514*cdf0e10cSrcweir 1515*cdf0e10cSrcweir // the calculated alignment was rejected by the window -> take floating mode 1516*cdf0e10cSrcweir if ( bForbidden ) 1517*cdf0e10cSrcweir eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_NOALIGNMENT); 1518*cdf0e10cSrcweir } 1519*cdf0e10cSrcweir } 1520*cdf0e10cSrcweir 1521*cdf0e10cSrcweir if ( eDockAlign == SFX_ALIGN_NOALIGNMENT ) 1522*cdf0e10cSrcweir { 1523*cdf0e10cSrcweir //Im FloatingMode erh"alt das tracking rectangle die floating size 1524*cdf0e10cSrcweir // wg. SV-Bug darf rRect nur ver"andert werden, wenn sich das 1525*cdf0e10cSrcweir // Alignment "andert ! 1526*cdf0e10cSrcweir if ( eDockAlign != pImp->GetDockAlignment() ) 1527*cdf0e10cSrcweir aDockingRect.SetSize( aFloatingSize ); 1528*cdf0e10cSrcweir } 1529*cdf0e10cSrcweir else if ( pImp->bSplitable ) 1530*cdf0e10cSrcweir { 1531*cdf0e10cSrcweir sal_uInt16 nLine, nPos; 1532*cdf0e10cSrcweir SfxSplitWindow *pSplitWin = pWorkWin->GetSplitWindow_Impl(eDockAlign); 1533*cdf0e10cSrcweir aPos = pSplitWin->ScreenToOutputPixel( aPos ); 1534*cdf0e10cSrcweir if ( pSplitWin->GetWindowPos( aPos, nLine, nPos ) ) 1535*cdf0e10cSrcweir { 1536*cdf0e10cSrcweir // mouse over splitwindow, get line and position 1537*cdf0e10cSrcweir pImp->nDockLine = nLine; 1538*cdf0e10cSrcweir pImp->nDockPos = nPos; 1539*cdf0e10cSrcweir pImp->bNewLine = sal_False; 1540*cdf0e10cSrcweir } 1541*cdf0e10cSrcweir else 1542*cdf0e10cSrcweir { 1543*cdf0e10cSrcweir if ( 0 ) 1544*cdf0e10cSrcweir { 1545*cdf0e10cSrcweir // mouse touches outer border -> treated as floating mode 1546*cdf0e10cSrcweir eDockAlign = SFX_ALIGN_NOALIGNMENT; 1547*cdf0e10cSrcweir aDockingRect.SetSize( aFloatingSize ); 1548*cdf0e10cSrcweir rRect = aDockingRect; 1549*cdf0e10cSrcweir return eDockAlign; 1550*cdf0e10cSrcweir } 1551*cdf0e10cSrcweir 1552*cdf0e10cSrcweir // mouse touches inner border -> create new line 1553*cdf0e10cSrcweir if ( eDockAlign == GetAlignment() && pImp->pSplitWin && 1554*cdf0e10cSrcweir pImp->nLine == pImp->pSplitWin->GetLineCount()-1 && pImp->pSplitWin->GetWindowCount(pImp->nLine) == 1 ) 1555*cdf0e10cSrcweir { 1556*cdf0e10cSrcweir // if this window is the only one in the last line, it can't be docked as new line in the same splitwindow 1557*cdf0e10cSrcweir pImp->nDockLine = pImp->nLine; 1558*cdf0e10cSrcweir pImp->nDockPos = pImp->nPos; 1559*cdf0e10cSrcweir pImp->bNewLine = sal_False; 1560*cdf0e10cSrcweir } 1561*cdf0e10cSrcweir else 1562*cdf0e10cSrcweir { 1563*cdf0e10cSrcweir // create new line 1564*cdf0e10cSrcweir pImp->nDockLine = pSplitWin->GetLineCount(); 1565*cdf0e10cSrcweir pImp->nDockPos = 0; 1566*cdf0e10cSrcweir pImp->bNewLine = sal_True; 1567*cdf0e10cSrcweir } 1568*cdf0e10cSrcweir } 1569*cdf0e10cSrcweir 1570*cdf0e10cSrcweir sal_Bool bChanged = pImp->nLine != pImp->nDockLine || pImp->nPos != pImp->nDockPos || eDockAlign != GetAlignment(); 1571*cdf0e10cSrcweir if ( !bChanged && !IsFloatingMode() ) 1572*cdf0e10cSrcweir { 1573*cdf0e10cSrcweir // window only sightly moved, no change of any property 1574*cdf0e10cSrcweir rRect.SetSize( pImp->aSplitSize ); 1575*cdf0e10cSrcweir rRect.SetPos( aDockingRect.TopLeft() ); 1576*cdf0e10cSrcweir return eDockAlign; 1577*cdf0e10cSrcweir } 1578*cdf0e10cSrcweir 1579*cdf0e10cSrcweir // calculate new size and position 1580*cdf0e10cSrcweir Size aSize; 1581*cdf0e10cSrcweir Point aPoint = aDockingRect.TopLeft(); 1582*cdf0e10cSrcweir Size aInnerSize = GetInnerRect().GetSize(); 1583*cdf0e10cSrcweir if ( eDockAlign == SFX_ALIGN_LEFT || eDockAlign == SFX_ALIGN_RIGHT ) 1584*cdf0e10cSrcweir { 1585*cdf0e10cSrcweir if ( pImp->bNewLine ) 1586*cdf0e10cSrcweir { 1587*cdf0e10cSrcweir // set height to height of free area 1588*cdf0e10cSrcweir aSize.Height() = aInnerSize.Height(); 1589*cdf0e10cSrcweir aSize.Width() = pImp->nHorizontalSize; 1590*cdf0e10cSrcweir if ( eDockAlign == SFX_ALIGN_LEFT ) 1591*cdf0e10cSrcweir { 1592*cdf0e10cSrcweir aPoint = aInnerRect.TopLeft(); 1593*cdf0e10cSrcweir } 1594*cdf0e10cSrcweir else 1595*cdf0e10cSrcweir { 1596*cdf0e10cSrcweir aPoint = aInnerRect.TopRight(); 1597*cdf0e10cSrcweir aPoint.X() -= aSize.Width(); 1598*cdf0e10cSrcweir } 1599*cdf0e10cSrcweir } 1600*cdf0e10cSrcweir else 1601*cdf0e10cSrcweir { 1602*cdf0e10cSrcweir // get width from splitwindow 1603*cdf0e10cSrcweir aSize.Width() = pSplitWin->GetLineSize(nLine); 1604*cdf0e10cSrcweir aSize.Height() = pImp->aSplitSize.Height(); 1605*cdf0e10cSrcweir } 1606*cdf0e10cSrcweir } 1607*cdf0e10cSrcweir else 1608*cdf0e10cSrcweir { 1609*cdf0e10cSrcweir if ( pImp->bNewLine ) 1610*cdf0e10cSrcweir { 1611*cdf0e10cSrcweir // set width to width of free area 1612*cdf0e10cSrcweir aSize.Width() = aInnerSize.Width(); 1613*cdf0e10cSrcweir aSize.Height() = pImp->nVerticalSize; 1614*cdf0e10cSrcweir if ( eDockAlign == SFX_ALIGN_TOP ) 1615*cdf0e10cSrcweir { 1616*cdf0e10cSrcweir aPoint = aInnerRect.TopLeft(); 1617*cdf0e10cSrcweir } 1618*cdf0e10cSrcweir else 1619*cdf0e10cSrcweir { 1620*cdf0e10cSrcweir aPoint = aInnerRect.BottomLeft(); 1621*cdf0e10cSrcweir aPoint.Y() -= aSize.Height(); 1622*cdf0e10cSrcweir } 1623*cdf0e10cSrcweir } 1624*cdf0e10cSrcweir else 1625*cdf0e10cSrcweir { 1626*cdf0e10cSrcweir // get height from splitwindow 1627*cdf0e10cSrcweir aSize.Height() = pSplitWin->GetLineSize(nLine); 1628*cdf0e10cSrcweir aSize.Width() = pImp->aSplitSize.Width(); 1629*cdf0e10cSrcweir } 1630*cdf0e10cSrcweir } 1631*cdf0e10cSrcweir 1632*cdf0e10cSrcweir aDockingRect.SetSize( aSize ); 1633*cdf0e10cSrcweir aDockingRect.SetPos( aPoint ); 1634*cdf0e10cSrcweir } 1635*cdf0e10cSrcweir else 1636*cdf0e10cSrcweir { 1637*cdf0e10cSrcweir // window can be docked, but outside our splitwindows 1638*cdf0e10cSrcweir // tracking rectangle only needs to be modified if alignment was changed 1639*cdf0e10cSrcweir if ( eDockAlign != pImp->GetDockAlignment() ) 1640*cdf0e10cSrcweir { 1641*cdf0e10cSrcweir switch ( eDockAlign ) 1642*cdf0e10cSrcweir { 1643*cdf0e10cSrcweir case SFX_ALIGN_LEFT: 1644*cdf0e10cSrcweir case SFX_ALIGN_RIGHT: 1645*cdf0e10cSrcweir case SFX_ALIGN_FIRSTLEFT: 1646*cdf0e10cSrcweir aDockingRect.SetPos( aInnerRect.TopLeft() ); 1647*cdf0e10cSrcweir aDockingRect.SetSize( aVerticalSize ); 1648*cdf0e10cSrcweir break; 1649*cdf0e10cSrcweir case SFX_ALIGN_LASTLEFT: 1650*cdf0e10cSrcweir case SFX_ALIGN_FIRSTRIGHT: 1651*cdf0e10cSrcweir case SFX_ALIGN_LASTRIGHT: 1652*cdf0e10cSrcweir { 1653*cdf0e10cSrcweir Point aPt( aInnerRect.TopRight() ); 1654*cdf0e10cSrcweir aPt.X() -= aDockingRect.GetWidth(); 1655*cdf0e10cSrcweir aDockingRect.SetPos( aPt ); 1656*cdf0e10cSrcweir aDockingRect.SetSize( aVerticalSize ); 1657*cdf0e10cSrcweir break; 1658*cdf0e10cSrcweir } 1659*cdf0e10cSrcweir 1660*cdf0e10cSrcweir case SFX_ALIGN_TOP: 1661*cdf0e10cSrcweir case SFX_ALIGN_BOTTOM: 1662*cdf0e10cSrcweir case SFX_ALIGN_LOWESTTOP: 1663*cdf0e10cSrcweir aDockingRect.SetPos( aInnerRect.TopLeft() ); 1664*cdf0e10cSrcweir aDockingRect.SetSize( aHorizontalSize ); 1665*cdf0e10cSrcweir break; 1666*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTTOP: 1667*cdf0e10cSrcweir case SFX_ALIGN_LOWESTBOTTOM: 1668*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTBOTTOM: 1669*cdf0e10cSrcweir { 1670*cdf0e10cSrcweir Point aPt( aInnerRect.BottomLeft() ); 1671*cdf0e10cSrcweir aPt.Y() -= aDockingRect.GetHeight(); 1672*cdf0e10cSrcweir aDockingRect.SetPos( aPt ); 1673*cdf0e10cSrcweir aDockingRect.SetSize( aHorizontalSize ); 1674*cdf0e10cSrcweir break; 1675*cdf0e10cSrcweir } 1676*cdf0e10cSrcweir default: 1677*cdf0e10cSrcweir break; 1678*cdf0e10cSrcweir } 1679*cdf0e10cSrcweir } 1680*cdf0e10cSrcweir } 1681*cdf0e10cSrcweir 1682*cdf0e10cSrcweir rRect = aDockingRect; 1683*cdf0e10cSrcweir return eDockAlign; 1684*cdf0e10cSrcweir } 1685*cdf0e10cSrcweir 1686*cdf0e10cSrcweir //------------------------------------------------------------------------- 1687*cdf0e10cSrcweir 1688*cdf0e10cSrcweir Size SfxDockingWindow::CalcDockingSize(SfxChildAlignment eAlign) 1689*cdf0e10cSrcweir 1690*cdf0e10cSrcweir /* [Beschreibung] 1691*cdf0e10cSrcweir 1692*cdf0e10cSrcweir Virtuelle Methode der Klasse SfxDockingWindow. 1693*cdf0e10cSrcweir Hier wird festgelegt, wie sich die Gr"o\se des DockingWindows abh"angig vom 1694*cdf0e10cSrcweir Alignment "andert. 1695*cdf0e10cSrcweir Die Basisimplementation setzt im Floating Mode die Gr"o\se auf die gemerkte 1696*cdf0e10cSrcweir Floating Size. 1697*cdf0e10cSrcweir Bei horizontalem Alignment wird die Breite auf die Breite des "au\seren 1698*cdf0e10cSrcweir DockingRects, bei vertikalem Alignment die H"ohe auf die H"ohe des inneren 1699*cdf0e10cSrcweir DockingRects (ergibt sich aus der Reihenfolge, in der im SFX ChildWindows 1700*cdf0e10cSrcweir ausgegeben werden). Die jeweils andere Gr"o\se wird auf die aktuelle 1701*cdf0e10cSrcweir Floating Size gesetzt, hier k"onnte eine abgeleitete Klasse "andernd 1702*cdf0e10cSrcweir eingreifen. 1703*cdf0e10cSrcweir Die DockingSize mu\s f"ur Left/Right und Top/Bottom jeweils gleich sein. 1704*cdf0e10cSrcweir */ 1705*cdf0e10cSrcweir 1706*cdf0e10cSrcweir { 1707*cdf0e10cSrcweir // Achtung: falls das Resizing auch im angedockten Zustand geht, mu\s dabei 1708*cdf0e10cSrcweir // auch die Floating Size angepa\st werden !? 1709*cdf0e10cSrcweir 1710*cdf0e10cSrcweir Size aSize = GetFloatingSize(); 1711*cdf0e10cSrcweir switch (eAlign) 1712*cdf0e10cSrcweir { 1713*cdf0e10cSrcweir case SFX_ALIGN_TOP: 1714*cdf0e10cSrcweir case SFX_ALIGN_BOTTOM: 1715*cdf0e10cSrcweir case SFX_ALIGN_LOWESTTOP: 1716*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTTOP: 1717*cdf0e10cSrcweir case SFX_ALIGN_LOWESTBOTTOM: 1718*cdf0e10cSrcweir case SFX_ALIGN_HIGHESTBOTTOM: 1719*cdf0e10cSrcweir aSize.Width() = aOuterRect.Right() - aOuterRect.Left(); 1720*cdf0e10cSrcweir break; 1721*cdf0e10cSrcweir case SFX_ALIGN_LEFT: 1722*cdf0e10cSrcweir case SFX_ALIGN_RIGHT: 1723*cdf0e10cSrcweir case SFX_ALIGN_FIRSTLEFT: 1724*cdf0e10cSrcweir case SFX_ALIGN_LASTLEFT: 1725*cdf0e10cSrcweir case SFX_ALIGN_FIRSTRIGHT: 1726*cdf0e10cSrcweir case SFX_ALIGN_LASTRIGHT: 1727*cdf0e10cSrcweir aSize.Height() = aInnerRect.Bottom() - aInnerRect.Top(); 1728*cdf0e10cSrcweir break; 1729*cdf0e10cSrcweir case SFX_ALIGN_NOALIGNMENT: 1730*cdf0e10cSrcweir break; 1731*cdf0e10cSrcweir default: 1732*cdf0e10cSrcweir break; 1733*cdf0e10cSrcweir } 1734*cdf0e10cSrcweir 1735*cdf0e10cSrcweir return aSize; 1736*cdf0e10cSrcweir } 1737*cdf0e10cSrcweir 1738*cdf0e10cSrcweir //------------------------------------------------------------------------- 1739*cdf0e10cSrcweir 1740*cdf0e10cSrcweir SfxChildAlignment SfxDockingWindow::CheckAlignment(SfxChildAlignment, 1741*cdf0e10cSrcweir SfxChildAlignment eAlign) 1742*cdf0e10cSrcweir 1743*cdf0e10cSrcweir /* [Beschreibung] 1744*cdf0e10cSrcweir 1745*cdf0e10cSrcweir Virtuelle Methode der Klasse SfxDockingWindow. 1746*cdf0e10cSrcweir Hier kann eine abgeleitete Klasse bestimmte Alignments verbieten. 1747*cdf0e10cSrcweir Die Basisimplementation verbietet kein Alignment. 1748*cdf0e10cSrcweir */ 1749*cdf0e10cSrcweir 1750*cdf0e10cSrcweir { 1751*cdf0e10cSrcweir return eAlign; 1752*cdf0e10cSrcweir } 1753*cdf0e10cSrcweir 1754*cdf0e10cSrcweir //------------------------------------------------------------------------- 1755*cdf0e10cSrcweir 1756*cdf0e10cSrcweir sal_Bool SfxDockingWindow::Close() 1757*cdf0e10cSrcweir 1758*cdf0e10cSrcweir /* [Beschreibung] 1759*cdf0e10cSrcweir 1760*cdf0e10cSrcweir Das Fenster wird geschlossen, indem das ChildWindow durch Ausf"uhren des 1761*cdf0e10cSrcweir ChildWindow-Slots zerst"ort wird. 1762*cdf0e10cSrcweir Wird diese Methode von einer abgeleiteten Klasse "uberschrieben, mu\s 1763*cdf0e10cSrcweir danach SfxDockingWindow::Close() gerufen werden, wenn nicht das Close() 1764*cdf0e10cSrcweir mit "return FALSE" abgebrochen wird. 1765*cdf0e10cSrcweir 1766*cdf0e10cSrcweir */ 1767*cdf0e10cSrcweir { 1768*cdf0e10cSrcweir // Execute mit Parametern, da Toggle von einigen ChildWindows ignoriert 1769*cdf0e10cSrcweir // werden kann 1770*cdf0e10cSrcweir if ( !pMgr ) 1771*cdf0e10cSrcweir return sal_True; 1772*cdf0e10cSrcweir 1773*cdf0e10cSrcweir SfxBoolItem aValue( pMgr->GetType(), sal_False); 1774*cdf0e10cSrcweir pBindings->GetDispatcher_Impl()->Execute( 1775*cdf0e10cSrcweir pMgr->GetType(), SFX_CALLMODE_RECORD | SFX_CALLMODE_ASYNCHRON, &aValue, 0L ); 1776*cdf0e10cSrcweir return sal_True; 1777*cdf0e10cSrcweir } 1778*cdf0e10cSrcweir 1779*cdf0e10cSrcweir //------------------------------------------------------------------------- 1780*cdf0e10cSrcweir 1781*cdf0e10cSrcweir void SfxDockingWindow::Paint(const Rectangle& /*rRect*/) 1782*cdf0e10cSrcweir 1783*cdf0e10cSrcweir /* [Beschreibung] 1784*cdf0e10cSrcweir 1785*cdf0e10cSrcweir Es wird im angedockten Zustand eine Begrenzungslinie an der angedockten 1786*cdf0e10cSrcweir Kante und ein Rahmen ausgegeben. Dabei wird SVLOOK ber"ucksichtigt. 1787*cdf0e10cSrcweir */ 1788*cdf0e10cSrcweir 1789*cdf0e10cSrcweir { 1790*cdf0e10cSrcweir if ( pImp->bSplitable || IsFloatingMode() ) 1791*cdf0e10cSrcweir return; 1792*cdf0e10cSrcweir 1793*cdf0e10cSrcweir Rectangle aRect = Rectangle(Point(0, 0), 1794*cdf0e10cSrcweir GetOutputSizePixel()); 1795*cdf0e10cSrcweir switch (GetAlignment()) 1796*cdf0e10cSrcweir { 1797*cdf0e10cSrcweir case SFX_ALIGN_TOP: 1798*cdf0e10cSrcweir { 1799*cdf0e10cSrcweir DrawLine(aRect.BottomLeft(), aRect.BottomRight()); 1800*cdf0e10cSrcweir aRect.Bottom()--; 1801*cdf0e10cSrcweir break; 1802*cdf0e10cSrcweir } 1803*cdf0e10cSrcweir 1804*cdf0e10cSrcweir case SFX_ALIGN_BOTTOM: 1805*cdf0e10cSrcweir { 1806*cdf0e10cSrcweir DrawLine(aRect.TopLeft(), aRect.TopRight()); 1807*cdf0e10cSrcweir aRect.Top()++; 1808*cdf0e10cSrcweir break; 1809*cdf0e10cSrcweir } 1810*cdf0e10cSrcweir 1811*cdf0e10cSrcweir case SFX_ALIGN_LEFT: 1812*cdf0e10cSrcweir { 1813*cdf0e10cSrcweir DrawLine(aRect.TopRight(), aRect.BottomRight()); 1814*cdf0e10cSrcweir aRect.Right()--; 1815*cdf0e10cSrcweir break; 1816*cdf0e10cSrcweir } 1817*cdf0e10cSrcweir 1818*cdf0e10cSrcweir case SFX_ALIGN_RIGHT: 1819*cdf0e10cSrcweir { 1820*cdf0e10cSrcweir DrawLine(aRect.TopLeft(), aRect.BottomLeft()); 1821*cdf0e10cSrcweir aRect.Left()++; 1822*cdf0e10cSrcweir break; 1823*cdf0e10cSrcweir } 1824*cdf0e10cSrcweir default: 1825*cdf0e10cSrcweir break; 1826*cdf0e10cSrcweir } 1827*cdf0e10cSrcweir 1828*cdf0e10cSrcweir DecorationView aView( this ); 1829*cdf0e10cSrcweir aView.DrawFrame( aRect, FRAME_DRAW_OUT ); 1830*cdf0e10cSrcweir } 1831*cdf0e10cSrcweir 1832*cdf0e10cSrcweir //------------------------------------------------------------------------- 1833*cdf0e10cSrcweir 1834*cdf0e10cSrcweir void SfxDockingWindow::SetMinOutputSizePixel( const Size& rSize ) 1835*cdf0e10cSrcweir 1836*cdf0e10cSrcweir /* [Beschreibung] 1837*cdf0e10cSrcweir 1838*cdf0e10cSrcweir Mit dieser Methode kann eine minimale OutpuSize gesetzt werden, die 1839*cdf0e10cSrcweir im Resizing()-Handler abgefragt wird. 1840*cdf0e10cSrcweir */ 1841*cdf0e10cSrcweir 1842*cdf0e10cSrcweir { 1843*cdf0e10cSrcweir pImp->aMinSize = rSize; 1844*cdf0e10cSrcweir DockingWindow::SetMinOutputSizePixel( rSize ); 1845*cdf0e10cSrcweir } 1846*cdf0e10cSrcweir 1847*cdf0e10cSrcweir //------------------------------------------------------------------------- 1848*cdf0e10cSrcweir 1849*cdf0e10cSrcweir Size SfxDockingWindow::GetMinOutputSizePixel() const 1850*cdf0e10cSrcweir 1851*cdf0e10cSrcweir /* [Beschreibung] 1852*cdf0e10cSrcweir 1853*cdf0e10cSrcweir Die gesetzte minimale Gr"o\se wird zur"uckgegeben. 1854*cdf0e10cSrcweir */ 1855*cdf0e10cSrcweir 1856*cdf0e10cSrcweir { 1857*cdf0e10cSrcweir return pImp->aMinSize; 1858*cdf0e10cSrcweir } 1859*cdf0e10cSrcweir 1860*cdf0e10cSrcweir //------------------------------------------------------------------------- 1861*cdf0e10cSrcweir 1862*cdf0e10cSrcweir long SfxDockingWindow::Notify( NotifyEvent& rEvt ) 1863*cdf0e10cSrcweir { 1864*cdf0e10cSrcweir if ( rEvt.GetType() == EVENT_GETFOCUS ) 1865*cdf0e10cSrcweir { 1866*cdf0e10cSrcweir pBindings->SetActiveFrame( pMgr->GetFrame() ); 1867*cdf0e10cSrcweir 1868*cdf0e10cSrcweir if ( pImp->pSplitWin ) 1869*cdf0e10cSrcweir pImp->pSplitWin->SetActiveWindow_Impl( this ); 1870*cdf0e10cSrcweir else 1871*cdf0e10cSrcweir pMgr->Activate_Impl(); 1872*cdf0e10cSrcweir 1873*cdf0e10cSrcweir Window* pWindow = rEvt.GetWindow(); 1874*cdf0e10cSrcweir rtl::OString sHelpId; 1875*cdf0e10cSrcweir while ( !sHelpId.getLength() && pWindow ) 1876*cdf0e10cSrcweir { 1877*cdf0e10cSrcweir sHelpId = pWindow->GetHelpId(); 1878*cdf0e10cSrcweir pWindow = pWindow->GetParent(); 1879*cdf0e10cSrcweir } 1880*cdf0e10cSrcweir 1881*cdf0e10cSrcweir if ( sHelpId.getLength() ) 1882*cdf0e10cSrcweir SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), sHelpId ); 1883*cdf0e10cSrcweir 1884*cdf0e10cSrcweir // In VCL geht Notify zun"achst an das Fenster selbst, 1885*cdf0e10cSrcweir // also base class rufen, sonst erf"ahrt der parent nichts 1886*cdf0e10cSrcweir // if ( rEvt.GetWindow() == this ) PB: #i74693# not necessary any longer 1887*cdf0e10cSrcweir DockingWindow::Notify( rEvt ); 1888*cdf0e10cSrcweir return sal_True; 1889*cdf0e10cSrcweir } 1890*cdf0e10cSrcweir else if( rEvt.GetType() == EVENT_KEYINPUT ) 1891*cdf0e10cSrcweir { 1892*cdf0e10cSrcweir // KeyInput zuerst f"ur Dialogfunktionen zulassen 1893*cdf0e10cSrcweir if ( !DockingWindow::Notify( rEvt ) && SfxViewShell::Current() ) 1894*cdf0e10cSrcweir // dann auch global g"ultige Acceleratoren verwenden 1895*cdf0e10cSrcweir return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() ); 1896*cdf0e10cSrcweir return sal_True; 1897*cdf0e10cSrcweir } 1898*cdf0e10cSrcweir else if ( rEvt.GetType() == EVENT_LOSEFOCUS && !HasChildPathFocus() ) 1899*cdf0e10cSrcweir { 1900*cdf0e10cSrcweir pBindings->SetActiveFrame( NULL ); 1901*cdf0e10cSrcweir pMgr->Deactivate_Impl(); 1902*cdf0e10cSrcweir } 1903*cdf0e10cSrcweir 1904*cdf0e10cSrcweir return DockingWindow::Notify( rEvt ); 1905*cdf0e10cSrcweir } 1906*cdf0e10cSrcweir 1907*cdf0e10cSrcweir 1908*cdf0e10cSrcweir sal_uInt16 SfxDockingWindow::GetWinBits_Impl() const 1909*cdf0e10cSrcweir { 1910*cdf0e10cSrcweir sal_uInt16 nBits = 0; 1911*cdf0e10cSrcweir // if ( pImp->bAutoHide ) 1912*cdf0e10cSrcweir // nBits |= SWIB_AUTOHIDE; 1913*cdf0e10cSrcweir return nBits; 1914*cdf0e10cSrcweir } 1915*cdf0e10cSrcweir 1916*cdf0e10cSrcweir //------------------------------------------------------------------------- 1917*cdf0e10cSrcweir 1918*cdf0e10cSrcweir void SfxDockingWindow::SetItemSize_Impl( const Size& rSize ) 1919*cdf0e10cSrcweir { 1920*cdf0e10cSrcweir pImp->aSplitSize = rSize; 1921*cdf0e10cSrcweir 1922*cdf0e10cSrcweir SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); 1923*cdf0e10cSrcweir SfxChildIdentifier eIdent = SFX_CHILDWIN_DOCKINGWINDOW; 1924*cdf0e10cSrcweir if ( pImp->bSplitable ) 1925*cdf0e10cSrcweir eIdent = SFX_CHILDWIN_SPLITWINDOW; 1926*cdf0e10cSrcweir pWorkWin->ConfigChild_Impl( eIdent, SFX_ALIGNDOCKINGWINDOW, pMgr->GetType() ); 1927*cdf0e10cSrcweir } 1928*cdf0e10cSrcweir 1929*cdf0e10cSrcweir void SfxDockingWindow::Disappear_Impl() 1930*cdf0e10cSrcweir { 1931*cdf0e10cSrcweir if ( pImp->pSplitWin && pImp->pSplitWin->IsItemValid( GetType() ) ) 1932*cdf0e10cSrcweir pImp->pSplitWin->RemoveWindow(this); 1933*cdf0e10cSrcweir } 1934*cdf0e10cSrcweir 1935*cdf0e10cSrcweir void SfxDockingWindow::Reappear_Impl() 1936*cdf0e10cSrcweir { 1937*cdf0e10cSrcweir if ( pImp->pSplitWin && !pImp->pSplitWin->IsItemValid( GetType() ) ) 1938*cdf0e10cSrcweir { 1939*cdf0e10cSrcweir pImp->pSplitWin->InsertWindow( this, pImp->aSplitSize ); 1940*cdf0e10cSrcweir } 1941*cdf0e10cSrcweir } 1942*cdf0e10cSrcweir 1943*cdf0e10cSrcweir sal_Bool SfxDockingWindow::IsAutoHide_Impl() const 1944*cdf0e10cSrcweir { 1945*cdf0e10cSrcweir if ( pImp->pSplitWin ) 1946*cdf0e10cSrcweir return !pImp->pSplitWin->IsFadeIn(); 1947*cdf0e10cSrcweir else 1948*cdf0e10cSrcweir return sal_False; 1949*cdf0e10cSrcweir } 1950*cdf0e10cSrcweir 1951*cdf0e10cSrcweir sal_Bool SfxDockingWindow::IsPinned_Impl() const 1952*cdf0e10cSrcweir { 1953*cdf0e10cSrcweir if ( pImp->pSplitWin ) 1954*cdf0e10cSrcweir return pImp->pSplitWin->IsPinned(); 1955*cdf0e10cSrcweir else 1956*cdf0e10cSrcweir return sal_True; 1957*cdf0e10cSrcweir } 1958*cdf0e10cSrcweir void SfxDockingWindow::AutoShow( sal_Bool bShow ) 1959*cdf0e10cSrcweir { 1960*cdf0e10cSrcweir AutoShow_Impl(bShow); 1961*cdf0e10cSrcweir } 1962*cdf0e10cSrcweir 1963*cdf0e10cSrcweir void SfxDockingWindow::AutoShow_Impl( sal_Bool bShow ) 1964*cdf0e10cSrcweir { 1965*cdf0e10cSrcweir if ( pImp->pSplitWin ) 1966*cdf0e10cSrcweir { 1967*cdf0e10cSrcweir if ( bShow ) 1968*cdf0e10cSrcweir pImp->pSplitWin->FadeIn(); 1969*cdf0e10cSrcweir else 1970*cdf0e10cSrcweir pImp->pSplitWin->FadeOut(); 1971*cdf0e10cSrcweir } 1972*cdf0e10cSrcweir } 1973*cdf0e10cSrcweir 1974*cdf0e10cSrcweir /* 1975*cdf0e10cSrcweir void SfxDockingWindow::Pin_Impl( sal_Bool bPinned ) 1976*cdf0e10cSrcweir { 1977*cdf0e10cSrcweir if ( pImp->pSplitWin ) 1978*cdf0e10cSrcweir pImp->pSplitWin->Pin_Impl( bPinned ); 1979*cdf0e10cSrcweir } 1980*cdf0e10cSrcweir */ 1981*cdf0e10cSrcweir 1982*cdf0e10cSrcweir SfxSplitWindow* SfxDockingWindow::GetSplitWindow_Impl() const 1983*cdf0e10cSrcweir { 1984*cdf0e10cSrcweir return pImp->pSplitWin; 1985*cdf0e10cSrcweir } 1986*cdf0e10cSrcweir 1987*cdf0e10cSrcweir void SfxDockingWindow::FadeIn( sal_Bool /*bFadeIn*/ ) 1988*cdf0e10cSrcweir { 1989*cdf0e10cSrcweir } 1990*cdf0e10cSrcweir 1991*cdf0e10cSrcweir void SfxDockingWindow::StateChanged( StateChangedType nStateChange ) 1992*cdf0e10cSrcweir { 1993*cdf0e10cSrcweir if ( nStateChange == STATE_CHANGE_INITSHOW ) 1994*cdf0e10cSrcweir Initialize_Impl(); 1995*cdf0e10cSrcweir 1996*cdf0e10cSrcweir DockingWindow::StateChanged( nStateChange ); 1997*cdf0e10cSrcweir } 1998*cdf0e10cSrcweir 1999*cdf0e10cSrcweir void SfxDockingWindow::Move() 2000*cdf0e10cSrcweir { 2001*cdf0e10cSrcweir if ( pImp ) 2002*cdf0e10cSrcweir pImp->aMoveTimer.Start(); 2003*cdf0e10cSrcweir } 2004*cdf0e10cSrcweir 2005*cdf0e10cSrcweir IMPL_LINK( SfxDockingWindow, TimerHdl, Timer*, EMPTYARG) 2006*cdf0e10cSrcweir { 2007*cdf0e10cSrcweir pImp->aMoveTimer.Stop(); 2008*cdf0e10cSrcweir if ( IsReallyVisible() && IsFloatingMode() ) 2009*cdf0e10cSrcweir { 2010*cdf0e10cSrcweir if( !GetFloatingWindow()->IsRollUp() ) 2011*cdf0e10cSrcweir SetFloatingSize( GetOutputSizePixel() ); 2012*cdf0e10cSrcweir pImp->aWinState = GetFloatingWindow()->GetWindowState(); 2013*cdf0e10cSrcweir SfxChildIdentifier eIdent = SFX_CHILDWIN_DOCKINGWINDOW; 2014*cdf0e10cSrcweir if ( pImp->bSplitable ) 2015*cdf0e10cSrcweir eIdent = SFX_CHILDWIN_SPLITWINDOW; 2016*cdf0e10cSrcweir SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl(); 2017*cdf0e10cSrcweir pWorkWin->ConfigChild_Impl( eIdent, SFX_ALIGNDOCKINGWINDOW, pMgr->GetType() ); 2018*cdf0e10cSrcweir } 2019*cdf0e10cSrcweir return 0; 2020*cdf0e10cSrcweir } 2021*cdf0e10cSrcweir 2022