Update ooo320-m1
[ooovba.git] / sc / source / ui / drawfunc / fudraw.cxx
blob2585271a35104bf4125ecd772d32da4b46d916b6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fudraw.cxx,v $
10 * $Revision: 1.25.128.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 //------------------------------------------------------------------------
36 #include <svx/editeng.hxx> // EditEngine::IsSimpleCharInput
37 #include <svx/outlobj.hxx>
38 #include <svx/svdobj.hxx>
39 #include <svx/svdoole2.hxx>
40 #include <svx/svdouno.hxx>
41 #include <svx/svdocapt.hxx>
42 #include <svx/svdpage.hxx>
43 #include <svx/svditer.hxx>
44 #include <svx/svdundo.hxx>
45 #include <sfx2/dispatch.hxx>
46 #include <sfx2/viewfrm.hxx>
47 #include <com/sun/star/embed/EmbedVerbs.hpp>
49 #include "sc.hrc"
50 #include "fudraw.hxx"
51 #include "futext.hxx"
52 #include "tabvwsh.hxx"
53 #include "drwlayer.hxx"
54 #include "scresid.hxx"
55 #include "userdat.hxx"
56 #include "docsh.hxx"
57 #include "postit.hxx"
58 #include "globstr.hrc"
59 #include "drawview.hxx"
61 using namespace ::com::sun::star;
63 /*************************************************************************
65 |* Basisklasse fuer alle Drawmodul-spezifischen Funktionen
67 \************************************************************************/
69 FuDraw::FuDraw(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
70 SdrModel* pDoc, SfxRequest& rReq) :
71 FuPoor (pViewSh, pWin, pViewP, pDoc, rReq),
72 aNewPointer ( POINTER_ARROW ),
73 aOldPointer ( POINTER_ARROW )
77 /*************************************************************************
79 |* Destruktor
81 \************************************************************************/
83 FuDraw::~FuDraw()
87 /*************************************************************************
89 |* Modifier-Tasten auswerten
91 \************************************************************************/
93 void FuDraw::DoModifiers(const MouseEvent& rMEvt)
95 // Shift = Ortho und AngleSnap
96 // Control = Snap (Toggle)
97 // Alt = zentrisch
99 BOOL bShift = rMEvt.IsShift();
100 // BOOL bCtrl = rMEvt.IsMod1();
101 BOOL bAlt = rMEvt.IsMod2();
103 // ScViewData* pViewData = pViewShell->GetViewData();
104 // const ScViewOptions& rOpt = pViewData->GetOptions();
105 // const ScGridOptions& rGrid = rOpt.GetGridOptions();
106 // BOOL bGridOpt = rGrid.GetUseGridSnap();
108 BOOL bOrtho = bShift;
109 BOOL bAngleSnap = bShift;
110 // BOOL bGridSnap = ( bGridOpt != bCtrl ); // andere Snap's nicht unterstuetzt
111 BOOL bCenter = bAlt;
113 // #i33136#
114 if(doConstructOrthogonal())
116 bOrtho = !bShift;
119 if (pView->IsOrtho() != bOrtho)
120 pView->SetOrtho(bOrtho);
121 if (pView->IsAngleSnapEnabled() != bAngleSnap)
122 pView->SetAngleSnapEnabled(bAngleSnap);
124 /* Control fuer Snap beisst sich beim Verschieben mit "kopieren" !!!
126 if (pView->IsGridSnap() != bGridSnap)
127 pView->SetGridSnap(bGridSnap);
128 if (pView->IsSnapEnabled() != bGridSnap)
129 pView->SetSnapEnabled(bGridSnap);
131 if (pView->IsCreate1stPointAsCenter() != bCenter)
132 pView->SetCreate1stPointAsCenter(bCenter);
133 if (pView->IsResizeAtCenter() != bCenter)
134 pView->SetResizeAtCenter(bCenter);
138 void FuDraw::ResetModifiers()
140 ScViewData* pViewData = pViewShell->GetViewData();
141 const ScViewOptions& rOpt = pViewData->GetOptions();
142 const ScGridOptions& rGrid = rOpt.GetGridOptions();
143 BOOL bGridOpt = rGrid.GetUseGridSnap();
145 if (pView->IsOrtho())
146 pView->SetOrtho(FALSE);
147 if (pView->IsAngleSnapEnabled())
148 pView->SetAngleSnapEnabled(FALSE);
150 if (pView->IsGridSnap() != bGridOpt)
151 pView->SetGridSnap(bGridOpt);
152 if (pView->IsSnapEnabled() != bGridOpt)
153 pView->SetSnapEnabled(bGridOpt);
155 if (pView->IsCreate1stPointAsCenter())
156 pView->SetCreate1stPointAsCenter(FALSE);
157 if (pView->IsResizeAtCenter())
158 pView->SetResizeAtCenter(FALSE);
161 /*************************************************************************
163 |* MouseButtonDown-event
165 \************************************************************************/
167 BOOL __EXPORT FuDraw::MouseButtonDown(const MouseEvent& rMEvt)
169 // #95491# remember button state for creation of own MouseEvents
170 SetMouseButtonCode(rMEvt.GetButtons());
172 DoModifiers( rMEvt );
173 return FALSE;
176 /*************************************************************************
178 |* MouseMove-event
180 \************************************************************************/
182 BOOL __EXPORT FuDraw::MouseMove(const MouseEvent& rMEvt)
184 // #106438# evaluate modifiers only if in a drawing layer action
185 // (don't interfere with keyboard shortcut handling)
186 if (pView->IsAction())
187 DoModifiers( rMEvt );
189 return FALSE;
192 /*************************************************************************
194 |* MouseButtonUp-event
196 \************************************************************************/
198 BOOL __EXPORT FuDraw::MouseButtonUp(const MouseEvent& rMEvt)
200 // #95491# remember button state for creation of own MouseEvents
201 SetMouseButtonCode(rMEvt.GetButtons());
203 ResetModifiers();
204 return FALSE;
207 /*************************************************************************
209 |* Tastaturereignisse bearbeiten
211 |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
212 |* FALSE.
214 \************************************************************************/
216 BOOL lcl_KeyEditMode( SdrObject* pObj, ScTabViewShell* pViewShell, const KeyEvent* pInitialKey )
218 BOOL bReturn = FALSE;
219 if ( pObj && pObj->ISA(SdrTextObj) && !pObj->ISA(SdrUnoObj) )
221 // start text edit - like FuSelection::MouseButtonUp,
222 // but with bCursorToEnd instead of mouse position
224 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
225 BOOL bVertical = ( pOPO && pOPO->IsVertical() );
226 USHORT nTextSlotId = bVertical ? SID_DRAW_TEXT_VERTICAL : SID_DRAW_TEXT;
228 // don't switch shells if text shell is already active
229 FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
230 if ( !pPoor || pPoor->GetSlotID() != nTextSlotId )
232 pViewShell->GetViewData()->GetDispatcher().
233 Execute(nTextSlotId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
236 // get the resulting FuText and set in edit mode
237 pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
238 if ( pPoor && pPoor->GetSlotID() == nTextSlotId ) // no RTTI
240 FuText* pText = (FuText*)pPoor;
241 pText->SetInEditMode( pObj, NULL, TRUE, pInitialKey );
242 //! set cursor to end of text
244 bReturn = TRUE;
246 return bReturn;
249 BOOL __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt)
251 BOOL bReturn = FALSE;
252 ScViewData& rViewData = *pViewShell->GetViewData();
254 switch ( rKEvt.GetKeyCode().GetCode() )
256 case KEY_ESCAPE:
258 /* 18.12.95: TextShell beibehalten nicht mehr gewuenscht...
260 * if ( pView->IsAction() )
262 * pView->BrkAction();
263 * pWindow->ReleaseMouse();
264 * bReturn = TRUE;
266 * else if ( pView->IsTextEdit() )
268 * pView->EndTextEdit();
269 * pView->SetCreateMode();
270 * pViewShell->GetScDrawView()->InvalidateDrawTextAttrs();
271 * bReturn = TRUE;
273 * else
276 if ( pViewShell->IsDrawTextShell() || aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT )
278 // in normale Draw-Shell, wenn Objekt selektiert, sonst Zeichnen aus
279 rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
280 bReturn = TRUE;
282 else if ( pViewShell->IsDrawSelMode() )
284 pView->UnmarkAll();
285 rViewData.GetDispatcher().Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
286 bReturn = TRUE;
288 else if ( pView->AreObjectsMarked() )
290 // #97016# III
291 SdrHdlList& rHdlList = const_cast< SdrHdlList& >( pView->GetHdlList() );
292 if( rHdlList.GetFocusHdl() )
293 rHdlList.ResetFocusHdl();
294 else
295 pView->UnmarkAll();
297 // Beim Bezier-Editieren ist jetzt wieder das Objekt selektiert
298 if (!pView->AreObjectsMarked())
299 pViewShell->SetDrawShell( FALSE );
301 bReturn = TRUE;
303 break;
305 case KEY_DELETE: //! ueber Accelerator
306 pView->DeleteMarked();
307 bReturn = TRUE;
308 break;
310 case KEY_RETURN:
312 if( rKEvt.GetKeyCode().GetModifier() == 0 )
314 // #98256# activate OLE object on RETURN for selected object
315 // #98198# put selected text object in edit mode
316 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
317 if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
319 BOOL bOle = pViewShell->GetViewFrame()->GetFrame()->IsInPlace();
320 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
321 if( pObj && pObj->ISA( SdrOle2Obj ) && !bOle )
323 //HMHpView->HideMarkHdl();
324 if(rKEvt.GetKeyCode().IsShift())
325 pViewShell->ActivateObject( static_cast< SdrOle2Obj* >( pObj ),
326 embed::EmbedVerbs::MS_OLEVERB_OPEN );
327 else
328 pViewShell->ActivateObject( static_cast< SdrOle2Obj* >( pObj ),
329 embed::EmbedVerbs::MS_OLEVERB_PRIMARY );
331 // consumed
332 bReturn = TRUE;
334 else if ( lcl_KeyEditMode( pObj, pViewShell, NULL ) ) // start text edit for suitable object
335 bReturn = TRUE;
339 break;
341 case KEY_F2:
343 if( rKEvt.GetKeyCode().GetModifier() == 0 )
345 // #98198# put selected text object in edit mode
346 // (this is not SID_SETINPUTMODE, but F2 hardcoded, like in Writer)
347 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
348 if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
350 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
351 if ( lcl_KeyEditMode( pObj, pViewShell, NULL ) ) // start text edit for suitable object
352 bReturn = TRUE;
356 break;
358 // #97016#
359 case KEY_TAB:
361 // in calc do NOT start draw object selection using TAB/SHIFT-TAB when
362 // there is not yet a object selected
363 if(pView->AreObjectsMarked())
365 KeyCode aCode = rKEvt.GetKeyCode();
367 if ( !aCode.IsMod1() && !aCode.IsMod2() )
369 // changeover to the next object
370 if(!pView->MarkNextObj( !aCode.IsShift() ))
372 // #97016# No next object: go over open end and
373 // get first from the other side
374 pView->UnmarkAllObj();
375 pView->MarkNextObj(!aCode.IsShift());
378 // #97016# II
379 if(pView->AreObjectsMarked())
380 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
382 bReturn = TRUE;
385 // #98994# handle Mod1 and Mod2 to get travelling running on different systems
386 if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
388 // #97016# II do something with a selected handle?
389 const SdrHdlList& rHdlList = pView->GetHdlList();
390 sal_Bool bForward(!rKEvt.GetKeyCode().IsShift());
392 ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
394 // guarantee visibility of focused handle
395 SdrHdl* pHdl = rHdlList.GetFocusHdl();
397 if(pHdl)
399 Point aHdlPosition(pHdl->GetPos());
400 Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200));
401 pView->MakeVisible(aVisRect, *pWindow);
404 // consumed
405 bReturn = TRUE;
409 break;
411 // #97016#
412 case KEY_END:
414 // in calc do NOT select the last draw object when
415 // there is not yet a object selected
416 if(pView->AreObjectsMarked())
418 KeyCode aCode = rKEvt.GetKeyCode();
420 if ( aCode.IsMod1() )
422 // #97016# mark last object
423 pView->UnmarkAllObj();
424 pView->MarkNextObj(FALSE);
426 // #97016# II
427 if(pView->AreObjectsMarked())
428 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
430 bReturn = TRUE;
434 break;
436 // #97016#
437 case KEY_HOME:
439 // in calc do NOT select the first draw object when
440 // there is not yet a object selected
441 if(pView->AreObjectsMarked())
443 KeyCode aCode = rKEvt.GetKeyCode();
445 if ( aCode.IsMod1() )
447 // #97016# mark first object
448 pView->UnmarkAllObj();
449 pView->MarkNextObj(TRUE);
451 // #97016# II
452 if(pView->AreObjectsMarked())
453 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
455 bReturn = TRUE;
459 break;
461 // #97016#
462 case KEY_UP:
463 case KEY_DOWN:
464 case KEY_LEFT:
465 case KEY_RIGHT:
467 // in calc do cursor travelling of draw objects only when
468 // there is a object selected yet
469 if(pView->AreObjectsMarked())
472 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
473 if(rMarkList.GetMarkCount() == 1)
475 // disable cursor travelling on note objects as the tail connector position
476 // must not move.
477 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
478 if( ScDrawLayer::IsNoteCaption( pObj ) )
479 break;
482 long nX = 0;
483 long nY = 0;
484 USHORT nCode = rKEvt.GetKeyCode().GetCode();
486 if (nCode == KEY_UP)
488 // Scroll nach oben
489 nX = 0;
490 nY =-1;
492 else if (nCode == KEY_DOWN)
494 // Scroll nach unten
495 nX = 0;
496 nY = 1;
498 else if (nCode == KEY_LEFT)
500 // Scroll nach links
501 nX =-1;
502 nY = 0;
504 else if (nCode == KEY_RIGHT)
506 // Scroll nach rechts
507 nX = 1;
508 nY = 0;
511 BOOL bReadOnly = rViewData.GetDocShell()->IsReadOnly();
513 if(!rKEvt.GetKeyCode().IsMod1() && !bReadOnly)
515 if(rKEvt.GetKeyCode().IsMod2())
517 // #97016# move in 1 pixel distance
518 Size aLogicSizeOnePixel = (pWindow) ? pWindow->PixelToLogic(Size(1,1)) : Size(100, 100);
519 nX *= aLogicSizeOnePixel.Width();
520 nY *= aLogicSizeOnePixel.Height();
522 else
524 // old, fixed move distance
525 nX *= 100;
526 nY *= 100;
529 // is there a movement to do?
530 if(0 != nX || 0 != nY)
532 // #97016# II
533 const SdrHdlList& rHdlList = pView->GetHdlList();
534 SdrHdl* pHdl = rHdlList.GetFocusHdl();
536 if(0L == pHdl)
538 // #107086# only take action when move is allowed
539 if(pView->IsMoveAllowed())
541 // #90129# restrict movement to WorkArea
542 const Rectangle& rWorkArea = pView->GetWorkArea();
544 if(!rWorkArea.IsEmpty())
546 Rectangle aMarkRect(pView->GetMarkedObjRect());
547 aMarkRect.Move(nX, nY);
549 if(!aMarkRect.IsInside(rWorkArea))
551 if(aMarkRect.Left() < rWorkArea.Left())
553 nX += rWorkArea.Left() - aMarkRect.Left();
556 if(aMarkRect.Right() > rWorkArea.Right())
558 nX -= aMarkRect.Right() - rWorkArea.Right();
561 if(aMarkRect.Top() < rWorkArea.Top())
563 nY += rWorkArea.Top() - aMarkRect.Top();
566 if(aMarkRect.Bottom() > rWorkArea.Bottom())
568 nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
573 // now move the selected draw objects
574 pView->MoveAllMarked(Size(nX, nY));
576 // #97016# II
577 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
579 bReturn = TRUE;
582 else
584 // move handle with index nHandleIndex
585 if(pHdl && (nX || nY))
587 // now move the Handle (nX, nY)
588 Point aStartPoint(pHdl->GetPos());
589 Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
590 const SdrDragStat& rDragStat = pView->GetDragStat();
592 // start dragging
593 pView->BegDragObj(aStartPoint, 0, pHdl, 0);
595 if(pView->IsDragObj())
597 FASTBOOL bWasNoSnap = rDragStat.IsNoSnap();
598 BOOL bWasSnapEnabled = pView->IsSnapEnabled();
600 // switch snapping off
601 if(!bWasNoSnap)
602 ((SdrDragStat&)rDragStat).SetNoSnap(TRUE);
603 if(bWasSnapEnabled)
604 pView->SetSnapEnabled(FALSE);
606 pView->MovAction(aEndPoint);
607 pView->EndDragObj();
609 // restore snap
610 if(!bWasNoSnap)
611 ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
612 if(bWasSnapEnabled)
613 pView->SetSnapEnabled(bWasSnapEnabled);
616 // make moved handle visible
617 Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
618 pView->MakeVisible(aVisRect, *pWindow);
620 bReturn = TRUE;
627 break;
629 // #97016#
630 case KEY_SPACE:
632 // in calc do only something when draw objects are selected
633 if(pView->AreObjectsMarked())
635 const SdrHdlList& rHdlList = pView->GetHdlList();
636 SdrHdl* pHdl = rHdlList.GetFocusHdl();
638 if(pHdl)
640 if(pHdl->GetKind() == HDL_POLY)
642 // rescue ID of point with focus
643 sal_uInt32 nPol(pHdl->GetPolyNum());
644 sal_uInt32 nPnt(pHdl->GetPointNum());
646 if(pView->IsPointMarked(*pHdl))
648 if(rKEvt.GetKeyCode().IsShift())
650 pView->UnmarkPoint(*pHdl);
653 else
655 if(!rKEvt.GetKeyCode().IsShift())
657 pView->UnmarkAllPoints();
660 pView->MarkPoint(*pHdl);
663 if(0L == rHdlList.GetFocusHdl())
665 // restore point with focus
666 SdrHdl* pNewOne = 0L;
668 for(sal_uInt32 a(0); !pNewOne && a < rHdlList.GetHdlCount(); a++)
670 SdrHdl* pAct = rHdlList.GetHdl(a);
672 if(pAct
673 && pAct->GetKind() == HDL_POLY
674 && pAct->GetPolyNum() == nPol
675 && pAct->GetPointNum() == nPnt)
677 pNewOne = pAct;
681 if(pNewOne)
683 ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
687 bReturn = TRUE;
692 break;
695 if (!bReturn)
697 bReturn = FuPoor::KeyInput(rKEvt);
700 if (!bReturn)
702 // #98198# allow direct typing into a selected text object
704 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
705 if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() && EditEngine::IsSimpleCharInput(rKEvt) )
707 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
709 // start text edit for suitable object, pass key event to OutlinerView
710 if ( lcl_KeyEditMode( pObj, pViewShell, &rKEvt ) )
711 bReturn = TRUE;
715 return (bReturn);
718 // #97016# II
719 void FuDraw::SelectionHasChanged()
721 const SdrHdlList& rHdlList = pView->GetHdlList();
722 ((SdrHdlList&)rHdlList).ResetFocusHdl();
725 /*************************************************************************
727 |* Vor dem Scrollen Selektionsdarstellung ausblenden
729 \************************************************************************/
731 void FuDraw::ScrollStart()
733 // HideShownXor in Gridwin
736 /*************************************************************************
738 |* Nach dem Scrollen Selektionsdarstellung wieder anzeigen
740 \************************************************************************/
742 void FuDraw::ScrollEnd()
744 // ShowShownXor in Gridwin
747 /*************************************************************************
749 |* Function aktivieren
751 \************************************************************************/
753 void FuDraw::Activate()
755 FuPoor::Activate();
758 /*************************************************************************
760 |* Function deaktivieren
762 \************************************************************************/
764 void FuDraw::Deactivate()
766 FuPoor::Deactivate();
769 /*************************************************************************
771 |* Maus-Pointer umschalten
773 \************************************************************************/
775 BOOL lcl_UrlHit( SdrView* pView, const Point& rPosPixel, Window* pWindow )
777 SdrViewEvent aVEvt;
778 MouseEvent aMEvt( rPosPixel, 1, 0, MOUSE_LEFT );
779 SdrHitKind eHit = pView->PickAnything( aMEvt, SDRMOUSEBUTTONDOWN, aVEvt );
781 if ( eHit != SDRHIT_NONE && aVEvt.pObj != NULL )
783 if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) && ScDrawLayer::GetHitIMapObject(
784 aVEvt.pObj, pWindow->PixelToLogic(rPosPixel), *pWindow ) )
785 return TRUE;
787 if ( aVEvt.eEvent == SDREVENT_EXECUTEURL )
788 return TRUE;
791 return FALSE;
794 void FuDraw::ForcePointer(const MouseEvent* pMEvt)
796 if ( !pView->IsAction() )
798 Point aPosPixel = pWindow->GetPointerPosPixel();
799 BOOL bAlt = pMEvt && pMEvt->IsMod2();
800 Point aPnt = pWindow->PixelToLogic( aPosPixel );
801 SdrHdl* pHdl = pView->PickHandle(aPnt);
802 SdrObject* pObj;
803 SdrPageView* pPV;
805 ScMacroInfo* pInfo = 0;
806 if ( pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) )
808 if ( pObj->IsGroupObject() )
810 SdrObject* pHit = 0;
811 if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
812 pObj = pHit;
814 pInfo = ScDrawLayer::GetMacroInfo( pObj );
817 if ( pView->IsTextEdit() )
819 pViewShell->SetActivePointer(Pointer(POINTER_TEXT)); // kann nicht sein ?
821 else if ( pHdl )
823 pViewShell->SetActivePointer(
824 pView->GetPreferedPointer( aPnt, pWindow ) );
826 else if ( pView->IsMarkedHit(aPnt) )
828 pViewShell->SetActivePointer( Pointer(POINTER_MOVE) );
830 else if ( !bAlt && ( !pMEvt || !pMEvt->GetButtons() )
831 && lcl_UrlHit( pView, aPosPixel, pWindow ) )
833 // kann mit ALT unterdrueckt werden
834 pWindow->SetPointer( Pointer( POINTER_REFHAND ) ); // Text-URL / ImageMap
836 else if ( !bAlt && pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
838 // kann mit ALT unterdrueckt werden
839 SdrObjMacroHitRec aHitRec; //! muss da noch irgendwas gesetzt werden ????
840 pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) );
842 else if ( !bAlt && pInfo && ((pInfo->GetMacro().getLength() > 0) || (pInfo->GetHlink().getLength() > 0)) )
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?
851 BOOL FuDraw::IsSizingOrMovingNote( const MouseEvent& rMEvt ) const
853 BOOL bIsSizingOrMoving = FALSE;
854 if ( rMEvt.IsLeft() )
856 const SdrMarkList& rNoteMarkList = pView->GetMarkedObjectList();
857 if(rNoteMarkList.GetMarkCount() == 1)
859 SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj();
860 if ( ScDrawLayer::IsNoteCaption( pObj ) )
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
869 return bIsSizingOrMoving;