svx: prefix members of GraphCtrl

See tdf#94879 for motivation.

Change-Id: I6284736a206255842d8f54699db4db9881497a38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190651
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna
2025-09-08 09:44:42 +02:00
parent 1d6298f1c6
commit de44e7966d
4 changed files with 214 additions and 214 deletions
+26 -26
View File
@@ -48,19 +48,19 @@ class SAL_DLLPUBLIC_RTTI GraphCtrl : public weld::CustomWidgetController
friend class GraphCtrlView;
friend class GraphCtrlUserCall;
Graphic aGraphic;
ScopedVclPtrInstance<VirtualDevice> xVD;
Idle aUpdateIdle;
Link<GraphCtrl*,void> aMousePosLink;
Link<GraphCtrl*,void> aGraphSizeLink;
Link<GraphCtrl*,void> aUpdateLink;
MapMode aMap100;
Size aGraphSize;
Point aMousePos;
std::unique_ptr<GraphCtrlUserCall> pUserCall;
SdrObjKind eObjKind;
sal_uInt16 nPolyEdit;
bool bEditMode;
Graphic maGraphic;
ScopedVclPtrInstance<VirtualDevice> mxVD;
Idle maUpdateIdle;
Link<GraphCtrl*,void> maMousePosLink;
Link<GraphCtrl*,void> maGraphSizeLink;
Link<GraphCtrl*,void> maUpdateLink;
MapMode maMap100;
Size maGraphSize;
Point maMousePos;
std::unique_ptr<GraphCtrlUserCall> mpUserCall;
SdrObjKind meObjKind;
sal_uInt16 mnPolyEdit;
bool mbEditMode;
bool mbSdrMode;
bool mbInIdleUpdate;
weld::Dialog* mpDialog;
@@ -71,8 +71,8 @@ class SAL_DLLPUBLIC_RTTI GraphCtrl : public weld::CustomWidgetController
protected:
std::unique_ptr<SdrModel> pModel;
std::unique_ptr<SdrView> pView;
std::unique_ptr<SdrModel> mpModel;
std::unique_ptr<SdrView> mpView;
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
virtual void Resize() override;
@@ -89,7 +89,7 @@ protected:
void GraphicToVD();
SdrObjUserCall* GetSdrUserCall() { return pUserCall.get(); }
SdrObjUserCall* GetSdrUserCall() { return mpUserCall.get(); }
public:
@@ -98,28 +98,28 @@ public:
SVX_DLLPUBLIC virtual ~GraphCtrl() override;
SVX_DLLPUBLIC void SetGraphic( const Graphic& rGraphic, bool bNewModel = true );
const Graphic& GetGraphic() const { return aGraphic; }
const Size& GetGraphicSize() const { return aGraphSize; }
const Graphic& GetGraphic() const { return maGraphic; }
const Size& GetGraphicSize() const { return maGraphSize; }
const Point& GetMousePos() const { return aMousePos; }
const Point& GetMousePos() const { return maMousePos; }
void SetEditMode( const bool bEditMode );
void SetPolyEditMode( const sal_uInt16 nPolyEdit );
sal_uInt16 GetPolyEditMode() const { return nPolyEdit; }
sal_uInt16 GetPolyEditMode() const { return mnPolyEdit; }
void SetObjKind( const SdrObjKind eObjKind );
SdrModel* GetSdrModel() const { return pModel.get(); }
SdrView* GetSdrView() const { return pView.get(); }
SdrModel* GetSdrModel() const { return mpModel.get(); }
SdrView* GetSdrView() const { return mpView.get(); }
SdrObject* GetSelectedSdrObject() const;
bool IsChanged() const { return mbSdrMode && pModel->IsChanged(); }
bool IsChanged() const { return mbSdrMode && mpModel->IsChanged(); }
void SetMousePosLink( const Link<GraphCtrl*,void>& rLink ) { aMousePosLink = rLink; }
void SetMousePosLink( const Link<GraphCtrl*,void>& rLink ) { maMousePosLink = rLink; }
void SetGraphSizeLink( const Link<GraphCtrl*,void>& rLink ) { aGraphSizeLink = rLink; }
void SetGraphSizeLink( const Link<GraphCtrl*,void>& rLink ) { maGraphSizeLink = rLink; }
void SetUpdateLink( const Link<GraphCtrl*,void>& rLink ) { aUpdateLink = rLink; }
void SetUpdateLink( const Link<GraphCtrl*,void>& rLink ) { maUpdateLink = rLink; }
void QueueIdleUpdate();
void SetSdrMode(bool b);
+22 -22
View File
@@ -42,7 +42,7 @@ ContourWindow::ContourWindow(weld::Dialog* pDialog)
void ContourWindow::SetPolyPolygon(const tools::PolyPolygon& rPolyPoly)
{
SdrPage* pPage = pModel->GetPage(0);
SdrPage* pPage = mpModel->GetPage(0);
const sal_uInt16 nPolyCount = rPolyPoly.Count();
// First delete all drawing objects
@@ -50,7 +50,7 @@ void ContourWindow::SetPolyPolygon(const tools::PolyPolygon& rPolyPoly)
// To avoid to have destroyed objects which are still selected, it is necessary to deselect
// them first (!)
pView->UnmarkAllObj();
mpView->UnmarkAllObj();
// clear SdrObjects with broadcasting
pPage->ClearSdrObjList();
@@ -60,11 +60,11 @@ void ContourWindow::SetPolyPolygon(const tools::PolyPolygon& rPolyPoly)
basegfx::B2DPolyPolygon aPolyPolygon;
aPolyPolygon.append(aPolyPoly[ i ].getB2DPolygon());
rtl::Reference<SdrPathObj> pPathObj = new SdrPathObj(
*pModel,
*mpModel,
SdrObjKind::PathFill,
std::move(aPolyPolygon));
SfxItemSet aSet(pModel->GetItemPool());
SfxItemSet aSet(mpModel->GetItemPool());
aSet.Put(XFillStyleItem(drawing::FillStyle_SOLID));
aSet.Put(XFillColorItem(u""_ustr, TRANSCOL));
@@ -77,18 +77,18 @@ void ContourWindow::SetPolyPolygon(const tools::PolyPolygon& rPolyPoly)
if (nPolyCount)
{
pView->MarkAll();
pView->CombineMarkedObjects(false);
mpView->MarkAll();
mpView->CombineMarkedObjects(false);
}
pModel->SetChanged(false);
mpModel->SetChanged(false);
}
const tools::PolyPolygon& ContourWindow::GetPolyPolygon()
{
if ( pModel->IsChanged() )
if ( mpModel->IsChanged() )
{
SdrPage* pPage = pModel->GetPage( 0 );
SdrPage* pPage = mpModel->GetPage( 0 );
aPolyPoly = tools::PolyPolygon();
@@ -101,7 +101,7 @@ const tools::PolyPolygon& ContourWindow::GetPolyPolygon()
aPolyPoly = tools::PolyPolygon(aB2DPolyPolygon);
}
pModel->SetChanged( false );
mpModel->SetChanged( false );
}
return aPolyPoly;
@@ -111,27 +111,27 @@ void ContourWindow::InitSdrModel()
{
GraphCtrl::InitSdrModel();
SfxItemSet aSet( pModel->GetItemPool() );
SfxItemSet aSet( mpModel->GetItemPool() );
aSet.Put( XFillColorItem( u""_ustr, TRANSCOL ) );
aSet.Put( XFillTransparenceItem( 50 ) );
pView->SetAttributes( aSet );
pView->SetFrameDragSingles();
mpView->SetAttributes( aSet );
mpView->SetFrameDragSingles();
}
void ContourWindow::SdrObjCreated( const SdrObject& )
{
pView->MarkAll();
pView->CombineMarkedObjects( false );
mpView->MarkAll();
mpView->CombineMarkedObjects( false );
}
bool ContourWindow::IsContourChanged() const
{
SdrPage* pPage = pModel->GetPage( 0 );
SdrPage* pPage = mpModel->GetPage( 0 );
bool bRet = false;
if ( pPage && pPage->GetObjCount() )
bRet = static_cast<SdrPathObj*>( pPage->GetObj( 0 ) )->GetPathPoly().count() && pModel->IsChanged();
bRet = static_cast<SdrPathObj*>( pPage->GetObj( 0 ) )->GetPathPoly().count() && mpModel->IsChanged();
return bRet;
}
@@ -208,10 +208,10 @@ bool ContourWindow::MouseButtonUp(const MouseEvent& rMEvt)
_aPolyPoly.Clip( aWorkRect );
SetPolyPolygon( _aPolyPoly );
pView->SetWorkArea( aWorkRect );
mpView->SetWorkArea( aWorkRect );
}
else
pView->SetWorkArea( aGraphRect );
mpView->SetWorkArea( aGraphRect );
Invalidate( aGraphRect );
@@ -228,7 +228,7 @@ void ContourWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
// #i75482#
// encapsulate the redraw using Begin/End and use the returned
// data to get the target output device (e.g. when pre-rendering)
SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(&rRenderContext);
SdrPaintWindow* pPaintWindow = mpView->BeginCompleteRedraw(&rRenderContext);
pPaintWindow->SetOutputToWindow(true);
OutputDevice& rTarget = pPaintWindow->GetTargetOutputDevice();
@@ -255,8 +255,8 @@ void ContourWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
// #i75482#
const vcl::Region aRepaintRegion(rRect);
pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
pView->EndCompleteRedraw(*pPaintWindow, true);
mpView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
mpView->EndCompleteRedraw(*pPaintWindow, true);
}
void ContourWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
+136 -136
View File
@@ -51,19 +51,19 @@ void GraphCtrlUserCall::Changed( const SdrObject& rObj, SdrUserCallType eType, c
}
GraphCtrl::GraphCtrl(weld::Dialog* pDialog)
: aUpdateIdle("svx GraphCtrl Update")
, aMap100(MapUnit::Map100thMM)
, eObjKind(SdrObjKind::NONE)
, nPolyEdit(0)
, bEditMode(false)
: maUpdateIdle("svx GraphCtrl Update")
, maMap100(MapUnit::Map100thMM)
, meObjKind(SdrObjKind::NONE)
, mnPolyEdit(0)
, mbEditMode(false)
, mbSdrMode(false)
, mbInIdleUpdate(false)
, mpDialog(pDialog)
{
pUserCall.reset(new GraphCtrlUserCall( *this ));
aUpdateIdle.SetPriority( TaskPriority::LOWEST );
aUpdateIdle.SetInvokeHandler( LINK( this, GraphCtrl, UpdateHdl ) );
aUpdateIdle.Start();
mpUserCall.reset(new GraphCtrlUserCall( *this ));
maUpdateIdle.SetPriority( TaskPriority::LOWEST );
maUpdateIdle.SetInvokeHandler( LINK( this, GraphCtrl, UpdateHdl ) );
maUpdateIdle.Start();
}
void GraphCtrl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
@@ -74,7 +74,7 @@ void GraphCtrl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
GraphCtrl::~GraphCtrl()
{
aUpdateIdle.Stop();
maUpdateIdle.Stop();
#if !ENABLE_WASM_STRIP_ACCESSIBILITY
if( mpAccContext.is() )
@@ -84,9 +84,9 @@ GraphCtrl::~GraphCtrl()
}
#endif
pView.reset();
pModel.reset();
pUserCall.reset();
mpView.reset();
mpModel.reset();
mpUserCall.reset();
}
void GraphCtrl::SetSdrMode(bool bSdrMode)
@@ -96,12 +96,12 @@ void GraphCtrl::SetSdrMode(bool bSdrMode)
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
rDevice.SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
xVD->SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
rDevice.SetMapMode( aMap100 );
xVD->SetMapMode( aMap100 );
mxVD->SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
rDevice.SetMapMode( maMap100 );
mxVD->SetMapMode( maMap100 );
pView.reset();
pModel.reset();
mpView.reset();
mpModel.reset();
if ( mbSdrMode )
InitSdrModel();
@@ -116,57 +116,57 @@ void GraphCtrl::InitSdrModel()
rtl::Reference<SdrPage> pPage;
// destroy old junk
pView.reset();
pModel.reset();
mpView.reset();
mpModel.reset();
// Creating a Model
pModel.reset(new SdrModel(nullptr, nullptr, true));
pModel->SetScaleUnit(aMap100.GetMapUnit());
pModel->SetDefaultFontHeight( 500 );
mpModel.reset(new SdrModel(nullptr, nullptr, true));
mpModel->SetScaleUnit(maMap100.GetMapUnit());
mpModel->SetDefaultFontHeight( 500 );
pPage = new SdrPage( *pModel );
pPage = new SdrPage( *mpModel );
pPage->SetSize( aGraphSize );
pPage->SetSize( maGraphSize );
pPage->SetBorder( 0, 0, 0, 0 );
pModel->InsertPage( pPage.get() );
pModel->SetChanged( false );
mpModel->InsertPage( pPage.get() );
mpModel->SetChanged( false );
// Creating a View
pView.reset(new GraphCtrlView(*pModel, this));
pView->SetWorkArea( tools::Rectangle( Point(), aGraphSize ) );
pView->EnableExtendedMouseEventDispatcher( true );
pView->ShowSdrPage(pView->GetModel().GetPage(0));
pView->SetFrameDragSingles();
pView->SetMarkedPointsSmooth( SdrPathSmoothKind::Symmetric );
pView->SetEditMode();
mpView.reset(new GraphCtrlView(*mpModel, this));
mpView->SetWorkArea( tools::Rectangle( Point(), maGraphSize ) );
mpView->EnableExtendedMouseEventDispatcher( true );
mpView->ShowSdrPage(mpView->GetModel().GetPage(0));
mpView->SetFrameDragSingles();
mpView->SetMarkedPointsSmooth( SdrPathSmoothKind::Symmetric );
mpView->SetEditMode();
// #i72889# set needed flags
pView->SetPageDecorationAllowed(false);
pView->SetMasterPageVisualizationAllowed(false);
pView->SetBufferedOutputAllowed(true);
pView->SetBufferedOverlayAllowed(true);
mpView->SetPageDecorationAllowed(false);
mpView->SetMasterPageVisualizationAllowed(false);
mpView->SetBufferedOutputAllowed(true);
mpView->SetBufferedOverlayAllowed(true);
#if !ENABLE_WASM_STRIP_ACCESSIBILITY
// Tell the accessibility object about the changes.
if (mpAccContext.is())
mpAccContext->setModelAndView (pModel.get(), pView.get());
mpAccContext->setModelAndView (mpModel.get(), mpView.get());
#endif
}
void GraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel )
{
aGraphic = rGraphic;
xVD->SetOutputSizePixel(Size(0, 0)); //force redraw
maGraphic = rGraphic;
mxVD->SetOutputSizePixel(Size(0, 0)); //force redraw
if ( aGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
aGraphSize = Application::GetDefaultDevice()->PixelToLogic( aGraphic.GetPrefSize(), aMap100 );
if ( maGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel )
maGraphSize = Application::GetDefaultDevice()->PixelToLogic( maGraphic.GetPrefSize(), maMap100 );
else
aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 );
maGraphSize = OutputDevice::LogicToLogic( maGraphic.GetPrefSize(), maGraphic.GetPrefMapMode(), maMap100 );
if ( mbSdrMode && bNewModel )
InitSdrModel();
aGraphSizeLink.Call( this );
maGraphSizeLink.Call( this );
Resize();
@@ -177,28 +177,28 @@ void GraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel )
void GraphCtrl::GraphicToVD()
{
OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
xVD->SetOutputSizePixel(GetOutputSizePixel());
xVD->SetBackground(rDevice.GetBackground());
xVD->Erase();
const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType());
mxVD->SetOutputSizePixel(GetOutputSizePixel());
mxVD->SetBackground(rDevice.GetBackground());
mxVD->Erase();
const bool bGraphicValid(GraphicType::NONE != maGraphic.GetType());
if (bGraphicValid)
aGraphic.Draw(*xVD, Point(), aGraphSize);
maGraphic.Draw(*mxVD, Point(), maGraphSize);
}
void GraphCtrl::Resize()
{
weld::CustomWidgetController::Resize();
if (aGraphSize.Width() && aGraphSize.Height())
if (maGraphSize.Width() && maGraphSize.Height())
{
MapMode aDisplayMap( aMap100 );
MapMode aDisplayMap( maMap100 );
Point aNewPos;
Size aNewSize;
OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
const Size aWinSize = rDevice.PixelToLogic( GetOutputSizePixel(), aDisplayMap );
const tools::Long nWidth = aWinSize.Width();
const tools::Long nHeight = aWinSize.Height();
double fGrfWH = static_cast<double>(aGraphSize.Width()) / aGraphSize.Height();
double fGrfWH = static_cast<double>(maGraphSize.Width()) / maGraphSize.Height();
double fWinWH = static_cast<double>(nWidth) / nHeight;
// Adapt Bitmap to Thumb size
@@ -217,12 +217,12 @@ void GraphCtrl::Resize()
aNewPos.setY( ( nHeight - aNewSize.Height() ) >> 1 );
// Implementing MapMode for Engine
aDisplayMap.SetScaleX( Fraction( aNewSize.Width(), aGraphSize.Width() ) );
aDisplayMap.SetScaleY( Fraction( aNewSize.Height(), aGraphSize.Height() ) );
aDisplayMap.SetScaleX( Fraction( aNewSize.Width(), maGraphSize.Width() ) );
aDisplayMap.SetScaleY( Fraction( aNewSize.Height(), maGraphSize.Height() ) );
aDisplayMap.SetOrigin( OutputDevice::LogicToLogic( aNewPos, aMap100, aDisplayMap ) );
aDisplayMap.SetOrigin( OutputDevice::LogicToLogic( aNewPos, maMap100, aDisplayMap ) );
rDevice.SetMapMode( aDisplayMap );
xVD->SetMapMode( aDisplayMap );
mxVD->SetMapMode( aDisplayMap );
}
Invalidate();
@@ -232,14 +232,14 @@ void GraphCtrl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle
{
// #i72889# used split repaint to be able to paint an own background
// even to the buffered view
const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType());
const bool bGraphicValid(GraphicType::NONE != maGraphic.GetType());
if (GetOutputSizePixel() != xVD->GetOutputSizePixel())
if (GetOutputSizePixel() != mxVD->GetOutputSizePixel())
GraphicToVD();
if (mbSdrMode)
{
SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(&rRenderContext);
SdrPaintWindow* pPaintWindow = mpView->BeginCompleteRedraw(&rRenderContext);
pPaintWindow->SetOutputToWindow(true);
if (bGraphicValid)
@@ -250,19 +250,19 @@ void GraphCtrl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle
rTarget.SetBackground(rDevice.GetBackground());
rTarget.Erase();
rTarget.DrawOutDev(Point(), xVD->GetOutputSize(), Point(), xVD->GetOutputSize(), *xVD);
rTarget.DrawOutDev(Point(), mxVD->GetOutputSize(), Point(), mxVD->GetOutputSize(), *mxVD);
}
const vcl::Region aRepaintRegion(rRect);
pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
pView->EndCompleteRedraw(*pPaintWindow, true);
mpView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
mpView->EndCompleteRedraw(*pPaintWindow, true);
}
else
{
// #i73381# in non-SdrMode, paint to local directly
rRenderContext.DrawOutDev(rRect.TopLeft(), rRect.GetSize(),
rRect.TopLeft(), rRect.GetSize(),
*xVD);
*mxVD);
}
}
@@ -295,7 +295,7 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
{
if ( mbSdrMode )
{
pView->DeleteMarked();
mpView->DeleteMarked();
bProc = true;
}
}
@@ -305,15 +305,15 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
{
if ( mbSdrMode )
{
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
if ( pView->IsAction() )
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
if ( mpView->IsAction() )
{
pView->BrkAction();
mpView->BrkAction();
bProc = true;
}
else if ( rMarkList.GetMarkCount() != 0 )
{
pView->UnmarkAllObj();
mpView->UnmarkAllObj();
bProc = true;
}
}
@@ -329,19 +329,19 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
{
bool bForward = !aCode.IsShift();
// select next object
if ( ! pView->MarkNextObj( bForward ))
if ( ! mpView->MarkNextObj( bForward ))
{
// At first or last object. Cycle to the other end
// of the list.
pView->UnmarkAllObj();
pView->MarkNextObj (bForward);
mpView->UnmarkAllObj();
mpView->MarkNextObj (bForward);
}
bProc = true;
}
else if(aCode.IsMod1())
{
// select next handle
const SdrHdlList& rHdlList = pView->GetHdlList();
const SdrHdlList& rHdlList = mpView->GetHdlList();
bool bForward(!aCode.IsShift());
const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
@@ -358,8 +358,8 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
if ( aCode.IsMod1() )
{
// mark last object
pView->UnmarkAllObj();
pView->MarkNextObj();
mpView->UnmarkAllObj();
mpView->MarkNextObj();
bProc = true;
}
@@ -370,8 +370,8 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
{
if ( aCode.IsMod1() )
{
pView->UnmarkAllObj();
pView->MarkNextObj(true);
mpView->UnmarkAllObj();
mpView->MarkNextObj(true);
bProc = true;
}
@@ -411,7 +411,7 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
nY = 0;
}
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
if (rMarkList.GetMarkCount() != 0 && !aCode.IsMod1() )
{
if(aCode.IsMod2())
@@ -429,17 +429,17 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
}
// II
const SdrHdlList& rHdlList = pView->GetHdlList();
const SdrHdlList& rHdlList = mpView->GetHdlList();
SdrHdl* pHdl = rHdlList.GetFocusHdl();
if(nullptr == pHdl)
{
// restrict movement to WorkArea
const tools::Rectangle& rWorkArea = pView->GetWorkArea();
const tools::Rectangle& rWorkArea = mpView->GetWorkArea();
if(!rWorkArea.IsEmpty())
{
tools::Rectangle aMarkRect(pView->GetMarkedObjRect());
tools::Rectangle aMarkRect(mpView->GetMarkedObjRect());
aMarkRect.Move(nX, nY);
if(!aMarkRect.Contains(rWorkArea))
@@ -469,7 +469,7 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
// no handle selected
if(0 != nX || 0 != nY)
{
pView->MoveAllMarked(Size(nX, nY));
mpView->MoveAllMarked(Size(nX, nY));
}
}
else
@@ -480,30 +480,30 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
// now move the Handle (nX, nY)
Point aStartPoint(pHdl->GetPos());
Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
const SdrDragStat& rDragStat = pView->GetDragStat();
const SdrDragStat& rDragStat = mpView->GetDragStat();
// start dragging
pView->BegDragObj(aStartPoint, nullptr, pHdl, 0);
mpView->BegDragObj(aStartPoint, nullptr, pHdl, 0);
if(pView->IsDragObj())
if(mpView->IsDragObj())
{
bool bWasNoSnap = rDragStat.IsNoSnap();
bool bWasSnapEnabled = pView->IsSnapEnabled();
bool bWasSnapEnabled = mpView->IsSnapEnabled();
// switch snapping off
if(!bWasNoSnap)
const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
if(bWasSnapEnabled)
pView->SetSnapEnabled(false);
mpView->SetSnapEnabled(false);
pView->MovAction(aEndPoint);
pView->EndDragObj();
mpView->MovAction(aEndPoint);
mpView->EndDragObj();
// restore snap
if(!bWasNoSnap)
const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
if(bWasSnapEnabled)
pView->SetSnapEnabled(bWasSnapEnabled);
mpView->SetSnapEnabled(bWasSnapEnabled);
}
}
}
@@ -515,7 +515,7 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
case KEY_SPACE:
{
const SdrHdlList& rHdlList = pView->GetHdlList();
const SdrHdlList& rHdlList = mpView->GetHdlList();
SdrHdl* pHdl = rHdlList.GetFocusHdl();
if(pHdl)
@@ -526,21 +526,21 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt )
sal_uInt32 nPol(pHdl->GetPolyNum());
sal_uInt32 nPnt(pHdl->GetPointNum());
if(pView->IsPointMarked(*pHdl))
if(mpView->IsPointMarked(*pHdl))
{
if(rKEvt.GetKeyCode().IsShift())
{
pView->UnmarkPoint(*pHdl);
mpView->UnmarkPoint(*pHdl);
}
}
else
{
if(!rKEvt.GetKeyCode().IsShift())
{
pView->UnmarkAllPoints();
mpView->UnmarkAllPoints();
}
pView->MarkPoint(*pHdl);
mpView->MarkPoint(*pHdl);
}
if(nullptr == rHdlList.GetFocusHdl())
@@ -593,34 +593,34 @@ bool GraphCtrl::MouseButtonDown( const MouseEvent& rMEvt )
const Point aLogPt( rDevice.PixelToLogic( rMEvt.GetPosPixel() ) );
if ( !tools::Rectangle( Point(), aGraphSize ).Contains( aLogPt ) && !pView->IsEditMode() )
if ( !tools::Rectangle( Point(), maGraphSize ).Contains( aLogPt ) && !mpView->IsEditMode() )
weld::CustomWidgetController::MouseButtonDown( rMEvt );
else
{
// Get Focus for key inputs
GrabFocus();
if ( nPolyEdit )
if ( mnPolyEdit )
{
SdrViewEvent aVEvt;
SdrHitKind eHit = pView->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt );
SdrHitKind eHit = mpView->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt );
if ( nPolyEdit == SID_BEZIER_INSERT && eHit == SdrHitKind::MarkedObject )
pView->BegInsObjPoint( aLogPt, rMEvt.IsMod1());
if ( mnPolyEdit == SID_BEZIER_INSERT && eHit == SdrHitKind::MarkedObject )
mpView->BegInsObjPoint( aLogPt, rMEvt.IsMod1());
else
pView->MouseButtonDown( rMEvt, &rDevice );
mpView->MouseButtonDown( rMEvt, &rDevice );
}
else
pView->MouseButtonDown( rMEvt, &rDevice );
mpView->MouseButtonDown( rMEvt, &rDevice );
}
SdrObject* pCreateObj = pView->GetCreateObj();
SdrObject* pCreateObj = mpView->GetCreateObj();
// We want to realize the insert
if ( pCreateObj && !pCreateObj->GetUserCall() )
pCreateObj->SetUserCall( pUserCall.get() );
pCreateObj->SetUserCall( mpUserCall.get() );
SetPointer( pView->GetPreferredPointer( aLogPt, &rDevice ) );
SetPointer( mpView->GetPreferredPointer( aLogPt, &rDevice ) );
}
else
weld::CustomWidgetController::MouseButtonDown( rMEvt );
@@ -637,28 +637,28 @@ bool GraphCtrl::MouseMove(const MouseEvent& rMEvt)
if ( mbSdrMode )
{
pView->MouseMove( rMEvt, &rDevice );
mpView->MouseMove( rMEvt, &rDevice );
if( ( SID_BEZIER_INSERT == nPolyEdit ) &&
!pView->PickHandle( aLogPos ) &&
!pView->IsInsObjPoint() )
if( ( SID_BEZIER_INSERT == mnPolyEdit ) &&
!mpView->PickHandle( aLogPos ) &&
!mpView->IsInsObjPoint() )
{
SetPointer( PointerStyle::Cross );
}
else
SetPointer( pView->GetPreferredPointer( aLogPos, &rDevice ) );
SetPointer( mpView->GetPreferredPointer( aLogPos, &rDevice ) );
}
else
weld::CustomWidgetController::MouseButtonUp( rMEvt );
if ( aMousePosLink.IsSet() )
if ( maMousePosLink.IsSet() )
{
if ( tools::Rectangle( Point(), aGraphSize ).Contains( aLogPos ) )
aMousePos = aLogPos;
if ( tools::Rectangle( Point(), maGraphSize ).Contains( aLogPos ) )
maMousePos = aLogPos;
else
aMousePos = Point();
maMousePos = Point();
aMousePosLink.Call( this );
maMousePosLink.Call( this );
}
QueueIdleUpdate();
@@ -672,13 +672,13 @@ bool GraphCtrl::MouseButtonUp(const MouseEvent& rMEvt)
{
OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
if ( pView->IsInsObjPoint() )
pView->EndInsObjPoint( SdrCreateCmd::ForceEnd );
if ( mpView->IsInsObjPoint() )
mpView->EndInsObjPoint( SdrCreateCmd::ForceEnd );
else
pView->MouseButtonUp( rMEvt, &rDevice );
mpView->MouseButtonUp( rMEvt, &rDevice );
ReleaseMouse();
SetPointer( pView->GetPreferredPointer( rDevice.PixelToLogic( rMEvt.GetPosPixel() ), &rDevice ) );
SetPointer( mpView->GetPreferredPointer( rDevice.PixelToLogic( rMEvt.GetPosPixel() ), &rDevice ) );
}
else
weld::CustomWidgetController::MouseButtonUp( rMEvt );
@@ -694,7 +694,7 @@ SdrObject* GraphCtrl::GetSelectedSdrObject() const
if ( mbSdrMode )
{
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
if ( rMarkList.GetMarkCount() == 1 )
pSdrObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
@@ -707,26 +707,26 @@ void GraphCtrl::SetEditMode( const bool _bEditMode )
{
if ( mbSdrMode )
{
bEditMode = _bEditMode;
pView->SetEditMode( bEditMode );
eObjKind = SdrObjKind::NONE;
pView->SetCurrentObj(eObjKind);
mbEditMode = _bEditMode;
mpView->SetEditMode( mbEditMode );
meObjKind = SdrObjKind::NONE;
mpView->SetCurrentObj(meObjKind);
}
else
bEditMode = false;
mbEditMode = false;
QueueIdleUpdate();
}
void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit )
{
if ( mbSdrMode && ( _nPolyEdit != nPolyEdit ) )
if ( mbSdrMode && ( _nPolyEdit != mnPolyEdit ) )
{
nPolyEdit = _nPolyEdit;
pView->SetFrameDragSingles( nPolyEdit == 0 );
mnPolyEdit = _nPolyEdit;
mpView->SetFrameDragSingles( mnPolyEdit == 0 );
}
else
nPolyEdit = 0;
mnPolyEdit = 0;
QueueIdleUpdate();
}
@@ -735,13 +735,13 @@ void GraphCtrl::SetObjKind( const SdrObjKind _eObjKind )
{
if ( mbSdrMode )
{
bEditMode = false;
pView->SetEditMode( bEditMode );
eObjKind = _eObjKind;
pView->SetCurrentObj(eObjKind);
mbEditMode = false;
mpView->SetEditMode( mbEditMode );
meObjKind = _eObjKind;
mpView->SetCurrentObj(meObjKind);
}
else
eObjKind = SdrObjKind::NONE;
meObjKind = SdrObjKind::NONE;
QueueIdleUpdate();
}
@@ -749,14 +749,14 @@ void GraphCtrl::SetObjKind( const SdrObjKind _eObjKind )
IMPL_LINK_NOARG(GraphCtrl, UpdateHdl, Timer *, void)
{
mbInIdleUpdate = true;
aUpdateLink.Call( this );
maUpdateLink.Call( this );
mbInIdleUpdate = false;
}
void GraphCtrl::QueueIdleUpdate()
{
if (!mbInIdleUpdate)
aUpdateIdle.Start();
maUpdateIdle.Start();
}
namespace
+30 -30
View File
@@ -152,7 +152,7 @@ void IMapWindow::ReplaceActualIMapInfo( const NotifyInfo& rNewInfo )
pIMapObj->SetURL( rNewInfo.aMarkURL );
pIMapObj->SetAltText( rNewInfo.aMarkAltText );
pIMapObj->SetTarget( rNewInfo.aMarkTarget );
pModel->SetChanged();
mpModel->SetChanged();
UpdateInfo( false );
}
}
@@ -160,9 +160,9 @@ void IMapWindow::ReplaceActualIMapInfo( const NotifyInfo& rNewInfo )
const ImageMap& IMapWindow::GetImageMap()
{
if ( pModel->IsChanged() )
if ( mpModel->IsChanged() )
{
SdrPage* pPage = pModel->GetPage( 0 );
SdrPage* pPage = mpModel->GetPage( 0 );
if ( pPage )
{
@@ -177,7 +177,7 @@ const ImageMap& IMapWindow::GetImageMap()
}
}
pModel->SetChanged( false );
mpModel->SetChanged( false );
}
return aIMap;
@@ -189,7 +189,7 @@ void IMapWindow::SetTargetList( const TargetList& rTargetList )
// Fill with the provided list
aTargetList = rTargetList;
pModel->SetChanged( false );
mpModel->SetChanged( false );
}
rtl::Reference<SdrObject> IMapWindow::CreateObj( const IMapObject* pIMapObj )
@@ -208,7 +208,7 @@ rtl::Reference<SdrObject> IMapWindow::CreateObj( const IMapObject* pIMapObj )
// clipped on CanvasPane
aDrawRect.Intersection( aClipRect );
pSdrObj = new SdrRectObj(*pModel, aDrawRect);
pSdrObj = new SdrRectObj(*mpModel, aDrawRect);
pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapRectangleObject( *pIMapRectObj )));
}
break;
@@ -225,7 +225,7 @@ rtl::Reference<SdrObject> IMapWindow::CreateObj( const IMapObject* pIMapObj )
aCircle.Intersection( aClipRect );
pSdrObj = new SdrCircObj(
*pModel,
*mpModel,
SdrCircKind::Full,
aCircle,
0_deg100,
@@ -247,7 +247,7 @@ rtl::Reference<SdrObject> IMapWindow::CreateObj( const IMapObject* pIMapObj )
aDrawRect.Intersection( aClipRect );
pSdrObj = new SdrCircObj(
*pModel,
*mpModel,
SdrCircKind::Full,
aDrawRect,
0_deg100,
@@ -264,7 +264,7 @@ rtl::Reference<SdrObject> IMapWindow::CreateObj( const IMapObject* pIMapObj )
basegfx::B2DPolygon aPolygon;
aPolygon.append(aDrawPoly.getB2DPolygon());
pSdrObj = new SdrPathObj(
*pModel,
*mpModel,
SdrObjKind::Polygon,
basegfx::B2DPolyPolygon(aPolygon));
}
@@ -279,7 +279,7 @@ rtl::Reference<SdrObject> IMapWindow::CreateObj( const IMapObject* pIMapObj )
if ( pSdrObj )
{
SfxItemSet aSet( pModel->GetItemPool() );
SfxItemSet aSet( mpModel->GetItemPool() );
aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
aSet.Put( XFillColorItem( u""_ustr, TRANSCOL ) );
@@ -308,12 +308,12 @@ void IMapWindow::InitSdrModel()
{
GraphCtrl::InitSdrModel();
SfxItemSet aSet( pModel->GetItemPool() );
SfxItemSet aSet( mpModel->GetItemPool() );
aSet.Put( XFillColorItem( u""_ustr, TRANSCOL ) );
aSet.Put( XFillTransparenceItem( 50 ) );
pView->SetAttributes( aSet );
pView->SetFrameDragSingles();
mpView->SetAttributes( aSet );
mpView->SetFrameDragSingles();
}
void IMapWindow::SdrObjCreated( const SdrObject& rObj )
@@ -456,7 +456,7 @@ SdrObject* IMapWindow::GetHitSdrObj( const Point& rPosPixel ) const
if ( tools::Rectangle( Point(), GetGraphicSize() ).Contains( aPt ) )
{
SdrPage* pPage = pModel->GetPage( 0 );
SdrPage* pPage = mpModel->GetPage( 0 );
if ( pPage )
{
for ( size_t i = pPage->GetObjCount(); i > 0; )
@@ -498,13 +498,13 @@ bool IMapWindow::Command(const CommandEvent& rCEvt)
{
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDrawingArea(), u"svx/ui/imapmenu.ui"_ustr));
mxPopupMenu = xBuilder->weld_menu(u"menu"_ustr);
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
const size_t nMarked = rMarkList.GetMarkCount();
mxPopupMenu->set_sensitive(u"url"_ustr, false);
mxPopupMenu->set_sensitive(u"active"_ustr, false);
mxPopupMenu->set_sensitive(u"macro"_ustr, false);
mxPopupMenu->set_sensitive(u"selectall"_ustr, pModel->GetPage(0)->GetObjCount() != rMarkList.GetMarkCount());
mxPopupMenu->set_sensitive(u"selectall"_ustr, mpModel->GetPage(0)->GetObjCount() != rMarkList.GetMarkCount());
if ( !nMarked )
{
@@ -572,9 +572,9 @@ sal_Int8 IMapWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
pIMapObj->SetURL( aBookMark.GetURL() );
pIMapObj->SetAltText( aBookMark.GetDescription() );
pModel->SetChanged();
pView->UnmarkAll();
pView->MarkObj( pSdrObj, pView->GetSdrPageView() );
mpModel->SetChanged();
mpView->UnmarkAll();
mpView->MarkObj( pSdrObj, mpView->GetSdrPageView() );
UpdateInfo( true );
nRet = rEvt.mnAction;
}
@@ -590,7 +590,7 @@ OUString IMapWindow::RequestHelp(tools::Rectangle& rHelpArea)
Point aPos = rDevice.PixelToLogic(rHelpArea.TopLeft());
SdrPageView* pPageView = nullptr;
SdrObject* pSdrObj = pView->PickObj(aPos, pView->getHitTolLog(), pPageView);
SdrObject* pSdrObj = mpView->PickObj(aPos, mpView->getHitTolLog(), pPageView);
if (pSdrObj)
{
const IMapObject* pIMapObj = GetIMapObj( pSdrObj );
@@ -615,7 +615,7 @@ void IMapWindow::SetCurrentObjState( bool bActive )
if ( !pObj )
return;
SfxItemSet aSet( pModel->GetItemPool() );
SfxItemSet aSet( mpModel->GetItemPool() );
GetIMapObj( pObj )->SetActive( bActive );
@@ -632,7 +632,7 @@ void IMapWindow::SetCurrentObjState( bool bActive )
aSet.Put( XLineColorItem( u""_ustr, COL_BLACK ) );
}
pView->SetAttributes( aSet );
mpView->SetAttributes( aSet );
}
void IMapWindow::UpdateInfo( bool bNewObj )
@@ -696,7 +696,7 @@ void IMapWindow::DoMacroAssign()
{
const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
pIMapObj->SetMacroTable( pOutSet->Get( SID_ATTR_MACROITEM ).GetMacroTable() );
pModel->SetChanged();
mpModel->SetChanged();
UpdateInfo( false );
}
pMacroDlg->disposeOnce();
@@ -733,7 +733,7 @@ void IMapWindow::DoPropertyDialog()
pIMapObj->SetDesc( aDlg->GetDesc() );
pIMapObj->SetTarget( aDlg->GetTarget() );
pIMapObj->SetName( aDlg->GetName() );
pModel->SetChanged();
mpModel->SetChanged();
UpdateInfo( true );
}
@@ -750,17 +750,17 @@ void IMapWindow::MenuSelectHdl(const OUString& rId)
UpdateInfo( false );
}
else if (rId == "front")
pView->PutMarkedToTop();
mpView->PutMarkedToTop();
else if (rId == "forward")
pView->MovMarkedToTop();
mpView->MovMarkedToTop();
else if (rId == "backward")
pView->MovMarkedToBtm();
mpView->MovMarkedToBtm();
else if (rId == "back")
pView->PutMarkedToBtm();
mpView->PutMarkedToBtm();
else if (rId == "selectall")
pView->MarkAll();
mpView->MarkAll();
else if (rId == "delete")
pView->DeleteMarked();
mpView->DeleteMarked();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */