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

loplugin:useuniqueptr in CustomAnimationDialog

Change-Id: Ic2e93c1493159c9602bd68b409052117766dcc02
Reviewed-on: https://gerrit.libreoffice.org/56328
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b9426828
......@@ -2167,9 +2167,9 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe
sal_uInt16 nTimingId = mpTabControl->GetPageId("timing");
sal_uInt16 nTextAnimId = mpTabControl->GetPageId("textanim");
mpEffectTabPage = VclPtr<CustomAnimationEffectTabPage>::Create( mpTabControl, mpSet );
mpEffectTabPage = VclPtr<CustomAnimationEffectTabPage>::Create( mpTabControl, mpSet.get() );
mpTabControl->SetTabPage( nEffectId, mpEffectTabPage );
mpDurationTabPage = VclPtr<CustomAnimationDurationTabPage>::Create( mpTabControl, mpSet );
mpDurationTabPage = VclPtr<CustomAnimationDurationTabPage>::Create( mpTabControl, mpSet.get() );
mpTabControl->SetTabPage( nTimingId, mpDurationTabPage );
bool bHasText = false;
......@@ -2178,7 +2178,7 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe
if( bHasText )
{
mpTextAnimTabPage = VclPtr<CustomAnimationTextAnimTabPage>::Create( mpTabControl, mpSet );
mpTextAnimTabPage = VclPtr<CustomAnimationTextAnimTabPage>::Create( mpTabControl, mpSet.get() );
mpTabControl->SetTabPage( nTextAnimId, mpTextAnimTabPage );
}
else
......@@ -2202,8 +2202,8 @@ void CustomAnimationDialog::dispose()
mpDurationTabPage.disposeAndClear();
mpTextAnimTabPage.disposeAndClear();
delete mpSet;
delete mpResultSet;
mpSet.reset();
mpResultSet.reset();
mpTabControl.clear();
TabDialog::dispose();
......@@ -2211,23 +2211,21 @@ void CustomAnimationDialog::dispose()
STLPropertySet* CustomAnimationDialog::getResultSet()
{
delete mpResultSet;
mpResultSet = createDefaultSet();
mpEffectTabPage->update( mpResultSet );
mpDurationTabPage->update( mpResultSet );
mpEffectTabPage->update( mpResultSet.get() );
mpDurationTabPage->update( mpResultSet.get() );
if( mpTextAnimTabPage )
mpTextAnimTabPage->update( mpResultSet );
mpTextAnimTabPage->update( mpResultSet.get() );
return mpResultSet;
return mpResultSet.get();
}
STLPropertySet* CustomAnimationDialog::createDefaultSet()
std::unique_ptr<STLPropertySet> CustomAnimationDialog::createDefaultSet()
{
Any aEmpty;
STLPropertySet* pSet = new STLPropertySet();
std::unique_ptr<STLPropertySet> pSet(new STLPropertySet());
pSet->setPropertyDefaultValue( nHandleMaxParaDepth, makeAny( sal_Int32(-1) ) );
pSet->setPropertyDefaultValue( nHandleHasAfterEffect, makeAny( false ) );
......
......@@ -148,11 +148,11 @@ public:
STLPropertySet* getResultSet();
static STLPropertySet* createDefaultSet();
static std::unique_ptr<STLPropertySet> createDefaultSet();
private:
STLPropertySet* mpSet;
STLPropertySet* mpResultSet;
std::unique_ptr<STLPropertySet> mpSet;
std::unique_ptr<STLPropertySet> mpResultSet;
VclPtr<TabControl> mpTabControl;
......
......@@ -917,7 +917,7 @@ void CustomAnimationPane::UpdateLook()
}
}
void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue )
void addValue( std::unique_ptr<STLPropertySet>& pSet, sal_Int32 nHandle, const Any& rValue )
{
switch( pSet->getPropertyState( nHandle ) )
{
......@@ -1122,9 +1122,9 @@ static bool hasVisibleShape( const Reference< XShape >& xShape )
return true;
}
STLPropertySet* CustomAnimationPane::createSelectionSet()
std::unique_ptr<STLPropertySet> CustomAnimationPane::createSelectionSet()
{
STLPropertySet* pSet = CustomAnimationDialog::createDefaultSet();
std::unique_ptr<STLPropertySet> pSet = CustomAnimationDialog::createDefaultSet();
pSet->setPropertyValue( nHandleCurrentPage, makeAny( mxCurrentPage ) );
......@@ -1666,13 +1666,13 @@ void CustomAnimationPane::changeSelection( STLPropertySet const * pResultSet, ST
void CustomAnimationPane::showOptions(const OString& sPage)
{
STLPropertySet* pSet = createSelectionSet();
std::unique_ptr<STLPropertySet> pSet = createSelectionSet();
VclPtrInstance< CustomAnimationDialog > pDlg(this, pSet, sPage);
VclPtrInstance< CustomAnimationDialog > pDlg(this, pSet.get(), sPage);
if( pDlg->Execute() )
{
addUndo();
changeSelection( pDlg->getResultSet(), pSet );
changeSelection( pDlg->getResultSet(), pSet.get() );
updateControls();
}
}
......
......@@ -109,7 +109,7 @@ private:
void moveSelection( bool bUp );
void onPreview( bool bForcePreview );
STLPropertySet* createSelectionSet();
std::unique_ptr<STLPropertySet> createSelectionSet();
void changeSelection( STLPropertySet const * pResultSet, STLPropertySet const * pOldSet );
static css::uno::Any getProperty1Value( sal_Int32 nType, const CustomAnimationEffectPtr& pEffect );
......
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