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