28 #include <svx/svxids.hrc>
52 : aUpdateIdle(
"svx GraphCtrl Update")
58 , mbInIdleUpdate(false)
119 pModel->GetItemPool().FreezeIdRanges();
122 pModel->SetDefaultFontHeight( 500 );
127 pPage->SetBorder( 0, 0, 0, 0 );
128 pModel->InsertPage( pPage.get() );
129 pModel->SetChanged(
false );
134 pView->EnableExtendedMouseEventDispatcher(
true );
135 pView->ShowSdrPage(
pView->GetModel()->GetPage(0));
136 pView->SetFrameDragSingles();
138 pView->SetEditMode();
141 pView->SetPagePaintingAllowed(
false);
142 pView->SetBufferedOutputAllowed(
true);
143 pView->SetBufferedOverlayAllowed(
true);
153 xVD->SetOutputSizePixel(
Size(0, 0));
196 double fWinWH =
static_cast<double>(nWidth) / nHeight;
199 if ( fGrfWH < fWinWH)
201 aNewSize.
setWidth( static_cast<tools::Long>( static_cast<double>(nHeight) * fGrfWH ) );
207 aNewSize.
setHeight( static_cast<tools::Long>( static_cast<double>(nWidth) / fGrfWH ) );
210 aNewPos.setX( ( nWidth - aNewSize.
Width() ) >> 1 );
211 aNewPos.setY( ( nHeight - aNewSize.
Height() ) >> 1 );
219 xVD->SetMapMode( aDisplayMap );
251 pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
252 pView->EndCompleteRedraw(*pPaintWindow,
true);
285 switch ( aCode.GetCode() )
292 pView->DeleteMarked();
302 if (
pView->IsAction() )
307 else if (
pView->AreObjectsMarked() )
309 pView->UnmarkAllObj();
321 if( !aCode.IsMod1() && !aCode.IsMod2() )
323 bool bForward = !aCode.IsShift();
325 if ( !
pView->MarkNextObj( bForward ))
329 pView->UnmarkAllObj();
330 pView->MarkNextObj (bForward);
334 else if(aCode.IsMod1())
338 bool bForward(!aCode.IsShift());
340 const_cast<SdrHdlList&
>(rHdlList).TravelFocusHdl(bForward);
351 if ( aCode.IsMod1() )
354 pView->UnmarkAllObj();
355 pView->MarkNextObj();
364 if ( aCode.IsMod1() )
366 pView->UnmarkAllObj();
367 pView->MarkNextObj(
true);
382 if (aCode.GetCode() ==
KEY_UP)
388 else if (aCode.GetCode() ==
KEY_DOWN)
394 else if (aCode.GetCode() ==
KEY_LEFT)
407 if (
pView->AreObjectsMarked() && !aCode.IsMod1() )
413 nX *= aLogicSizeOnePixel.
Width();
414 nY *= aLogicSizeOnePixel.
Height();
435 aMarkRect.
Move(nX, nY);
437 if(!aMarkRect.IsInside(rWorkArea))
439 if(aMarkRect.Left() < rWorkArea.
Left())
441 nX += rWorkArea.
Left() - aMarkRect.Left();
444 if(aMarkRect.Right() > rWorkArea.
Right())
446 nX -= aMarkRect.Right() - rWorkArea.
Right();
449 if(aMarkRect.Top() < rWorkArea.
Top())
451 nY += rWorkArea.
Top() - aMarkRect.Top();
454 if(aMarkRect.Bottom() > rWorkArea.
Bottom())
456 nY -= aMarkRect.Bottom() - rWorkArea.
Bottom();
462 if(0 != nX || 0 != nY)
478 pView->BegDragObj(aStartPoint,
nullptr, pHdl, 0);
480 if(
pView->IsDragObj())
482 bool bWasNoSnap = rDragStat.IsNoSnap();
483 bool bWasSnapEnabled =
pView->IsSnapEnabled();
489 pView->SetSnapEnabled(
false);
491 pView->MovAction(aEndPoint);
496 const_cast<SdrDragStat&
>(rDragStat).SetNoSnap(bWasNoSnap);
498 pView->SetSnapEnabled(bWasSnapEnabled);
521 if(
pView->IsPointMarked(*pHdl))
525 pView->UnmarkPoint(*pHdl);
532 pView->UnmarkAllPoints();
535 pView->MarkPoint(*pHdl);
541 SdrHdl* pNewOne =
nullptr;
558 const_cast<SdrHdlList&
>(rHdlList).SetFocusHdl(pNewOne);
603 pView->MouseButtonDown( rMEvt, &rDevice );
606 pView->MouseButtonDown( rMEvt, &rDevice );
632 pView->MouseMove( rMEvt, &rDevice );
634 if( ( SID_BEZIER_INSERT ==
nPolyEdit ) &&
635 !
pView->PickHandle( aLogPos ) &&
636 !
pView->IsInsObjPoint() )
667 if (
pView->IsInsObjPoint() )
670 pView->MouseButtonUp( rMEvt, &rDevice );
743 mbInIdleUpdate =
true;
744 aUpdateLink.Call(
this );
745 mbInIdleUpdate =
false;
762 : OverlayManager(rDevice)
763 , m_rGraphCtrl(rGraphCtrl)
771 m_rGraphCtrl.Invalidate(aInvalidateRectangle);
783 return xOverlayManager;
815 for (sal_uInt32 nWinNum(0); nWinNum < nWindowCount; nWinNum++)
824 int x,
y, width, height;
#define LINK(Instance, Class, Member)
std::unique_ptr< GraphCtrlUserCall > pUserCall
OutDevType GetOutDevType() const
const Wallpaper & GetBackground() const
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
size_t GetMarkCount() const
sal_uInt32 GetPolyNum() const
std::unique_ptr< SdrModel > pModel
GraphCtrl(weld::Dialog *pDialog)
void setWidth(tools::Long nWidth)
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
virtual rtl::Reference< sdr::overlay::OverlayManager > CreateOverlayManager(OutputDevice &rDevice) const override
sal_uInt32 GetPointNum() const
virtual void MarkListHasChanged()
void InitOverlayManager(rtl::Reference< sdr::overlay::OverlayManager > xOverlayManager) const
SdrMark * GetMark(size_t nNum) const
const Point & GetPos() const
constexpr sal_uInt16 KEY_SPACE
void SetGraphic(const Graphic &rGraphic, bool bNewModel=true)
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_END
static OutputDevice * GetDefaultDevice()
constexpr tools::Long Width() const
sal_uInt16 GetClicks() const
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect) override
rtl::Reference< SvxGraphCtrlAccessibleContext > mpAccContext
virtual rtl::Reference< sdr::overlay::OverlayManager > CreateOverlayManager(OutputDevice &rDevice) const
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
OutputDevice & GetTargetOutputDevice()
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
friend class GraphCtrlView
Point GetPositionInDialog() const
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...
virtual OutputDevice & get_ref_device()=0
sal_uInt32 PaintWindowCount() const
ScopedVclPtrInstance< VirtualDevice > xVD
constexpr sal_uInt16 KEY_DOWN
SdrObject * GetMarkedSdrObj() const
void SetScaleX(const Fraction &rScaleX)
void SetObjKind(const SdrObjKind eObjKind)
void Draw(OutputDevice *pOutDev, const Point &rDestPt) const
GraphicType GetType() const
virtual void InitSdrModel()
constexpr sal_uInt16 KEY_HOME
void SetOrigin(const Point &rOrigin)
void SetOutputToWindow(bool bOutputToWindow)
IMPL_LINK_NOARG(GraphCtrl, UpdateHdl, Timer *, void)
Link< GraphCtrl *, void > aMousePosLink
void SetScaleY(const Fraction &rScaleY)
virtual bool MouseMove(const MouseEvent &rMEvt) override
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
MapUnit GetMapUnit() const
void SetUserCall(SdrObjUserCall *pUser)
tools::Rectangle RangeToInvalidateRectangle(const basegfx::B2DRange &rRange) const
void SetPolyEditMode(const sal_uInt16 nPolyEdit)
virtual void SdrObjChanged(const SdrObject &rObj)
constexpr sal_uInt16 KEY_RIGHT
Point PixelToLogic(const Point &rDevicePt) const
SdrHdl * GetFocusHdl() const
size_t GetHdlCount() const
SdrHdl * GetHdl(size_t nNum) const
const vcl::KeyCode & GetKeyCode() const
virtual void Resize() override
virtual bool KeyInput(const KeyEvent &rKEvt) override
MapMode GetPrefMapMode() const
constexpr tools::Long Height() const
virtual ~GraphCtrlView() override
constexpr sal_uInt16 KEY_ESCAPE
constexpr sal_uInt16 KEY_F11
std::unique_ptr< SdrView > pView
SdrObject * GetSelectedSdrObject() const
void SetInvokeHandler(const Link< Timer *, void > &rLink)
const Color & GetWindowColor() const
const Point & GetPosPixel() const
constexpr sal_uInt16 KEY_BACKSPACE
void setHeight(tools::Long nHeight)
virtual void SdrObjCreated(const SdrObject &rObj)
reference_type * get() const
void SetPriority(TaskPriority ePriority)
virtual ~GraphCtrl() override
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...
Link< GraphCtrl *, void > aGraphSizeLink
void SetEditMode(const bool bEditMode)
virtual void InvalidateOneWin(OutputDevice &rWin)
If the View should not call Invalidate() on the windows, override the following 2 methods and do some...
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
SdrObjUserCall * GetUserCall() const
virtual void invalidateRange(const basegfx::B2DRange &rRange)
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
SAL_DLLPRIVATE void DrawOutDev(const Point &, const Size &, const Point &, const Size &, const Printer &)=delete
friend class GraphCtrlUserCall
constexpr sal_uInt16 KEY_TAB
SdrHdlKind GetKind() const