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