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