LibreOffice Module svx (master)  1
graphctl.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 <config_wasm_strip.h>
21 
22 #include <svl/itempool.hxx>
23 #include <vcl/settings.hxx>
24 #include <vcl/ptrstyle.hxx>
25 #include <vcl/svapp.hxx>
26 
27 #include <svx/graphctl.hxx>
30 #include <svx/svxids.hrc>
31 #include <svx/svdpage.hxx>
32 #include <svx/sdrpaintwindow.hxx>
33 
34 void GraphCtrlUserCall::Changed( const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& /*rOldBoundRect*/ )
35 {
36  switch( eType )
37  {
40  rWin.SdrObjChanged( rObj );
41  break;
42 
44  rWin.SdrObjCreated( rObj );
45  break;
46 
47  default:
48  break;
49  }
51 }
52 
54  : aUpdateIdle("svx GraphCtrl Update")
55  , aMap100(MapUnit::Map100thMM)
56  , eObjKind(SdrObjKind::NONE)
57  , nPolyEdit(0)
58  , bEditMode(false)
59  , mbSdrMode(false)
60  , mbInIdleUpdate(false)
61  , mpDialog(pDialog)
62 {
63  pUserCall.reset(new GraphCtrlUserCall( *this ));
64  aUpdateIdle.SetPriority( TaskPriority::LOWEST );
65  aUpdateIdle.SetInvokeHandler( LINK( this, GraphCtrl, UpdateHdl ) );
67 }
68 
70 {
72  EnableRTL(false);
73 }
74 
76 {
77  aUpdateIdle.Stop();
78 
79 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
80  if( mpAccContext.is() )
81  {
82  mpAccContext->disposing();
83  mpAccContext.clear();
84  }
85 #endif
86 
87  pView.reset();
88  pModel.reset();
89  pUserCall.reset();
90 }
91 
92 void GraphCtrl::SetSdrMode(bool bSdrMode)
93 {
94  mbSdrMode = bSdrMode;
95 
96  const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
98  rDevice.SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
99  xVD->SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
100  rDevice.SetMapMode( aMap100 );
101  xVD->SetMapMode( aMap100 );
102 
103  pView.reset();
104  pModel.reset();
105 
106  if ( mbSdrMode )
107  InitSdrModel();
108 
109  QueueIdleUpdate();
110 }
111 
113 {
114  SolarMutexGuard aGuard;
115 
117 
118  // destroy old junk
119  pView.reset();
120  pModel.reset();
121 
122  // Creating a Model
123  pModel.reset(new SdrModel(nullptr, nullptr, true));
124  pModel->GetItemPool().FreezeIdRanges();
125  pModel->SetScaleUnit( aMap100.GetMapUnit() );
126  pModel->SetScaleFraction( Fraction( 1, 1 ) );
127  pModel->SetDefaultFontHeight( 500 );
128 
129  pPage = new SdrPage( *pModel );
130 
131  pPage->SetSize( aGraphSize );
132  pPage->SetBorder( 0, 0, 0, 0 );
133  pModel->InsertPage( pPage.get() );
134  pModel->SetChanged( false );
135 
136  // Creating a View
137  pView.reset(new GraphCtrlView(*pModel, this));
138  pView->SetWorkArea( tools::Rectangle( Point(), aGraphSize ) );
139  pView->EnableExtendedMouseEventDispatcher( true );
140  pView->ShowSdrPage(pView->GetModel()->GetPage(0));
141  pView->SetFrameDragSingles();
142  pView->SetMarkedPointsSmooth( SdrPathSmoothKind::Symmetric );
143  pView->SetEditMode();
144 
145  // #i72889# set needed flags
146  pView->SetPagePaintingAllowed(false);
147  pView->SetBufferedOutputAllowed(true);
148  pView->SetBufferedOverlayAllowed(true);
149 
150 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
151  // Tell the accessibility object about the changes.
152  if (mpAccContext.is())
153  mpAccContext->setModelAndView (pModel.get(), pView.get());
154 #endif
155 }
156 
157 void GraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel )
158 {
159  aGraphic = rGraphic;
160  xVD->SetOutputSizePixel(Size(0, 0)); //force redraw
161 
162  if ( aGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
164  else
166 
167  if ( mbSdrMode && bNewModel )
168  InitSdrModel();
169 
170  aGraphSizeLink.Call( this );
171 
172  Resize();
173 
174  Invalidate();
175  QueueIdleUpdate();
176 }
177 
179 {
181  xVD->SetOutputSizePixel(GetOutputSizePixel());
182  xVD->SetBackground(rDevice.GetBackground());
183  xVD->Erase();
184  const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType());
185  if (bGraphicValid)
187 }
188 
190 {
192 
193  if (aGraphSize.Width() && aGraphSize.Height())
194  {
195  MapMode aDisplayMap( aMap100 );
196  Point aNewPos;
197  Size aNewSize;
199  const Size aWinSize = rDevice.PixelToLogic( GetOutputSizePixel(), aDisplayMap );
200  const tools::Long nWidth = aWinSize.Width();
201  const tools::Long nHeight = aWinSize.Height();
202  double fGrfWH = static_cast<double>(aGraphSize.Width()) / aGraphSize.Height();
203  double fWinWH = static_cast<double>(nWidth) / nHeight;
204 
205  // Adapt Bitmap to Thumb size
206  if ( fGrfWH < fWinWH)
207  {
208  aNewSize.setWidth( static_cast<tools::Long>( static_cast<double>(nHeight) * fGrfWH ) );
209  aNewSize.setHeight( nHeight );
210  }
211  else
212  {
213  aNewSize.setWidth( nWidth );
214  aNewSize.setHeight( static_cast<tools::Long>( static_cast<double>(nWidth) / fGrfWH ) );
215  }
216 
217  aNewPos.setX( ( nWidth - aNewSize.Width() ) >> 1 );
218  aNewPos.setY( ( nHeight - aNewSize.Height() ) >> 1 );
219 
220  // Implementing MapMode for Engine
221  aDisplayMap.SetScaleX( Fraction( aNewSize.Width(), aGraphSize.Width() ) );
222  aDisplayMap.SetScaleY( Fraction( aNewSize.Height(), aGraphSize.Height() ) );
223 
224  aDisplayMap.SetOrigin( OutputDevice::LogicToLogic( aNewPos, aMap100, aDisplayMap ) );
225  rDevice.SetMapMode( aDisplayMap );
226  xVD->SetMapMode( aDisplayMap );
227  }
228 
229  Invalidate();
230 }
231 
232 void GraphCtrl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
233 {
234  // #i72889# used split repaint to be able to paint an own background
235  // even to the buffered view
236  const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType());
237 
238  if (GetOutputSizePixel() != xVD->GetOutputSizePixel())
239  GraphicToVD();
240 
241  if (mbSdrMode)
242  {
243  SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(&rRenderContext);
244  pPaintWindow->SetOutputToWindow(true);
245 
246  if (bGraphicValid)
247  {
249 
251  rTarget.SetBackground(rDevice.GetBackground());
252  rTarget.Erase();
253 
254  rTarget.DrawOutDev(Point(), xVD->GetOutputSize(), Point(), xVD->GetOutputSize(), *xVD);
255  }
256 
257  const vcl::Region aRepaintRegion(rRect);
258  pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
259  pView->EndCompleteRedraw(*pPaintWindow, true);
260  }
261  else
262  {
263  // #i73381# in non-SdrMode, paint to local directly
264  rRenderContext.DrawOutDev(rRect.TopLeft(), rRect.GetSize(),
265  rRect.TopLeft(), rRect.GetSize(),
266  *xVD);
267  }
268 }
269 
271 {
272  QueueIdleUpdate();
273 }
274 
276 {
277  QueueIdleUpdate();
278 }
279 
281 {
282  QueueIdleUpdate();
283 }
284 
285 bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
286 {
287  vcl::KeyCode aCode( rKEvt.GetKeyCode() );
288  bool bProc = false;
289 
291 
292  switch ( aCode.GetCode() )
293  {
294  case KEY_DELETE:
295  case KEY_BACKSPACE:
296  {
297  if ( mbSdrMode )
298  {
299  pView->DeleteMarked();
300  bProc = true;
301  }
302  }
303  break;
304 
305  case KEY_ESCAPE:
306  {
307  if ( mbSdrMode )
308  {
309  if ( pView->IsAction() )
310  {
311  pView->BrkAction();
312  bProc = true;
313  }
314  else if ( pView->AreObjectsMarked() )
315  {
316  pView->UnmarkAllObj();
317  bProc = true;
318  }
319  }
320  }
321  break;
322 
323  case KEY_F11:
324  case KEY_TAB:
325  {
326  if( mbSdrMode )
327  {
328  if( !aCode.IsMod1() && !aCode.IsMod2() )
329  {
330  bool bForward = !aCode.IsShift();
331  // select next object
332  if ( ! pView->MarkNextObj( bForward ))
333  {
334  // At first or last object. Cycle to the other end
335  // of the list.
336  pView->UnmarkAllObj();
337  pView->MarkNextObj (bForward);
338  }
339  bProc = true;
340  }
341  else if(aCode.IsMod1())
342  {
343  // select next handle
344  const SdrHdlList& rHdlList = pView->GetHdlList();
345  bool bForward(!aCode.IsShift());
346 
347  const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
348 
349  bProc = true;
350  }
351  }
352  }
353  break;
354 
355  case KEY_END:
356  {
357 
358  if ( aCode.IsMod1() )
359  {
360  // mark last object
361  pView->UnmarkAllObj();
362  pView->MarkNextObj();
363 
364  bProc = true;
365  }
366  }
367  break;
368 
369  case KEY_HOME:
370  {
371  if ( aCode.IsMod1() )
372  {
373  pView->UnmarkAllObj();
374  pView->MarkNextObj(true);
375 
376  bProc = true;
377  }
378  }
379  break;
380 
381  case KEY_UP:
382  case KEY_DOWN:
383  case KEY_LEFT:
384  case KEY_RIGHT:
385  {
386  tools::Long nX = 0;
387  tools::Long nY = 0;
388 
389  if (aCode.GetCode() == KEY_UP)
390  {
391  // Scroll up
392  nX = 0;
393  nY =-1;
394  }
395  else if (aCode.GetCode() == KEY_DOWN)
396  {
397  // Scroll down
398  nX = 0;
399  nY = 1;
400  }
401  else if (aCode.GetCode() == KEY_LEFT)
402  {
403  // Scroll left
404  nX =-1;
405  nY = 0;
406  }
407  else if (aCode.GetCode() == KEY_RIGHT)
408  {
409  // Scroll right
410  nX = 1;
411  nY = 0;
412  }
413 
414  if (pView->AreObjectsMarked() && !aCode.IsMod1() )
415  {
416  if(aCode.IsMod2())
417  {
418  // move in 1 pixel distance
419  Size aLogicSizeOnePixel = rDevice.PixelToLogic(Size(1,1));
420  nX *= aLogicSizeOnePixel.Width();
421  nY *= aLogicSizeOnePixel.Height();
422  }
423  else
424  {
425  // old, fixed move distance
426  nX *= 100;
427  nY *= 100;
428  }
429 
430  // II
431  const SdrHdlList& rHdlList = pView->GetHdlList();
432  SdrHdl* pHdl = rHdlList.GetFocusHdl();
433 
434  if(nullptr == pHdl)
435  {
436  // restrict movement to WorkArea
437  const tools::Rectangle& rWorkArea = pView->GetWorkArea();
438 
439  if(!rWorkArea.IsEmpty())
440  {
441  tools::Rectangle aMarkRect(pView->GetMarkedObjRect());
442  aMarkRect.Move(nX, nY);
443 
444  if(!aMarkRect.Contains(rWorkArea))
445  {
446  if(aMarkRect.Left() < rWorkArea.Left())
447  {
448  nX += rWorkArea.Left() - aMarkRect.Left();
449  }
450 
451  if(aMarkRect.Right() > rWorkArea.Right())
452  {
453  nX -= aMarkRect.Right() - rWorkArea.Right();
454  }
455 
456  if(aMarkRect.Top() < rWorkArea.Top())
457  {
458  nY += rWorkArea.Top() - aMarkRect.Top();
459  }
460 
461  if(aMarkRect.Bottom() > rWorkArea.Bottom())
462  {
463  nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
464  }
465  }
466  }
467 
468  // no handle selected
469  if(0 != nX || 0 != nY)
470  {
471  pView->MoveAllMarked(Size(nX, nY));
472  }
473  }
474  else
475  {
476  // move handle with index nHandleIndex
477  if (nX || nY)
478  {
479  // now move the Handle (nX, nY)
480  Point aStartPoint(pHdl->GetPos());
481  Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
482  const SdrDragStat& rDragStat = pView->GetDragStat();
483 
484  // start dragging
485  pView->BegDragObj(aStartPoint, nullptr, pHdl, 0);
486 
487  if(pView->IsDragObj())
488  {
489  bool bWasNoSnap = rDragStat.IsNoSnap();
490  bool bWasSnapEnabled = pView->IsSnapEnabled();
491 
492  // switch snapping off
493  if(!bWasNoSnap)
494  const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
495  if(bWasSnapEnabled)
496  pView->SetSnapEnabled(false);
497 
498  pView->MovAction(aEndPoint);
499  pView->EndDragObj();
500 
501  // restore snap
502  if(!bWasNoSnap)
503  const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
504  if(bWasSnapEnabled)
505  pView->SetSnapEnabled(bWasSnapEnabled);
506  }
507  }
508  }
509 
510  bProc = true;
511  }
512  }
513  break;
514 
515  case KEY_SPACE:
516  {
517  const SdrHdlList& rHdlList = pView->GetHdlList();
518  SdrHdl* pHdl = rHdlList.GetFocusHdl();
519 
520  if(pHdl)
521  {
522  if(pHdl->GetKind() == SdrHdlKind::Poly)
523  {
524  // rescue ID of point with focus
525  sal_uInt32 nPol(pHdl->GetPolyNum());
526  sal_uInt32 nPnt(pHdl->GetPointNum());
527 
528  if(pView->IsPointMarked(*pHdl))
529  {
530  if(rKEvt.GetKeyCode().IsShift())
531  {
532  pView->UnmarkPoint(*pHdl);
533  }
534  }
535  else
536  {
537  if(!rKEvt.GetKeyCode().IsShift())
538  {
539  pView->UnmarkAllPoints();
540  }
541 
542  pView->MarkPoint(*pHdl);
543  }
544 
545  if(nullptr == rHdlList.GetFocusHdl())
546  {
547  // restore point with focus
548  SdrHdl* pNewOne = nullptr;
549 
550  for(size_t a = 0; !pNewOne && a < rHdlList.GetHdlCount(); ++a)
551  {
552  SdrHdl* pAct = rHdlList.GetHdl(a);
553 
554  if(pAct
555  && pAct->GetKind() == SdrHdlKind::Poly
556  && pAct->GetPolyNum() == nPol
557  && pAct->GetPointNum() == nPnt)
558  {
559  pNewOne = pAct;
560  }
561  }
562 
563  if(pNewOne)
564  {
565  const_cast<SdrHdlList&>(rHdlList).SetFocusHdl(pNewOne);
566  }
567  }
568 
569  bProc = true;
570  }
571  }
572  }
573  break;
574 
575  default:
576  break;
577  }
578 
579  if (bProc)
580  ReleaseMouse();
581 
582  QueueIdleUpdate();
583 
584  return bProc;
585 }
586 
588 {
589  if ( mbSdrMode && ( rMEvt.GetClicks() < 2 ) )
590  {
592 
593  const Point aLogPt( rDevice.PixelToLogic( rMEvt.GetPosPixel() ) );
594 
595  if ( !tools::Rectangle( Point(), aGraphSize ).Contains( aLogPt ) && !pView->IsEditMode() )
597  else
598  {
599  // Get Focus for key inputs
600  GrabFocus();
601 
602  if ( nPolyEdit )
603  {
604  SdrViewEvent aVEvt;
605  SdrHitKind eHit = pView->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt );
606 
607  if ( nPolyEdit == SID_BEZIER_INSERT && eHit == SdrHitKind::MarkedObject )
608  pView->BegInsObjPoint( aLogPt, rMEvt.IsMod1());
609  else
610  pView->MouseButtonDown( rMEvt, &rDevice );
611  }
612  else
613  pView->MouseButtonDown( rMEvt, &rDevice );
614  }
615 
616  SdrObject* pCreateObj = pView->GetCreateObj();
617 
618  // We want to realize the insert
619  if ( pCreateObj && !pCreateObj->GetUserCall() )
620  pCreateObj->SetUserCall( pUserCall.get() );
621 
622  SetPointer( pView->GetPreferredPointer( aLogPt, &rDevice ) );
623  }
624  else
626 
627  QueueIdleUpdate();
628 
629  return false;
630 }
631 
633 {
635  const Point aLogPos( rDevice.PixelToLogic( rMEvt.GetPosPixel() ) );
636 
637  if ( mbSdrMode )
638  {
639  pView->MouseMove( rMEvt, &rDevice );
640 
641  if( ( SID_BEZIER_INSERT == nPolyEdit ) &&
642  !pView->PickHandle( aLogPos ) &&
643  !pView->IsInsObjPoint() )
644  {
645  SetPointer( PointerStyle::Cross );
646  }
647  else
648  SetPointer( pView->GetPreferredPointer( aLogPos, &rDevice ) );
649  }
650  else
652 
653  if ( aMousePosLink.IsSet() )
654  {
655  if ( tools::Rectangle( Point(), aGraphSize ).Contains( aLogPos ) )
656  aMousePos = aLogPos;
657  else
658  aMousePos = Point();
659 
660  aMousePosLink.Call( this );
661  }
662 
663  QueueIdleUpdate();
664 
665  return false;
666 }
667 
669 {
670  if ( mbSdrMode )
671  {
673 
674  if ( pView->IsInsObjPoint() )
675  pView->EndInsObjPoint( SdrCreateCmd::ForceEnd );
676  else
677  pView->MouseButtonUp( rMEvt, &rDevice );
678 
679  ReleaseMouse();
680  SetPointer( pView->GetPreferredPointer( rDevice.PixelToLogic( rMEvt.GetPosPixel() ), &rDevice ) );
681  }
682  else
684 
685  QueueIdleUpdate();
686 
687  return false;
688 }
689 
691 {
692  SdrObject* pSdrObj = nullptr;
693 
694  if ( mbSdrMode )
695  {
696  const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
697 
698  if ( rMarkList.GetMarkCount() == 1 )
699  pSdrObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
700  }
701 
702  return pSdrObj;
703 }
704 
705 void GraphCtrl::SetEditMode( const bool _bEditMode )
706 {
707  if ( mbSdrMode )
708  {
709  bEditMode = _bEditMode;
710  pView->SetEditMode( bEditMode );
712  pView->SetCurrentObj(eObjKind);
713  }
714  else
715  bEditMode = false;
716 
717  QueueIdleUpdate();
718 }
719 
720 void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit )
721 {
722  if ( mbSdrMode && ( _nPolyEdit != nPolyEdit ) )
723  {
724  nPolyEdit = _nPolyEdit;
725  pView->SetFrameDragSingles( nPolyEdit == 0 );
726  }
727  else
728  nPolyEdit = 0;
729 
730  QueueIdleUpdate();
731 }
732 
733 void GraphCtrl::SetObjKind( const SdrObjKind _eObjKind )
734 {
735  if ( mbSdrMode )
736  {
737  bEditMode = false;
738  pView->SetEditMode( bEditMode );
739  eObjKind = _eObjKind;
740  pView->SetCurrentObj(eObjKind);
741  }
742  else
744 
745  QueueIdleUpdate();
746 }
747 
748 IMPL_LINK_NOARG(GraphCtrl, UpdateHdl, Timer *, void)
749 {
750  mbInIdleUpdate = true;
751  aUpdateLink.Call( this );
752  mbInIdleUpdate = false;
753 }
754 
756 {
757  if (!mbInIdleUpdate)
758  aUpdateIdle.Start();
759 }
760 
761 namespace
762 {
763  class WeldOverlayManager final : public sdr::overlay::OverlayManager
764  {
765  weld::CustomWidgetController& m_rGraphCtrl;
766 
767  public:
768  WeldOverlayManager(weld::CustomWidgetController& rGraphCtrl, OutputDevice& rDevice)
769  : OverlayManager(rDevice)
770  , m_rGraphCtrl(rGraphCtrl)
771  {
772  }
773 
774  // invalidate the given range at local OutputDevice
775  virtual void invalidateRange(const basegfx::B2DRange& rRange) override
776  {
777  tools::Rectangle aInvalidateRectangle(RangeToInvalidateRectangle(rRange));
778  m_rGraphCtrl.Invalidate(aInvalidateRectangle);
779  }
780  };
781 }
782 
784 {
785  assert(&rDevice == &rGraphCtrl.GetDrawingArea()->get_ref_device());
786  if (rDevice.GetOutDevType() == OUTDEV_VIRDEV)
787  {
788  rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager(new WeldOverlayManager(rGraphCtrl, rDevice));
789  InitOverlayManager(xOverlayManager);
790  return xOverlayManager;
791  }
792  return SdrView::CreateOverlayManager(rDevice);
793 }
794 
796 {
797  assert(&rDevice == &rGraphCtrl.GetDrawingArea()->get_ref_device());
798  if (rDevice.GetOutDevType() == OUTDEV_VIRDEV)
799  {
801  return;
802  }
803  SdrView::InvalidateOneWin(rDevice);
804 }
805 
807 {
808  assert(&rDevice == &rGraphCtrl.GetDrawingArea()->get_ref_device());
809  if (rDevice.GetOutDevType() == OUTDEV_VIRDEV)
810  {
811  rGraphCtrl.Invalidate(rArea);
812  return;
813  }
814  SdrView::InvalidateOneWin(rDevice, rArea);
815 }
816 
818 {
819  // turn SetOutputToWindow back off again before
820  // turning back into our baseclass during dtoring
821  const sal_uInt32 nWindowCount(PaintWindowCount());
822  for (sal_uInt32 nWinNum(0); nWinNum < nWindowCount; nWinNum++)
823  {
824  SdrPaintWindow* pPaintWindow = GetPaintWindow(nWinNum);
825  pPaintWindow->SetOutputToWindow(false);
826  }
827 }
828 
830 {
831  int x, y, width, height;
832  if (GetDrawingArea()->get_extents_relative_to(*mpDialog, x, y, width, height))
833  return Point(x, y);
834  return Point();
835 }
836 
837 css::uno::Reference< css::accessibility::XAccessible > GraphCtrl::CreateAccessible()
838 {
839 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
840  if(mpAccContext == nullptr )
841  {
842  // Disable accessibility if no model/view data available
843  if (pView && pModel)
845  }
846 #endif
847  return mpAccContext;
848 }
849 
850 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< GraphCtrlUserCall > pUserCall
Definition: graphctl.hxx:60
OutDevType GetOutDevType() const
const Wallpaper & GetBackground() const
sal_uInt16 nPolyEdit
Definition: graphctl.hxx:62
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: graphctl.cxx:69
size_t GetMarkCount() const
Definition: svdmark.hxx:178
sal_uInt32 GetPolyNum() const
Definition: svdhdl.hxx:219
std::unique_ptr< SdrModel > pModel
Definition: graphctl.hxx:74
GraphCtrl(weld::Dialog *pDialog)
Definition: graphctl.cxx:53
void QueueIdleUpdate()
Definition: graphctl.cxx:755
void setWidth(tools::Long nWidth)
OUTDEV_VIRDEV
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Left() const
bool Contains(const Point &rPOINT) const
long Long
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
virtual rtl::Reference< sdr::overlay::OverlayManager > CreateOverlayManager(OutputDevice &rDevice) const override
Definition: graphctl.cxx:783
SdrUserCallType
Definition: svdobj.hxx:113
FilterGroup & rTarget
virtual bool MouseButtonUp(const MouseEvent &)
sal_uInt32 GetPointNum() const
Definition: svdhdl.hxx:222
void GraphicToVD()
Definition: graphctl.cxx:178
virtual void MarkListHasChanged()
Definition: graphctl.cxx:280
Graphic aGraphic
Definition: graphctl.hxx:51
void Draw(OutputDevice &rOutDev, const Point &rDestPt) const
SdrMark * GetMark(size_t nNum) const
Definition: svdmark.cxx:230
const Point & GetPos() const
Definition: svdhdl.hxx:197
constexpr sal_uInt16 KEY_SPACE
float x
void SetGraphic(const Graphic &rGraphic, bool bNewModel=true)
Definition: graphctl.cxx:157
void SetMapMode()
constexpr sal_uInt16 KEY_UP
Size const & GetOutputSizePixel() const
NONE
SdrObjKind
Definition: svdobjkind.hxx:24
constexpr sal_uInt16 KEY_END
static OutputDevice * GetDefaultDevice()
constexpr tools::Long Width() const
sal_uInt16 GetClicks() const
void SetBackground()
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect) override
Definition: graphctl.cxx:34
rtl::Reference< SvxGraphCtrlAccessibleContext > mpAccContext
Definition: graphctl.hxx:70
virtual rtl::Reference< sdr::overlay::OverlayManager > CreateOverlayManager(OutputDevice &rDevice) const
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Definition: graphctl.cxx:837
OutputDevice & GetTargetOutputDevice()
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: graphctl.cxx:232
friend class GraphCtrlView
Definition: graphctl.hxx:48
Point GetPositionInDialog() const
Definition: graphctl.cxx:829
virtual void InvalidateOneWin(OutputDevice &rWin) override
If the View should not call Invalidate() on the windows, override the following 2 methods and do some...
Definition: graphctl.cxx:795
bool mbInIdleUpdate
Definition: graphctl.hxx:65
virtual OutputDevice & get_ref_device()=0
constexpr bool IsEmpty() const
sal_uInt32 PaintWindowCount() const
Definition: svdpntv.hxx:218
float y
ScopedVclPtrInstance< VirtualDevice > xVD
Definition: graphctl.hxx:52
DocumentType eType
constexpr sal_uInt16 KEY_DOWN
SdrObject * GetMarkedSdrObj() const
Definition: svdmark.hxx:68
SdrHitKind
Definition: svdmrkv.hxx:57
weld::Dialog * mpDialog
Definition: graphctl.hxx:66
void SetScaleX(const Fraction &rScaleX)
void SetObjKind(const SdrObjKind eObjKind)
Definition: graphctl.cxx:733
uno_Any a
MapMode aMap100
Definition: graphctl.hxx:57
GraphicType GetType() const
virtual void InitSdrModel()
Definition: graphctl.cxx:112
constexpr sal_uInt16 KEY_HOME
void SetOrigin(const Point &rOrigin)
void SetOutputToWindow(bool bOutputToWindow)
constexpr tools::Long Right() const
IMPL_LINK_NOARG(GraphCtrl, UpdateHdl, Timer *, void)
Definition: graphctl.cxx:748
Link< GraphCtrl *, void > aMousePosLink
Definition: graphctl.hxx:54
void SetScaleY(const Fraction &rScaleY)
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: graphctl.cxx:632
constexpr tools::Long Top() const
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: graphctl.cxx:587
MapUnit GetMapUnit() const
void SetUserCall(SdrObjUserCall *pUser)
Definition: svdobj.cxx:2756
tools::Rectangle RangeToInvalidateRectangle(const basegfx::B2DRange &rRange) const
Abstract DrawObject.
Definition: svdobj.hxx:259
bool bEditMode
Definition: graphctl.hxx:63
void SetPolyEditMode(const sal_uInt16 nPolyEdit)
Definition: graphctl.cxx:720
virtual void SdrObjChanged(const SdrObject &rObj)
Definition: graphctl.cxx:270
constexpr Point TopLeft() const
constexpr sal_uInt16 KEY_RIGHT
constexpr tools::Long Bottom() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
Size GetPrefSize() const
SdrHdl * GetFocusHdl() const
Definition: svdhdl.cxx:2128
size_t GetHdlCount() const
Definition: svdhdl.hxx:459
SdrHdl * GetHdl(size_t nNum) const
Definition: svdhdl.hxx:460
const vcl::KeyCode & GetKeyCode() const
virtual void Resize() override
Definition: graphctl.cxx:189
constexpr Size GetSize() const
bool IsShift() const
weld::DrawingArea * GetDrawingArea() const
void Stop()
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: graphctl.cxx:285
MapMode GetPrefMapMode() const
constexpr tools::Long Height() const
virtual ~GraphCtrlView() override
Definition: graphctl.cxx:817
constexpr sal_uInt16 KEY_ESCAPE
virtual bool MouseButtonDown(const MouseEvent &)
constexpr sal_uInt16 KEY_F11
SdrObjKind eObjKind
Definition: graphctl.hxx:61
std::unique_ptr< SdrView > pView
Definition: graphctl.hxx:75
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
SdrObject * GetSelectedSdrObject() const
Definition: graphctl.cxx:690
void SetInvokeHandler(const Link< Timer *, void > &rLink)
const Color & GetWindowColor() const
const Point & GetPosPixel() const
static void InitOverlayManager(rtl::Reference< sdr::overlay::OverlayManager > xOverlayManager)
constexpr sal_uInt16 KEY_BACKSPACE
Idle aUpdateIdle
Definition: graphctl.hxx:53
Point aMousePos
Definition: graphctl.hxx:59
void setHeight(tools::Long nHeight)
virtual void Start(bool bStartTimer=true) override
virtual void SdrObjCreated(const SdrObject &rObj)
Definition: graphctl.cxx:275
bool mbSdrMode
Definition: graphctl.hxx:64
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
MapUnit
void SetPriority(TaskPriority ePriority)
void SetSdrMode(bool b)
Definition: graphctl.cxx:92
virtual ~GraphCtrl() override
Definition: graphctl.cxx:75
constexpr sal_uInt16 KEY_DELETE
constexpr sal_uInt16 KEY_LEFT
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:373
Link< GraphCtrl *, void > aGraphSizeLink
Definition: graphctl.hxx:55
void SetEditMode(const bool bEditMode)
Definition: graphctl.cxx:705
virtual void InvalidateOneWin(OutputDevice &rWin)
If the View should not call Invalidate() on the windows, override the following 2 methods and do some...
Definition: svdpntv.cxx:861
GraphCtrl & rGraphCtrl
Definition: graphctl.hxx:133
GraphCtrl & rWin
Definition: graphctl.hxx:33
void SetPointer(PointerStyle ePointerStyle)
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: graphctl.cxx:668
SdrObjUserCall * GetUserCall() const
Definition: svdobj.hxx:831
virtual void invalidateRange(const basegfx::B2DRange &rRange)
Size aGraphSize
Definition: graphctl.hxx:58
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
Definition: svdpntv.cxx:75
SAL_DLLPRIVATE void DrawOutDev(const Point &, const Size &, const Point &, const Size &, const Printer &)=delete
friend class GraphCtrlUserCall
Definition: graphctl.hxx:49
constexpr sal_uInt16 KEY_TAB
SdrHdlKind GetKind() const
Definition: svdhdl.hxx:194
bool IsMod1() const
bool m_bDetectedRangeSegmentation false
void EnableRTL(bool bEnable)