xref: /AOO41X/main/sc/source/ui/drawfunc/fudraw.cxx (revision ff0525f24f03981d56b7579b645949f111420994)
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 if(rKEvt.GetKeyCode().IsShift()) // #121236# Support for shift key in calc
508                     {
509                         nX *= 1000;
510                         nY *= 1000;
511                     }
512                     else
513                     {
514                         // old, fixed move distance
515                         nX *= 100;
516                         nY *= 100;
517                     }
518 
519                     // is there a movement to do?
520                     if(0 != nX || 0 != nY)
521                     {
522                         // #97016# II
523                         const SdrHdlList& rHdlList = pView->GetHdlList();
524                         SdrHdl* pHdl = rHdlList.GetFocusHdl();
525 
526                         if(0L == pHdl)
527                         {
528                             // #107086# only take action when move is allowed
529                             if(pView->IsMoveAllowed())
530                             {
531                                 // #90129# restrict movement to WorkArea
532                                 const Rectangle& rWorkArea = pView->GetWorkArea();
533 
534                                 if(!rWorkArea.IsEmpty())
535                                 {
536                                     Rectangle aMarkRect(pView->GetMarkedObjRect());
537                                     aMarkRect.Move(nX, nY);
538 
539                                     if(!aMarkRect.IsInside(rWorkArea))
540                                     {
541                                         if(aMarkRect.Left() < rWorkArea.Left())
542                                         {
543                                             nX += rWorkArea.Left() - aMarkRect.Left();
544                                         }
545 
546                                         if(aMarkRect.Right() > rWorkArea.Right())
547                                         {
548                                             nX -= aMarkRect.Right() - rWorkArea.Right();
549                                         }
550 
551                                         if(aMarkRect.Top() < rWorkArea.Top())
552                                         {
553                                             nY += rWorkArea.Top() - aMarkRect.Top();
554                                         }
555 
556                                         if(aMarkRect.Bottom() > rWorkArea.Bottom())
557                                         {
558                                             nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
559                                         }
560                                     }
561                                 }
562 
563                                 // now move the selected draw objects
564                                 pView->MoveAllMarked(Size(nX, nY));
565 
566                                 // #97016# II
567                                 pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
568 
569                                 bReturn = sal_True;
570                             }
571                         }
572                         else
573                         {
574                             // move handle with index nHandleIndex
575                             if(pHdl && (nX || nY))
576                             {
577                                 // now move the Handle (nX, nY)
578                                 Point aStartPoint(pHdl->GetPos());
579                                 Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
580                                 const SdrDragStat& rDragStat = pView->GetDragStat();
581 
582                                 // start dragging
583                                 pView->BegDragObj(aStartPoint, 0, pHdl, 0);
584 
585                                 if(pView->IsDragObj())
586                                 {
587                                     FASTBOOL bWasNoSnap = rDragStat.IsNoSnap();
588                                     sal_Bool bWasSnapEnabled = pView->IsSnapEnabled();
589 
590                                     // switch snapping off
591                                     if(!bWasNoSnap)
592                                         ((SdrDragStat&)rDragStat).SetNoSnap(sal_True);
593                                     if(bWasSnapEnabled)
594                                         pView->SetSnapEnabled(sal_False);
595 
596                                     pView->MovAction(aEndPoint);
597                                     pView->EndDragObj();
598 
599                                     // restore snap
600                                     if(!bWasNoSnap)
601                                         ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
602                                     if(bWasSnapEnabled)
603                                         pView->SetSnapEnabled(bWasSnapEnabled);
604                                 }
605 
606                                 // make moved handle visible
607                                 Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
608                                 pView->MakeVisible(aVisRect, *pWindow);
609 
610                                 bReturn = sal_True;
611                             }
612                         }
613                     }
614                 }
615             }
616         }
617         break;
618 
619         // #97016#
620         case KEY_SPACE:
621         {
622             // in calc do only something when draw objects are selected
623             if(pView->AreObjectsMarked())
624             {
625                 const SdrHdlList& rHdlList = pView->GetHdlList();
626                 SdrHdl* pHdl = rHdlList.GetFocusHdl();
627 
628                 if(pHdl)
629                 {
630                     if(pHdl->GetKind() == HDL_POLY)
631                     {
632                         // rescue ID of point with focus
633                         sal_uInt32 nPol(pHdl->GetPolyNum());
634                         sal_uInt32 nPnt(pHdl->GetPointNum());
635 
636                         if(pView->IsPointMarked(*pHdl))
637                         {
638                             if(rKEvt.GetKeyCode().IsShift())
639                             {
640                                 pView->UnmarkPoint(*pHdl);
641                             }
642                         }
643                         else
644                         {
645                             if(!rKEvt.GetKeyCode().IsShift())
646                             {
647                                 pView->UnmarkAllPoints();
648                             }
649 
650                             pView->MarkPoint(*pHdl);
651                         }
652 
653                         if(0L == rHdlList.GetFocusHdl())
654                         {
655                             // restore point with focus
656                             SdrHdl* pNewOne = 0L;
657 
658                             for(sal_uInt32 a(0); !pNewOne && a < rHdlList.GetHdlCount(); a++)
659                             {
660                                 SdrHdl* pAct = rHdlList.GetHdl(a);
661 
662                                 if(pAct
663                                     && pAct->GetKind() == HDL_POLY
664                                     && pAct->GetPolyNum() == nPol
665                                     && pAct->GetPointNum() == nPnt)
666                                 {
667                                     pNewOne = pAct;
668                                 }
669                             }
670 
671                             if(pNewOne)
672                             {
673                                 ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
674                             }
675                         }
676 
677                         bReturn = sal_True;
678                     }
679                 }
680             }
681         }
682         break;
683     }
684 
685     if (!bReturn)
686     {
687         bReturn = FuPoor::KeyInput(rKEvt);
688     }
689 
690     if (!bReturn)
691     {
692         // #98198# allow direct typing into a selected text object
693 
694         const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
695         if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() && EditEngine::IsSimpleCharInput(rKEvt) )
696         {
697             SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
698 
699             // start text edit for suitable object, pass key event to OutlinerView
700             if ( lcl_KeyEditMode( pObj, pViewShell, &rKEvt ) )
701                 bReturn = sal_True;
702         }
703     }
704 
705     return (bReturn);
706 }
707 
708 // #97016# II
709 void FuDraw::SelectionHasChanged()
710 {
711     const SdrHdlList& rHdlList = pView->GetHdlList();
712     ((SdrHdlList&)rHdlList).ResetFocusHdl();
713 }
714 
715 /*************************************************************************
716 |*
717 |* Vor dem Scrollen Selektionsdarstellung ausblenden
718 |*
719 \************************************************************************/
720 
721 void FuDraw::ScrollStart()
722 {
723 //      HideShownXor in Gridwin
724 }
725 
726 /*************************************************************************
727 |*
728 |* Nach dem Scrollen Selektionsdarstellung wieder anzeigen
729 |*
730 \************************************************************************/
731 
732 void FuDraw::ScrollEnd()
733 {
734 //      ShowShownXor in Gridwin
735 }
736 
737 /*************************************************************************
738 |*
739 |* Function aktivieren
740 |*
741 \************************************************************************/
742 
743 void FuDraw::Activate()
744 {
745     FuPoor::Activate();
746 }
747 
748 /*************************************************************************
749 |*
750 |* Function deaktivieren
751 |*
752 \************************************************************************/
753 
754 void FuDraw::Deactivate()
755 {
756     FuPoor::Deactivate();
757 }
758 
759 /*************************************************************************
760 |*
761 |* Maus-Pointer umschalten
762 |*
763 \************************************************************************/
764 
765 sal_Bool lcl_UrlHit( SdrView* pView, const Point& rPosPixel, Window* pWindow )
766 {
767     SdrViewEvent aVEvt;
768     MouseEvent aMEvt( rPosPixel, 1, 0, MOUSE_LEFT );
769     SdrHitKind eHit = pView->PickAnything( aMEvt, SDRMOUSEBUTTONDOWN, aVEvt );
770 
771     if ( eHit != SDRHIT_NONE && aVEvt.pObj != NULL )
772     {
773         if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) && ScDrawLayer::GetHitIMapObject(
774                                 aVEvt.pObj, pWindow->PixelToLogic(rPosPixel), *pWindow ) )
775             return sal_True;
776 
777         if ( aVEvt.eEvent == SDREVENT_EXECUTEURL )
778             return sal_True;
779     }
780 
781     return sal_False;
782 }
783 
784 void FuDraw::ForcePointer(const MouseEvent* pMEvt)
785 {
786     if ( !pView->IsAction() )
787     {
788         Point aPosPixel = pWindow->GetPointerPosPixel();
789         sal_Bool bAlt       = pMEvt && pMEvt->IsMod2();
790         Point aPnt      = pWindow->PixelToLogic( aPosPixel );
791         SdrHdl* pHdl    = pView->PickHandle(aPnt);
792         SdrObject* pObj;
793         SdrPageView* pPV;
794 
795         ScMacroInfo* pInfo = 0;
796         if ( pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) )
797         {
798             if ( pObj->IsGroupObject() )
799             {
800                 SdrObject* pHit = 0;
801                 if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
802                     pObj = pHit;
803             }
804             pInfo = ScDrawLayer::GetMacroInfo( pObj );
805         }
806 
807         if ( pView->IsTextEdit() )
808         {
809             pViewShell->SetActivePointer(Pointer(POINTER_TEXT));        // kann nicht sein ?
810         }
811         else if ( pHdl )
812         {
813             pViewShell->SetActivePointer(
814                 pView->GetPreferedPointer( aPnt, pWindow ) );
815         }
816         else if ( pView->IsMarkedHit(aPnt) )
817         {
818             pViewShell->SetActivePointer( Pointer(POINTER_MOVE) );
819         }
820         else if ( !bAlt && ( !pMEvt || !pMEvt->GetButtons() )
821                         && lcl_UrlHit( pView, aPosPixel, pWindow ) )
822         {
823             //  kann mit ALT unterdrueckt werden
824             pWindow->SetPointer( Pointer( POINTER_REFHAND ) );          // Text-URL / ImageMap
825         }
826         else if ( !bAlt && pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
827         {
828             //  kann mit ALT unterdrueckt werden
829             SdrObjMacroHitRec aHitRec;  //! muss da noch irgendwas gesetzt werden ????
830             pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) );
831         }
832 #ifdef ISSUE66550_HLINK_FOR_SHAPES
833         else if ( !bAlt && pInfo && ((pInfo->GetMacro().getLength() > 0) || (pInfo->GetHlink().getLength() > 0)) )
834 #else
835         else if ( !bAlt && pInfo && (pInfo->GetMacro().getLength() > 0) )
836 #endif
837             pWindow->SetPointer( Pointer( POINTER_REFHAND ) );
838         else if ( IsDetectiveHit( aPnt ) )
839             pViewShell->SetActivePointer( Pointer( POINTER_DETECTIVE ) );
840         else
841             pViewShell->SetActivePointer( aNewPointer );            //! in Gridwin?
842     }
843 }
844 
845 sal_Bool FuDraw::IsSizingOrMovingNote( const MouseEvent& rMEvt ) const
846 {
847     sal_Bool bIsSizingOrMoving = sal_False;
848     if ( rMEvt.IsLeft() )
849     {
850         const SdrMarkList& rNoteMarkList = pView->GetMarkedObjectList();
851         if(rNoteMarkList.GetMarkCount() == 1)
852         {
853             SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj();
854             if ( ScDrawLayer::IsNoteCaption( pObj ) )
855             {
856                 Point aMPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
857                 bIsSizingOrMoving =
858                     pView->PickHandle( aMPos ) ||      // handles to resize the note
859                     pView->IsTextEditFrameHit( aMPos );         // frame for moving the note
860             }
861         }
862     }
863     return bIsSizingOrMoving;
864 }
865