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 // #97016# No next object: go over open end and 358 // get first from the other side 359 pView->UnmarkAllObj(); 360 pView->MarkNextObj(!aCode.IsShift()); 361 } 362 363 // #97016# II 364 if(pView->AreObjectsMarked()) 365 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow); 366 367 bReturn = sal_True; 368 } 369 370 // #98994# handle Mod1 and Mod2 to get travelling running on different systems 371 if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2()) 372 { 373 // #97016# II do something with a selected handle? 374 const SdrHdlList& rHdlList = pView->GetHdlList(); 375 sal_Bool bForward(!rKEvt.GetKeyCode().IsShift()); 376 377 ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward); 378 379 // guarantee visibility of focused handle 380 SdrHdl* pHdl = rHdlList.GetFocusHdl(); 381 382 if(pHdl) 383 { 384 Point aHdlPosition(pHdl->GetPos()); 385 Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200)); 386 pView->MakeVisible(aVisRect, *pWindow); 387 } 388 389 // consumed 390 bReturn = sal_True; 391 } 392 } 393 } 394 break; 395 396 // #97016# 397 case KEY_END: 398 { 399 // in calc do NOT select the last draw object when 400 // there is not yet a object selected 401 if(pView->AreObjectsMarked()) 402 { 403 KeyCode aCode = rKEvt.GetKeyCode(); 404 405 if ( aCode.IsMod1() ) 406 { 407 // #97016# mark last object 408 pView->UnmarkAllObj(); 409 pView->MarkNextObj(sal_False); 410 411 // #97016# II 412 if(pView->AreObjectsMarked()) 413 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow); 414 415 bReturn = sal_True; 416 } 417 } 418 } 419 break; 420 421 // #97016# 422 case KEY_HOME: 423 { 424 // in calc do NOT select the first draw object when 425 // there is not yet a object selected 426 if(pView->AreObjectsMarked()) 427 { 428 KeyCode aCode = rKEvt.GetKeyCode(); 429 430 if ( aCode.IsMod1() ) 431 { 432 // #97016# mark first object 433 pView->UnmarkAllObj(); 434 pView->MarkNextObj(sal_True); 435 436 // #97016# II 437 if(pView->AreObjectsMarked()) 438 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow); 439 440 bReturn = sal_True; 441 } 442 } 443 } 444 break; 445 446 // #97016# 447 case KEY_UP: 448 case KEY_DOWN: 449 case KEY_LEFT: 450 case KEY_RIGHT: 451 { 452 // in calc do cursor travelling of draw objects only when 453 // there is a object selected yet 454 if(pView->AreObjectsMarked()) 455 { 456 457 const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 458 if(rMarkList.GetMarkCount() == 1) 459 { 460 // disable cursor travelling on note objects as the tail connector position 461 // must not move. 462 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 463 if( ScDrawLayer::IsNoteCaption( pObj ) ) 464 break; 465 } 466 467 long nX = 0; 468 long nY = 0; 469 sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); 470 471 if (nCode == KEY_UP) 472 { 473 // Scroll nach oben 474 nX = 0; 475 nY =-1; 476 } 477 else if (nCode == KEY_DOWN) 478 { 479 // Scroll nach unten 480 nX = 0; 481 nY = 1; 482 } 483 else if (nCode == KEY_LEFT) 484 { 485 // Scroll nach links 486 nX =-1; 487 nY = 0; 488 } 489 else if (nCode == KEY_RIGHT) 490 { 491 // Scroll nach rechts 492 nX = 1; 493 nY = 0; 494 } 495 496 sal_Bool bReadOnly = rViewData.GetDocShell()->IsReadOnly(); 497 498 if(!rKEvt.GetKeyCode().IsMod1() && !bReadOnly) 499 { 500 if(rKEvt.GetKeyCode().IsMod2()) 501 { 502 // #97016# move in 1 pixel distance 503 Size aLogicSizeOnePixel = (pWindow) ? pWindow->PixelToLogic(Size(1,1)) : Size(100, 100); 504 nX *= aLogicSizeOnePixel.Width(); 505 nY *= aLogicSizeOnePixel.Height(); 506 } 507 else 508 { 509 // old, fixed move distance 510 nX *= 100; 511 nY *= 100; 512 } 513 514 // is there a movement to do? 515 if(0 != nX || 0 != nY) 516 { 517 // #97016# II 518 const SdrHdlList& rHdlList = pView->GetHdlList(); 519 SdrHdl* pHdl = rHdlList.GetFocusHdl(); 520 521 if(0L == pHdl) 522 { 523 // #107086# only take action when move is allowed 524 if(pView->IsMoveAllowed()) 525 { 526 // #90129# restrict movement to WorkArea 527 const Rectangle& rWorkArea = pView->GetWorkArea(); 528 529 if(!rWorkArea.IsEmpty()) 530 { 531 Rectangle aMarkRect(pView->GetMarkedObjRect()); 532 aMarkRect.Move(nX, nY); 533 534 if(!aMarkRect.IsInside(rWorkArea)) 535 { 536 if(aMarkRect.Left() < rWorkArea.Left()) 537 { 538 nX += rWorkArea.Left() - aMarkRect.Left(); 539 } 540 541 if(aMarkRect.Right() > rWorkArea.Right()) 542 { 543 nX -= aMarkRect.Right() - rWorkArea.Right(); 544 } 545 546 if(aMarkRect.Top() < rWorkArea.Top()) 547 { 548 nY += rWorkArea.Top() - aMarkRect.Top(); 549 } 550 551 if(aMarkRect.Bottom() > rWorkArea.Bottom()) 552 { 553 nY -= aMarkRect.Bottom() - rWorkArea.Bottom(); 554 } 555 } 556 } 557 558 // now move the selected draw objects 559 pView->MoveAllMarked(Size(nX, nY)); 560 561 // #97016# II 562 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow); 563 564 bReturn = sal_True; 565 } 566 } 567 else 568 { 569 // move handle with index nHandleIndex 570 if(pHdl && (nX || nY)) 571 { 572 // now move the Handle (nX, nY) 573 Point aStartPoint(pHdl->GetPos()); 574 Point aEndPoint(pHdl->GetPos() + Point(nX, nY)); 575 const SdrDragStat& rDragStat = pView->GetDragStat(); 576 577 // start dragging 578 pView->BegDragObj(aStartPoint, 0, pHdl, 0); 579 580 if(pView->IsDragObj()) 581 { 582 FASTBOOL bWasNoSnap = rDragStat.IsNoSnap(); 583 sal_Bool bWasSnapEnabled = pView->IsSnapEnabled(); 584 585 // switch snapping off 586 if(!bWasNoSnap) 587 ((SdrDragStat&)rDragStat).SetNoSnap(sal_True); 588 if(bWasSnapEnabled) 589 pView->SetSnapEnabled(sal_False); 590 591 pView->MovAction(aEndPoint); 592 pView->EndDragObj(); 593 594 // restore snap 595 if(!bWasNoSnap) 596 ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); 597 if(bWasSnapEnabled) 598 pView->SetSnapEnabled(bWasSnapEnabled); 599 } 600 601 // make moved handle visible 602 Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200)); 603 pView->MakeVisible(aVisRect, *pWindow); 604 605 bReturn = sal_True; 606 } 607 } 608 } 609 } 610 } 611 } 612 break; 613 614 // #97016# 615 case KEY_SPACE: 616 { 617 // in calc do only something when draw objects are selected 618 if(pView->AreObjectsMarked()) 619 { 620 const SdrHdlList& rHdlList = pView->GetHdlList(); 621 SdrHdl* pHdl = rHdlList.GetFocusHdl(); 622 623 if(pHdl) 624 { 625 if(pHdl->GetKind() == HDL_POLY) 626 { 627 // rescue ID of point with focus 628 sal_uInt32 nPol(pHdl->GetPolyNum()); 629 sal_uInt32 nPnt(pHdl->GetPointNum()); 630 631 if(pView->IsPointMarked(*pHdl)) 632 { 633 if(rKEvt.GetKeyCode().IsShift()) 634 { 635 pView->UnmarkPoint(*pHdl); 636 } 637 } 638 else 639 { 640 if(!rKEvt.GetKeyCode().IsShift()) 641 { 642 pView->UnmarkAllPoints(); 643 } 644 645 pView->MarkPoint(*pHdl); 646 } 647 648 if(0L == rHdlList.GetFocusHdl()) 649 { 650 // restore point with focus 651 SdrHdl* pNewOne = 0L; 652 653 for(sal_uInt32 a(0); !pNewOne && a < rHdlList.GetHdlCount(); a++) 654 { 655 SdrHdl* pAct = rHdlList.GetHdl(a); 656 657 if(pAct 658 && pAct->GetKind() == HDL_POLY 659 && pAct->GetPolyNum() == nPol 660 && pAct->GetPointNum() == nPnt) 661 { 662 pNewOne = pAct; 663 } 664 } 665 666 if(pNewOne) 667 { 668 ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne); 669 } 670 } 671 672 bReturn = sal_True; 673 } 674 } 675 } 676 } 677 break; 678 } 679 680 if (!bReturn) 681 { 682 bReturn = FuPoor::KeyInput(rKEvt); 683 } 684 685 if (!bReturn) 686 { 687 // #98198# allow direct typing into a selected text object 688 689 const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 690 if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() && EditEngine::IsSimpleCharInput(rKEvt) ) 691 { 692 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 693 694 // start text edit for suitable object, pass key event to OutlinerView 695 if ( lcl_KeyEditMode( pObj, pViewShell, &rKEvt ) ) 696 bReturn = sal_True; 697 } 698 } 699 700 return (bReturn); 701 } 702 703 // #97016# II 704 void FuDraw::SelectionHasChanged() 705 { 706 const SdrHdlList& rHdlList = pView->GetHdlList(); 707 ((SdrHdlList&)rHdlList).ResetFocusHdl(); 708 } 709 710 /************************************************************************* 711 |* 712 |* Vor dem Scrollen Selektionsdarstellung ausblenden 713 |* 714 \************************************************************************/ 715 716 void FuDraw::ScrollStart() 717 { 718 // HideShownXor in Gridwin 719 } 720 721 /************************************************************************* 722 |* 723 |* Nach dem Scrollen Selektionsdarstellung wieder anzeigen 724 |* 725 \************************************************************************/ 726 727 void FuDraw::ScrollEnd() 728 { 729 // ShowShownXor in Gridwin 730 } 731 732 /************************************************************************* 733 |* 734 |* Function aktivieren 735 |* 736 \************************************************************************/ 737 738 void FuDraw::Activate() 739 { 740 FuPoor::Activate(); 741 } 742 743 /************************************************************************* 744 |* 745 |* Function deaktivieren 746 |* 747 \************************************************************************/ 748 749 void FuDraw::Deactivate() 750 { 751 FuPoor::Deactivate(); 752 } 753 754 /************************************************************************* 755 |* 756 |* Maus-Pointer umschalten 757 |* 758 \************************************************************************/ 759 760 sal_Bool lcl_UrlHit( SdrView* pView, const Point& rPosPixel, Window* pWindow ) 761 { 762 SdrViewEvent aVEvt; 763 MouseEvent aMEvt( rPosPixel, 1, 0, MOUSE_LEFT ); 764 SdrHitKind eHit = pView->PickAnything( aMEvt, SDRMOUSEBUTTONDOWN, aVEvt ); 765 766 if ( eHit != SDRHIT_NONE && aVEvt.pObj != NULL ) 767 { 768 if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) && ScDrawLayer::GetHitIMapObject( 769 aVEvt.pObj, pWindow->PixelToLogic(rPosPixel), *pWindow ) ) 770 return sal_True; 771 772 if ( aVEvt.eEvent == SDREVENT_EXECUTEURL ) 773 return sal_True; 774 } 775 776 return sal_False; 777 } 778 779 void FuDraw::ForcePointer(const MouseEvent* pMEvt) 780 { 781 if ( !pView->IsAction() ) 782 { 783 Point aPosPixel = pWindow->GetPointerPosPixel(); 784 sal_Bool bAlt = pMEvt && pMEvt->IsMod2(); 785 Point aPnt = pWindow->PixelToLogic( aPosPixel ); 786 SdrHdl* pHdl = pView->PickHandle(aPnt); 787 SdrObject* pObj; 788 SdrPageView* pPV; 789 790 ScMacroInfo* pInfo = 0; 791 if ( pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) ) 792 { 793 if ( pObj->IsGroupObject() ) 794 { 795 SdrObject* pHit = 0; 796 if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) ) 797 pObj = pHit; 798 } 799 pInfo = ScDrawLayer::GetMacroInfo( pObj ); 800 } 801 802 if ( pView->IsTextEdit() ) 803 { 804 pViewShell->SetActivePointer(Pointer(POINTER_TEXT)); // kann nicht sein ? 805 } 806 else if ( pHdl ) 807 { 808 pViewShell->SetActivePointer( 809 pView->GetPreferedPointer( aPnt, pWindow ) ); 810 } 811 else if ( pView->IsMarkedHit(aPnt) ) 812 { 813 pViewShell->SetActivePointer( Pointer(POINTER_MOVE) ); 814 } 815 else if ( !bAlt && ( !pMEvt || !pMEvt->GetButtons() ) 816 && lcl_UrlHit( pView, aPosPixel, pWindow ) ) 817 { 818 // kann mit ALT unterdrueckt werden 819 pWindow->SetPointer( Pointer( POINTER_REFHAND ) ); // Text-URL / ImageMap 820 } 821 else if ( !bAlt && pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) ) 822 { 823 // kann mit ALT unterdrueckt werden 824 SdrObjMacroHitRec aHitRec; //! muss da noch irgendwas gesetzt werden ???? 825 pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) ); 826 } 827 #ifdef ISSUE66550_HLINK_FOR_SHAPES 828 else if ( !bAlt && pInfo && ((pInfo->GetMacro().getLength() > 0) || (pInfo->GetHlink().getLength() > 0)) ) 829 #else 830 else if ( !bAlt && pInfo && (pInfo->GetMacro().getLength() > 0) ) 831 #endif 832 pWindow->SetPointer( Pointer( POINTER_REFHAND ) ); 833 else if ( IsDetectiveHit( aPnt ) ) 834 pViewShell->SetActivePointer( Pointer( POINTER_DETECTIVE ) ); 835 else 836 pViewShell->SetActivePointer( aNewPointer ); //! in Gridwin? 837 } 838 } 839 840 sal_Bool FuDraw::IsSizingOrMovingNote( const MouseEvent& rMEvt ) const 841 { 842 sal_Bool bIsSizingOrMoving = sal_False; 843 if ( rMEvt.IsLeft() ) 844 { 845 const SdrMarkList& rNoteMarkList = pView->GetMarkedObjectList(); 846 if(rNoteMarkList.GetMarkCount() == 1) 847 { 848 SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj(); 849 if ( ScDrawLayer::IsNoteCaption( pObj ) ) 850 { 851 Point aMPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() ); 852 bIsSizingOrMoving = 853 pView->PickHandle( aMPos ) || // handles to resize the note 854 pView->IsTextEditFrameHit( aMPos ); // frame for moving the note 855 } 856 } 857 } 858 return bIsSizingOrMoving; 859 } 860