1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sc.hxx" 26 27 //------------------------------------------------------------------------ 28 29 #include <editeng/editeng.hxx> // EditEngine::IsSimpleCharInput 30 #include <editeng/outlobj.hxx> 31 #include <svx/svdobj.hxx> 32 #include <svx/svdoole2.hxx> 33 #include <svx/svdouno.hxx> 34 #include <svx/svdocapt.hxx> 35 #include <svx/svdpage.hxx> 36 #include <svx/svditer.hxx> 37 #include <svx/svdundo.hxx> 38 #include <sfx2/dispatch.hxx> 39 #include <sfx2/viewfrm.hxx> 40 41 #include "sc.hrc" 42 #include "fudraw.hxx" 43 #include "futext.hxx" 44 #include "tabvwsh.hxx" 45 #include "drwlayer.hxx" 46 #include "scresid.hxx" 47 #include "userdat.hxx" 48 #include "docsh.hxx" 49 #include "postit.hxx" 50 #include "globstr.hrc" 51 #include "drawview.hxx" 52 53 /************************************************************************* 54 |* 55 |* Basisklasse fuer alle Drawmodul-spezifischen Funktionen 56 |* 57 \************************************************************************/ 58 59 FuDraw::FuDraw(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP, 60 SdrModel* pDoc, SfxRequest& rReq) : 61 FuPoor (pViewSh, pWin, pViewP, pDoc, rReq), 62 aNewPointer ( POINTER_ARROW ), 63 aOldPointer ( POINTER_ARROW ) 64 { 65 } 66 67 /************************************************************************* 68 |* 69 |* Destruktor 70 |* 71 \************************************************************************/ 72 73 FuDraw::~FuDraw() 74 { 75 } 76 77 /************************************************************************* 78 |* 79 |* Modifier-Tasten auswerten 80 |* 81 \************************************************************************/ 82 83 void FuDraw::DoModifiers(const MouseEvent& rMEvt) 84 { 85 // Shift = Ortho und AngleSnap 86 // Control = Snap (Toggle) 87 // Alt = zentrisch 88 89 sal_Bool bShift = rMEvt.IsShift(); 90 // sal_Bool bCtrl = rMEvt.IsMod1(); 91 sal_Bool bAlt = rMEvt.IsMod2(); 92 93 // ScViewData* pViewData = pViewShell->GetViewData(); 94 // const ScViewOptions& rOpt = pViewData->GetOptions(); 95 // const ScGridOptions& rGrid = rOpt.GetGridOptions(); 96 // sal_Bool bGridOpt = rGrid.GetUseGridSnap(); 97 98 sal_Bool bOrtho = bShift; 99 sal_Bool bAngleSnap = bShift; 100 // sal_Bool bGridSnap = ( bGridOpt != bCtrl ); // andere Snap's nicht unterstuetzt 101 sal_Bool bCenter = bAlt; 102 103 // #i33136# 104 if(doConstructOrthogonal()) 105 { 106 bOrtho = !bShift; 107 } 108 109 if (pView->IsOrtho() != bOrtho) 110 pView->SetOrtho(bOrtho); 111 if (pView->IsAngleSnapEnabled() != bAngleSnap) 112 pView->SetAngleSnapEnabled(bAngleSnap); 113 114 /* Control fuer Snap beisst sich beim Verschieben mit "kopieren" !!! 115 116 if (pView->IsGridSnap() != bGridSnap) 117 pView->SetGridSnap(bGridSnap); 118 if (pView->IsSnapEnabled() != bGridSnap) 119 pView->SetSnapEnabled(bGridSnap); 120 */ 121 if (pView->IsCreate1stPointAsCenter() != bCenter) 122 pView->SetCreate1stPointAsCenter(bCenter); 123 if (pView->IsResizeAtCenter() != bCenter) 124 pView->SetResizeAtCenter(bCenter); 125 126 } 127 128 void FuDraw::ResetModifiers() 129 { 130 ScViewData* pViewData = pViewShell->GetViewData(); 131 const ScViewOptions& rOpt = pViewData->GetOptions(); 132 const ScGridOptions& rGrid = rOpt.GetGridOptions(); 133 sal_Bool bGridOpt = rGrid.GetUseGridSnap(); 134 135 if (pView->IsOrtho()) 136 pView->SetOrtho(sal_False); 137 if (pView->IsAngleSnapEnabled()) 138 pView->SetAngleSnapEnabled(sal_False); 139 140 if (pView->IsGridSnap() != bGridOpt) 141 pView->SetGridSnap(bGridOpt); 142 if (pView->IsSnapEnabled() != bGridOpt) 143 pView->SetSnapEnabled(bGridOpt); 144 145 if (pView->IsCreate1stPointAsCenter()) 146 pView->SetCreate1stPointAsCenter(sal_False); 147 if (pView->IsResizeAtCenter()) 148 pView->SetResizeAtCenter(sal_False); 149 } 150 151 /************************************************************************* 152 |* 153 |* MouseButtonDown-event 154 |* 155 \************************************************************************/ 156 157 sal_Bool __EXPORT FuDraw::MouseButtonDown(const MouseEvent& rMEvt) 158 { 159 // #95491# remember button state for creation of own MouseEvents 160 SetMouseButtonCode(rMEvt.GetButtons()); 161 162 DoModifiers( rMEvt ); 163 return sal_False; 164 } 165 166 /************************************************************************* 167 |* 168 |* MouseMove-event 169 |* 170 \************************************************************************/ 171 172 sal_Bool __EXPORT FuDraw::MouseMove(const MouseEvent& rMEvt) 173 { 174 // #106438# evaluate modifiers only if in a drawing layer action 175 // (don't interfere with keyboard shortcut handling) 176 if (pView->IsAction()) 177 DoModifiers( rMEvt ); 178 179 return sal_False; 180 } 181 182 /************************************************************************* 183 |* 184 |* MouseButtonUp-event 185 |* 186 \************************************************************************/ 187 188 sal_Bool __EXPORT FuDraw::MouseButtonUp(const MouseEvent& rMEvt) 189 { 190 // #95491# remember button state for creation of own MouseEvents 191 SetMouseButtonCode(rMEvt.GetButtons()); 192 193 ResetModifiers(); 194 return sal_False; 195 } 196 197 /************************************************************************* 198 |* 199 |* Tastaturereignisse bearbeiten 200 |* 201 |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls 202 |* FALSE. 203 |* 204 \************************************************************************/ 205 206 sal_Bool lcl_KeyEditMode( SdrObject* pObj, ScTabViewShell* pViewShell, const KeyEvent* pInitialKey ) 207 { 208 sal_Bool bReturn = sal_False; 209 if ( pObj && pObj->ISA(SdrTextObj) && !pObj->ISA(SdrUnoObj) ) 210 { 211 // start text edit - like FuSelection::MouseButtonUp, 212 // but with bCursorToEnd instead of mouse position 213 214 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); 215 sal_Bool bVertical = ( pOPO && pOPO->IsVertical() ); 216 sal_uInt16 nTextSlotId = bVertical ? SID_DRAW_TEXT_VERTICAL : SID_DRAW_TEXT; 217 218 // don't switch shells if text shell is already active 219 FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr(); 220 if ( !pPoor || pPoor->GetSlotID() != nTextSlotId ) 221 { 222 pViewShell->GetViewData()->GetDispatcher(). 223 Execute(nTextSlotId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD); 224 } 225 226 // get the resulting FuText and set in edit mode 227 pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr(); 228 if ( pPoor && pPoor->GetSlotID() == nTextSlotId ) // no RTTI 229 { 230 FuText* pText = (FuText*)pPoor; 231 pText->SetInEditMode( pObj, NULL, sal_True, pInitialKey ); 232 //! set cursor to end of text 233 } 234 bReturn = sal_True; 235 } 236 return bReturn; 237 } 238 239 sal_Bool __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt) 240 { 241 sal_Bool bReturn = sal_False; 242 ScViewData& rViewData = *pViewShell->GetViewData(); 243 244 switch ( rKEvt.GetKeyCode().GetCode() ) 245 { 246 case KEY_ESCAPE: 247 248 /* 18.12.95: TextShell beibehalten nicht mehr gewuenscht... 249 * 250 * if ( pView->IsAction() ) 251 * { 252 * pView->BrkAction(); 253 * pWindow->ReleaseMouse(); 254 * bReturn = sal_True; 255 * } 256 * else if ( pView->IsTextEdit() ) 257 * { 258 * pView->EndTextEdit(); 259 * pView->SetCreateMode(); 260 * pViewShell->GetScDrawView()->InvalidateDrawTextAttrs(); 261 * bReturn = sal_True; 262 * } 263 * else 264 */ 265 266 if ( pViewShell->IsDrawTextShell() || aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT ) 267 { 268 // in normale Draw-Shell, wenn Objekt selektiert, sonst Zeichnen aus 269 rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); 270 bReturn = sal_True; 271 } 272 else if ( pViewShell->IsDrawSelMode() ) 273 { 274 pView->UnmarkAll(); 275 rViewData.GetDispatcher().Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); 276 bReturn = sal_True; 277 } 278 else if ( pView->AreObjectsMarked() ) 279 { 280 // #97016# III 281 SdrHdlList& rHdlList = const_cast< SdrHdlList& >( pView->GetHdlList() ); 282 if( rHdlList.GetFocusHdl() ) 283 rHdlList.ResetFocusHdl(); 284 else 285 pView->UnmarkAll(); 286 287 // Beim Bezier-Editieren ist jetzt wieder das Objekt selektiert 288 if (!pView->AreObjectsMarked()) 289 pViewShell->SetDrawShell( sal_False ); 290 291 bReturn = sal_True; 292 } 293 break; 294 295 case KEY_DELETE: //! ueber Accelerator 296 pView->DeleteMarked(); 297 bReturn = sal_True; 298 break; 299 300 case KEY_RETURN: 301 { 302 if( rKEvt.GetKeyCode().GetModifier() == 0 ) 303 { 304 // #98256# activate OLE object on RETURN for selected object 305 // #98198# put selected text object in edit mode 306 const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 307 if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() ) 308 { 309 sal_Bool bOle = pViewShell->GetViewFrame()->GetFrame().IsInPlace(); 310 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 311 if( pObj && pObj->ISA( SdrOle2Obj ) && !bOle ) 312 { 313 //HMHpView->HideMarkHdl(); 314 pViewShell->ActivateObject( static_cast< SdrOle2Obj* >( pObj ), 0 ); 315 316 // consumed 317 bReturn = sal_True; 318 } 319 else if ( lcl_KeyEditMode( pObj, pViewShell, NULL ) ) // start text edit for suitable object 320 bReturn = sal_True; 321 } 322 } 323 } 324 break; 325 326 case KEY_F2: 327 { 328 if( rKEvt.GetKeyCode().GetModifier() == 0 ) 329 { 330 // #98198# put selected text object in edit mode 331 // (this is not SID_SETINPUTMODE, but F2 hardcoded, like in Writer) 332 const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 333 if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() ) 334 { 335 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 336 if ( lcl_KeyEditMode( pObj, pViewShell, NULL ) ) // start text edit for suitable object 337 bReturn = sal_True; 338 } 339 } 340 } 341 break; 342 343 // #97016# 344 case KEY_TAB: 345 { 346 // in calc do NOT start draw object selection using TAB/SHIFT-TAB when 347 // there is not yet a object selected 348 if(pView->AreObjectsMarked()) 349 { 350 KeyCode aCode = rKEvt.GetKeyCode(); 351 352 if ( !aCode.IsMod1() && !aCode.IsMod2() ) 353 { 354 // changeover to the next object 355 if(!pView->MarkNextObj( !aCode.IsShift() )) 356 { 357 //IAccessibility2 Implementation 2009----- 358 //If there is only one object, don't do the UnmarkAlllObj() & MarkNextObj(). 359 if ( pView->GetMarkableObjCount() > 1 && pView->HasMarkableObj() ) 360 { 361 //-----IAccessibility2 Implementation 2009 362 // #97016# No next object: go over open end and 363 // get first from the other side 364 pView->UnmarkAllObj(); 365 pView->MarkNextObj(!aCode.IsShift()); 366 } 367 } 368 369 // #97016# II 370 if(pView->AreObjectsMarked()) 371 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow); 372 373 bReturn = sal_True; 374 } 375 376 // #98994# handle Mod1 and Mod2 to get travelling running on different systems 377 if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2()) 378 { 379 // #97016# II do something with a selected handle? 380 const SdrHdlList& rHdlList = pView->GetHdlList(); 381 sal_Bool bForward(!rKEvt.GetKeyCode().IsShift()); 382 383 ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward); 384 385 // guarantee visibility of focused handle 386 SdrHdl* pHdl = rHdlList.GetFocusHdl(); 387 388 if(pHdl) 389 { 390 Point aHdlPosition(pHdl->GetPos()); 391 Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200)); 392 pView->MakeVisible(aVisRect, *pWindow); 393 } 394 395 // consumed 396 bReturn = sal_True; 397 } 398 } 399 } 400 break; 401 402 // #97016# 403 case KEY_END: 404 { 405 // in calc do NOT select the last draw object when 406 // there is not yet a object selected 407 if(pView->AreObjectsMarked()) 408 { 409 KeyCode aCode = rKEvt.GetKeyCode(); 410 411 if ( aCode.IsMod1() ) 412 { 413 // #97016# mark last object 414 pView->UnmarkAllObj(); 415 pView->MarkNextObj(sal_False); 416 417 // #97016# II 418 if(pView->AreObjectsMarked()) 419 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow); 420 421 bReturn = sal_True; 422 } 423 } 424 } 425 break; 426 427 // #97016# 428 case KEY_HOME: 429 { 430 // in calc do NOT select the first draw object when 431 // there is not yet a object selected 432 if(pView->AreObjectsMarked()) 433 { 434 KeyCode aCode = rKEvt.GetKeyCode(); 435 436 if ( aCode.IsMod1() ) 437 { 438 // #97016# mark first object 439 pView->UnmarkAllObj(); 440 pView->MarkNextObj(sal_True); 441 442 // #97016# II 443 if(pView->AreObjectsMarked()) 444 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow); 445 446 bReturn = sal_True; 447 } 448 } 449 } 450 break; 451 452 // #97016# 453 case KEY_UP: 454 case KEY_DOWN: 455 case KEY_LEFT: 456 case KEY_RIGHT: 457 { 458 // in calc do cursor travelling of draw objects only when 459 // there is a object selected yet 460 if(pView->AreObjectsMarked()) 461 { 462 463 const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 464 if(rMarkList.GetMarkCount() == 1) 465 { 466 // disable cursor travelling on note objects as the tail connector position 467 // must not move. 468 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 469 if( ScDrawLayer::IsNoteCaption( pObj ) ) 470 break; 471 } 472 473 long nX = 0; 474 long nY = 0; 475 sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); 476 477 if (nCode == KEY_UP) 478 { 479 // Scroll nach oben 480 nX = 0; 481 nY =-1; 482 } 483 else if (nCode == KEY_DOWN) 484 { 485 // Scroll nach unten 486 nX = 0; 487 nY = 1; 488 } 489 else if (nCode == KEY_LEFT) 490 { 491 // Scroll nach links 492 nX =-1; 493 nY = 0; 494 } 495 else if (nCode == KEY_RIGHT) 496 { 497 // Scroll nach rechts 498 nX = 1; 499 nY = 0; 500 } 501 502 sal_Bool bReadOnly = rViewData.GetDocShell()->IsReadOnly(); 503 504 if(!rKEvt.GetKeyCode().IsMod1() && !bReadOnly) 505 { 506 if(rKEvt.GetKeyCode().IsMod2()) 507 { 508 // #97016# move in 1 pixel distance 509 Size aLogicSizeOnePixel = (pWindow) ? pWindow->PixelToLogic(Size(1,1)) : Size(100, 100); 510 nX *= aLogicSizeOnePixel.Width(); 511 nY *= aLogicSizeOnePixel.Height(); 512 } 513 else if(rKEvt.GetKeyCode().IsShift()) // #121236# Support for shift key in calc 514 { 515 nX *= 1000; 516 nY *= 1000; 517 } 518 else 519 { 520 // old, fixed move distance 521 nX *= 100; 522 nY *= 100; 523 } 524 525 // is there a movement to do? 526 if(0 != nX || 0 != nY) 527 { 528 // #97016# II 529 const SdrHdlList& rHdlList = pView->GetHdlList(); 530 SdrHdl* pHdl = rHdlList.GetFocusHdl(); 531 532 if(0L == pHdl) 533 { 534 // #107086# only take action when move is allowed 535 if(pView->IsMoveAllowed()) 536 { 537 // #90129# restrict movement to WorkArea 538 const Rectangle& rWorkArea = pView->GetWorkArea(); 539 540 if(!rWorkArea.IsEmpty()) 541 { 542 Rectangle aMarkRect(pView->GetMarkedObjRect()); 543 aMarkRect.Move(nX, nY); 544 545 if(!aMarkRect.IsInside(rWorkArea)) 546 { 547 if(aMarkRect.Left() < rWorkArea.Left()) 548 { 549 nX += rWorkArea.Left() - aMarkRect.Left(); 550 } 551 552 if(aMarkRect.Right() > rWorkArea.Right()) 553 { 554 nX -= aMarkRect.Right() - rWorkArea.Right(); 555 } 556 557 if(aMarkRect.Top() < rWorkArea.Top()) 558 { 559 nY += rWorkArea.Top() - aMarkRect.Top(); 560 } 561 562 if(aMarkRect.Bottom() > rWorkArea.Bottom()) 563 { 564 nY -= aMarkRect.Bottom() - rWorkArea.Bottom(); 565 } 566 } 567 } 568 569 // now move the selected draw objects 570 pView->MoveAllMarked(Size(nX, nY)); 571 572 // #97016# II 573 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow); 574 575 bReturn = sal_True; 576 } 577 } 578 else 579 { 580 // move handle with index nHandleIndex 581 if(pHdl && (nX || nY)) 582 { 583 // now move the Handle (nX, nY) 584 Point aStartPoint(pHdl->GetPos()); 585 Point aEndPoint(pHdl->GetPos() + Point(nX, nY)); 586 const SdrDragStat& rDragStat = pView->GetDragStat(); 587 588 // start dragging 589 pView->BegDragObj(aStartPoint, 0, pHdl, 0); 590 591 if(pView->IsDragObj()) 592 { 593 FASTBOOL bWasNoSnap = rDragStat.IsNoSnap(); 594 sal_Bool bWasSnapEnabled = pView->IsSnapEnabled(); 595 596 // switch snapping off 597 if(!bWasNoSnap) 598 ((SdrDragStat&)rDragStat).SetNoSnap(sal_True); 599 if(bWasSnapEnabled) 600 pView->SetSnapEnabled(sal_False); 601 602 pView->MovAction(aEndPoint); 603 pView->EndDragObj(); 604 605 // restore snap 606 if(!bWasNoSnap) 607 ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); 608 if(bWasSnapEnabled) 609 pView->SetSnapEnabled(bWasSnapEnabled); 610 } 611 612 // make moved handle visible 613 Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200)); 614 pView->MakeVisible(aVisRect, *pWindow); 615 616 bReturn = sal_True; 617 } 618 } 619 } 620 } 621 } 622 } 623 break; 624 625 // #97016# 626 case KEY_SPACE: 627 { 628 // in calc do only something when draw objects are selected 629 if(pView->AreObjectsMarked()) 630 { 631 const SdrHdlList& rHdlList = pView->GetHdlList(); 632 SdrHdl* pHdl = rHdlList.GetFocusHdl(); 633 634 if(pHdl) 635 { 636 if(pHdl->GetKind() == HDL_POLY) 637 { 638 // rescue ID of point with focus 639 sal_uInt32 nPol(pHdl->GetPolyNum()); 640 sal_uInt32 nPnt(pHdl->GetPointNum()); 641 642 if(pView->IsPointMarked(*pHdl)) 643 { 644 if(rKEvt.GetKeyCode().IsShift()) 645 { 646 pView->UnmarkPoint(*pHdl); 647 } 648 } 649 else 650 { 651 if(!rKEvt.GetKeyCode().IsShift()) 652 { 653 pView->UnmarkAllPoints(); 654 } 655 656 pView->MarkPoint(*pHdl); 657 } 658 659 if(0L == rHdlList.GetFocusHdl()) 660 { 661 // restore point with focus 662 SdrHdl* pNewOne = 0L; 663 664 for(sal_uInt32 a(0); !pNewOne && a < rHdlList.GetHdlCount(); a++) 665 { 666 SdrHdl* pAct = rHdlList.GetHdl(a); 667 668 if(pAct 669 && pAct->GetKind() == HDL_POLY 670 && pAct->GetPolyNum() == nPol 671 && pAct->GetPointNum() == nPnt) 672 { 673 pNewOne = pAct; 674 } 675 } 676 677 if(pNewOne) 678 { 679 ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne); 680 } 681 } 682 683 bReturn = sal_True; 684 } 685 } 686 } 687 } 688 break; 689 } 690 691 if (!bReturn) 692 { 693 bReturn = FuPoor::KeyInput(rKEvt); 694 } 695 696 if (!bReturn) 697 { 698 // #98198# allow direct typing into a selected text object 699 700 const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 701 if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() && EditEngine::IsSimpleCharInput(rKEvt) ) 702 { 703 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 704 705 // start text edit for suitable object, pass key event to OutlinerView 706 if ( lcl_KeyEditMode( pObj, pViewShell, &rKEvt ) ) 707 bReturn = sal_True; 708 } 709 } 710 711 return (bReturn); 712 } 713 714 // #97016# II 715 void FuDraw::SelectionHasChanged() 716 { 717 const SdrHdlList& rHdlList = pView->GetHdlList(); 718 ((SdrHdlList&)rHdlList).ResetFocusHdl(); 719 } 720 721 /************************************************************************* 722 |* 723 |* Vor dem Scrollen Selektionsdarstellung ausblenden 724 |* 725 \************************************************************************/ 726 727 void FuDraw::ScrollStart() 728 { 729 // HideShownXor in Gridwin 730 } 731 732 /************************************************************************* 733 |* 734 |* Nach dem Scrollen Selektionsdarstellung wieder anzeigen 735 |* 736 \************************************************************************/ 737 738 void FuDraw::ScrollEnd() 739 { 740 // ShowShownXor in Gridwin 741 } 742 743 /************************************************************************* 744 |* 745 |* Function aktivieren 746 |* 747 \************************************************************************/ 748 749 void FuDraw::Activate() 750 { 751 FuPoor::Activate(); 752 } 753 754 /************************************************************************* 755 |* 756 |* Function deaktivieren 757 |* 758 \************************************************************************/ 759 760 void FuDraw::Deactivate() 761 { 762 FuPoor::Deactivate(); 763 } 764 765 /************************************************************************* 766 |* 767 |* Maus-Pointer umschalten 768 |* 769 \************************************************************************/ 770 771 sal_Bool lcl_UrlHit( SdrView* pView, const Point& rPosPixel, Window* pWindow ) 772 { 773 SdrViewEvent aVEvt; 774 MouseEvent aMEvt( rPosPixel, 1, 0, MOUSE_LEFT ); 775 SdrHitKind eHit = pView->PickAnything( aMEvt, SDRMOUSEBUTTONDOWN, aVEvt ); 776 777 if ( eHit != SDRHIT_NONE && aVEvt.pObj != NULL ) 778 { 779 if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) && ScDrawLayer::GetHitIMapObject( 780 aVEvt.pObj, pWindow->PixelToLogic(rPosPixel), *pWindow ) ) 781 return sal_True; 782 783 if ( aVEvt.eEvent == SDREVENT_EXECUTEURL ) 784 return sal_True; 785 } 786 787 return sal_False; 788 } 789 790 void FuDraw::ForcePointer(const MouseEvent* pMEvt) 791 { 792 if ( !pView->IsAction() ) 793 { 794 Point aPosPixel = pWindow->GetPointerPosPixel(); 795 sal_Bool bAlt = pMEvt && pMEvt->IsMod2(); 796 Point aPnt = pWindow->PixelToLogic( aPosPixel ); 797 SdrHdl* pHdl = pView->PickHandle(aPnt); 798 SdrObject* pObj; 799 SdrPageView* pPV; 800 801 ScMacroInfo* pInfo = 0; 802 if ( pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) ) 803 { 804 if ( pObj->IsGroupObject() ) 805 { 806 SdrObject* pHit = 0; 807 if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) ) 808 pObj = pHit; 809 } 810 pInfo = ScDrawLayer::GetMacroInfo( pObj ); 811 } 812 813 if ( pView->IsTextEdit() ) 814 { 815 pViewShell->SetActivePointer(Pointer(POINTER_TEXT)); // kann nicht sein ? 816 } 817 else if ( pHdl ) 818 { 819 pViewShell->SetActivePointer( 820 pView->GetPreferedPointer( aPnt, pWindow ) ); 821 } 822 else if ( pView->IsMarkedHit(aPnt) ) 823 { 824 pViewShell->SetActivePointer( Pointer(POINTER_MOVE) ); 825 } 826 else if ( !bAlt && ( !pMEvt || !pMEvt->GetButtons() ) 827 && lcl_UrlHit( pView, aPosPixel, pWindow ) ) 828 { 829 // kann mit ALT unterdrueckt werden 830 pWindow->SetPointer( Pointer( POINTER_REFHAND ) ); // Text-URL / ImageMap 831 } 832 else if ( !bAlt && pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) ) 833 { 834 // kann mit ALT unterdrueckt werden 835 SdrObjMacroHitRec aHitRec; //! muss da noch irgendwas gesetzt werden ???? 836 pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) ); 837 } 838 #ifdef ISSUE66550_HLINK_FOR_SHAPES 839 else if ( !bAlt && pInfo && ((pInfo->GetMacro().getLength() > 0) || (pInfo->GetHlink().getLength() > 0)) ) 840 #else 841 else if ( !bAlt && pInfo && (pInfo->GetMacro().getLength() > 0) ) 842 #endif 843 pWindow->SetPointer( Pointer( POINTER_REFHAND ) ); 844 else if ( IsDetectiveHit( aPnt ) ) 845 pViewShell->SetActivePointer( Pointer( POINTER_DETECTIVE ) ); 846 else 847 pViewShell->SetActivePointer( aNewPointer ); //! in Gridwin? 848 } 849 } 850 851 sal_Bool FuDraw::IsSizingOrMovingNote( const MouseEvent& rMEvt ) const 852 { 853 sal_Bool bIsSizingOrMoving = sal_False; 854 if ( rMEvt.IsLeft() ) 855 { 856 const SdrMarkList& rNoteMarkList = pView->GetMarkedObjectList(); 857 if(rNoteMarkList.GetMarkCount() == 1) 858 { 859 SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj(); 860 if ( ScDrawLayer::IsNoteCaption( pObj ) ) 861 { 862 Point aMPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() ); 863 bIsSizingOrMoving = 864 pView->PickHandle( aMPos ) || // handles to resize the note 865 pView->IsTextEditFrameHit( aMPos ); // frame for moving the note 866 } 867 } 868 } 869 return bIsSizingOrMoving; 870 } 871