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