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 #include <tools/list.hxx> 29*cdf0e10cSrcweir #include <tools/debug.hxx> 30*cdf0e10cSrcweir #include <vcl/svapp.hxx> 31*cdf0e10cSrcweir #include <vcl/help.hxx> 32*cdf0e10cSrcweir #include <vcl/wall.hxx> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <soldep/objwin.hxx> 35*cdf0e10cSrcweir #include <soldep/depwin.hxx> 36*cdf0e10cSrcweir //#include "depapp.hxx" 37*cdf0e10cSrcweir #include <soldep/depper.hxx> 38*cdf0e10cSrcweir //#include "prjdep.hxx" 39*cdf0e10cSrcweir #include <soldep/connctr.hxx> 40*cdf0e10cSrcweir #include <stdio.h> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir static Color aDefaultColor = 0L; 43*cdf0e10cSrcweir static Wallpaper* pDefaultWallpaper = 0L; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir // Initialize static class member 46*cdf0e10cSrcweir sal_Bool ObjectWin::msbHideMode = sal_False; 47*cdf0e10cSrcweir sal_uIntPtr ObjectWin::msnGlobalViewMask = 0; 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir sal_uInt32 aColorMap[] = { 51*cdf0e10cSrcweir RGB_COLORDATA( 0xFF, 0xFF, 0x80 ), //MARKMODE_DEFAULT 0 52*cdf0e10cSrcweir COL_GREEN, //MARKMODE_DEPENDING 1 53*cdf0e10cSrcweir COL_RED, //MARKMODE_NEEDED 2 54*cdf0e10cSrcweir COL_MAGENTA, //1+2 55*cdf0e10cSrcweir COL_GRAY, //MARKMODE_ACTIVATED 4 56*cdf0e10cSrcweir COL_LIGHTGREEN, //1+4 57*cdf0e10cSrcweir COL_LIGHTRED, //2+4 58*cdf0e10cSrcweir COL_LIGHTMAGENTA, //1+2+4 59*cdf0e10cSrcweir COL_BLUE, //MARKMODE_SELECTED 8 60*cdf0e10cSrcweir COL_LIGHTGRAY, //1+8 61*cdf0e10cSrcweir COL_CYAN, //2+8 62*cdf0e10cSrcweir COL_LIGHTCYAN, //1+2+8 63*cdf0e10cSrcweir COL_LIGHTBLUE, //4+8 64*cdf0e10cSrcweir COL_BROWN, //1+4+8 65*cdf0e10cSrcweir COL_BLACK, //2+4+8 66*cdf0e10cSrcweir COL_BLUE //1+2+4+8 67*cdf0e10cSrcweir }; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir // 71*cdf0e10cSrcweir // class ObjectWin 72*cdf0e10cSrcweir // 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir /*****************************************************************************/ 75*cdf0e10cSrcweir ObjectWin::ObjectWin( Window* pParent, WinBits nWinStyle ) 76*cdf0e10cSrcweir /*****************************************************************************/ 77*cdf0e10cSrcweir : Window( pParent, nWinStyle ), 78*cdf0e10cSrcweir msBodyText( "" ), 79*cdf0e10cSrcweir msTipText( "" ), 80*cdf0e10cSrcweir mnObjectId( 0 ), 81*cdf0e10cSrcweir mnMarkMode( 0 ), 82*cdf0e10cSrcweir mnViewMask( 0 ), 83*cdf0e10cSrcweir mbVisible( sal_False ), 84*cdf0e10cSrcweir mbMenuExecute( sal_False ), 85*cdf0e10cSrcweir mbVisited( sal_False ), 86*cdf0e10cSrcweir mnRootDist( 0 ), 87*cdf0e10cSrcweir mnHeadDist( 0 ), 88*cdf0e10cSrcweir mbFixed( sal_False ) 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir SetBackground( Wallpaper( aColorMap[0] )); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir aTipTimer.SetTimeout( 500 ); 93*cdf0e10cSrcweir aTipTimer.SetTimeoutHdl( 94*cdf0e10cSrcweir LINK( this, ObjectWin, TipHdl )); 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir SetFont( Font( GetFont() ) ); 97*cdf0e10cSrcweir Font aFont( GetFont() ); 98*cdf0e10cSrcweir Size aSize = aFont.GetSize(); 99*cdf0e10cSrcweir aFont.SetSize( aSize ); 100*cdf0e10cSrcweir SetFont( aFont ); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir EnableClipSiblings(); 103*cdf0e10cSrcweir SetZOrder( NULL, WINDOW_ZORDER_FIRST ); 104*cdf0e10cSrcweir mpPopup = new PopupMenu(); 105*cdf0e10cSrcweir mpPopup->InsertItem( OBJWIN_EDIT_TEXT, String::CreateFromAscii( "Details" )); 106*cdf0e10cSrcweir mpPopup->InsertItem( OBJWIN_ADD_CONNECTOR, String::CreateFromAscii( "New connection" )); 107*cdf0e10cSrcweir mpPopup->InsertItem( OBJWIN_REMOVE_WIN, String::CreateFromAscii( "Remove object" )); 108*cdf0e10cSrcweir mpPopup->InsertItem( OBJWIN_VIEW_CONTENT, String::CreateFromAscii( "View content" )); 109*cdf0e10cSrcweir // mpPopup->InsertSeparator(); 110*cdf0e10cSrcweir mpPopup->SetSelectHdl( LINK( this, ObjectWin, PopupSelected )); 111*cdf0e10cSrcweir mpPopup->SetDeactivateHdl( LINK( this, ObjectWin, PopupDeactivated )); 112*cdf0e10cSrcweir mnPopupStaticItems = mpPopup->GetItemCount(); 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir if ( ! pDefaultWallpaper ) 115*cdf0e10cSrcweir { 116*cdf0e10cSrcweir pDefaultWallpaper = new Wallpaper( GetBackground() ); 117*cdf0e10cSrcweir aDefaultColor = GetTextColor(); 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir Hide(); 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir /*****************************************************************************/ 123*cdf0e10cSrcweir ObjectWin::~ObjectWin() 124*cdf0e10cSrcweir /*****************************************************************************/ 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir while ( mConnections.Count() > 0 ) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir delete mConnections.GetObject( 0 ); 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir void ObjectWin::SetHideMode(sal_Bool bHide) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir msbHideMode = bHide; 135*cdf0e10cSrcweir mConnections.GetObject(0)->SetHideMode(msbHideMode); 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir sal_Bool ObjectWin::ToggleHideMode() 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir msbHideMode = !msbHideMode; 141*cdf0e10cSrcweir mConnections.GetObject(0)->SetHideMode(msbHideMode); 142*cdf0e10cSrcweir return msbHideMode; 143*cdf0e10cSrcweir } 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir /*****************************************************************************/ 146*cdf0e10cSrcweir void ObjectWin::SetViewMask( sal_uIntPtr nMask ) 147*cdf0e10cSrcweir /*****************************************************************************/ 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir mnViewMask = nMask; 150*cdf0e10cSrcweir // Compares 151*cdf0e10cSrcweir if ( mnViewMask & msnGlobalViewMask) { 152*cdf0e10cSrcweir mbVisible = sal_True; 153*cdf0e10cSrcweir Show(); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir else { 156*cdf0e10cSrcweir Hide(); 157*cdf0e10cSrcweir mbVisible = sal_False; 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir for ( sal_uIntPtr i = 0; i < mConnections.Count(); i++ ) 160*cdf0e10cSrcweir mConnections.GetObject( i )->UpdateVisibility(); 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir /*****************************************************************************/ 164*cdf0e10cSrcweir void ObjectWin::SetBodyText( const ByteString& rNewString ) 165*cdf0e10cSrcweir /*****************************************************************************/ 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir msBodyText = rNewString; 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir /*****************************************************************************/ 171*cdf0e10cSrcweir ByteString& ObjectWin::GetBodyText() 172*cdf0e10cSrcweir /*****************************************************************************/ 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir return msBodyText; 175*cdf0e10cSrcweir } 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir /*****************************************************************************/ 178*cdf0e10cSrcweir void ObjectWin::SetTipText( const ByteString& rNewString ) 179*cdf0e10cSrcweir /*****************************************************************************/ 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir msTipText = rNewString; 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir /*****************************************************************************/ 185*cdf0e10cSrcweir ByteString& ObjectWin::GetTipText() 186*cdf0e10cSrcweir /*****************************************************************************/ 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir return msTipText; 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir /*****************************************************************************/ 192*cdf0e10cSrcweir Point ObjectWin::GetFixPoint( const Point& rRefPoint, sal_Bool bUseRealPos ) 193*cdf0e10cSrcweir /*****************************************************************************/ 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir Point aLocalPoint; 196*cdf0e10cSrcweir if ( bUseRealPos ) 197*cdf0e10cSrcweir aLocalPoint = GetPosPixel(); 198*cdf0e10cSrcweir else 199*cdf0e10cSrcweir aLocalPoint = GetCalcPosPixel(); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir Size aLocalSize = GetSizePixel(); 202*cdf0e10cSrcweir Point aRetPoint; 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir sal_uInt16 nRefX = aLocalPoint.X() + aLocalSize.Width() / 2 ; 205*cdf0e10cSrcweir sal_uInt16 nRefY = aLocalPoint.Y() + aLocalSize.Height() / 2 ; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir // always false... 208*cdf0e10cSrcweir //if ( nRefX < 0 ) nRefX = 0; 209*cdf0e10cSrcweir //if ( nRefY < 0 ) nRefY = 0; 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir if ( rRefPoint.X() > nRefX ) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir if ( rRefPoint.Y() > nRefY ) 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY )) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir aRetPoint.X() = aLocalPoint.X() + aLocalSize.Width(); 218*cdf0e10cSrcweir aRetPoint.Y() = nRefY; 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir else 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir aRetPoint.X() = nRefX; 223*cdf0e10cSrcweir aRetPoint.Y() = aLocalPoint.Y() + aLocalSize.Height(); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir else 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY )) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir aRetPoint.X() = aLocalPoint.X() + aLocalSize.Width(); 231*cdf0e10cSrcweir aRetPoint.Y() = nRefY; 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir else 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir aRetPoint.X() = nRefX; 236*cdf0e10cSrcweir aRetPoint.Y() = aLocalPoint.Y(); 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir else 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir if ( rRefPoint.Y() > nRefY ) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY )) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir aRetPoint.X() = aLocalPoint.X(); 247*cdf0e10cSrcweir aRetPoint.Y() = nRefY; 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir else 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir aRetPoint.X() = nRefX; 252*cdf0e10cSrcweir aRetPoint.Y() = aLocalPoint.Y() + aLocalSize.Height(); 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir else 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir if ( Abs( rRefPoint.X() - nRefX ) > Abs( rRefPoint.Y() - nRefY )) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir aRetPoint.X() = aLocalPoint.X(); 260*cdf0e10cSrcweir aRetPoint.Y() = nRefY; 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir else 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir aRetPoint.X() = nRefX; 265*cdf0e10cSrcweir aRetPoint.Y() = aLocalPoint.Y(); 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir return PixelToLogic(aRetPoint); 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir /*****************************************************************************/ 275*cdf0e10cSrcweir void ObjectWin::AddConnector( Connector* pNewCon ) 276*cdf0e10cSrcweir /*****************************************************************************/ 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir mConnections.Insert( pNewCon ); 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir /*****************************************************************************/ 282*cdf0e10cSrcweir sal_Bool ObjectWin::ConnectionExistsInAnyDirection( ObjectWin *pWin ) 283*cdf0e10cSrcweir /*****************************************************************************/ 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir for ( sal_uIntPtr i = 0; i < mConnections.Count(); i++ ) 286*cdf0e10cSrcweir if ( mConnections.GetObject( i )->GetOtherWin( this ) == pWin ) 287*cdf0e10cSrcweir return sal_True; 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir return sal_False; 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir /*****************************************************************************/ 293*cdf0e10cSrcweir void ObjectWin::RemoveConnector( Connector* pOldCon ) 294*cdf0e10cSrcweir /*****************************************************************************/ 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir mConnections.Remove( pOldCon ); 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir /*****************************************************************************/ 300*cdf0e10cSrcweir Connector* ObjectWin::GetConnector( sal_uIntPtr nIndex ) 301*cdf0e10cSrcweir /*****************************************************************************/ 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir sal_uIntPtr nConCount = mConnections.Count(); 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir if ( nIndex < nConCount ) 306*cdf0e10cSrcweir return mConnections.GetObject( nIndex ); 307*cdf0e10cSrcweir return NULL; 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir /*****************************************************************************/ 311*cdf0e10cSrcweir Connector* ObjectWin::GetConnector( sal_uIntPtr nStartId, sal_uIntPtr nEndId ) 312*cdf0e10cSrcweir /*****************************************************************************/ 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir if ( mnObjectId != nStartId ) 315*cdf0e10cSrcweir return NULL; 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir sal_uInt16 i; 318*cdf0e10cSrcweir Connector* pCon; 319*cdf0e10cSrcweir sal_uIntPtr nConCount = mConnections.Count(); 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir for ( i = 0; i < nConCount; i++ ) 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir pCon = mConnections.GetObject( i ); 324*cdf0e10cSrcweir if ( pCon->GetOtherWin( this )->GetId() == nEndId ) 325*cdf0e10cSrcweir return pCon; 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir return NULL; 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir void ObjectWin::SetAllConnectorsUnvisible() 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir Connector* pCon; 333*cdf0e10cSrcweir sal_uIntPtr nConCount = mConnections.Count(); 334*cdf0e10cSrcweir for ( sal_uIntPtr i = 0; i < nConCount; i++ ) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir pCon = mConnections.GetObject( i ); 337*cdf0e10cSrcweir if (pCon) pCon->SetVisibility( sal_False ); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir /*****************************************************************************/ 342*cdf0e10cSrcweir void ObjectWin::SetMarkMode( sal_uIntPtr nMarkMode ) 343*cdf0e10cSrcweir /*****************************************************************************/ 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir //Wallpaper aWallpaper; 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir if ( nMarkMode == MARKMODE_DEFAULT ) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir if ( pDefaultWallpaper ) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir maObjWallpaper = GetBackground(); 352*cdf0e10cSrcweir maObjWallpaper.SetColor( pDefaultWallpaper->GetColor() ); 353*cdf0e10cSrcweir SetBackground( maObjWallpaper ); 354*cdf0e10cSrcweir SetTextColor( aDefaultColor ); 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir else 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir mnMarkMode |= nMarkMode; 360*cdf0e10cSrcweir maObjWallpaper = GetBackground(); 361*cdf0e10cSrcweir maObjWallpaper.SetColor( aColorMap[ mnMarkMode ] ); 362*cdf0e10cSrcweir SetBackground( maObjWallpaper ); 363*cdf0e10cSrcweir SetTextColor( COL_WHITE ); 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir Invalidate(); 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir /*****************************************************************************/ 370*cdf0e10cSrcweir void ObjectWin::UnsetMarkMode( sal_uIntPtr nMarkMode ) 371*cdf0e10cSrcweir /*****************************************************************************/ 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir //Wallpaper aWallpaper; 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir sal_uIntPtr nOldMode = mnMarkMode; 376*cdf0e10cSrcweir mnMarkMode &= ( !nMarkMode ); 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir if ( nOldMode != mnMarkMode ) { 379*cdf0e10cSrcweir if ( mnMarkMode == MARKMODE_DEFAULT ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir if ( pDefaultWallpaper ) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir maObjWallpaper = GetBackground(); 384*cdf0e10cSrcweir maObjWallpaper.SetColor( pDefaultWallpaper->GetColor() ); 385*cdf0e10cSrcweir SetBackground( maObjWallpaper ); 386*cdf0e10cSrcweir SetTextColor( aDefaultColor ); 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir else 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir maObjWallpaper = GetBackground(); 392*cdf0e10cSrcweir maObjWallpaper.SetColor( aColorMap[ mnMarkMode ] ); //mnMarkMode 393*cdf0e10cSrcweir SetBackground( maObjWallpaper ); 394*cdf0e10cSrcweir SetTextColor( COL_WHITE ); 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir Invalidate(); 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir /*****************************************************************************/ 401*cdf0e10cSrcweir void ObjectWin::MarkNeeded( sal_Bool bReset ) 402*cdf0e10cSrcweir /*****************************************************************************/ 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir Connector* pCon; 405*cdf0e10cSrcweir ObjectWin* pWin; 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir sal_uIntPtr nConCount = mConnections.Count(); 408*cdf0e10cSrcweir sal_uIntPtr i; 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir for ( i = 0; i < nConCount; i++ ) 411*cdf0e10cSrcweir { 412*cdf0e10cSrcweir pCon = mConnections.GetObject( i ); 413*cdf0e10cSrcweir if ( pCon && !pCon->IsStart( this)) 414*cdf0e10cSrcweir { 415*cdf0e10cSrcweir pWin = pCon->GetOtherWin( this ); 416*cdf0e10cSrcweir if ( pWin ) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir if ( bReset ) 419*cdf0e10cSrcweir pWin->UnsetMarkMode( MARKMODE_NEEDED ); 420*cdf0e10cSrcweir else 421*cdf0e10cSrcweir pWin->SetMarkMode( MARKMODE_NEEDED ); 422*cdf0e10cSrcweir pWin->MarkNeeded( bReset ); // recursive call 423*cdf0e10cSrcweir } 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir /*****************************************************************************/ 429*cdf0e10cSrcweir void ObjectWin::MarkDepending( sal_Bool bReset ) 430*cdf0e10cSrcweir /*****************************************************************************/ 431*cdf0e10cSrcweir { 432*cdf0e10cSrcweir //if ( !bReset ) 433*cdf0e10cSrcweir // return; 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir Connector* pCon; 436*cdf0e10cSrcweir ObjectWin* pWin; 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir sal_uIntPtr nConCount = mConnections.Count(); 439*cdf0e10cSrcweir sal_uIntPtr i; 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir for ( i = 0; i < nConCount; i++ ) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir pCon = mConnections.GetObject( i ); 444*cdf0e10cSrcweir if ( pCon && pCon->IsStart( this) ) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir pWin = pCon->GetOtherWin( this ); 447*cdf0e10cSrcweir if ( pWin ) 448*cdf0e10cSrcweir { 449*cdf0e10cSrcweir if ( bReset ) 450*cdf0e10cSrcweir pWin->UnsetMarkMode( MARKMODE_DEPENDING ); 451*cdf0e10cSrcweir else 452*cdf0e10cSrcweir pWin->SetMarkMode( MARKMODE_DEPENDING ); 453*cdf0e10cSrcweir pWin->MarkDepending( bReset ); // recursive call 454*cdf0e10cSrcweir } 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir } 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir /*****************************************************************************/ 460*cdf0e10cSrcweir void ObjectWin::Paint( const Rectangle& rRect ) 461*cdf0e10cSrcweir /*****************************************************************************/ 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir Size aWinSize = PixelToLogic( GetOutputSizePixel() ); 464*cdf0e10cSrcweir Size aTextSize; 465*cdf0e10cSrcweir ByteString sbt = msBodyText; //debug 466*cdf0e10cSrcweir //sbt += " "; //debug 467*cdf0e10cSrcweir //sbt += ByteString::CreateFromInt32(mnMarkMode); //debug 468*cdf0e10cSrcweir aTextSize.Width() = GetTextWidth( String( msBodyText, RTL_TEXTENCODING_UTF8 )); 469*cdf0e10cSrcweir aTextSize.Height() = GetTextHeight(); 470*cdf0e10cSrcweir Point aPos( aWinSize.Width() / 2 - aTextSize.Width() / 2, 471*cdf0e10cSrcweir aWinSize.Height() / 2 - aTextSize.Height() / 2 ); 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir //DrawText( aPos , String( sBodyText, RTL_TEXTENCODING_UTF8 )); 474*cdf0e10cSrcweir if (msBodyText =="null") //don't paint this "window" 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir Hide(); 477*cdf0e10cSrcweir Invalidate(); 478*cdf0e10cSrcweir } else 479*cdf0e10cSrcweir DrawText( aPos , String( sbt, RTL_TEXTENCODING_UTF8 )); //debug 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir void ObjectWin::DrawOutput( OutputDevice* pDevice, const Point& rOffset ) 483*cdf0e10cSrcweir /*****************************************************************************/ 484*cdf0e10cSrcweir { 485*cdf0e10cSrcweir Size aWinSize = PixelToLogic( GetSizePixel() ); 486*cdf0e10cSrcweir Size aTextSize; 487*cdf0e10cSrcweir ByteString sbt = msBodyText; 488*cdf0e10cSrcweir aTextSize.Width() = GetTextWidth( String( msBodyText, RTL_TEXTENCODING_UTF8 )); 489*cdf0e10cSrcweir aTextSize.Height() = GetTextHeight(); 490*cdf0e10cSrcweir Point aPos = GetPosPixel(); 491*cdf0e10cSrcweir Point aTextPos( aWinSize.Width() / 2 - aTextSize.Width() / 2, 492*cdf0e10cSrcweir aWinSize.Height() / 2 - aTextSize.Height() / 2 ); 493*cdf0e10cSrcweir aTextPos += aPos; 494*cdf0e10cSrcweir aPos = pDevice->PixelToLogic( aPos ) - rOffset; 495*cdf0e10cSrcweir aTextPos = pDevice->PixelToLogic( aTextPos ) - rOffset; 496*cdf0e10cSrcweir if ( msBodyText !="null" ) 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir pDevice->SetFillColor( GetBackground().GetColor() ); 499*cdf0e10cSrcweir pDevice->DrawRect( Rectangle( aPos, pDevice->PixelToLogic( GetSizePixel() ) ) ); 500*cdf0e10cSrcweir Font aFont( GetFont() ); 501*cdf0e10cSrcweir Size aSize = aFont.GetSize(); 502*cdf0e10cSrcweir aSize = pDevice->PixelToLogic( aSize ); 503*cdf0e10cSrcweir aFont.SetSize( aSize ); 504*cdf0e10cSrcweir pDevice->SetFont( aFont ); 505*cdf0e10cSrcweir pDevice->SetTextColor( GetTextColor() ); 506*cdf0e10cSrcweir pDevice->DrawText( aTextPos, String( sbt, RTL_TEXTENCODING_UTF8 ) ); 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir /*****************************************************************************/ 511*cdf0e10cSrcweir void ObjectWin::MouseButtonDown( const MouseEvent& rMEvt ) 512*cdf0e10cSrcweir /*****************************************************************************/ 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir //Notify Soldep to clear ObjectList 515*cdf0e10cSrcweir SetZOrder( NULL, WINDOW_ZORDER_FIRST ); 516*cdf0e10cSrcweir GrabFocus(); 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir // workaround fuer vcl-bug 519*cdf0e10cSrcweir // GetWindow( WINDOW_REALPARENT)->Invalidate(); 520*cdf0e10cSrcweir // MyApp *pApp = (MyApp*)GetpApp(); 521*cdf0e10cSrcweir // SolDep *pSoldep = pApp->GetSolDep(); 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir maMouseOffset = rMEvt.GetPosPixel(); 524*cdf0e10cSrcweir if ( rMEvt.IsLeft() ) 525*cdf0e10cSrcweir { 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir if ( rMEvt.IsMod2() ) // alt + mouse click left 528*cdf0e10cSrcweir { 529*cdf0e10cSrcweir CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN_ALT, this ); 530*cdf0e10cSrcweir } 531*cdf0e10cSrcweir else { 532*cdf0e10cSrcweir CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN, this ); 533*cdf0e10cSrcweir } 534*cdf0e10cSrcweir if( rMEvt.GetClicks() == 2 ) 535*cdf0e10cSrcweir CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_DOWN_DBLCLICK, this ); 536*cdf0e10cSrcweir else if ( !rMEvt.IsShift() && !((DepWin*)GetParent())->IsStartNewCon()) 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir //((DepWin*)GetParent())->SaveSelectedObjWin(&this); 539*cdf0e10cSrcweir CaptureMouse(); 540*cdf0e10cSrcweir } 541*cdf0e10cSrcweir } 542*cdf0e10cSrcweir } 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir /*****************************************************************************/ 545*cdf0e10cSrcweir void ObjectWin::MouseButtonUp( const MouseEvent& rMEvt ) 546*cdf0e10cSrcweir /*****************************************************************************/ 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir fprintf(stdout,"ObjectWin::MouseButtonUp\n"); 549*cdf0e10cSrcweir if ( rMEvt.IsLeft() ) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir if ( rMEvt.IsShift() || ((DepWin*)GetParent())->IsStartNewCon()) 552*cdf0e10cSrcweir CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_UP_SHFT, this ); 553*cdf0e10cSrcweir // ((DepWin*)GetParent())->NewConnector( this ); 554*cdf0e10cSrcweir else 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir CallEventListeners( VCLEVENT_USER_MOUSEBUTTON_UP, this ); 557*cdf0e10cSrcweir if ( IsMouseCaptured() ) ReleaseMouse(); 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir else if ( rMEvt.IsRight() ) 561*cdf0e10cSrcweir { 562*cdf0e10cSrcweir sal_uInt16 i; 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir while ( mnPopupStaticItems < mpPopup->GetItemCount() ) 565*cdf0e10cSrcweir { 566*cdf0e10cSrcweir mpPopup->RemoveItem( mnPopupStaticItems ); 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir if ( mConnections.Count()) { 570*cdf0e10cSrcweir mpPopup->InsertSeparator(); 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir for( i = 0; i < mConnections.Count() ; i++ ) 573*cdf0e10cSrcweir { 574*cdf0e10cSrcweir mpPopup->InsertItem( mnPopupStaticItems + i + 1, String( ((mConnections.GetObject( i ))->GetOtherWin( this ))->GetBodyText(), RTL_TEXTENCODING_UTF8 )); 575*cdf0e10cSrcweir } 576*cdf0e10cSrcweir } 577*cdf0e10cSrcweir mbMenuExecute = sal_True; 578*cdf0e10cSrcweir mpPopup->Execute( GetParent(), rMEvt.GetPosPixel() + GetPosPixel()); 579*cdf0e10cSrcweir } 580*cdf0e10cSrcweir } 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir /*****************************************************************************/ 583*cdf0e10cSrcweir void ObjectWin::MouseMove( const MouseEvent& rMEvt ) 584*cdf0e10cSrcweir /*****************************************************************************/ 585*cdf0e10cSrcweir { 586*cdf0e10cSrcweir if ( IsMouseCaptured() ) 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir sal_uInt16 i; 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir Point aNewWinPos( GetPosPixel() + rMEvt.GetPosPixel() - maMouseOffset ); 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir aNewWinPos.X() = Max( 0L, aNewWinPos.X()); 593*cdf0e10cSrcweir aNewWinPos.Y() = Max( 0L, aNewWinPos.Y()); 594*cdf0e10cSrcweir SetPosPixel( aNewWinPos ); 595*cdf0e10cSrcweir //int t = mConnections.Count(); 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir for ( i=0; i < mConnections.Count();i++) 598*cdf0e10cSrcweir { 599*cdf0e10cSrcweir mConnections.GetObject( i )->UpdatePosition( this ); 600*cdf0e10cSrcweir } 601*cdf0e10cSrcweir } 602*cdf0e10cSrcweir else // !IsMouseCaptured() 603*cdf0e10cSrcweir { 604*cdf0e10cSrcweir if ( rMEvt.IsLeaveWindow() ) 605*cdf0e10cSrcweir aTipTimer.Stop(); 606*cdf0e10cSrcweir else 607*cdf0e10cSrcweir aTipTimer.Start(); 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir MouseEvent aNewMEvt( rMEvt.GetPosPixel() + GetPosPixel()); 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir GetParent()->MouseMove( aNewMEvt ); //call to DepWin::MouseMove 612*cdf0e10cSrcweir } 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir /*****************************************************************************/ 616*cdf0e10cSrcweir sal_uInt16 ObjectWin::Save( SvFileStream& rOutFile ) 617*cdf0e10cSrcweir /*****************************************************************************/ 618*cdf0e10cSrcweir { 619*cdf0e10cSrcweir return 0; 620*cdf0e10cSrcweir } 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir /*****************************************************************************/ 623*cdf0e10cSrcweir sal_uInt16 ObjectWin::Load( SvFileStream& rInFile ) 624*cdf0e10cSrcweir /*****************************************************************************/ 625*cdf0e10cSrcweir { 626*cdf0e10cSrcweir return 0; 627*cdf0e10cSrcweir } 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir /*****************************************************************************/ 630*cdf0e10cSrcweir void ObjectWin::SetId( sal_uIntPtr nId ) 631*cdf0e10cSrcweir /*****************************************************************************/ 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir mnObjectId = nId; 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir /*****************************************************************************/ 637*cdf0e10cSrcweir sal_uIntPtr ObjectWin::GetId() 638*cdf0e10cSrcweir /*****************************************************************************/ 639*cdf0e10cSrcweir { 640*cdf0e10cSrcweir return mnObjectId; 641*cdf0e10cSrcweir } 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir /*****************************************************************************/ 644*cdf0e10cSrcweir void ObjectWin::UpdateConnectors() 645*cdf0e10cSrcweir /*****************************************************************************/ 646*cdf0e10cSrcweir { 647*cdf0e10cSrcweir sal_uInt16 i; 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir for ( i = 0; i < mConnections.Count(); i++ ) 650*cdf0e10cSrcweir { 651*cdf0e10cSrcweir mConnections.GetObject( i )->UpdatePosition( this ); 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir IMPL_LINK( ObjectWin, PopupSelected, PopupMenu*, mpPopup_l ) 656*cdf0e10cSrcweir { 657*cdf0e10cSrcweir sal_uInt16 nItemId = mpPopup_l->GetCurItemId(); 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir switch( nItemId ) 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir case OBJWIN_EDIT_TEXT : 662*cdf0e10cSrcweir DBG_ASSERT( sal_False,"edit"); 663*cdf0e10cSrcweir break; 664*cdf0e10cSrcweir case OBJWIN_REMOVE_WIN : 665*cdf0e10cSrcweir // DBG_ASSERT( FALSE,"remove"); 666*cdf0e10cSrcweir // DBG_ASSERT( mpDepperDontuseme,"remove"); 667*cdf0e10cSrcweir //mpDepperDontuseme->RemoveObject(mpDepperDontuseme->mpObjectList, ( sal_uInt16 ) GetId()); 668*cdf0e10cSrcweir break; 669*cdf0e10cSrcweir case OBJWIN_ADD_CONNECTOR : 670*cdf0e10cSrcweir // DBG_ASSERT( FALSE,"add con"); 671*cdf0e10cSrcweir ((DepWin*)GetParent())->NewConnector( this ); 672*cdf0e10cSrcweir break; 673*cdf0e10cSrcweir case OBJWIN_VIEW_CONTENT : 674*cdf0e10cSrcweir // DBG_ASSERT( FALSE,"view cnt"); 675*cdf0e10cSrcweir // mpDepperDontuseme->ViewContent( msBodyText ); 676*cdf0e10cSrcweir // TBD: CallEventListener 677*cdf0e10cSrcweir break; 678*cdf0e10cSrcweir default : 679*cdf0e10cSrcweir // DBG_ASSERT( sal_False, String (nItemId) ); 680*cdf0e10cSrcweir Connector* pCon = mConnections.GetObject( nItemId - mnPopupStaticItems - 1); 681*cdf0e10cSrcweir pCon = 0; 682*cdf0e10cSrcweir // delete pCon; 683*cdf0e10cSrcweir // mpDepperDontuseme->RemoveConnector( pCon->GetStartId(), pCon->GetEndId()); 684*cdf0e10cSrcweir // TBD: CallEventListener 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir break; 687*cdf0e10cSrcweir } 688*cdf0e10cSrcweir return 0; 689*cdf0e10cSrcweir } 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir /*****************************************************************************/ 692*cdf0e10cSrcweir IMPL_LINK( ObjectWin, TipHdl, void *, EMTY_ARG ) 693*cdf0e10cSrcweir /*****************************************************************************/ 694*cdf0e10cSrcweir { 695*cdf0e10cSrcweir aTipTimer.Stop(); 696*cdf0e10cSrcweir 697*cdf0e10cSrcweir if ( msTipText.Len()) { 698*cdf0e10cSrcweir Point aPos( GetpApp()->GetAppWindow()->GetPointerPosPixel()); 699*cdf0e10cSrcweir Help::ShowBalloon( GetpApp()->GetAppWindow(), 700*cdf0e10cSrcweir Point( aPos.X(), aPos.Y()), 701*cdf0e10cSrcweir String( msTipText, RTL_TEXTENCODING_UTF8 )); 702*cdf0e10cSrcweir } 703*cdf0e10cSrcweir return 0; 704*cdf0e10cSrcweir } 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir /*****************************************************************************/ 707*cdf0e10cSrcweir //void ObjectWin::GetFocus() 708*cdf0e10cSrcweir /*****************************************************************************/ 709*cdf0e10cSrcweir //{ 710*cdf0e10cSrcweir //SetMarkMode( MARKMODE_SELECTED ); 711*cdf0e10cSrcweir //} 712*cdf0e10cSrcweir 713*cdf0e10cSrcweir /*****************************************************************************/ 714*cdf0e10cSrcweir void ObjectWin::LoseFocus() 715*cdf0e10cSrcweir /*****************************************************************************/ 716*cdf0e10cSrcweir { 717*cdf0e10cSrcweir if ( !mbMenuExecute && !msbHideMode ) { 718*cdf0e10cSrcweir UnsetMarkMode( MARKMODE_SELECTED ); 719*cdf0e10cSrcweir UnsetMarkMode( MARKMODE_ACTIVATED ); 720*cdf0e10cSrcweir MarkNeeded( sal_True ); 721*cdf0e10cSrcweir MarkDepending( sal_True ); 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir else 724*cdf0e10cSrcweir mbMenuExecute = sal_False; 725*cdf0e10cSrcweir } 726*cdf0e10cSrcweir 727*cdf0e10cSrcweir /*****************************************************************************/ 728*cdf0e10cSrcweir IMPL_LINK( ObjectWin, PopupDeactivated, PopupMenu*, mpPopup_l ) 729*cdf0e10cSrcweir /*****************************************************************************/ 730*cdf0e10cSrcweir { 731*cdf0e10cSrcweir mbMenuExecute = sal_False; 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir if ( !HasFocus()) { 734*cdf0e10cSrcweir UnsetMarkMode( MARKMODE_SELECTED ); 735*cdf0e10cSrcweir UnsetMarkMode( MARKMODE_ACTIVATED ); 736*cdf0e10cSrcweir MarkNeeded( sal_True ); 737*cdf0e10cSrcweir MarkDepending( sal_True ); 738*cdf0e10cSrcweir } 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir return 0; 741*cdf0e10cSrcweir } 742*cdf0e10cSrcweir 743*cdf0e10cSrcweir /*****************************************************************************/ 744*cdf0e10cSrcweir void ObjectWin::Command( const CommandEvent& rEvent) 745*cdf0e10cSrcweir /*****************************************************************************/ 746*cdf0e10cSrcweir { 747*cdf0e10cSrcweir fprintf(stdout, "ObjectWin::Command"); 748*cdf0e10cSrcweir // mpDepperDontuseme->GetGraphWin()->Command( rEvent ); 749*cdf0e10cSrcweir // TBD: CallEventListener 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir } 752*cdf0e10cSrcweir 753*cdf0e10cSrcweir /*****************************************************************************/ 754*cdf0e10cSrcweir /*****************************************************************************/ 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir ObjectList::ObjectList() : ObjWinList() 757*cdf0e10cSrcweir { 758*cdf0e10cSrcweir } 759*cdf0e10cSrcweir 760*cdf0e10cSrcweir /*****************************************************************************/ 761*cdf0e10cSrcweir void ObjectList::ResetSelectedObject() 762*cdf0e10cSrcweir /*****************************************************************************/ 763*cdf0e10cSrcweir { 764*cdf0e10cSrcweir // return; 765*cdf0e10cSrcweir 766*cdf0e10cSrcweir sal_uIntPtr nCount_l = Count(); 767*cdf0e10cSrcweir ObjectWin* pObjectWin = NULL; 768*cdf0e10cSrcweir for (sal_uIntPtr i=0; i < nCount_l; i++ ) 769*cdf0e10cSrcweir { 770*cdf0e10cSrcweir pObjectWin = GetObject( i ); 771*cdf0e10cSrcweir pObjectWin->UnsetMarkMode( MARKMODE_SELECTED ); 772*cdf0e10cSrcweir pObjectWin->UnsetMarkMode( MARKMODE_NEEDED ); 773*cdf0e10cSrcweir pObjectWin->UnsetMarkMode( MARKMODE_DEPENDING ); 774*cdf0e10cSrcweir pObjectWin->SetActualWallpaper(*pDefaultWallpaper); 775*cdf0e10cSrcweir pObjectWin->SetAllConnectorsUnvisible(); 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir return; 778*cdf0e10cSrcweir } 779*cdf0e10cSrcweir 780*cdf0e10cSrcweir /*****************************************************************************/ 781*cdf0e10cSrcweir ObjectWin* ObjectList::GetPtrByName( const ByteString& rText ) 782*cdf0e10cSrcweir /*****************************************************************************/ 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir sal_uIntPtr i = 0; 785*cdf0e10cSrcweir sal_uIntPtr nCount_l = Count(); 786*cdf0e10cSrcweir ObjectWin* pObjectWin = NULL; 787*cdf0e10cSrcweir while ( i < nCount_l ) 788*cdf0e10cSrcweir { 789*cdf0e10cSrcweir pObjectWin = GetObject( i ); 790*cdf0e10cSrcweir ByteString sPrj = pObjectWin->GetBodyText(); 791*cdf0e10cSrcweir if (sPrj == rText) return pObjectWin; 792*cdf0e10cSrcweir i++; 793*cdf0e10cSrcweir } 794*cdf0e10cSrcweir return 0; 795*cdf0e10cSrcweir } 796*cdf0e10cSrcweir 797*cdf0e10cSrcweir ObjectList* ObjectList::FindTopLevelModules() 798*cdf0e10cSrcweir { 799*cdf0e10cSrcweir ObjectList* pList = new ObjectList; 800*cdf0e10cSrcweir for ( sal_uInt16 i=0; i<Count(); i++ ) 801*cdf0e10cSrcweir { 802*cdf0e10cSrcweir ObjectWin* pObjectWin = GetObject( i ); 803*cdf0e10cSrcweir if ( pObjectWin->IsTop() ) 804*cdf0e10cSrcweir pList->Insert( pObjectWin ); 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir return pList; 808*cdf0e10cSrcweir } 809*cdf0e10cSrcweir 810*cdf0e10cSrcweir sal_Bool ObjectWin::IsTop() 811*cdf0e10cSrcweir { 812*cdf0e10cSrcweir sal_uIntPtr nConCount = mConnections.Count(); 813*cdf0e10cSrcweir for ( sal_uIntPtr i = 0; i < nConCount; i++ ) 814*cdf0e10cSrcweir { 815*cdf0e10cSrcweir Connector* pCon = mConnections.GetObject( i ); 816*cdf0e10cSrcweir if ( pCon && pCon->IsStart( this) ) 817*cdf0e10cSrcweir return sal_False; 818*cdf0e10cSrcweir } 819*cdf0e10cSrcweir 820*cdf0e10cSrcweir return sal_True; 821*cdf0e10cSrcweir } 822