LibreOffice Module sc (master)  1
fudraw.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <editeng/editeng.hxx>
21 #include <editeng/outlobj.hxx>
22 #include <svx/svdobj.hxx>
23 #include <svx/svdoole2.hxx>
24 #include <svx/svdouno.hxx>
25 #include <svx/ImageMapInfo.hxx>
26 #include <sfx2/dispatch.hxx>
27 #include <sfx2/viewfrm.hxx>
28 #include <vcl/uitest/logger.hxx>
30 
31 #include <sc.hrc>
32 #include <fudraw.hxx>
33 #include <futext.hxx>
34 #include <tabvwsh.hxx>
35 #include <drwlayer.hxx>
36 #include <userdat.hxx>
37 #include <docsh.hxx>
38 #include <drawview.hxx>
39 #include <comphelper/lok.hxx>
40 
41 namespace
42 {
43 
44 void collectUIInformation( const OUString& aevent )
45 {
46  EventDescription aDescription;
47  aDescription.aID = "grid_window";
48  aDescription.aParameters = {{ aevent , ""}};
49  aDescription.aAction = "COMMENT";
50  aDescription.aParent = "MainWindow";
51  aDescription.aKeyWord = "ScGridWinUIObject";
52  UITestLogger::getInstance().logEvent(aDescription);
53 }
54 
55 }
56 
57 // base class for draw module specific functions
59  SdrModel* pDoc, const SfxRequest& rReq)
60  : FuPoor(rViewSh, pWin, pViewP, pDoc, rReq)
61  , aNewPointer(PointerStyle::Arrow)
62  , aOldPointer(PointerStyle::Arrow)
63 {
64 }
65 
67 {
68 }
69 
70 void FuDraw::DoModifiers(const MouseEvent& rMEvt)
71 {
72  // Shift = Ortho and AngleSnap
73  // Control = Snap (Toggle)
74  // Alt = centric
75 
76  bool bShift = rMEvt.IsShift();
77  bool bAlt = rMEvt.IsMod2();
78 
79  bool bOrtho = bShift;
80  bool bAngleSnap = bShift;
81  bool bCenter = bAlt;
82 
83  // #i33136#
85  {
86  bOrtho = !bShift;
87  }
88 
89  if (pView->IsOrtho() != bOrtho)
90  pView->SetOrtho(bOrtho);
91  if (pView->IsAngleSnapEnabled() != bAngleSnap)
92  pView->SetAngleSnapEnabled(bAngleSnap);
93 
94  if (pView->IsCreate1stPointAsCenter() != bCenter)
96  if (pView->IsResizeAtCenter() != bCenter)
97  pView->SetResizeAtCenter(bCenter);
98 
99 }
100 
102 {
103  if (!pView)
104  return;
105 
106  ScViewData& rViewData = rViewShell.GetViewData();
107  const ScViewOptions& rOpt = rViewData.GetOptions();
108  const ScGridOptions& rGrid = rOpt.GetGridOptions();
109  bool bGridOpt = rGrid.GetUseGridSnap();
110 
111  if (pView->IsOrtho())
112  pView->SetOrtho(false);
113  if (pView->IsAngleSnapEnabled())
114  pView->SetAngleSnapEnabled(false);
115 
116  if (pView->IsGridSnap() != bGridOpt)
117  pView->SetGridSnap(bGridOpt);
118  if (pView->IsSnapEnabled() != bGridOpt)
119  pView->SetSnapEnabled(bGridOpt);
120 
123  if (pView->IsResizeAtCenter())
124  pView->SetResizeAtCenter(false);
125 }
126 
128 {
129  // remember button state for creation of own MouseEvents
131 
132  DoModifiers( rMEvt );
133  return false;
134 }
135 
136 bool FuDraw::MouseMove(const MouseEvent& rMEvt)
137 {
138  // evaluate modifiers only if in a drawing layer action
139  // (don't interfere with keyboard shortcut handling)
140  if (pView->IsAction())
141  DoModifiers( rMEvt );
142 
143  return false;
144 }
145 
147 {
148  // remember button state for creation of own MouseEvents
150 
151  ResetModifiers();
152  return false;
153 }
154 
155 // Process Keyboard events. Return true if an event is being handled
156 static bool lcl_KeyEditMode( SdrObject* pObj, ScTabViewShell& rViewShell, const KeyEvent* pInitialKey )
157 {
158  bool bReturn = false;
159  if ( dynamic_cast<const SdrTextObj*>( pObj) != nullptr && dynamic_cast<const SdrUnoObj*>( pObj) == nullptr )
160  {
161  // start text edit - like FuSelection::MouseButtonUp,
162  // but with bCursorToEnd instead of mouse position
163 
165  bool bVertical = ( pOPO && pOPO->IsVertical() );
166  sal_uInt16 nTextSlotId = bVertical ? SID_DRAW_TEXT_VERTICAL : SID_DRAW_TEXT;
167 
168  // don't switch shells if text shell is already active
169  FuPoor* pPoor = rViewShell.GetViewData().GetView()->GetDrawFuncPtr();
170  if ( !pPoor || pPoor->GetSlotID() != nTextSlotId )
171  {
172  rViewShell.GetViewData().GetDispatcher().
173  Execute(nTextSlotId, SfxCallMode::SYNCHRON | SfxCallMode::RECORD);
174  }
175 
176  // get the resulting FuText and set in edit mode
177  pPoor = rViewShell.GetViewData().GetView()->GetDrawFuncPtr();
178  if ( pPoor && pPoor->GetSlotID() == nTextSlotId ) // no RTTI
179  {
180  FuText* pText = static_cast<FuText*>(pPoor);
181  pText->SetInEditMode( pObj, nullptr, true, pInitialKey );
183  }
184  bReturn = true;
185  }
186  return bReturn;
187 }
188 
189 bool FuDraw::KeyInput(const KeyEvent& rKEvt)
190 {
191  bool bReturn = false;
192  ScViewData& rViewData = rViewShell.GetViewData();
193 
194  switch ( rKEvt.GetKeyCode().GetCode() )
195  {
196  case KEY_ESCAPE:
197  if ( rViewShell.IsDrawTextShell() || aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT )
198  {
199  collectUIInformation("CLOSE");
200  // if object selected -> normal draw-shell, else turn off drawing
201  rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
202  bReturn = true;
203  }
204  else if ( rViewShell.IsDrawSelMode() )
205  {
206  pView->UnmarkAll();
207  rViewData.GetDispatcher().Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD);
208  bReturn = true;
209  }
210  else if ( pView->AreObjectsMarked() )
211  {
212  // III
213  SdrHdlList& rHdlList = const_cast< SdrHdlList& >( pView->GetHdlList() );
214  if( rHdlList.GetFocusHdl() )
215  rHdlList.ResetFocusHdl();
216  else
217  pView->UnmarkAll();
218 
219  // while bezier editing, object is selected
220  if (!pView->AreObjectsMarked())
221  rViewShell.SetDrawShell( false );
222 
223  bReturn = true;
224  }
225  break;
226 
227  case KEY_DELETE:
228  pView->DeleteMarked();
229  bReturn = true;
230  break;
231 
232  case KEY_RETURN:
233  {
234  if( rKEvt.GetKeyCode().GetModifier() == 0 )
235  {
236  // activate OLE object on RETURN for selected object
237  // put selected text object in edit mode
238  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
239  if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
240  {
241  bool bOle = rViewShell.GetViewFrame()->GetFrame().IsInPlace();
242  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
243  if( dynamic_cast<const SdrOle2Obj*>( pObj) && !bOle )
244  {
245  rViewShell.ActivateObject( static_cast< SdrOle2Obj* >( pObj ), 0 );
246 
247  // consumed
248  bReturn = true;
249  }
250  else if ( lcl_KeyEditMode( pObj, rViewShell, nullptr ) ) // start text edit for suitable object
251  bReturn = true;
252  }
253  }
254  }
255  break;
256 
257  case KEY_F2:
258  {
259  if( rKEvt.GetKeyCode().GetModifier() == 0 )
260  {
261  // put selected text object in edit mode
262  // (this is not SID_SETINPUTMODE, but F2 hardcoded, like in Writer)
263  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
264  if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
265  {
266  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
268  // Double tapping on charts on phone may result in activating the edit mode which is not wanted.
269  // It happens due to the delay of selection message of the object from kit to javascript
270  // in that case F2 is sent instead of double click
271  if (isMobilePhone && ScDocument::IsChart(pObj))
272  {
273  rViewShell.ActivateObject( static_cast< SdrOle2Obj* >( pObj ), 0 );
274  break;
275  }
276  if ( lcl_KeyEditMode( pObj, rViewShell, nullptr ) ) // start text edit for suitable object
277  bReturn = true;
278  }
279  }
280  }
281  break;
282 
283  case KEY_TAB:
284  {
285  // in calc do NOT start draw object selection using TAB/SHIFT-TAB when
286  // there is not yet an object selected
287  if(pView->AreObjectsMarked())
288  {
289  vcl::KeyCode aCode = rKEvt.GetKeyCode();
290 
291  if ( !aCode.IsMod1() && !aCode.IsMod2() )
292  {
293  // changeover to the next object
294  if(!pView->MarkNextObj( !aCode.IsShift() ))
295  {
296  //If there is only one object, don't do the UnmarkAllObj() & MarkNextObj().
298  {
299  // No next object: go over open end and
300  // get first from the other side
301  pView->UnmarkAllObj();
302  pView->MarkNextObj(!aCode.IsShift());
303  }
304  }
305 
306  // II
307  if(pView->AreObjectsMarked())
309 
310  bReturn = true;
311  }
312 
313  // handle Mod1 and Mod2 to get travelling running on different systems
314  if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
315  {
316  // II do something with a selected handle?
317  const SdrHdlList& rHdlList = pView->GetHdlList();
318  bool bForward(!rKEvt.GetKeyCode().IsShift());
319 
320  const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
321 
322  // guarantee visibility of focused handle
323  SdrHdl* pHdl = rHdlList.GetFocusHdl();
324 
325  if(pHdl)
326  {
327  Point aHdlPosition(pHdl->GetPos());
328  tools::Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200));
329  pView->MakeVisible(aVisRect, *pWindow);
330  }
331 
332  // consumed
333  bReturn = true;
334  }
335  }
336  }
337  break;
338 
339  case KEY_END:
340  {
341  // in calc do NOT select the last draw object when
342  // there is not yet an object selected
343  if(pView->AreObjectsMarked())
344  {
345  vcl::KeyCode aCode = rKEvt.GetKeyCode();
346 
347  if ( aCode.IsMod1() )
348  {
349  // mark last object
350  pView->UnmarkAllObj();
351  pView->MarkNextObj();
352 
353  // II
354  if(pView->AreObjectsMarked())
356 
357  bReturn = true;
358  }
359  }
360  }
361  break;
362 
363  case KEY_HOME:
364  {
365  // in calc do NOT select the first draw object when
366  // there is not yet an object selected
367  if(pView->AreObjectsMarked())
368  {
369  vcl::KeyCode aCode = rKEvt.GetKeyCode();
370 
371  if ( aCode.IsMod1() )
372  {
373  // mark first object
374  pView->UnmarkAllObj();
375  pView->MarkNextObj(true);
376 
377  // II
378  if(pView->AreObjectsMarked())
380 
381  bReturn = true;
382  }
383  }
384  }
385  break;
386 
387  case KEY_UP:
388  case KEY_DOWN:
389  case KEY_LEFT:
390  case KEY_RIGHT:
391  {
392  // in calc do cursor travelling of draw objects only when
393  // there is an object selected yet
394  if(pView->AreObjectsMarked())
395  {
396 
397  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
398  if(rMarkList.GetMarkCount() == 1)
399  {
400  // disable cursor travelling on note objects as the tail connector position
401  // must not move.
402  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
403  if( ScDrawLayer::IsNoteCaption( pObj ) )
404  break;
405  }
406 
407  tools::Long nX = 0;
408  tools::Long nY = 0;
409  sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
410 
411  if (nCode == KEY_UP)
412  {
413  // scroll up
414  nX = 0;
415  nY =-1;
416  }
417  else if (nCode == KEY_DOWN)
418  {
419  // scroll down
420  nX = 0;
421  nY = 1;
422  }
423  else if (nCode == KEY_LEFT)
424  {
425  // scroll left
426  nX =-1;
427  nY = 0;
428  }
429  else if (nCode == KEY_RIGHT)
430  {
431  // scroll right
432  nX = 1;
433  nY = 0;
434  }
435 
436  bool bReadOnly = rViewData.GetDocShell()->IsReadOnly();
437 
438  if(!rKEvt.GetKeyCode().IsMod1() && !bReadOnly)
439  {
440  if(rKEvt.GetKeyCode().IsMod2())
441  {
442  // move in 1 pixel distance
443  Size aLogicSizeOnePixel = pWindow ? pWindow->PixelToLogic(Size(1,1)) : Size(100, 100);
444  nX *= aLogicSizeOnePixel.Width();
445  nY *= aLogicSizeOnePixel.Height();
446  }
447  else if(rKEvt.GetKeyCode().IsShift()) // #i121236# Support for shift key in calc
448  {
449  nX *= 1000;
450  nY *= 1000;
451  }
452  else
453  {
454  // old, fixed move distance
455  nX *= 100;
456  nY *= 100;
457  }
458 
459  // is there a movement to do?
460  if(0 != nX || 0 != nY)
461  {
462  // II
463  const SdrHdlList& rHdlList = pView->GetHdlList();
464  SdrHdl* pHdl = rHdlList.GetFocusHdl();
465 
466  if(nullptr == pHdl)
467  {
468  // only take action when move is allowed
469  if(pView->IsMoveAllowed())
470  {
471  // restrict movement to WorkArea
472  const tools::Rectangle& rWorkArea = pView->GetWorkArea();
473 
474  if(!rWorkArea.IsEmpty())
475  {
477  aMarkRect.Move(nX, nY);
478 
479  if(!aMarkRect.IsInside(rWorkArea))
480  {
481  if(aMarkRect.Left() < rWorkArea.Left())
482  {
483  nX += rWorkArea.Left() - aMarkRect.Left();
484  }
485 
486  if(aMarkRect.Right() > rWorkArea.Right())
487  {
488  nX -= aMarkRect.Right() - rWorkArea.Right();
489  }
490 
491  if(aMarkRect.Top() < rWorkArea.Top())
492  {
493  nY += rWorkArea.Top() - aMarkRect.Top();
494  }
495 
496  if(aMarkRect.Bottom() > rWorkArea.Bottom())
497  {
498  nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
499  }
500  }
501  }
502 
503  // now move the selected draw objects
504  pView->MoveAllMarked(Size(nX, nY));
505 
506  // II
508 
509  bReturn = true;
510  }
511  }
512  else
513  {
514  // move handle with index nHandleIndex
515  if (nX || nY)
516  {
517  // now move the Handle (nX, nY)
518  Point aStartPoint(pHdl->GetPos());
519  Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
520  const SdrDragStat& rDragStat = pView->GetDragStat();
521 
522  // start dragging
523  pView->BegDragObj(aStartPoint, nullptr, pHdl, 0);
524 
525  if(pView->IsDragObj())
526  {
527  bool bWasNoSnap = rDragStat.IsNoSnap();
528  bool bWasSnapEnabled = pView->IsSnapEnabled();
529 
530  // switch snapping off
531  if(!bWasNoSnap)
532  const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
533  if(bWasSnapEnabled)
534  pView->SetSnapEnabled(false);
535 
536  pView->MovAction(aEndPoint);
537  pView->EndDragObj();
538 
539  // restore snap
540  if(!bWasNoSnap)
541  const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
542  if(bWasSnapEnabled)
543  pView->SetSnapEnabled(bWasSnapEnabled);
544  }
545 
546  // make moved handle visible
547  tools::Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
548  pView->MakeVisible(aVisRect, *pWindow);
549 
550  bReturn = true;
551  }
552  }
553  }
554  }
555  }
556  }
557  break;
558 
559  case KEY_SPACE:
560  {
561  // in calc do only something when draw objects are selected
562  if(pView->AreObjectsMarked())
563  {
564  const SdrHdlList& rHdlList = pView->GetHdlList();
565  SdrHdl* pHdl = rHdlList.GetFocusHdl();
566 
567  if(pHdl)
568  {
569  if(pHdl->GetKind() == SdrHdlKind::Poly)
570  {
571  // rescue ID of point with focus
572  sal_uInt32 nPol(pHdl->GetPolyNum());
573  sal_uInt32 nPnt(pHdl->GetPointNum());
574 
575  if(pView->IsPointMarked(*pHdl))
576  {
577  if(rKEvt.GetKeyCode().IsShift())
578  {
579  pView->UnmarkPoint(*pHdl);
580  }
581  }
582  else
583  {
584  if(!rKEvt.GetKeyCode().IsShift())
585  {
587  }
588 
589  pView->MarkPoint(*pHdl);
590  }
591 
592  if(nullptr == rHdlList.GetFocusHdl())
593  {
594  // restore point with focus
595  SdrHdl* pNewOne = nullptr;
596 
597  for(size_t a = 0; !pNewOne && a < rHdlList.GetHdlCount(); ++a)
598  {
599  SdrHdl* pAct = rHdlList.GetHdl(a);
600 
601  if(pAct
602  && pAct->GetKind() == SdrHdlKind::Poly
603  && pAct->GetPolyNum() == nPol
604  && pAct->GetPointNum() == nPnt)
605  {
606  pNewOne = pAct;
607  }
608  }
609 
610  if(pNewOne)
611  {
612  const_cast<SdrHdlList&>(rHdlList).SetFocusHdl(pNewOne);
613  }
614  }
615 
616  bReturn = true;
617  }
618  }
619  }
620  }
621  break;
622  }
623 
624  if (!bReturn)
625  {
626  bReturn = FuPoor::KeyInput(rKEvt);
627  }
628 
629  if (!bReturn)
630  {
631  // allow direct typing into a selected text object
632 
633  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
634  if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() && EditEngine::IsSimpleCharInput(rKEvt) )
635  {
636  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
637 
638  // start text edit for suitable object, pass key event to OutlinerView
639  if ( lcl_KeyEditMode( pObj, rViewShell, &rKEvt ) )
640  bReturn = true;
641  }
642  }
643 
644  return bReturn;
645 }
646 
647 // toggle mouse-pointer
648 static bool lcl_UrlHit( const SdrView* pView, const Point& rPosPixel, const vcl::Window* pWindow )
649 {
650  SdrViewEvent aVEvt;
651  MouseEvent aMEvt( rPosPixel, 1, MouseEventModifiers::NONE, MOUSE_LEFT );
652  SdrHitKind eHit = pView->PickAnything( aMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt );
653 
654  if ( eHit != SdrHitKind::NONE && aVEvt.pObj != nullptr )
655  {
657  aVEvt.pObj, pWindow->PixelToLogic(rPosPixel), pWindow ) )
658  return true;
659 
660  if ( aVEvt.eEvent == SdrEventKind::ExecuteUrl )
661  return true;
662  }
663 
664  return false;
665 }
666 
668 {
669  if ( pView->IsAction() )
670  return;
671 
672  Point aPosPixel = pWindow->GetPointerPosPixel();
673  bool bAlt = pMEvt && pMEvt->IsMod2();
674  Point aPnt = pWindow->PixelToLogic( aPosPixel );
675  SdrHdl* pHdl = pView->PickHandle(aPnt);
676  SdrPageView* pPV;
677 
678  ScMacroInfo* pInfo = nullptr;
679  SdrObject* pObj = pView->PickObj(aPnt, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER);
680  if (pObj)
681  {
682  if ( pObj->IsGroupObject() )
683  {
684  SdrObject* pHit = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::DEEP);
685  if (pHit)
686  pObj = pHit;
687  }
688  pInfo = ScDrawLayer::GetMacroInfo( pObj );
689  }
690 
691  if ( pView->IsTextEdit() )
692  {
693  rViewShell.SetActivePointer(PointerStyle::Text); // can't be ?
694  }
695  else if ( pHdl )
696  {
698  pView->GetPreferredPointer( aPnt, pWindow ) );
699  }
700  else if ( pView->IsMarkedHit(aPnt) )
701  {
702  rViewShell.SetActivePointer( PointerStyle::Move );
703  }
704  else if ( !bAlt && ( !pMEvt || !pMEvt->GetButtons() )
705  && lcl_UrlHit( pView, aPosPixel, pWindow ) )
706  {
707  // could be suppressed with ALT
708  pWindow->SetPointer( PointerStyle::RefHand ); // Text-URL / ImageMap
709  }
710  else if ( !bAlt && (pObj = pView->PickObj(aPnt, pView->getHitTolLog(), pPV, SdrSearchOptions::PICKMACRO)) )
711  {
712  // could be suppressed with ALT
713  SdrObjMacroHitRec aHitRec;
714  rViewShell.SetActivePointer( pObj->GetMacroPointer(aHitRec) );
715  }
716  else if ( !bAlt && pInfo && (!pInfo->GetMacro().isEmpty() || !pInfo->GetHlink().isEmpty()) )
717  pWindow->SetPointer( PointerStyle::RefHand );
718  else if ( IsDetectiveHit( aPnt ) )
719  rViewShell.SetActivePointer( PointerStyle::Detective );
720  else
722 }
723 
725 {
726  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
727  const size_t backval=rMarkList.GetMarkCount();
728  for (size_t nlv1=0; nlv1<backval; ++nlv1)
729  {
730  SdrObject* pObj = rMarkList.GetMark( nlv1 )->GetMarkedSdrObj();
731  if ( ScDrawLayer::IsNoteCaption( pObj ) )
732  {
733  return true;
734  }
735  }
736  return false;
737 }
738 
739 bool FuDraw::IsSizingOrMovingNote( const MouseEvent& rMEvt ) const
740 {
741  bool bIsSizingOrMoving = false;
742  if ( rMEvt.IsLeft() )
743  {
744  const SdrMarkList& rNoteMarkList = pView->GetMarkedObjectList();
745  if(rNoteMarkList.GetMarkCount() == 1)
746  {
747  SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj();
748  if ( ScDrawLayer::IsNoteCaption( pObj ) )
749  {
750  Point aMPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
751  bIsSizingOrMoving =
752  pView->PickHandle( aMPos ) || // handles to resize the note
753  pView->IsTextEditFrameHit( aMPos ); // frame for moving the note
754  }
755  }
756  }
757  return bIsSizingOrMoving;
758 }
759 
760 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
bool UnmarkPoint(SdrHdl &rHdl)
Point GetPointerPosPixel()
bool IsDrawSelMode() const
Definition: tabview.hxx:317
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
size_t GetMarkCount() const
sal_uInt32 GetPolyNum() const
PointerStyle GetPreferredPointer(const Point &rMousePos, const OutputDevice *pOut, sal_uInt16 nModifier=0, bool bLeftDown=false) const
void ActivateObject(SdrOle2Obj *pObj, tools::Long nVerb)
Definition: tabvwshb.cxx:145
bool isLOKMobilePhone() const
const OUString & GetMacro() const
Definition: userdat.hxx:83
bool HasMarkableObj() const
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: fudraw.cxx:189
virtual ~FuDraw() override
Definition: fudraw.cxx:66
bool IsVertical() const
bool AreObjectsMarked() const
static ScMacroInfo * GetMacroInfo(SdrObject *pObj, bool bCreate=false)
Definition: drwlayer.cxx:2524
const SdrDragStat & GetDragStat() const
long Long
bool EndDragObj(bool bCopy=false)
static bool IsSimpleCharInput(const KeyEvent &rKeyEvent)
sal_uInt32 GetPointNum() const
bool IsShift() const
virtual bool doConstructOrthogonal() const
Definition: fupoor.cxx:240
sal_uInt16 GetCode() const
SdrMark * GetMark(size_t nNum) const
const Point & GetPos() const
SdrHitKind PickAnything(const MouseEvent &rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent &rVEvt) const
bool IsResizeAtCenter() const
constexpr sal_uInt16 KEY_SPACE
bool bReadOnly
bool IsMoveAllowed() const
void ResetFocusHdl()
constexpr sal_uInt16 KEY_UP
const tools::Rectangle & GetMarkedObjRect() const
constexpr sal_uInt16 KEY_END
bool IsEmpty() const
static UITestLogger & getInstance()
void SetGridSnap(bool bOn)
void logEvent(const EventDescription &rDescription)
virtual void MovAction(const Point &rPnt) override
bool IsTextEditFrameHit(const Point &rHit) const
virtual void DeleteMarked() override
Definition: drawview.cxx:854
bool IsOrtho() const
sal_uInt16 GetButtons() const
tools::Long Left() const
void SetMouseButtonCode(sal_uInt16 nNew)
Definition: fupoor.hxx:71
bool HasMultipleMarkableObjects() const
SfxFrame & GetFrame() const
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: fudraw.cxx:136
tools::Long Bottom() const
void SetResizeAtCenter(bool bOn)
constexpr sal_uInt16 KEY_F2
bool IsDetectiveHit(const Point &rLogicPos)
Definition: fupoor.cxx:184
bool IsDrawTextShell() const
Definition: tabvwsh4.cxx:988
sal_uInt16 GetModifier() const
ScTabViewShell & rViewShell
Definition: fupoor.hxx:44
bool IsMarkedHit(const Point &rPnt, short nTol=-2) const
void UnmarkAll()
sal_uInt16 nCode
virtual bool KeyInput(const KeyEvent &rKEvt)
Definition: fupoor.cxx:135
ScViewData & GetViewData()
Definition: tabview.hxx:334
sal_uInt16 GetSlotID() const
Definition: fupoor.hxx:91
void SetSnapEnabled(bool bOn)
#define MOUSE_LEFT
bool IsSizingOrMovingNote(const MouseEvent &rMEvt) const
Definition: fudraw.cxx:739
Base class for Text functions.
Definition: futext.hxx:28
constexpr sal_uInt16 KEY_DOWN
SdrObject * GetMarkedSdrObj() const
SdrHitKind
SdrObject * PickObj(const Point &rPnt, short nTol, SdrPageView *&rpPV, SdrSearchOptions nOptions, SdrObject **ppRootObj, bool *pbHitPassDirect=nullptr) const
static bool lcl_KeyEditMode(SdrObject *pObj, ScTabViewShell &rViewShell, const KeyEvent *pInitialKey)
Definition: fudraw.cxx:156
bool GetUseGridSnap() const
uno_Any a
bool IsMod2() const
constexpr sal_uInt16 KEY_HOME
void SetActivePointer(PointerStyle nPointer)
Definition: tabview.cxx:892
void ResetModifiers()
Definition: fudraw.cxx:101
bool IsSnapEnabled() const
SdrEventKind eEvent
const SdrMarkList & GetMarkedObjectList() const
bool IsAngleSnapEnabled() const
tools::Long Width() const
void SetDrawShell(bool bActive)
Definition: tabvwsh4.cxx:593
SdrHdl * PickHandle(const Point &rPnt) const
bool IsGroupObject() const
const ScGridOptions & GetGridOptions() const
Definition: viewopti.hxx:96
bool IsCreate1stPointAsCenter() const
void DoModifiers(const MouseEvent &rMEvt)
Definition: fudraw.cxx:70
SfxRequest aSfxRequest
Definition: fupoor.hxx:48
static bool lcl_UrlHit(const SdrView *pView, const Point &rPosPixel, const vcl::Window *pWindow)
Definition: fudraw.cxx:648
tools::Long Top() const
Base class for all functions.
Definition: fupoor.hxx:40
bool MarkNextObj(bool bPrev=false)
Point aMDPos
Definition: fupoor.hxx:58
const tools::Rectangle & GetAllMarkedRect() const
bool IsReadOnly() const
constexpr sal_uInt16 KEY_RETURN
ScDBFunc * GetView() const
Definition: viewdata.cxx:852
constexpr sal_uInt16 KEY_RIGHT
Point PixelToLogic(const Point &rDevicePt) const
SdrHdl * GetFocusHdl() const
virtual bool IsAction() const override
void SetAngleSnapEnabled(bool bOn)
size_t GetHdlCount() const
void SetPointer(PointerStyle)
SdrHdl * GetHdl(size_t nNum) const
const vcl::KeyCode & GetKeyCode() const
sal_uInt16 GetSlot() const
bool IsShift() const
bool UnmarkAllPoints()
virtual bool IsTextEdit() const final override
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const
static IMapObject * GetHitIMapObject(const SdrObject *pObj, const Point &rWinPoint, const vcl::Window *rCmpWnd=nullptr)
bool IsInPlace() const
constexpr sal_uInt16 KEY_ESCAPE
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: fudraw.cxx:127
void SetOrtho(bool bOn)
bool IsLeft() const
SfxDispatcher & GetDispatcher()
Definition: viewdata.cxx:3040
FuPoor * GetDrawFuncPtr()
Definition: tabview.hxx:322
bool IsGridSnap() const
bool IsMod1() const
ScDrawView * pView
Definition: fupoor.hxx:43
tools::Long Height() const
const ScViewOptions & GetOptions() const
Definition: viewdata.hxx:537
bool IsPointMarked(const SdrHdl &rHdl) const
const Point & GetPosPixel() const
SdrObject * pObj
PointerStyle
static bool IsChart(const SdrObject *pObject)
Definition: documen9.cxx:201
PointerStyle aNewPointer
Definition: fudraw.hxx:31
FuDraw(ScTabViewShell &rViewSh, vcl::Window *pWin, ScDrawView *pView, SdrModel *pDoc, const SfxRequest &rReq)
Definition: fudraw.cxx:58
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
bool IsDragObj() const
static bool IsNoteCaption(SdrObject *pObj)
Returns true, if the passed object is the caption of a cell note.
Definition: drwlayer.cxx:2512
void SetInEditMode(SdrObject *pObj=nullptr, const Point *pMousePixel=nullptr, bool bCursorToEnd=false, const KeyEvent *pInitialKey=nullptr)
Definition: futext.cxx:533
const OUString & GetHlink() const
Definition: userdat.hxx:86
constexpr sal_uInt16 KEY_DELETE
virtual bool BegDragObj(const Point &rPnt, OutputDevice *pOut, SdrHdl *pHdl, short nMinMov=-3, SdrDragMethod *pForcedMeth=nullptr) override
constexpr sal_uInt16 KEY_LEFT
const SdrHdlList & GetHdlList() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
std::map< OUString, OUString > aParameters
virtual bool MarkPoint(SdrHdl &rHdl, bool bUnmark=false)
bool IsEditingANote() const
Definition: fudraw.cxx:724
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: fudraw.cxx:146
void SetCreate1stPointAsCenter(bool bOn)
void MoveAllMarked(const Size &rSiz, bool bCopy=false)
sal_uInt16 getHitTolLog() const
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin) override
Definition: drawview.cxx:840
virtual OutlinerParaObject * GetOutlinerParaObject() const
const tools::Rectangle & GetWorkArea() const
VclPtr< vcl::Window > pWindow
Definition: fupoor.hxx:45
tools::Long Right() const
constexpr sal_uInt16 KEY_TAB
SdrHdlKind GetKind() const
virtual void ForcePointer(const MouseEvent *pMEvt)
Definition: fudraw.cxx:667
bool IsMod2() const
static SvxIMapInfo * GetIMapInfo(const SdrObject *pObject)