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 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_svtools.hxx" 30 31 #include <svtools/svlbox.hxx> 32 #include <svtools/svicnvw.hxx> 33 #include <svimpicn.hxx> 34 #include <svtools/svlbitm.hxx> 35 36 #ifndef GCC 37 #endif 38 39 #define ICNVW_BLOCK_ENTRYINS 0x0001 40 41 SvIcnVwDataEntry::SvIcnVwDataEntry() 42 : nIcnVwFlags(0),eTextMode(ShowTextDontKnow) 43 { 44 } 45 46 SvIcnVwDataEntry::~SvIcnVwDataEntry() 47 { 48 } 49 50 SvIconView::SvIconView( Window* pParent, WinBits nWinStyle ) : 51 SvLBox( pParent, nWinStyle | WB_BORDER ) 52 { 53 nIcnVwFlags = 0; 54 pImp = new SvImpIconView( this, GetModel(), nWinStyle | WB_ICON ); 55 pImp->mpViewData = 0; 56 SetSelectionMode( SINGLE_SELECTION ); 57 SetLineColor(); 58 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 59 SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) ); 60 SetDefaultFont(); 61 } 62 63 SvIconView::SvIconView( Window* pParent , const ResId& rResId ) : 64 SvLBox( pParent, rResId ) 65 { 66 pImp = new SvImpIconView( this, GetModel(), WB_BORDER | WB_ICON ); 67 nIcnVwFlags = 0; 68 pImp->mpViewData = 0; 69 SetLineColor(); 70 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 71 SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) ); 72 SetDefaultFont(); 73 pImp->SetSelectionMode( GetSelectionMode() ); 74 } 75 76 SvIconView::~SvIconView() 77 { 78 delete pImp; 79 } 80 81 void SvIconView::SetDefaultFont() 82 { 83 SetFont( GetFont() ); 84 } 85 86 SvLBoxEntry* SvIconView::CreateEntry( const XubString& rStr, 87 const Image& rCollEntryBmp, const Image& rExpEntryBmp ) 88 { 89 SvLBoxEntry* pEntry = new SvLBoxEntry; 90 91 SvLBoxContextBmp* pContextBmp = 92 new SvLBoxContextBmp( pEntry,0, rCollEntryBmp,rExpEntryBmp, 0xffff ); 93 pEntry->AddItem( pContextBmp ); 94 95 SvLBoxString* pString = new SvLBoxString( pEntry, 0, rStr ); 96 pEntry->AddItem( pString ); 97 98 return pEntry; 99 } 100 101 void SvIconView::DisconnectFromModel() 102 { 103 SvLBox::DisconnectFromModel(); 104 pImp->SetModel( GetModel(), 0 ); 105 } 106 107 108 SvLBoxEntry* SvIconView::InsertEntry( const XubString& rText, 109 SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uLong nPos ) 110 { 111 SvLBoxEntry* pEntry = CreateEntry( 112 rText, aCollapsedEntryBmp, aExpandedEntryBmp ); 113 pEntry->EnableChildsOnDemand( bChildsOnDemand ); 114 115 if ( !pParent ) 116 SvLBox::Insert( pEntry, nPos ); 117 else 118 SvLBox::Insert( pEntry, pParent, nPos ); 119 return pEntry; 120 } 121 122 SvLBoxEntry* SvIconView::InsertEntry( const XubString& rText, 123 const Image& rExpEntryBmp, 124 const Image& rCollEntryBmp, 125 SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uLong nPos) 126 { 127 SvLBoxEntry* pEntry = CreateEntry( 128 rText, rCollEntryBmp, rExpEntryBmp ); 129 130 pEntry->EnableChildsOnDemand( bChildsOnDemand ); 131 if ( !pParent ) 132 SvLBox::Insert( pEntry, nPos ); 133 else 134 SvLBox::Insert( pEntry, pParent, nPos ); 135 return pEntry; 136 } 137 138 139 void SvIconView::SetEntryText(SvLBoxEntry* pEntry, const XubString& rStr) 140 { 141 SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); 142 if ( pItem ) 143 { 144 pItem->SetText( pEntry, rStr ); 145 GetModel()->InvalidateEntry( pEntry ); 146 } 147 } 148 149 void SvIconView::SetExpandedEntryBmp(SvLBoxEntry* pEntry, const Image& rBmp) 150 { 151 SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); 152 if ( pItem ) 153 { 154 pItem->SetBitmap2( rBmp ); 155 GetModel()->InvalidateEntry( pEntry ); 156 } 157 } 158 159 void SvIconView::SetCollapsedEntryBmp(SvLBoxEntry* pEntry, 160 const Image& rBmp ) 161 { 162 SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); 163 if ( pItem ) 164 { 165 pItem->SetBitmap1( rBmp ); 166 GetModel()->InvalidateEntry( pEntry ); 167 } 168 } 169 170 XubString SvIconView::GetEntryText(SvLBoxEntry* pEntry ) const 171 { 172 XubString aStr; 173 SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); 174 if ( pItem ) 175 aStr = pItem->GetText(); 176 return aStr; 177 } 178 179 Image SvIconView::GetExpandedEntryBmp(SvLBoxEntry* pEntry) const 180 { 181 Image aBmp; 182 SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); 183 if ( pItem ) 184 aBmp = pItem->GetBitmap2(); 185 return aBmp; 186 } 187 188 Image SvIconView::GetCollapsedEntryBmp(SvLBoxEntry* pEntry) const 189 { 190 Image aBmp; 191 SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); 192 if ( pItem ) 193 aBmp = pItem->GetBitmap1(); 194 return aBmp; 195 } 196 197 198 SvLBoxEntry* SvIconView::CloneEntry( SvLBoxEntry* pSource ) 199 { 200 XubString aStr; 201 Image aCollEntryBmp; 202 Image aExpEntryBmp; 203 204 SvLBoxString* pStringItem = (SvLBoxString*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); 205 if ( pStringItem ) 206 aStr = pStringItem->GetText(); 207 SvLBoxContextBmp* pBmpItem =(SvLBoxContextBmp*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); 208 if ( pBmpItem ) 209 { 210 aCollEntryBmp = pBmpItem->GetBitmap1(); 211 aExpEntryBmp = pBmpItem->GetBitmap2(); 212 } 213 SvLBoxEntry* pEntry = CreateEntry( aStr, aCollEntryBmp, aExpEntryBmp ); 214 pEntry->SvListEntry::Clone( pSource ); 215 pEntry->EnableChildsOnDemand( pSource->HasChildsOnDemand() ); 216 pEntry->SetUserData( pSource->GetUserData() ); 217 return pEntry; 218 } 219 220 221 sal_uInt16 SvIconView::IsA() 222 { 223 return SV_LISTBOX_ID_ICONVIEW; 224 } 225 226 void SvIconView::RequestingChilds( SvLBoxEntry* pParent ) 227 { 228 if ( !pParent->HasChilds() ) 229 InsertEntry( String::CreateFromAscii("<dummy>"), pParent, sal_False, LIST_APPEND ); 230 } 231 232 void __EXPORT SvIconView::Paint( const Rectangle& rRect ) 233 { 234 pImp->Paint( rRect ); 235 } 236 237 void __EXPORT SvIconView::MouseButtonDown( const MouseEvent& rMEvt ) 238 { 239 pImp->MouseButtonDown( rMEvt ); 240 } 241 242 void __EXPORT SvIconView::MouseButtonUp( const MouseEvent& rMEvt ) 243 { 244 pImp->MouseButtonUp( rMEvt ); 245 } 246 247 void __EXPORT SvIconView::MouseMove( const MouseEvent& rMEvt ) 248 { 249 pImp->MouseMove( rMEvt ); 250 } 251 252 void __EXPORT SvIconView::KeyInput( const KeyEvent& rKEvt ) 253 { 254 // unter OS/2 bekommen wir auch beim Editieren Key-Up/Down 255 if( IsEditingActive() ) 256 return; 257 258 nImpFlags |= SVLBOX_IS_TRAVELSELECT; 259 sal_Bool bKeyUsed = pImp->KeyInput( rKEvt ); 260 if ( !bKeyUsed ) 261 SvLBox::KeyInput( rKEvt ); 262 nImpFlags &= ~SVLBOX_IS_TRAVELSELECT; 263 } 264 265 void __EXPORT SvIconView::Resize() 266 { 267 pImp->Resize(); 268 SvLBox::Resize(); 269 } 270 271 void __EXPORT SvIconView::GetFocus() 272 { 273 pImp->GetFocus(); 274 SvLBox::GetFocus(); 275 } 276 277 void __EXPORT SvIconView::LoseFocus() 278 { 279 pImp->LoseFocus(); 280 SvLBox::LoseFocus(); 281 } 282 283 void SvIconView::SetUpdateMode( sal_Bool bUpdate ) 284 { 285 Control::SetUpdateMode( bUpdate ); 286 if ( bUpdate ) 287 pImp->UpdateAll(); 288 } 289 290 void SvIconView::SetModel( SvLBoxTreeList* ) 291 { 292 } 293 294 void SvIconView::SetModel( SvLBoxTreeList* pNewModel, SvLBoxEntry* pParent ) 295 { 296 nIcnVwFlags |= ICNVW_BLOCK_ENTRYINS; 297 SvLBox::SetModel( pNewModel ); 298 nIcnVwFlags &= (~ICNVW_BLOCK_ENTRYINS); 299 if ( pParent && pParent->HasChildsOnDemand() ) 300 RequestingChilds( pParent ); 301 pImp->SetModel( pNewModel, pParent ); 302 } 303 304 void __EXPORT SvIconView::ModelHasCleared() 305 { 306 SvLBox::ModelHasCleared(); 307 pImp->Clear(); 308 } 309 310 void __EXPORT SvIconView::ModelHasInserted( SvListEntry* pEntry ) 311 { 312 if( !(nIcnVwFlags & ICNVW_BLOCK_ENTRYINS ) ) 313 pImp->EntryInserted( (SvLBoxEntry*)pEntry ); 314 } 315 316 void __EXPORT SvIconView::ModelHasInsertedTree( SvListEntry* pEntry ) 317 { 318 pImp->TreeInserted( (SvLBoxEntry*)pEntry ); 319 } 320 321 void __EXPORT SvIconView::ModelIsMoving(SvListEntry* pSource, 322 SvListEntry* /* pTargetParent */ , sal_uLong /* nChildPos */ ) 323 { 324 pImp->MovingEntry( (SvLBoxEntry*)pSource ); 325 } 326 327 void __EXPORT SvIconView::ModelHasMoved(SvListEntry* pSource ) 328 { 329 pImp->EntryMoved( (SvLBoxEntry*)pSource ); 330 } 331 332 void __EXPORT SvIconView::ModelIsRemoving( SvListEntry* pEntry ) 333 { 334 pImp->RemovingEntry( (SvLBoxEntry*)pEntry ); 335 NotifyRemoving( (SvLBoxEntry*)pEntry ); 336 } 337 338 void __EXPORT SvIconView::ModelHasRemoved( SvListEntry* /* pEntry */ ) 339 { 340 pImp->EntryRemoved(); 341 } 342 343 void __EXPORT SvIconView::ModelHasEntryInvalidated( SvListEntry* pEntry ) 344 { 345 // die einzelnen Items des Entries reinitialisieren 346 SvLBox::ModelHasEntryInvalidated( pEntry ); 347 // painten 348 pImp->ModelHasEntryInvalidated( pEntry ); 349 } 350 351 void SvIconView::ShowTargetEmphasis( SvLBoxEntry* pEntry, sal_Bool bShow ) 352 { 353 pImp->ShowTargetEmphasis( pEntry, bShow ); 354 } 355 356 Point SvIconView::GetEntryPosition( SvLBoxEntry* pEntry ) const 357 { 358 return ((SvIconView*)this)->pImp->GetEntryPosition( pEntry ); 359 } 360 361 void SvIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos) 362 { 363 pImp->SetEntryPosition( pEntry, rPos, sal_False, sal_True ); 364 } 365 366 void SvIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos, sal_Bool bAdjustAtGrid ) 367 { 368 pImp->SetEntryPosition( pEntry, rPos, bAdjustAtGrid ); 369 } 370 371 void SvIconView::SetFont( const Font& rFont ) 372 { 373 Font aTempFont( rFont ); 374 aTempFont.SetTransparent( sal_True ); 375 SvLBox::SetFont( aTempFont ); 376 RecalcViewData(); 377 pImp->ChangedFont(); 378 } 379 380 void SvIconView::ViewDataInitialized( SvLBoxEntry* pEntry ) 381 { 382 pImp->ViewDataInitialized( pEntry ); 383 } 384 385 SvLBoxEntry* SvIconView::GetDropTarget( const Point& rPos ) 386 { 387 return pImp->GetDropTarget( rPos ); 388 } 389 390 SvLBoxEntry* SvIconView::GetEntry( const Point& rPixPos, sal_Bool ) const 391 { 392 Point aPos( rPixPos ); 393 aPos -= GetMapMode().GetOrigin(); 394 return ((SvIconView*)this)->pImp->GetEntry( aPos ); 395 } 396 397 SvLBoxEntry* SvIconView::GetEntryFromLogicPos( const Point& rDocPos ) const 398 { 399 return ((SvIconView*)this)->pImp->GetEntry( rDocPos ); 400 } 401 402 403 void SvIconView::StateChanged( StateChangedType i_nStateChange ) 404 { 405 SvLBox::StateChanged( i_nStateChange ); 406 if ( i_nStateChange == STATE_CHANGE_STYLE ) 407 pImp->SetStyle( GetStyle() ); 408 } 409 410 void SvIconView::PaintEntry( SvLBoxEntry* pEntry ) 411 { 412 pImp->PaintEntry( pEntry ); 413 } 414 415 416 void SvIconView::PaintEntry( SvLBoxEntry* pEntry, const Point& rPos ) 417 { 418 pImp->PaintEntry( pEntry, rPos ); 419 } 420 421 Rectangle SvIconView::GetFocusRect( SvLBoxEntry* pEntry ) 422 { 423 return pImp->CalcFocusRect( pEntry ); 424 } 425 426 void SvIconView::InvalidateEntry( SvLBoxEntry* pEntry ) 427 { 428 pImp->InvalidateEntry( pEntry ); 429 } 430 431 void SvIconView::SetDragDropMode( DragDropMode nDDMode ) 432 { 433 SvLBox::SetDragDropMode( nDDMode ); 434 pImp->SetDragDropMode( nDDMode ); 435 } 436 437 void SvIconView::SetSelectionMode( SelectionMode eSelectMode ) 438 { 439 SvLBox::SetSelectionMode( eSelectMode ); 440 pImp->SetSelectionMode( eSelectMode ); 441 } 442 443 sal_Bool SvIconView::Select( SvLBoxEntry* pEntry, sal_Bool bSelect ) 444 { 445 EndEditing(); 446 sal_Bool bRetVal = SvListView::Select( pEntry, bSelect ); 447 if( bRetVal ) 448 { 449 pImp->EntrySelected( pEntry, bSelect ); 450 pHdlEntry = pEntry; 451 SelectHdl(); 452 } 453 return bRetVal; 454 } 455 456 void SvIconView::SelectAll( sal_Bool bSelect, sal_Bool ) 457 { 458 SvLBoxEntry* pEntry = pImp->GetCurParent(); 459 pEntry = FirstChild( pEntry ); 460 while( pEntry ) 461 { 462 Select( pEntry, bSelect ); 463 pEntry = NextSibling( pEntry ); 464 } 465 } 466 467 void SvIconView::SetCurEntry( SvLBoxEntry* _pEntry ) 468 { 469 pImp->SetCursor( _pEntry ); 470 OnCurrentEntryChanged(); 471 } 472 473 SvLBoxEntry* SvIconView::GetCurEntry() const 474 { 475 return pImp->GetCurEntry(); 476 } 477 478 void SvIconView::Arrange() 479 { 480 #ifdef DBG_UTIL 481 sal_uInt16 n=1; 482 if( n == 1 && n-1 == 0 ) 483 { 484 pImp->Arrange(); 485 } 486 else 487 { 488 pImp->AdjustAtGrid(); 489 } 490 #else 491 pImp->Arrange(); 492 #endif 493 } 494 495 496 void SvIconView::SetSpaceBetweenEntries( long nX, long nY ) 497 { 498 pImp->SetSpaceBetweenEntries( nX, nY ); 499 } 500 501 sal_Bool SvIconView::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, 502 SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) 503 { 504 return pImp->NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos); 505 } 506 507 sal_Bool SvIconView::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, 508 SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) 509 { 510 return pImp->NotifyCopying(pTarget,pEntry,rpNewParent,rNewChildPos); 511 } 512 513 514 void SvIconView::EnableInplaceEditing( sal_Bool bEnable ) 515 { 516 SvLBox::EnableInplaceEditing( bEnable ); 517 } 518 519 void SvIconView::EditingRequest( SvLBoxEntry* pEntry, SvLBoxItem* pItem, 520 const Point& ) 521 { 522 if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING ) 523 { 524 Selection aSel( SELECTION_MIN, SELECTION_MAX ); 525 if ( EditingEntry( pEntry, aSel ) ) 526 { 527 SelectAll( sal_False ); 528 EditItemText( pEntry, (SvLBoxString*)pItem, aSel ); 529 } 530 } 531 } 532 533 534 void SvIconView::EditItemText( SvLBoxEntry* pEntry, SvLBoxItem* pItem, 535 const Selection& rSel ) 536 { 537 DBG_ASSERT(pEntry&&pItem,"EditItemText:Params?"); 538 pCurEdEntry = pEntry; 539 pCurEdItem = pItem; 540 Rectangle aRect( pImp->CalcTextRect( pEntry, (SvLBoxString*)pItem,0,sal_True )); 541 542 aRect.Bottom() += 4; 543 pImp->MakeVisible( aRect ); // vor der Umrechnung in Pixel-Koord. rufen! 544 aRect.Bottom() -= 4; 545 546 Point aPos( aRect.TopLeft() ); 547 aPos += GetMapMode().GetOrigin(); // Dok-Koord. -> Window-Koord. 548 aRect.SetPos( aPos ); 549 550 aRect.Bottom() += 2; // sieht huebscher aus 551 552 #ifdef OS2 553 554 #if OS2_SINGLE_LINE_EDIT 555 aRect.Left() -= 3; 556 aRect.Right() += 3; 557 aRect.Top() -= 3; 558 aRect.Bottom() += 3; 559 #else 560 aRect.Left() -= 10; 561 aRect.Right() += 10; 562 aRect.Top() -= 5; 563 aRect.Bottom() += 5; 564 #endif 565 566 #endif // OS2 567 EditText( ((SvLBoxString*)pItem)->GetText(), aRect, rSel, sal_True ); 568 } 569 570 void SvIconView::EditEntry( SvLBoxEntry* pEntry ) 571 { 572 if( !pEntry ) 573 pEntry = pImp->GetCurEntry(); 574 if( pEntry ) 575 { 576 SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); 577 if( pItem ) 578 { 579 Selection aSel( SELECTION_MIN, SELECTION_MAX ); 580 if( EditingEntry( pEntry, aSel ) ) 581 { 582 SelectAll( sal_False ); 583 EditItemText( pEntry, pItem, aSel ); 584 } 585 } 586 } 587 } 588 589 void SvIconView::EditedText( const XubString& rStr ) 590 { 591 XubString aRefStr( ((SvLBoxString*)pCurEdItem)->GetText() ); 592 if ( EditedEntry( pCurEdEntry, rStr ) ) 593 { 594 ((SvLBoxString*)pCurEdItem)->SetText( pCurEdEntry, rStr ); 595 pModel->InvalidateEntry( pCurEdEntry ); 596 } 597 if( GetSelectionMode()==SINGLE_SELECTION && !GetSelectionCount()) 598 Select( pCurEdEntry ); 599 } 600 601 602 sal_Bool SvIconView::EditingEntry( SvLBoxEntry*, Selection& ) 603 { 604 return sal_True; 605 } 606 607 sal_Bool SvIconView::EditedEntry( SvLBoxEntry*, const XubString& ) 608 { 609 return sal_True; 610 } 611 612 613 void SvIconView::WriteDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo) 614 { 615 pImp->WriteDragServerInfo( rPos, pInfo ); 616 } 617 618 void SvIconView::ReadDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo ) 619 { 620 pImp->ReadDragServerInfo( rPos, pInfo ); 621 } 622 623 void SvIconView::Command( const CommandEvent& rCEvt ) 624 { 625 pImp->PrepareCommandEvent( rCEvt.GetMousePosPixel() ); 626 } 627 628 void SvIconView::SetCurParent( SvLBoxEntry* pNewParent ) 629 { 630 if ( pNewParent && pNewParent->HasChildsOnDemand() ) 631 RequestingChilds( pNewParent ); 632 pImp->SetCurParent( pNewParent ); 633 } 634 635 SvLBoxEntry* SvIconView::GetCurParent() const 636 { 637 return pImp->GetCurParent(); 638 } 639 640 SvViewData* SvIconView::CreateViewData( SvListEntry* ) 641 { 642 SvIcnVwDataEntry* pEntryData = new SvIcnVwDataEntry; 643 return (SvViewData*)pEntryData; 644 } 645 646 void SvIconView::InitViewData( SvViewData* pData, SvListEntry* pEntry ) 647 { 648 SvLBox::InitViewData( pData, pEntry ); 649 pImp->InvalidateBoundingRect( ((SvIcnVwDataEntry*)pData)->aRect ); 650 } 651 652 Region SvIconView::GetDragRegion() const 653 { 654 Rectangle aRect; 655 SvLBoxEntry* pEntry = GetCurEntry(); 656 if( pEntry ) 657 aRect = pImp->GetBoundingRect( pEntry ); 658 Region aRegion( aRect ); 659 return aRegion; 660 } 661 662 sal_uLong SvIconView::GetSelectionCount() const 663 { 664 return (sal_uLong)(pImp->GetSelectionCount()); 665 } 666 667 void SvIconView::SetGrid( long nDX, long nDY ) 668 { 669 pImp->SetGrid( nDX, nDY ); 670 } 671 672 void SvIconView::ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1, 673 SvListEntry* pEntry2, sal_uLong nPos ) 674 { 675 SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos ); 676 switch( nActionId ) 677 { 678 case LISTACTION_RESORTING: 679 SetUpdateMode( sal_False ); 680 break; 681 682 case LISTACTION_RESORTED: 683 SetUpdateMode( sal_True ); 684 Arrange(); 685 break; 686 687 case LISTACTION_CLEARED: 688 if( IsUpdateMode() ) 689 Update(); 690 break; 691 } 692 } 693 694 695 void SvIconView::Scroll( long nDeltaX, long nDeltaY, sal_uInt16 ) 696 { 697 pImp->Scroll( nDeltaX, nDeltaY, sal_False ); 698 } 699 700 void SvIconView::PrepareCommandEvent( const CommandEvent& rCEvt ) 701 { 702 pImp->PrepareCommandEvent( rCEvt.GetMousePosPixel() ); 703 } 704 705 void SvIconView::StartDrag( sal_Int8 nAction, const Point& rPos ) 706 { 707 pImp->SttDrag( rPos ); 708 SvLBoxEntry* pEntry = GetEntry( rPos, sal_True ); 709 pImp->mpViewData = pEntry; 710 SvLBox::StartDrag( nAction, rPos ); 711 } 712 713 void SvIconView::DragFinished( sal_Int8 ) 714 { 715 pImp->EndDrag(); 716 } 717 718 sal_Int8 SvIconView::AcceptDrop( const AcceptDropEvent& rEvt ) 719 { 720 if( pImp->mpViewData ) 721 pImp->HideDDIcon(); 722 sal_Int8 nRet = SvLBox::AcceptDrop( rEvt ); 723 if( DND_ACTION_NONE != nRet ) 724 pImp->ShowDDIcon( pImp->mpViewData, rEvt.maPosPixel ); 725 726 return nRet; 727 } 728 729 sal_Int8 SvIconView::ExecuteDrop( const ExecuteDropEvent& rEvt ) 730 { 731 if( pImp->mpViewData ) 732 { 733 pImp->HideDDIcon(); 734 pImp->mpViewData = 0; 735 } 736 return SvLBox::ExecuteDrop( rEvt ); 737 } 738 739 void SvIconView::ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ) 740 { 741 pImp->ShowDDIcon( pRefEntry, rPos ); 742 } 743 744 void SvIconView::HideDDIcon() 745 { 746 pImp->HideDDIcon(); 747 } 748 749 void SvIconView::HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ) 750 { 751 pImp->HideShowDDIcon( pRefEntry, rPos ); 752 } 753 754 void SvIconView::SelectRect( const Rectangle& rRect, sal_Bool bAdd, 755 SvPtrarr* pRects, short nOffs ) 756 { 757 pImp->SelectRect( rRect, bAdd, pRects, nOffs ); 758 } 759 760 void SvIconView::CalcScrollOffsets( const Point& rRefPosPixel, long& rX, long& rY, 761 sal_Bool b, sal_uInt16 nBorderWidth ) 762 { 763 pImp->CalcScrollOffsets( rRefPosPixel, rX, rY, b, nBorderWidth ); 764 } 765 766 void SvIconView::EndTracking() 767 { 768 pImp->EndTracking(); 769 } 770 771 void SvIconView::MakeVisible( SvLBoxEntry* pEntry ) 772 { 773 pImp->MakeVisible( pEntry ); 774 } 775 776 void SvIconView::PreparePaint( SvLBoxEntry* ) 777 { 778 } 779 780 void SvIconView::AdjustAtGrid( SvLBoxEntry* pEntry ) 781 { 782 pImp->AdjustAtGrid( pEntry ); 783 } 784 785 void SvIconView::LockEntryPos( SvLBoxEntry* pEntry, sal_Bool bLock ) 786 { 787 SvIcnVwDataEntry* pViewData = (SvIcnVwDataEntry*)GetViewData( pEntry ); 788 if( bLock ) 789 pViewData->SetVwFlags( ICNVW_FLAG_POS_LOCKED ); 790 else 791 pViewData->ClearVwFlags( ICNVW_FLAG_POS_LOCKED ); 792 } 793 794 sal_Bool SvIconView::IsEntryPosLocked( const SvLBoxEntry* pEntry ) const 795 { 796 const SvIcnVwDataEntry* pViewData = (const SvIcnVwDataEntry*)GetViewData( (SvListEntry*)pEntry ); 797 return pViewData->IsEntryPosLocked(); 798 } 799 800 void SvIconView::SetTextMode( SvIconViewTextMode eMode, SvLBoxEntry* pEntry ) 801 { 802 pImp->SetTextMode( eMode, pEntry ); 803 } 804 805 SvIconViewTextMode SvIconView::GetTextMode( const SvLBoxEntry* pEntry ) const 806 { 807 return pImp->GetTextMode( pEntry ); 808 } 809 810 SvLBoxEntry* SvIconView::GetNextEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const 811 { 812 Point aPos( rPixPos ); 813 aPos -= GetMapMode().GetOrigin(); 814 return ((SvIconView*)this)->pImp->GetNextEntry( aPos, pCurEntry ); 815 } 816 817 SvLBoxEntry* SvIconView::GetPrevEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const 818 { 819 Point aPos( rPixPos ); 820 aPos -= GetMapMode().GetOrigin(); 821 return ((SvIconView*)this)->pImp->GetPrevEntry( aPos, pCurEntry ); 822 } 823 824 void SvIconView::ShowFocusRect( const SvLBoxEntry* pEntry ) 825 { 826 pImp->ShowFocusRect( pEntry ); 827 } 828 829 830