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 #include <com/sun/star/embed/EmbedVerbs.hpp>
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->IsEffectivelyVertical() );
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  auto pOleObj = dynamic_cast<SdrOle2Obj*>(pObj);
245  if( pOleObj && !bOle )
246  {
247  rViewShell.ActivateObject(pOleObj, css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY);
248 
249  // consumed
250  bReturn = true;
251  }
252  else if ( lcl_KeyEditMode( pObj, rViewShell, nullptr ) ) // start text edit for suitable object
253  bReturn = true;
254  }
255  }
256  }
257  break;
258 
259  case KEY_F2:
260  {
261  if( rKEvt.GetKeyCode().GetModifier() == 0 )
262  {
263  // put selected text object in edit mode
264  // (this is not SID_SETINPUTMODE, but F2 hardcoded, like in Writer)
265  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
266  if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
267  {
268  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
270  // Double tapping on charts on phone may result in activating the edit mode which is not wanted.
271  // It happens due to the delay of selection message of the object from kit to javascript
272  // in that case F2 is sent instead of double click
273  if (isMobilePhone && ScDocument::IsChart(pObj))
274  {
275  rViewShell.ActivateObject(static_cast<SdrOle2Obj*>(pObj), css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY);
276  break;
277  }
278  if ( lcl_KeyEditMode( pObj, rViewShell, nullptr ) ) // start text edit for suitable object
279  bReturn = true;
280  }
281  }
282  }
283  break;
284 
285  case KEY_TAB:
286  {
287  // in calc do NOT start draw object selection using TAB/SHIFT-TAB when
288  // there is not yet an object selected
289  if(pView->AreObjectsMarked())
290  {
291  vcl::KeyCode aCode = rKEvt.GetKeyCode();
292 
293  if ( !aCode.IsMod1() && !aCode.IsMod2() )
294  {
295  // changeover to the next object
296  if(!pView->MarkNextObj( !aCode.IsShift() ))
297  {
298  //If there is only one object, don't do the UnmarkAllObj() & MarkNextObj().
300  {
301  // No next object: go over open end and
302  // get first from the other side
303  pView->UnmarkAllObj();
304  pView->MarkNextObj(!aCode.IsShift());
305  }
306  }
307 
308  // II
309  if(pView->AreObjectsMarked())
311 
312  bReturn = true;
313  }
314 
315  // handle Mod1 and Mod2 to get travelling running on different systems
316  if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
317  {
318  // II do something with a selected handle?
319  const SdrHdlList& rHdlList = pView->GetHdlList();
320  bool bForward(!rKEvt.GetKeyCode().IsShift());
321 
322  const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
323 
324  // guarantee visibility of focused handle
325  SdrHdl* pHdl = rHdlList.GetFocusHdl();
326 
327  if(pHdl)
328  {
329  Point aHdlPosition(pHdl->GetPos());
330  tools::Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200));
331  pView->MakeVisible(aVisRect, *pWindow);
332  }
333 
334  // consumed
335  bReturn = true;
336  }
337  }
338  }
339  break;
340 
341  case KEY_END:
342  {
343  // in calc do NOT select the last draw object when
344  // there is not yet an object selected
345  if(pView->AreObjectsMarked())
346  {
347  vcl::KeyCode aCode = rKEvt.GetKeyCode();
348 
349  if ( aCode.IsMod1() )
350  {
351  // mark last object
352  pView->UnmarkAllObj();
353  pView->MarkNextObj();
354 
355  // II
356  if(pView->AreObjectsMarked())
358 
359  bReturn = true;
360  }
361  }
362  }
363  break;
364 
365  case KEY_HOME:
366  {
367  // in calc do NOT select the first draw object when
368  // there is not yet an object selected
369  if(pView->AreObjectsMarked())
370  {
371  vcl::KeyCode aCode = rKEvt.GetKeyCode();
372 
373  if ( aCode.IsMod1() )
374  {
375  // mark first object
376  pView->UnmarkAllObj();
377  pView->MarkNextObj(true);
378 
379  // II
380  if(pView->AreObjectsMarked())
382 
383  bReturn = true;
384  }
385  }
386  }
387  break;
388 
389  case KEY_UP:
390  case KEY_DOWN:
391  case KEY_LEFT:
392  case KEY_RIGHT:
393  {
394  // in calc do cursor travelling of draw objects only when
395  // there is an object selected yet
396  if(pView->AreObjectsMarked())
397  {
398 
399  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
400  if(rMarkList.GetMarkCount() == 1)
401  {
402  // disable cursor travelling on note objects as the tail connector position
403  // must not move.
404  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
405  if( ScDrawLayer::IsNoteCaption( pObj ) )
406  break;
407  }
408 
409  tools::Long nX = 0;
410  tools::Long nY = 0;
411  sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
412 
413  if (nCode == KEY_UP)
414  {
415  // scroll up
416  nX = 0;
417  nY =-1;
418  }
419  else if (nCode == KEY_DOWN)
420  {
421  // scroll down
422  nX = 0;
423  nY = 1;
424  }
425  else if (nCode == KEY_LEFT)
426  {
427  // scroll left
428  nX =-1;
429  nY = 0;
430  }
431  else if (nCode == KEY_RIGHT)
432  {
433  // scroll right
434  nX = 1;
435  nY = 0;
436  }
437 
438  bool bReadOnly = rViewData.GetDocShell()->IsReadOnly();
439 
440  if(!rKEvt.GetKeyCode().IsMod1() && !bReadOnly)
441  {
442  if(rKEvt.GetKeyCode().IsMod2())
443  {
444  // move in 1 pixel distance
445  Size aLogicSizeOnePixel = pWindow ? pWindow->PixelToLogic(Size(1,1)) : Size(100, 100);
446  nX *= aLogicSizeOnePixel.Width();
447  nY *= aLogicSizeOnePixel.Height();
448  }
449  else if(rKEvt.GetKeyCode().IsShift()) // #i121236# Support for shift key in calc
450  {
451  nX *= 1000;
452  nY *= 1000;
453  }
454  else
455  {
456  // old, fixed move distance
457  nX *= 100;
458  nY *= 100;
459  }
460 
461  // is there a movement to do?
462  if(0 != nX || 0 != nY)
463  {
464  // II
465  const SdrHdlList& rHdlList = pView->GetHdlList();
466  SdrHdl* pHdl = rHdlList.GetFocusHdl();
467 
468  if(nullptr == pHdl)
469  {
470  // only take action when move is allowed
471  if(pView->IsMoveAllowed())
472  {
473  // restrict movement to WorkArea
474  const tools::Rectangle& rWorkArea = pView->GetWorkArea();
475 
476  if(!rWorkArea.IsEmpty())
477  {
479  aMarkRect.Move(nX, nY);
480 
481  if(!aMarkRect.IsInside(rWorkArea))
482  {
483  if(aMarkRect.Left() < rWorkArea.Left())
484  {
485  nX += rWorkArea.Left() - aMarkRect.Left();
486  }
487 
488  if(aMarkRect.Right() > rWorkArea.Right())
489  {
490  nX -= aMarkRect.Right() - rWorkArea.Right();
491  }
492 
493  if(aMarkRect.Top() < rWorkArea.Top())
494  {
495  nY += rWorkArea.Top() - aMarkRect.Top();
496  }
497 
498  if(aMarkRect.Bottom() > rWorkArea.Bottom())
499  {
500  nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
501  }
502  }
503  }
504 
505  // now move the selected draw objects
506  pView->MoveAllMarked(Size(nX, nY));
507 
508  // II
510 
511  bReturn = true;
512  }
513  }
514  else
515  {
516  // move handle with index nHandleIndex
517  if (nX || nY)
518  {
519  // now move the Handle (nX, nY)
520  Point aStartPoint(pHdl->GetPos());
521  Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
522  const SdrDragStat& rDragStat = pView->GetDragStat();
523 
524  // start dragging
525  pView->BegDragObj(aStartPoint, nullptr, pHdl, 0);
526 
527  if(pView->IsDragObj())
528  {
529  bool bWasNoSnap = rDragStat.IsNoSnap();
530  bool bWasSnapEnabled = pView->IsSnapEnabled();
531 
532  // switch snapping off
533  if(!bWasNoSnap)
534  const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
535  if(bWasSnapEnabled)
536  pView->SetSnapEnabled(false);
537 
538  pView->MovAction(aEndPoint);
539  pView->EndDragObj();
540 
541  // restore snap
542  if(!bWasNoSnap)
543  const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
544  if(bWasSnapEnabled)
545  pView->SetSnapEnabled(bWasSnapEnabled);
546  }
547 
548  // make moved handle visible
549  tools::Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
550  pView->MakeVisible(aVisRect, *pWindow);
551 
552  bReturn = true;
553  }
554  }
555  }
556  }
557  }
558  }
559  break;
560 
561  case KEY_SPACE:
562  {
563  // in calc do only something when draw objects are selected
564  if(pView->AreObjectsMarked())
565  {
566  const SdrHdlList& rHdlList = pView->GetHdlList();
567  SdrHdl* pHdl = rHdlList.GetFocusHdl();
568 
569  if(pHdl)
570  {
571  if(pHdl->GetKind() == SdrHdlKind::Poly)
572  {
573  // rescue ID of point with focus
574  sal_uInt32 nPol(pHdl->GetPolyNum());
575  sal_uInt32 nPnt(pHdl->GetPointNum());
576 
577  if(pView->IsPointMarked(*pHdl))
578  {
579  if(rKEvt.GetKeyCode().IsShift())
580  {
581  pView->UnmarkPoint(*pHdl);
582  }
583  }
584  else
585  {
586  if(!rKEvt.GetKeyCode().IsShift())
587  {
589  }
590 
591  pView->MarkPoint(*pHdl);
592  }
593 
594  if(nullptr == rHdlList.GetFocusHdl())
595  {
596  // restore point with focus
597  SdrHdl* pNewOne = nullptr;
598 
599  for(size_t a = 0; !pNewOne && a < rHdlList.GetHdlCount(); ++a)
600  {
601  SdrHdl* pAct = rHdlList.GetHdl(a);
602 
603  if(pAct
604  && pAct->GetKind() == SdrHdlKind::Poly
605  && pAct->GetPolyNum() == nPol
606  && pAct->GetPointNum() == nPnt)
607  {
608  pNewOne = pAct;
609  }
610  }
611 
612  if(pNewOne)
613  {
614  const_cast<SdrHdlList&>(rHdlList).SetFocusHdl(pNewOne);
615  }
616  }
617 
618  bReturn = true;
619  }
620  }
621  }
622  }
623  break;
624  }
625 
626  if (!bReturn)
627  {
628  bReturn = FuPoor::KeyInput(rKEvt);
629  }
630 
631  if (!bReturn)
632  {
633  // allow direct typing into a selected text object
634 
635  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
636  if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() && EditEngine::IsSimpleCharInput(rKEvt) )
637  {
638  SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
639 
640  // start text edit for suitable object, pass key event to OutlinerView
641  if ( lcl_KeyEditMode( pObj, rViewShell, &rKEvt ) )
642  bReturn = true;
643  }
644  }
645 
646  return bReturn;
647 }
648 
649 // toggle mouse-pointer
650 static bool lcl_UrlHit( const SdrView* pView, const Point& rPosPixel, const vcl::Window* pWindow )
651 {
652  SdrViewEvent aVEvt;
653  MouseEvent aMEvt( rPosPixel, 1, MouseEventModifiers::NONE, MOUSE_LEFT );
654  SdrHitKind eHit = pView->PickAnything( aMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt );
655 
656  if (eHit != SdrHitKind::NONE && aVEvt.mpObj != nullptr)
657  {
659  aVEvt.mpObj, pWindow->PixelToLogic(rPosPixel), pWindow->GetOutDev() ) )
660  return true;
661 
662  if (aVEvt.meEvent == SdrEventKind::ExecuteUrl)
663  return true;
664  }
665 
666  return false;
667 }
668 
670 {
671  if ( pView->IsAction() )
672  return;
673 
674  Point aPosPixel = pWindow->GetPointerPosPixel();
675  bool bAlt = pMEvt && pMEvt->IsMod2();
676  Point aPnt = pWindow->PixelToLogic( aPosPixel );
677  SdrHdl* pHdl = pView->PickHandle(aPnt);
678  SdrPageView* pPV;
679  SdrObject* pMacroPickObj;
680 
681  ScMacroInfo* pInfo = nullptr;
682  SdrObject* pObj = pView->PickObj(aPnt, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER);
683  if (pObj)
684  {
685  if ( pObj->IsGroupObject() )
686  {
687  SdrObject* pHit = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::DEEP);
688  if (pHit)
689  pObj = pHit;
690  }
691  pInfo = ScDrawLayer::GetMacroInfo( pObj );
692  }
693 
694  if ( pView->IsTextEdit() )
695  {
696  rViewShell.SetActivePointer(PointerStyle::Text); // can't be ?
697  }
698  else if ( pHdl )
699  {
702  }
703  else if ( pView->IsMarkedHit(aPnt) )
704  {
705  rViewShell.SetActivePointer( PointerStyle::Move );
706  }
707  else if ( !bAlt && ( !pMEvt || !pMEvt->GetButtons() )
708  && lcl_UrlHit( pView, aPosPixel, pWindow ) )
709  {
710  // could be suppressed with ALT
711  pWindow->SetPointer( PointerStyle::RefHand ); // Text-URL / ImageMap
712  }
713  else if ( !bAlt && (pMacroPickObj = pView->PickObj(aPnt, pView->getHitTolLog(), pPV, SdrSearchOptions::PICKMACRO)) )
714  {
715  // could be suppressed with ALT
716  SdrObjMacroHitRec aHitRec;
717  rViewShell.SetActivePointer(pMacroPickObj->GetMacroPointer(aHitRec));
718  }
719  else if ( !bAlt && pInfo && (!pInfo->GetMacro().isEmpty() || !pObj->getHyperlink().isEmpty()) )
720  pWindow->SetPointer( PointerStyle::RefHand );
721  else if ( IsDetectiveHit( aPnt ) )
722  rViewShell.SetActivePointer( PointerStyle::Detective );
723  else
724  {
725  const bool bIsThemed = rViewShell.GetViewData().IsThemedCursor();
726  rViewShell.SetActivePointer( bIsThemed ? PointerStyle::FatCross : PointerStyle::Arrow );
727  }
728 }
729 
731 {
732  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
733  const size_t backval=rMarkList.GetMarkCount();
734  for (size_t nlv1=0; nlv1<backval; ++nlv1)
735  {
736  SdrObject* pObj = rMarkList.GetMark( nlv1 )->GetMarkedSdrObj();
737  if ( ScDrawLayer::IsNoteCaption( pObj ) )
738  {
739  return true;
740  }
741  }
742  return false;
743 }
744 
745 bool FuDraw::IsSizingOrMovingNote( const MouseEvent& rMEvt ) const
746 {
747  bool bIsSizingOrMoving = false;
748  if ( rMEvt.IsLeft() )
749  {
750  const SdrMarkList& rNoteMarkList = pView->GetMarkedObjectList();
751  if(rNoteMarkList.GetMarkCount() == 1)
752  {
753  SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj();
754  if ( ScDrawLayer::IsNoteCaption( pObj ) )
755  {
756  Point aMPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
757  bIsSizingOrMoving =
758  pView->PickHandle( aMPos ) || // handles to resize the note
759  pView->IsTextEditFrameHit( aMPos ); // frame for moving the note
760  }
761  }
762  }
763  return bIsSizingOrMoving;
764 }
765 
766 /* 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:316
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:353
size_t GetMarkCount() const
sal_uInt32 GetPolyNum() const
PointerStyle GetPreferredPointer(const Point &rMousePos, const OutputDevice *pOut, sal_uInt16 nModifier=0, bool bLeftDown=false) const
bool isLOKMobilePhone() const
const OUString & GetMacro() const
Definition: userdat.hxx:82
bool HasMarkableObj() const
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: fudraw.cxx:190
constexpr tools::Long Left() const
virtual ~FuDraw() override
Definition: fudraw.cxx:67
bool AreObjectsMarked() const
static ScMacroInfo * GetMacroInfo(SdrObject *pObj, bool bCreate=false)
Definition: drwlayer.cxx:2634
const SdrDragStat & GetDragStat() const
long Long
bool EndDragObj(bool bCopy=false)
static bool IsSimpleCharInput(const KeyEvent &rKeyEvent)
sal_uInt32 GetPointNum() const
const ::avmedia::MediaItem * Execute(const SdrMarkView *pSdrView, SfxRequest const &rReq)
bool IsShift() const
virtual bool doConstructOrthogonal() const
Definition: fupoor.cxx:240
sal_uInt16 GetCode() const
const OUString & getHyperlink() 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
constexpr tools::Long Width() 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:858
bool IsOrtho() const
sal_uInt16 GetButtons() const
void SetMouseButtonCode(sal_uInt16 nNew)
Definition: fupoor.hxx:70
bool HasMultipleMarkableObjects() const
static IMapObject * GetHitIMapObject(const SdrObject *pObj, const Point &rWinPoint, const OutputDevice *pCmpWnd=nullptr)
SfxFrame & GetFrame() const
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: fudraw.cxx:137
void SetResizeAtCenter(bool bOn)
constexpr sal_uInt16 KEY_F2
bool IsDetectiveHit(const Point &rLogicPos)
Definition: fupoor.cxx:184
bool IsDrawTextShell() const
Definition: tabvwsh4.cxx:1006
sal_uInt16 GetModifier() const
ScTabViewShell & rViewShell
Definition: fupoor.hxx:43
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:333
sal_uInt16 GetSlotID() const
Definition: fupoor.hxx:90
void SetSnapEnabled(bool bOn)
#define MOUSE_LEFT
constexpr bool IsEmpty() const
bool IsSizingOrMovingNote(const MouseEvent &rMEvt) const
Definition: fudraw.cxx:745
Base class for Text functions.
Definition: futext.hxx:27
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:893
void ResetModifiers()
Definition: fudraw.cxx:102
bool IsSnapEnabled() const
const SdrMarkList & GetMarkedObjectList() const
bool IsAngleSnapEnabled() const
constexpr tools::Long Right() const
void SetDrawShell(bool bActive)
Definition: tabvwsh4.cxx:611
SdrHdl * PickHandle(const Point &rPnt) const
constexpr tools::Long Top() 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:47
Point PixelToLogic(const Point &rDevicePt) const
static bool lcl_UrlHit(const SdrView *pView, const Point &rPosPixel, const vcl::Window *pWindow)
Definition: fudraw.cxx:650
Base class for all functions.
Definition: fupoor.hxx:39
bool MarkNextObj(bool bPrev=false)
Point aMDPos
Definition: fupoor.hxx:57
const tools::Rectangle & GetAllMarkedRect() const
bool IsReadOnly() const
constexpr sal_uInt16 KEY_RETURN
ScDBFunc * GetView() const
Definition: viewdata.cxx:861
constexpr sal_uInt16 KEY_RIGHT
constexpr tools::Long Bottom() const
void ActivateObject(SdrOle2Obj *pObj, sal_Int32 nVerb)
Definition: tabvwshb.cxx:145
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 IsEffectivelyVertical() const
bool IsShift() const
bool UnmarkAllPoints()
virtual bool IsTextEdit() const final override
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const
bool IsInPlace() const
constexpr tools::Long Height() const
SdrObject * mpObj
constexpr sal_uInt16 KEY_ESCAPE
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: fudraw.cxx:128
::OutputDevice const * GetOutDev() const
void SetOrtho(bool bOn)
bool IsLeft() const
SfxDispatcher & GetDispatcher()
Definition: viewdata.cxx:3102
FuPoor * GetDrawFuncPtr()
Definition: tabview.hxx:321
bool IsGridSnap() const
bool IsMod1() const
ScDrawView * pView
Definition: fupoor.hxx:42
const ScViewOptions & GetOptions() const
Definition: viewdata.hxx:544
bool IsThemedCursor() const
Definition: viewdata.hxx:556
bool IsPointMarked(const SdrHdl &rHdl) const
const Point & GetPosPixel() const
PointerStyle
static bool IsChart(const SdrObject *pObject)
Definition: documen9.cxx:203
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:2622
void SetInEditMode(SdrObject *pObj=nullptr, const Point *pMousePixel=nullptr, bool bCursorToEnd=false, const KeyEvent *pInitialKey=nullptr)
Definition: futext.cxx:534
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)
SdrEventKind meEvent
std::map< OUString, OUString > aParameters
virtual bool MarkPoint(SdrHdl &rHdl, bool bUnmark=false)
bool IsEditingANote() const
Definition: fudraw.cxx:730
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:844
virtual OutlinerParaObject * GetOutlinerParaObject() const
const tools::Rectangle & GetWorkArea() const
VclPtr< vcl::Window > pWindow
Definition: fupoor.hxx:44
constexpr sal_uInt16 KEY_TAB
SdrHdlKind GetKind() const
virtual void ForcePointer(const MouseEvent *pMEvt)
Definition: fudraw.cxx:669
bool IsMod2() const
static SvxIMapInfo * GetIMapInfo(const SdrObject *pObject)