Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / dialog / graphctl.cxx
blob56c1509fa776dc0b2e6f6a68052ca6ffbed26b54
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <config_wasm_strip.h>
22 #include <svl/itempool.hxx>
23 #include <vcl/settings.hxx>
24 #include <vcl/ptrstyle.hxx>
25 #include <vcl/svapp.hxx>
27 #include <svx/graphctl.hxx>
28 #include <svx/sdr/overlay/overlaymanager.hxx>
29 #include <GraphCtlAccessibleContext.hxx>
30 #include <svx/svxids.hrc>
31 #include <svx/svdpage.hxx>
32 #include <svx/sdrpaintwindow.hxx>
34 void GraphCtrlUserCall::Changed( const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& /*rOldBoundRect*/ )
36 switch( eType )
38 case SdrUserCallType::MoveOnly:
39 case SdrUserCallType::Resize:
40 rWin.SdrObjChanged( rObj );
41 break;
43 case SdrUserCallType::Inserted:
44 rWin.SdrObjCreated( rObj );
45 break;
47 default:
48 break;
50 rWin.QueueIdleUpdate();
53 GraphCtrl::GraphCtrl(weld::Dialog* pDialog)
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)
63 pUserCall.reset(new GraphCtrlUserCall( *this ));
64 aUpdateIdle.SetPriority( TaskPriority::LOWEST );
65 aUpdateIdle.SetInvokeHandler( LINK( this, GraphCtrl, UpdateHdl ) );
66 aUpdateIdle.Start();
69 void GraphCtrl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
71 weld::CustomWidgetController::SetDrawingArea(pDrawingArea);
72 EnableRTL(false);
75 GraphCtrl::~GraphCtrl()
77 aUpdateIdle.Stop();
79 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
80 if( mpAccContext.is() )
82 mpAccContext->disposing();
83 mpAccContext.clear();
85 #endif
87 pView.reset();
88 pModel.reset();
89 pUserCall.reset();
92 void GraphCtrl::SetSdrMode(bool bSdrMode)
94 mbSdrMode = bSdrMode;
96 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
97 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
98 rDevice.SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
99 xVD->SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
100 rDevice.SetMapMode( aMap100 );
101 xVD->SetMapMode( aMap100 );
103 pView.reset();
104 pModel.reset();
106 if ( mbSdrMode )
107 InitSdrModel();
109 QueueIdleUpdate();
112 void GraphCtrl::InitSdrModel()
114 SolarMutexGuard aGuard;
116 rtl::Reference<SdrPage> pPage;
118 // destroy old junk
119 pView.reset();
120 pModel.reset();
122 // Creating a Model
123 pModel.reset(new SdrModel(nullptr, nullptr, true));
124 pModel->GetItemPool().FreezeIdRanges();
125 pModel->SetScaleUnit(aMap100.GetMapUnit());
126 pModel->SetDefaultFontHeight( 500 );
128 pPage = new SdrPage( *pModel );
130 pPage->SetSize( aGraphSize );
131 pPage->SetBorder( 0, 0, 0, 0 );
132 pModel->InsertPage( pPage.get() );
133 pModel->SetChanged( false );
135 // Creating a View
136 pView.reset(new GraphCtrlView(*pModel, this));
137 pView->SetWorkArea( tools::Rectangle( Point(), aGraphSize ) );
138 pView->EnableExtendedMouseEventDispatcher( true );
139 pView->ShowSdrPage(pView->GetModel().GetPage(0));
140 pView->SetFrameDragSingles();
141 pView->SetMarkedPointsSmooth( SdrPathSmoothKind::Symmetric );
142 pView->SetEditMode();
144 // #i72889# set needed flags
145 pView->SetPagePaintingAllowed(false);
146 pView->SetBufferedOutputAllowed(true);
147 pView->SetBufferedOverlayAllowed(true);
149 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
150 // Tell the accessibility object about the changes.
151 if (mpAccContext.is())
152 mpAccContext->setModelAndView (pModel.get(), pView.get());
153 #endif
156 void GraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel )
158 aGraphic = rGraphic;
159 xVD->SetOutputSizePixel(Size(0, 0)); //force redraw
161 if ( aGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
162 aGraphSize = Application::GetDefaultDevice()->PixelToLogic( aGraphic.GetPrefSize(), aMap100 );
163 else
164 aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 );
166 if ( mbSdrMode && bNewModel )
167 InitSdrModel();
169 aGraphSizeLink.Call( this );
171 Resize();
173 Invalidate();
174 QueueIdleUpdate();
177 void GraphCtrl::GraphicToVD()
179 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
180 xVD->SetOutputSizePixel(GetOutputSizePixel());
181 xVD->SetBackground(rDevice.GetBackground());
182 xVD->Erase();
183 const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType());
184 if (bGraphicValid)
185 aGraphic.Draw(*xVD, Point(), aGraphSize);
188 void GraphCtrl::Resize()
190 weld::CustomWidgetController::Resize();
192 if (aGraphSize.Width() && aGraphSize.Height())
194 MapMode aDisplayMap( aMap100 );
195 Point aNewPos;
196 Size aNewSize;
197 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
198 const Size aWinSize = rDevice.PixelToLogic( GetOutputSizePixel(), aDisplayMap );
199 const tools::Long nWidth = aWinSize.Width();
200 const tools::Long nHeight = aWinSize.Height();
201 double fGrfWH = static_cast<double>(aGraphSize.Width()) / aGraphSize.Height();
202 double fWinWH = static_cast<double>(nWidth) / nHeight;
204 // Adapt Bitmap to Thumb size
205 if ( fGrfWH < fWinWH)
207 aNewSize.setWidth( static_cast<tools::Long>( static_cast<double>(nHeight) * fGrfWH ) );
208 aNewSize.setHeight( nHeight );
210 else
212 aNewSize.setWidth( nWidth );
213 aNewSize.setHeight( static_cast<tools::Long>( static_cast<double>(nWidth) / fGrfWH ) );
216 aNewPos.setX( ( nWidth - aNewSize.Width() ) >> 1 );
217 aNewPos.setY( ( nHeight - aNewSize.Height() ) >> 1 );
219 // Implementing MapMode for Engine
220 aDisplayMap.SetScaleX( Fraction( aNewSize.Width(), aGraphSize.Width() ) );
221 aDisplayMap.SetScaleY( Fraction( aNewSize.Height(), aGraphSize.Height() ) );
223 aDisplayMap.SetOrigin( OutputDevice::LogicToLogic( aNewPos, aMap100, aDisplayMap ) );
224 rDevice.SetMapMode( aDisplayMap );
225 xVD->SetMapMode( aDisplayMap );
228 Invalidate();
231 void GraphCtrl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
233 // #i72889# used split repaint to be able to paint an own background
234 // even to the buffered view
235 const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType());
237 if (GetOutputSizePixel() != xVD->GetOutputSizePixel())
238 GraphicToVD();
240 if (mbSdrMode)
242 SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(&rRenderContext);
243 pPaintWindow->SetOutputToWindow(true);
245 if (bGraphicValid)
247 vcl::RenderContext& rTarget = pPaintWindow->GetTargetOutputDevice();
249 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
250 rTarget.SetBackground(rDevice.GetBackground());
251 rTarget.Erase();
253 rTarget.DrawOutDev(Point(), xVD->GetOutputSize(), Point(), xVD->GetOutputSize(), *xVD);
256 const vcl::Region aRepaintRegion(rRect);
257 pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
258 pView->EndCompleteRedraw(*pPaintWindow, true);
260 else
262 // #i73381# in non-SdrMode, paint to local directly
263 rRenderContext.DrawOutDev(rRect.TopLeft(), rRect.GetSize(),
264 rRect.TopLeft(), rRect.GetSize(),
265 *xVD);
269 void GraphCtrl::SdrObjChanged( const SdrObject& )
271 QueueIdleUpdate();
274 void GraphCtrl::SdrObjCreated( const SdrObject& )
276 QueueIdleUpdate();
279 void GraphCtrl::MarkListHasChanged()
281 QueueIdleUpdate();
284 bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
286 vcl::KeyCode aCode( rKEvt.GetKeyCode() );
287 bool bProc = false;
289 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
291 switch ( aCode.GetCode() )
293 case KEY_DELETE:
294 case KEY_BACKSPACE:
296 if ( mbSdrMode )
298 pView->DeleteMarked();
299 bProc = true;
302 break;
304 case KEY_ESCAPE:
306 if ( mbSdrMode )
308 if ( pView->IsAction() )
310 pView->BrkAction();
311 bProc = true;
313 else if ( pView->AreObjectsMarked() )
315 pView->UnmarkAllObj();
316 bProc = true;
320 break;
322 case KEY_F11:
323 case KEY_TAB:
325 if( mbSdrMode )
327 if( !aCode.IsMod1() && !aCode.IsMod2() )
329 bool bForward = !aCode.IsShift();
330 // select next object
331 if ( ! pView->MarkNextObj( bForward ))
333 // At first or last object. Cycle to the other end
334 // of the list.
335 pView->UnmarkAllObj();
336 pView->MarkNextObj (bForward);
338 bProc = true;
340 else if(aCode.IsMod1())
342 // select next handle
343 const SdrHdlList& rHdlList = pView->GetHdlList();
344 bool bForward(!aCode.IsShift());
346 const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
348 bProc = true;
352 break;
354 case KEY_END:
357 if ( aCode.IsMod1() )
359 // mark last object
360 pView->UnmarkAllObj();
361 pView->MarkNextObj();
363 bProc = true;
366 break;
368 case KEY_HOME:
370 if ( aCode.IsMod1() )
372 pView->UnmarkAllObj();
373 pView->MarkNextObj(true);
375 bProc = true;
378 break;
380 case KEY_UP:
381 case KEY_DOWN:
382 case KEY_LEFT:
383 case KEY_RIGHT:
385 tools::Long nX = 0;
386 tools::Long nY = 0;
388 if (aCode.GetCode() == KEY_UP)
390 // Scroll up
391 nX = 0;
392 nY =-1;
394 else if (aCode.GetCode() == KEY_DOWN)
396 // Scroll down
397 nX = 0;
398 nY = 1;
400 else if (aCode.GetCode() == KEY_LEFT)
402 // Scroll left
403 nX =-1;
404 nY = 0;
406 else if (aCode.GetCode() == KEY_RIGHT)
408 // Scroll right
409 nX = 1;
410 nY = 0;
413 if (pView->AreObjectsMarked() && !aCode.IsMod1() )
415 if(aCode.IsMod2())
417 // move in 1 pixel distance
418 Size aLogicSizeOnePixel = rDevice.PixelToLogic(Size(1,1));
419 nX *= aLogicSizeOnePixel.Width();
420 nY *= aLogicSizeOnePixel.Height();
422 else
424 // old, fixed move distance
425 nX *= 100;
426 nY *= 100;
429 // II
430 const SdrHdlList& rHdlList = pView->GetHdlList();
431 SdrHdl* pHdl = rHdlList.GetFocusHdl();
433 if(nullptr == pHdl)
435 // restrict movement to WorkArea
436 const tools::Rectangle& rWorkArea = pView->GetWorkArea();
438 if(!rWorkArea.IsEmpty())
440 tools::Rectangle aMarkRect(pView->GetMarkedObjRect());
441 aMarkRect.Move(nX, nY);
443 if(!aMarkRect.Contains(rWorkArea))
445 if(aMarkRect.Left() < rWorkArea.Left())
447 nX += rWorkArea.Left() - aMarkRect.Left();
450 if(aMarkRect.Right() > rWorkArea.Right())
452 nX -= aMarkRect.Right() - rWorkArea.Right();
455 if(aMarkRect.Top() < rWorkArea.Top())
457 nY += rWorkArea.Top() - aMarkRect.Top();
460 if(aMarkRect.Bottom() > rWorkArea.Bottom())
462 nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
467 // no handle selected
468 if(0 != nX || 0 != nY)
470 pView->MoveAllMarked(Size(nX, nY));
473 else
475 // move handle with index nHandleIndex
476 if (nX || nY)
478 // now move the Handle (nX, nY)
479 Point aStartPoint(pHdl->GetPos());
480 Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
481 const SdrDragStat& rDragStat = pView->GetDragStat();
483 // start dragging
484 pView->BegDragObj(aStartPoint, nullptr, pHdl, 0);
486 if(pView->IsDragObj())
488 bool bWasNoSnap = rDragStat.IsNoSnap();
489 bool bWasSnapEnabled = pView->IsSnapEnabled();
491 // switch snapping off
492 if(!bWasNoSnap)
493 const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
494 if(bWasSnapEnabled)
495 pView->SetSnapEnabled(false);
497 pView->MovAction(aEndPoint);
498 pView->EndDragObj();
500 // restore snap
501 if(!bWasNoSnap)
502 const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
503 if(bWasSnapEnabled)
504 pView->SetSnapEnabled(bWasSnapEnabled);
509 bProc = true;
512 break;
514 case KEY_SPACE:
516 const SdrHdlList& rHdlList = pView->GetHdlList();
517 SdrHdl* pHdl = rHdlList.GetFocusHdl();
519 if(pHdl)
521 if(pHdl->GetKind() == SdrHdlKind::Poly)
523 // rescue ID of point with focus
524 sal_uInt32 nPol(pHdl->GetPolyNum());
525 sal_uInt32 nPnt(pHdl->GetPointNum());
527 if(pView->IsPointMarked(*pHdl))
529 if(rKEvt.GetKeyCode().IsShift())
531 pView->UnmarkPoint(*pHdl);
534 else
536 if(!rKEvt.GetKeyCode().IsShift())
538 pView->UnmarkAllPoints();
541 pView->MarkPoint(*pHdl);
544 if(nullptr == rHdlList.GetFocusHdl())
546 // restore point with focus
547 SdrHdl* pNewOne = nullptr;
549 for(size_t a = 0; !pNewOne && a < rHdlList.GetHdlCount(); ++a)
551 SdrHdl* pAct = rHdlList.GetHdl(a);
553 if(pAct
554 && pAct->GetKind() == SdrHdlKind::Poly
555 && pAct->GetPolyNum() == nPol
556 && pAct->GetPointNum() == nPnt)
558 pNewOne = pAct;
562 if(pNewOne)
564 const_cast<SdrHdlList&>(rHdlList).SetFocusHdl(pNewOne);
568 bProc = true;
572 break;
574 default:
575 break;
578 if (bProc)
579 ReleaseMouse();
581 QueueIdleUpdate();
583 return bProc;
586 bool GraphCtrl::MouseButtonDown( const MouseEvent& rMEvt )
588 if ( mbSdrMode && ( rMEvt.GetClicks() < 2 ) )
590 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
592 const Point aLogPt( rDevice.PixelToLogic( rMEvt.GetPosPixel() ) );
594 if ( !tools::Rectangle( Point(), aGraphSize ).Contains( aLogPt ) && !pView->IsEditMode() )
595 weld::CustomWidgetController::MouseButtonDown( rMEvt );
596 else
598 // Get Focus for key inputs
599 GrabFocus();
601 if ( nPolyEdit )
603 SdrViewEvent aVEvt;
604 SdrHitKind eHit = pView->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt );
606 if ( nPolyEdit == SID_BEZIER_INSERT && eHit == SdrHitKind::MarkedObject )
607 pView->BegInsObjPoint( aLogPt, rMEvt.IsMod1());
608 else
609 pView->MouseButtonDown( rMEvt, &rDevice );
611 else
612 pView->MouseButtonDown( rMEvt, &rDevice );
615 SdrObject* pCreateObj = pView->GetCreateObj();
617 // We want to realize the insert
618 if ( pCreateObj && !pCreateObj->GetUserCall() )
619 pCreateObj->SetUserCall( pUserCall.get() );
621 SetPointer( pView->GetPreferredPointer( aLogPt, &rDevice ) );
623 else
624 weld::CustomWidgetController::MouseButtonDown( rMEvt );
626 QueueIdleUpdate();
628 return false;
631 bool GraphCtrl::MouseMove(const MouseEvent& rMEvt)
633 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
634 const Point aLogPos( rDevice.PixelToLogic( rMEvt.GetPosPixel() ) );
636 if ( mbSdrMode )
638 pView->MouseMove( rMEvt, &rDevice );
640 if( ( SID_BEZIER_INSERT == nPolyEdit ) &&
641 !pView->PickHandle( aLogPos ) &&
642 !pView->IsInsObjPoint() )
644 SetPointer( PointerStyle::Cross );
646 else
647 SetPointer( pView->GetPreferredPointer( aLogPos, &rDevice ) );
649 else
650 weld::CustomWidgetController::MouseButtonUp( rMEvt );
652 if ( aMousePosLink.IsSet() )
654 if ( tools::Rectangle( Point(), aGraphSize ).Contains( aLogPos ) )
655 aMousePos = aLogPos;
656 else
657 aMousePos = Point();
659 aMousePosLink.Call( this );
662 QueueIdleUpdate();
664 return false;
667 bool GraphCtrl::MouseButtonUp(const MouseEvent& rMEvt)
669 if ( mbSdrMode )
671 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
673 if ( pView->IsInsObjPoint() )
674 pView->EndInsObjPoint( SdrCreateCmd::ForceEnd );
675 else
676 pView->MouseButtonUp( rMEvt, &rDevice );
678 ReleaseMouse();
679 SetPointer( pView->GetPreferredPointer( rDevice.PixelToLogic( rMEvt.GetPosPixel() ), &rDevice ) );
681 else
682 weld::CustomWidgetController::MouseButtonUp( rMEvt );
684 QueueIdleUpdate();
686 return false;
689 SdrObject* GraphCtrl::GetSelectedSdrObject() const
691 SdrObject* pSdrObj = nullptr;
693 if ( mbSdrMode )
695 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
697 if ( rMarkList.GetMarkCount() == 1 )
698 pSdrObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
701 return pSdrObj;
704 void GraphCtrl::SetEditMode( const bool _bEditMode )
706 if ( mbSdrMode )
708 bEditMode = _bEditMode;
709 pView->SetEditMode( bEditMode );
710 eObjKind = SdrObjKind::NONE;
711 pView->SetCurrentObj(eObjKind);
713 else
714 bEditMode = false;
716 QueueIdleUpdate();
719 void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit )
721 if ( mbSdrMode && ( _nPolyEdit != nPolyEdit ) )
723 nPolyEdit = _nPolyEdit;
724 pView->SetFrameDragSingles( nPolyEdit == 0 );
726 else
727 nPolyEdit = 0;
729 QueueIdleUpdate();
732 void GraphCtrl::SetObjKind( const SdrObjKind _eObjKind )
734 if ( mbSdrMode )
736 bEditMode = false;
737 pView->SetEditMode( bEditMode );
738 eObjKind = _eObjKind;
739 pView->SetCurrentObj(eObjKind);
741 else
742 eObjKind = SdrObjKind::NONE;
744 QueueIdleUpdate();
747 IMPL_LINK_NOARG(GraphCtrl, UpdateHdl, Timer *, void)
749 mbInIdleUpdate = true;
750 aUpdateLink.Call( this );
751 mbInIdleUpdate = false;
754 void GraphCtrl::QueueIdleUpdate()
756 if (!mbInIdleUpdate)
757 aUpdateIdle.Start();
760 namespace
762 class WeldOverlayManager final : public sdr::overlay::OverlayManager
764 weld::CustomWidgetController& m_rGraphCtrl;
766 public:
767 WeldOverlayManager(weld::CustomWidgetController& rGraphCtrl, OutputDevice& rDevice)
768 : OverlayManager(rDevice)
769 , m_rGraphCtrl(rGraphCtrl)
773 // invalidate the given range at local OutputDevice
774 virtual void invalidateRange(const basegfx::B2DRange& rRange) override
776 tools::Rectangle aInvalidateRectangle(RangeToInvalidateRectangle(rRange));
777 m_rGraphCtrl.Invalidate(aInvalidateRectangle);
782 rtl::Reference<sdr::overlay::OverlayManager> GraphCtrlView::CreateOverlayManager(OutputDevice& rDevice) const
784 assert(&rDevice == &rGraphCtrl.GetDrawingArea()->get_ref_device());
785 if (rDevice.GetOutDevType() == OUTDEV_VIRDEV)
787 rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager(new WeldOverlayManager(rGraphCtrl, rDevice));
788 InitOverlayManager(xOverlayManager);
789 return xOverlayManager;
791 return SdrView::CreateOverlayManager(rDevice);
794 void GraphCtrlView::InvalidateOneWin(OutputDevice& rDevice)
796 assert(&rDevice == &rGraphCtrl.GetDrawingArea()->get_ref_device());
797 if (rDevice.GetOutDevType() == OUTDEV_VIRDEV)
799 rGraphCtrl.Invalidate();
800 return;
802 SdrView::InvalidateOneWin(rDevice);
805 void GraphCtrlView::InvalidateOneWin(OutputDevice& rDevice, const tools::Rectangle& rArea)
807 assert(&rDevice == &rGraphCtrl.GetDrawingArea()->get_ref_device());
808 if (rDevice.GetOutDevType() == OUTDEV_VIRDEV)
810 rGraphCtrl.Invalidate(rArea);
811 return;
813 SdrView::InvalidateOneWin(rDevice, rArea);
816 GraphCtrlView::~GraphCtrlView()
818 // turn SetOutputToWindow back off again before
819 // turning back into our baseclass during dtoring
820 const sal_uInt32 nWindowCount(PaintWindowCount());
821 for (sal_uInt32 nWinNum(0); nWinNum < nWindowCount; nWinNum++)
823 SdrPaintWindow* pPaintWindow = GetPaintWindow(nWinNum);
824 pPaintWindow->SetOutputToWindow(false);
828 Point GraphCtrl::GetPositionInDialog() const
830 int x, y, width, height;
831 if (GetDrawingArea()->get_extents_relative_to(*mpDialog, x, y, width, height))
832 return Point(x, y);
833 return Point();
836 css::uno::Reference< css::accessibility::XAccessible > GraphCtrl::CreateAccessible()
838 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
839 if(mpAccContext == nullptr )
841 // Disable accessibility if no model/view data available
842 if (pView && pModel)
843 mpAccContext = new SvxGraphCtrlAccessibleContext(*this);
845 #endif
846 return mpAccContext;
849 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */