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 #define private public 28*cdf0e10cSrcweir 29*cdf0e10cSrcweir #include <tools/ref.hxx> 30*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 31*cdf0e10cSrcweir #include <soldep/soldep.hxx> 32*cdf0e10cSrcweir #include <soldep/tbox.hxx> 33*cdf0e10cSrcweir #include <soldep/soldlg.hrc> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir SoldepToolBox::SoldepToolBox( Window* pParent, const ResId& aId, sal_Bool bDAble ) : 38*cdf0e10cSrcweir ToolBox( pParent, aId ), 39*cdf0e10cSrcweir bDockable( bDAble ), 40*cdf0e10cSrcweir bCloseMode( sal_False ), 41*cdf0e10cSrcweir bBoxIsVisible( sal_True ), 42*cdf0e10cSrcweir bPinable( sal_True ), 43*cdf0e10cSrcweir aPinedBitmap( DtSodResId( TID_SMALL_PIN_PINED )), // BMP_SMALL_PIN_PINED 44*cdf0e10cSrcweir aUnpinedBitmap( DtSodResId( TID_SMALL_PIN_UNPINED )) // BMP_SMALL_PIN_UNPINED 45*cdf0e10cSrcweir { 46*cdf0e10cSrcweir bPinable = sal_True; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir SetAlign( WINDOWALIGN_TOP ); 49*cdf0e10cSrcweir HideItem(TID_SOLDEP_BACK); //Inital hide this item, activated in project view. 50*cdf0e10cSrcweir HideItem(TID_SOLDEP_SAVE); // Hide this item now, not used yet 51*cdf0e10cSrcweir HideItem(TID_SOLDEP_OPEN); // Hide this item now, not used yet 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir //SetMouseDownHdl(LINK(this,SoldepToolBox,MouseDownHdl)); 54*cdf0e10cSrcweir //SetFloatingLines( nFloatingLines ); 55*cdf0e10cSrcweir //SetFloatingMode( bFloatingMode ); 56*cdf0e10cSrcweir sal_Bool bFloatingMode = sal_False; 57*cdf0e10cSrcweir if ( bFloatingMode ) 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir //Point aPos( sToolBoxInfo.GetToken( 4, ',' ).ToInt64(), sToolBoxInfo.GetToken( 5, ',' ).ToInt64()); 60*cdf0e10cSrcweir //SetPosPixel( aPos ); 61*cdf0e10cSrcweir } 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir if ( bDockable ) InsertSeparator( 0 ); // Freiraum f�r Abrei�d�del schaffen 64*cdf0e10cSrcweir // (ein Separator an 1er Pos wird 65*cdf0e10cSrcweir // nicht gezeichnet, 66*cdf0e10cSrcweir // schafft aber Platz.) 67*cdf0e10cSrcweir bBoxIsVisible = sal_False; 68*cdf0e10cSrcweir // if ( sToolBoxInfo.GetToken( 3, ',' ) == "Visible" ) { 69*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < GetItemCount() && !bBoxIsVisible; i++ ) 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir // sal_uInt16 nItemId = GetItemId( i ); 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir switch ( GetItemType( i )) 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir case TOOLBOXITEM_SPACE: 76*cdf0e10cSrcweir break; 77*cdf0e10cSrcweir case TOOLBOXITEM_SEPARATOR : 78*cdf0e10cSrcweir break; 79*cdf0e10cSrcweir default: 80*cdf0e10cSrcweir bBoxIsVisible = sal_True; 81*cdf0e10cSrcweir break; 82*cdf0e10cSrcweir } 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir // } 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir if ( bBoxIsVisible ) { 87*cdf0e10cSrcweir if (!bDockable) 88*cdf0e10cSrcweir Show(); 89*cdf0e10cSrcweir else 90*cdf0e10cSrcweir Hide(); 91*cdf0e10cSrcweir } 92*cdf0e10cSrcweir else 93*cdf0e10cSrcweir Hide(); 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir bOldFloatMode = IsFloatingMode(); 96*cdf0e10cSrcweir } 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir /************************************************************************* 99*cdf0e10cSrcweir |* SoldepToolBox::~SoldepToolBox() 100*cdf0e10cSrcweir |************************************************************************/ 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir SoldepToolBox::~SoldepToolBox() 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir /************************************************************************* 107*cdf0e10cSrcweir |* SoldepToolBox::Paint() 108*cdf0e10cSrcweir |************************************************************************/ 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir void SoldepToolBox::Paint( const Rectangle& rRect ) 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir SetOutStyle( TOOLBOX_STYLE_FLAT ); 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir // Wenn wir eine Dockable ToolBox haben, ... 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir if ( bDockable ) 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir sal_uInt16 nItemId = GetItemId( 0 ); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir // ... zeichnen wir den wunderbaren Abrei�d�del �ber das erste Item (Seperator) 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir if ( !IsFloatingMode() && ( mnCurLine == 1 )) { 123*cdf0e10cSrcweir sal_Bool bIsCloseable = (( mnWinStyle & WB_CLOSEABLE ) != 0 ); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir ShowItem( nItemId ); 126*cdf0e10cSrcweir Rectangle aRect = GetItemRect( nItemId ); 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir ToolBox::Paint( rRect ); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir if ( bIsCloseable ) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir // Paint small cross button left/top of toolbar 133*cdf0e10cSrcweir SetLineColor( Color( COL_WHITE )); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left()+6, aRect.Top())); 136*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Top()+6)); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir SetLineColor( Color( COL_GRAY )); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()+6), Point( aRect.Left()+6, aRect.Top()+6)); 141*cdf0e10cSrcweir DrawLine( Point( aRect.Left()+6, aRect.Top()), Point( aRect.Left()+6, aRect.Top()+6)); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir SetLineColor( Color( COL_BLACK )); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir DrawLine( Point( aRect.Left()+2, aRect.Top()+2), Point( aRect.Left()+4, aRect.Top()+4)); 146*cdf0e10cSrcweir DrawLine( Point( aRect.Left()+2, aRect.Top()+4), Point( aRect.Left()+4, aRect.Top()+2)); 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir else if ( bPinable ) 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir if ( GetPin()) 151*cdf0e10cSrcweir DrawBitmap( Point( aRect.Left(), aRect.Top()), aPinedBitmap ); 152*cdf0e10cSrcweir else 153*cdf0e10cSrcweir DrawBitmap( Point( aRect.Left(), aRect.Top()), aUnpinedBitmap ); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir SetLineColor( Color( COL_WHITE )); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir if ( IsHorizontal()) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir if ( bIsCloseable || bPinable ) aRect = Rectangle( Point( aRect.Left(), aRect.Top()+8), Point( aRect.Right(), aRect.Bottom())); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir DrawLine( Point(aRect.Left(), aRect.Top()), Point(aRect.Left(), aRect.Bottom())); 163*cdf0e10cSrcweir DrawLine( Point(aRect.Left(), aRect.Top()), Point(aRect.Left()+2, aRect.Top())); 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir SetLineColor( Color( COL_WHITE )); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir DrawLine( Point(aRect.Left()+4, aRect.Top()), Point(aRect.Left()+4, aRect.Bottom())); 168*cdf0e10cSrcweir DrawLine( Point(aRect.Left()+4, aRect.Top()), Point(aRect.Left()+6, aRect.Top())); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir SetLineColor( Color( COL_GRAY ));//GRAY 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir DrawLine( Point(aRect.Left()+2, aRect.Top()), Point(aRect.Left()+2, aRect.Bottom())); 173*cdf0e10cSrcweir DrawLine( Point(aRect.Left(), aRect.Bottom()), Point(aRect.Left()+2, aRect.Bottom())); 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir SetLineColor( Color( COL_BLACK )); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir DrawLine( Point(aRect.Left()+6, aRect.Top()), Point(aRect.Left()+6, aRect.Bottom())); 178*cdf0e10cSrcweir DrawLine( Point(aRect.Left()+4, aRect.Bottom()), Point(aRect.Left()+6, aRect.Bottom())); 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir else 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir if ( bIsCloseable || bPinable ) aRect = Rectangle( Point( aRect.Left()+8, aRect.Top()), Point( aRect.Right(), aRect.Bottom())); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Top()+2)); 186*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()+4), Point( aRect.Left(), aRect.Top()+6)); 189*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()+4), Point( aRect.Right(), aRect.Top()+4)); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir SetLineColor( Color( COL_GRAY )); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()+2), Point( aRect.Right(),aRect.Top()+2)); 194*cdf0e10cSrcweir DrawLine( Point( aRect.Right(), aRect.Top()), Point( aRect.Right(), aRect.Top()+2)); 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()+6), Point( aRect.Right(),aRect.Top()+6)); 197*cdf0e10cSrcweir DrawLine( Point( aRect.Right(), aRect.Top()+4), Point( aRect.Right(), aRect.Top()+6)); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir else 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir // Sind wir im FloatingMode, dann wollen wir keinen Abrei�d�del haben 204*cdf0e10cSrcweir // und hiden somit das erste Item. 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir //Hiden l�scht leider das erste Object der n�chsten Zeile, daher nicht 207*cdf0e10cSrcweir //l�schen 208*cdf0e10cSrcweir HideItem( nItemId ); 209*cdf0e10cSrcweir ToolBox::Paint( rRect ); 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir else 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir ToolBox::Paint( rRect ); 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir /************************************************************************* 219*cdf0e10cSrcweir |* SoldepToolBox::MouseButtonDown() 220*cdf0e10cSrcweir |************************************************************************/ 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir void SoldepToolBox::MouseButtonDown(const MouseEvent& rEvent) 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir // Sind wir im DockingMode, ... 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir if ( !IsFloatingMode() && ((( mnWinStyle & WB_CLOSEABLE ) != 0 ) || bPinable )) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir // ... dann testen wir, ob am Abrei�d�del der Close-Button gedr�ckt wurde ... 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir Rectangle aRect = GetItemRect( GetItemId( 0 )); 231*cdf0e10cSrcweir aRect = Rectangle( aRect.TopLeft(), Point( aRect.Left()+6, aRect.Top()+6 )); 232*cdf0e10cSrcweir if ( rEvent.IsLeft() && aRect.IsInside( rEvent.GetPosPixel())) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir if ( bPinable ) { 235*cdf0e10cSrcweir TogglePin(); 236*cdf0e10cSrcweir Invalidate(); 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir else { 239*cdf0e10cSrcweir bCloseMode = sal_True; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir // ... und zeichnen ggf. den Button gedr�ckt. 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir SetLineColor( Color( COL_WHITE )); 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Bottom()), Point( aRect.Right(), aRect.Bottom())); 246*cdf0e10cSrcweir DrawLine( Point( aRect.Right(), aRect.Bottom()), Point( aRect.Right(), aRect.Top())); 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir SetLineColor( Color( COL_GRAY )); 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); 251*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Bottom())); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir else 255*cdf0e10cSrcweir { 256*cdf0e10cSrcweir ToolBox::MouseButtonDown( rEvent ); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir else 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir ToolBox::MouseButtonDown( rEvent ); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir aMouseDownHdl.Call(this); 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir /************************************************************************* 268*cdf0e10cSrcweir |* SoldepToolBox::MouseButtonUp() 269*cdf0e10cSrcweir |************************************************************************/ 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir void SoldepToolBox::MouseButtonUp(const MouseEvent& rEvent) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir // Wenn der Close-Button am Abrei�d�del zuvor gedr�ckt wurde, ... 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir if ( bCloseMode ) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir bCloseMode = sal_False; 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir // ... so zeichen wir diesen wieder normal ... 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir Rectangle aRect = GetItemRect( GetItemId( 0 )); 282*cdf0e10cSrcweir aRect = Rectangle( aRect.TopLeft(), Point( aRect.Left()+6, aRect.Top()+6 )); 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir SetLineColor( Color( COL_WHITE )); 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); 287*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Bottom())); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir SetLineColor( Color( COL_GRAY )); 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Bottom()), Point( aRect.Right(), aRect.Bottom())); 292*cdf0e10cSrcweir DrawLine( Point( aRect.Right(), aRect.Bottom()), Point( aRect.Right(), aRect.Top())); 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir if ( rEvent.IsLeft() && aRect.IsInside( rEvent.GetPosPixel())) 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir // ... und schlie�en die Box durch Aufruf der virtuellen Methode 297*cdf0e10cSrcweir // CloseDockingMode(). 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir CloseDockingMode(); 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir else 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir ToolBox::MouseButtonUp( rEvent ); 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir else 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir ToolBox::MouseButtonUp( rEvent ); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir /************************************************************************* 313*cdf0e10cSrcweir |* SoldepToolBox::MouseMove() 314*cdf0e10cSrcweir |************************************************************************/ 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir void SoldepToolBox::MouseMove(const MouseEvent& rEvent) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir // Wenn der Close-Button am Abrei�d�del zuvor gedr�ckt wurde, ... 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir if ( bCloseMode ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir Rectangle aRect = GetItemRect( GetItemId( 0 )); 323*cdf0e10cSrcweir aRect = Rectangle( aRect.TopLeft(), Point( aRect.Left()+6, aRect.Top()+6 )); 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir // ... der Mouse-Zeiger jedoch den Close-Button verl��t, ... 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir if ( !aRect.IsInside( rEvent.GetPosPixel())) 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir SetLineColor( Color( COL_WHITE )); 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir // ... zeichnen wir diesen halt wieder normal. 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Right(), aRect.Top())); 334*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Top()), Point( aRect.Left(), aRect.Bottom())); 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir SetLineColor( Color( COL_GRAY )); 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir DrawLine( Point( aRect.Left(), aRect.Bottom()), Point( aRect.Right(), aRect.Bottom())); 339*cdf0e10cSrcweir DrawLine( Point( aRect.Right(), aRect.Bottom()), Point( aRect.Right(), aRect.Top())); 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir bCloseMode = sal_False; 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir else 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir ToolBox::MouseMove( rEvent ); 346*cdf0e10cSrcweir } 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir else 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir ToolBox::MouseMove( rEvent ); 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir /*****************************************************************************/ 355*cdf0e10cSrcweir void SoldepToolBox::ToggleFloatingMode() 356*cdf0e10cSrcweir /*****************************************************************************/ 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir ToolBox::ToggleFloatingMode(); 359*cdf0e10cSrcweir CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir /*****************************************************************************/ 363*cdf0e10cSrcweir void SoldepToolBox::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) 364*cdf0e10cSrcweir /*****************************************************************************/ 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir ToolBox::EndDocking( rRect, bFloatMode ); 367*cdf0e10cSrcweir if ( aResizeHdl.IsSet()) 368*cdf0e10cSrcweir CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); 369*cdf0e10cSrcweir else 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir GetParent()->Resize(); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir }; 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir /*****************************************************************************/ 376*cdf0e10cSrcweir sal_Bool SoldepToolBox::Close() 377*cdf0e10cSrcweir /*****************************************************************************/ 378*cdf0e10cSrcweir { 379*cdf0e10cSrcweir if (!ToolBox::Close()) return sal_False; 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir return sal_True; 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir /*****************************************************************************/ 385*cdf0e10cSrcweir void SoldepToolBox::Move() 386*cdf0e10cSrcweir /*****************************************************************************/ 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir /************************************************************************* 391*cdf0e10cSrcweir |* SoldepToolBox::CloseDockingMode() 392*cdf0e10cSrcweir |* 393*cdf0e10cSrcweir |* virtuelle Methode zur Reaktion auf den Close-Button im DockinMode 394*cdf0e10cSrcweir |************************************************************************/ 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir void SoldepToolBox::CloseDockingMode() 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir Hide(); 399*cdf0e10cSrcweir bBoxIsVisible = sal_False; 400*cdf0e10cSrcweir CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir /************************************************************************* 404*cdf0e10cSrcweir |* SoldepToolBox::Command() 405*cdf0e10cSrcweir |************************************************************************/ 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir void SoldepToolBox::Command( const CommandEvent& rCEvt) 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) 410*cdf0e10cSrcweir { 411*cdf0e10cSrcweir if( !IsFloatingMode() && bDockable 412*cdf0e10cSrcweir && ( GetItemRect(GetItemId( 0 )).IsInside(rCEvt.GetMousePosPixel()))) 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir // Hier das Context-Menue fuer Abrei�d�del dynamisch erzeugen... 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir PopupMenu aPopupMenu; 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir String sText( String::CreateFromAscii( "Floating mode" )); 419*cdf0e10cSrcweir aPopupMenu.InsertItem( 5, sText ); 420*cdf0e10cSrcweir aPopupMenu.InsertSeparator(); 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir sText = String::CreateFromAscii( "Top" ); 423*cdf0e10cSrcweir aPopupMenu.InsertItem( 1, sText ); 424*cdf0e10cSrcweir sText = String::CreateFromAscii( "Bottom" ); 425*cdf0e10cSrcweir aPopupMenu.InsertItem( 2, sText ); 426*cdf0e10cSrcweir sText = String::CreateFromAscii( "Left" ); 427*cdf0e10cSrcweir aPopupMenu.InsertItem( 3, sText ); 428*cdf0e10cSrcweir sText = String::CreateFromAscii( "Right" ); 429*cdf0e10cSrcweir aPopupMenu.InsertItem( 4, sText ); 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir switch( GetAlign()) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir case WINDOWALIGN_TOP : aPopupMenu.EnableItem( 1, sal_False ); break; 434*cdf0e10cSrcweir case WINDOWALIGN_BOTTOM : aPopupMenu.EnableItem( 2, sal_False ); break; 435*cdf0e10cSrcweir case WINDOWALIGN_LEFT : aPopupMenu.EnableItem( 3, sal_False ); break; 436*cdf0e10cSrcweir case WINDOWALIGN_RIGHT : aPopupMenu.EnableItem( 4, sal_False ); break; 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir if (( mnWinStyle & WB_CLOSEABLE ) != 0 ) 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir aPopupMenu.InsertSeparator(); 442*cdf0e10cSrcweir sText = String::CreateFromAscii( "Hide" ); 443*cdf0e10cSrcweir aPopupMenu.InsertItem( 6, sText ); 444*cdf0e10cSrcweir } 445*cdf0e10cSrcweir else if ( bPinable ) { 446*cdf0e10cSrcweir aPopupMenu.InsertSeparator(); 447*cdf0e10cSrcweir sText = String::CreateFromAscii( "Pin" ); 448*cdf0e10cSrcweir aPopupMenu.InsertItem( 6, sText ); 449*cdf0e10cSrcweir aPopupMenu.CheckItem( 6, GetPin()); 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir // ... und rufen. 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir aPopupMenu.SetSelectHdl ( LINK ( this, SoldepToolBox, MenuSelectHdl )); 455*cdf0e10cSrcweir aPopupMenu.Execute( this, rCEvt.GetMousePosPixel()); 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir else if ( !GetItemId(rCEvt.GetMousePosPixel())) 458*cdf0e10cSrcweir { 459*cdf0e10cSrcweir CallContextMenu( this, rCEvt.GetMousePosPixel()); 460*cdf0e10cSrcweir } 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir else ToolBox::Command( rCEvt ); 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir /************************************************************************* 466*cdf0e10cSrcweir |* SoldepToolBox::GetContextMenu() 467*cdf0e10cSrcweir |************************************************************************/ 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir PopupMenu *SoldepToolBox::GetContextMenu() 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir InitContextMenu(); 472*cdf0e10cSrcweir return &aMenu; 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir /************************************************************************* 476*cdf0e10cSrcweir |* SoldepToolBox::InitContextMenu() 477*cdf0e10cSrcweir |************************************************************************/ 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir void SoldepToolBox::InitContextMenu() 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir sal_uInt16 nStart = 0; 482*cdf0e10cSrcweir if ( bDockable ) 483*cdf0e10cSrcweir nStart = 1; 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir aMenu.Clear(); 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir for ( sal_uInt16 i = nStart; i < GetItemCount(); i++ ) 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir sal_uInt16 nItemId = GetItemId( i ); 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir switch ( GetItemType( i )) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir case TOOLBOXITEM_SPACE: 494*cdf0e10cSrcweir break; 495*cdf0e10cSrcweir case TOOLBOXITEM_SEPARATOR : 496*cdf0e10cSrcweir if (!(( i < GetItemCount() - 1 ) && ( GetItemType( i + 1 ) == TOOLBOXITEM_DONTKNOW ))) 497*cdf0e10cSrcweir aMenu.InsertSeparator(); 498*cdf0e10cSrcweir break; 499*cdf0e10cSrcweir default: 500*cdf0e10cSrcweir aMenu.InsertItem( nItemId, GetItemText( nItemId ), GetItemImage( nItemId )); 501*cdf0e10cSrcweir if (IsItemChecked( nItemId )) aMenu.CheckItem( nItemId, sal_True ); 502*cdf0e10cSrcweir if (!IsItemEnabled( nItemId )) aMenu.EnableItem( nItemId, sal_False ); 503*cdf0e10cSrcweir if (!IsItemVisible( nItemId )) aMenu.HideItem(nItemId); 504*cdf0e10cSrcweir break; 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir } 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir /************************************************************************* 510*cdf0e10cSrcweir |* SoldepToolBox::CallContextMenu() 511*cdf0e10cSrcweir |************************************************************************/ 512*cdf0e10cSrcweir 513*cdf0e10cSrcweir void SoldepToolBox::CallContextMenu( Window *pWin, Point aPos ) 514*cdf0e10cSrcweir { 515*cdf0e10cSrcweir if ( aMenu.IsInExecute()) 516*cdf0e10cSrcweir return; 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir InitContextMenu(); 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir // ... und rufen. 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir aMenu.SetSelectHdl ( LINK ( this, SoldepToolBox, MenuSelectHdl )); 523*cdf0e10cSrcweir aMenu.Execute( pWin, aPos ); 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir void SoldepToolBox::SetPosSizePixel( const Point& rNewPos, 527*cdf0e10cSrcweir const Size& rNewSize ) 528*cdf0e10cSrcweir { 529*cdf0e10cSrcweir // if(rNewPos != GetPosPixel() || rNewSize != GetSizePixel()) 530*cdf0e10cSrcweir // { 531*cdf0e10cSrcweir ToolBox::SetPosSizePixel(rNewPos,rNewSize); 532*cdf0e10cSrcweir // Resize(); 533*cdf0e10cSrcweir // } 534*cdf0e10cSrcweir } 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir void SoldepToolBox::SetDockingRects( const Rectangle& rOutRect, 537*cdf0e10cSrcweir const Rectangle& rInRect ) 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir if(rOutRect != aOutRect || rInRect != aInRect) 540*cdf0e10cSrcweir { 541*cdf0e10cSrcweir ToolBox::SetDockingRects(rOutRect,rInRect); 542*cdf0e10cSrcweir Invalidate(); 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir aOutRect = rOutRect; 545*cdf0e10cSrcweir aInRect = rInRect; 546*cdf0e10cSrcweir } 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir /*****************************************************************************/ 550*cdf0e10cSrcweir void SoldepToolBox::StartDocking() 551*cdf0e10cSrcweir /*****************************************************************************/ 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir ToolBox::StartDocking(); 554*cdf0e10cSrcweir CallEventListeners( VCLEVENT_USER_TBOX_RESIZE_APP, this); 555*cdf0e10cSrcweir }; 556*cdf0e10cSrcweir 557*cdf0e10cSrcweir sal_Bool SoldepToolBox::GetPin() 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir { 560*cdf0e10cSrcweir return bPin; 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir void SoldepToolBox::TogglePin() 564*cdf0e10cSrcweir { 565*cdf0e10cSrcweir bPin = !bPin; 566*cdf0e10cSrcweir } 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir void SoldepToolBox::SetPin( sal_Bool bP ) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir bPin = bP; 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir /************************************************************************* 574*cdf0e10cSrcweir |* SoldepToolBox::MenuSelectHdl() 575*cdf0e10cSrcweir |* 576*cdf0e10cSrcweir |* Handler, der beim Execute der Context-Men�s gerufen wird 577*cdf0e10cSrcweir |************************************************************************/ 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir IMPL_LINK ( SoldepToolBox, MenuSelectHdl, Menu*, pMenu ) 580*cdf0e10cSrcweir { 581*cdf0e10cSrcweir // Wenn die CurItemId <= 6 ist, dann wurde das Abrei�d�del-Context-Men� ausgef�hrt ... 582*cdf0e10cSrcweir sal_uIntPtr itemid; 583*cdf0e10cSrcweir itemid = pMenu->GetCurItemId(); 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir if ( pMenu == &aMenu ) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir // ... Andernfalls wurde das Default-Context-Men� ausgef�hrt ... 588*cdf0e10cSrcweir sal_uInt16 nTmpId = mnCurItemId; 589*cdf0e10cSrcweir mnCurItemId = pMenu->GetCurItemId(); 590*cdf0e10cSrcweir 591*cdf0e10cSrcweir // ... und der gesetzte Handler (in soldep.cxx) wird gerufen. 592*cdf0e10cSrcweir maSelectHdl.Call( this ); 593*cdf0e10cSrcweir mnCurItemId = nTmpId; 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir return 0; 596*cdf0e10cSrcweir } 597