Kaydet (Commit) e83e5144 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in ChartController

Change-Id: I224db5ab179bfd84125617e643441fd9a2872e67
Reviewed-on: https://gerrit.libreoffice.org/57872
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 4089e1d9
......@@ -389,7 +389,7 @@ private:
css::uno::Reference<css::awt::XWindow> m_xViewWindow;
css::uno::Reference<css::uno::XInterface> m_xChartView;
std::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
DrawViewWrapper* m_pDrawViewWrapper;
std::unique_ptr<DrawViewWrapper> m_pDrawViewWrapper;
Selection m_aSelection;
SdrDragMode m_eDragMode;
......
......@@ -729,7 +729,7 @@ void ChartController::impl_createDrawViewController()
{
if( m_pDrawModelWrapper )
{
m_pDrawViewWrapper = new DrawViewWrapper(m_pDrawModelWrapper->getSdrModel(),GetChartWindow());
m_pDrawViewWrapper.reset( new DrawViewWrapper(m_pDrawModelWrapper->getSdrModel(),GetChartWindow()) );
m_pDrawViewWrapper->attachParentReferenceDevice( getModel() );
}
}
......@@ -742,7 +742,7 @@ void ChartController::impl_deleteDrawViewController()
SolarMutexGuard aGuard;
if( m_pDrawViewWrapper->IsTextEdit() )
this->EndTextEdit();
DELETEZ( m_pDrawViewWrapper );
m_pDrawViewWrapper.reset();
}
}
......@@ -1470,7 +1470,7 @@ DrawViewWrapper* ChartController::GetDrawViewWrapper()
{
impl_createDrawViewController();
}
return m_pDrawViewWrapper;
return m_pDrawViewWrapper.get();
}
......
......@@ -131,7 +131,7 @@ void ChartController::executeDispatch_PositionAndSize()
SfxItemSet aItemSet = m_pDrawViewWrapper->getPositionAndSizeItemSetFromMarkedObject();
//prepare and open dialog
SdrView* pSdrView = m_pDrawViewWrapper;
SdrView* pSdrView = m_pDrawViewWrapper.get();
bool bResizePossible = m_aSelection.isResizeableObjectSelected();
SolarMutexGuard aGuard;
......
......@@ -209,7 +209,7 @@ uno::Reference< css::accessibility::XAccessibleContext >
ChartController::impl_createAccessibleTextContext()
{
uno::Reference< css::accessibility::XAccessibleContext > xResult(
new AccessibleTextHelper( m_pDrawViewWrapper ));
new AccessibleTextHelper( m_pDrawViewWrapper.get() ));
return xResult;
}
......
......@@ -361,7 +361,7 @@ void ChartController::impl_PasteGraphic(
}
//select new shape
m_aSelection.setSelection( xGraphicShape );
m_aSelection.applySelection( m_pDrawViewWrapper );
m_aSelection.applySelection( m_pDrawViewWrapper.get() );
}
xGraphicShapeProp->setPropertyValue( "Graphic", uno::Any( xGraphic ));
uno::Reference< beans::XPropertySet > xGraphicProp( xGraphic, uno::UNO_QUERY );
......@@ -427,7 +427,7 @@ void ChartController::impl_PasteShapes( SdrModel* pModel )
// select last inserted shape
m_aSelection.setSelection( xSelShape );
m_aSelection.applySelection( m_pDrawViewWrapper );
m_aSelection.applySelection( m_pDrawViewWrapper.get() );
m_pDrawViewWrapper->EndUndo();
......@@ -470,7 +470,7 @@ void ChartController::impl_PasteStringAsTextShape( const OUString& rString, cons
xTextShape->setPosition( rPosition );
m_aSelection.setSelection( xTextShape );
m_aSelection.applySelection( m_pDrawViewWrapper );
m_aSelection.applySelection( m_pDrawViewWrapper.get() );
SdrObject* pObj = DrawViewWrapper::getSdrObject( xTextShape );
if ( pObj )
......
......@@ -437,7 +437,7 @@ void SAL_CALL ChartController::removePaintListener(
void ChartController::PrePaint()
{
// forward VCLs PrePaint window event to DrawingLayer
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
if (pDrawViewWrapper)
{
......@@ -477,7 +477,7 @@ void ChartController::execute_Paint(vcl::RenderContext& rRenderContext, const to
{
SolarMutexGuard aGuard;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
if (pDrawViewWrapper)
pDrawViewWrapper->CompleteRedraw(&rRenderContext, vcl::Region(rRect));
}
......@@ -557,7 +557,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
m_aSelection.remindSelectionBeforeMouseDown();
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
auto pChartWindow(GetChartWindow());
if(!pChartWindow || !pDrawViewWrapper )
return;
......@@ -707,7 +707,7 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
{
SolarMutexGuard aGuard;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
auto pChartWindow(GetChartWindow());
if(!pChartWindow || !pDrawViewWrapper)
return;
......@@ -735,7 +735,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
{
SolarMutexGuard aGuard;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
auto pChartWindow(GetChartWindow());
if(!pChartWindow || !pDrawViewWrapper)
return;
......@@ -967,7 +967,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
auto pChartWindow(GetChartWindow());
bool bIsAction = false;
{
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
if(!pChartWindow || !pDrawViewWrapper)
return;
bIsAction = m_pDrawViewWrapper->IsAction();
......@@ -1306,7 +1306,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
SolarMutexGuard aGuard;
bool bReturn=false;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
auto pChartWindow(GetChartWindow());
if(!pChartWindow || !pDrawViewWrapper)
return bReturn;
......@@ -1724,11 +1724,11 @@ void ChartController::impl_selectObjectAndNotiy()
{
{
SolarMutexGuard aGuard;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
if( pDrawViewWrapper )
{
pDrawViewWrapper->SetDragMode( m_eDragMode );
m_aSelection.applySelection( m_pDrawViewWrapper );
m_aSelection.applySelection( m_pDrawViewWrapper.get() );
}
}
impl_notifySelectionChangeListeners();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment