use a std::unique_ptr
Change-Id: I23fdc5f86d8fb9da3c74fab4e47636600fa408b7
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index 1e61f43..5520f22 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -167,7 +167,7 @@ SwOutlineTabDialog::SwOutlineTabDialog(vcl::Window* pParent, const SfxItemSet* p
pUserButton->SetClickHdl(LINK(this, SwOutlineTabDialog, FormHdl));
pUserButton->SetAccessibleRole( css::accessibility::AccessibleRole::BUTTON_MENU );
pNumRule = new SwNumRule( *rSh.GetOutlineNumRule() );
xNumRule.reset(new SwNumRule(*rSh.GetOutlineNumRule()));
GetCancelButton().SetClickHdl(LINK(this, SwOutlineTabDialog, CancelHdl));
m_nNumPosId = AddTabPage("position", &SwNumPositionTabPage::Create, nullptr);
@@ -208,7 +208,7 @@ SwOutlineTabDialog::~SwOutlineTabDialog()
void SwOutlineTabDialog::dispose()
{
delete pNumRule;
xNumRule.reset();
SfxTabDialog::dispose();
}
@@ -294,7 +294,7 @@ IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu, bool )
{
const OUString aName(pDlg->GetName());
pChapterNumRules->ApplyNumRules( SwNumRulesWithName(
*pNumRule, aName ), pDlg->GetCurEntryPos() );
*xNumRule, aName ), pDlg->GetCurEntryPos() );
pMenu->SetItemText(pMenu->GetItemId(pDlg->GetCurEntryPos()), aName);
}
return false;
@@ -305,11 +305,11 @@ IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu, bool )
const SwNumRulesWithName *pRules = pChapterNumRules->GetRules( nLevelNo );
if( pRules )
{
*pNumRule = pRules->MakeNumRule(rWrtSh);
pNumRule->SetRuleType( OUTLINE_RULE );
*xNumRule = pRules->MakeNumRule(rWrtSh);
xNumRule->SetRuleType( OUTLINE_RULE );
}
else
*pNumRule = *rWrtSh.GetOutlineNumRule();
*xNumRule = *rWrtSh.GetOutlineNumRule();
}
sal_uInt16 nPageId = GetCurPageId();
@@ -406,7 +406,7 @@ short SwOutlineTabDialog::Ok()
}
}
rWrtSh.SetOutlineNumRule( *pNumRule);
rWrtSh.SetOutlineNumRule(*xNumRule);
// #i30443#
rWrtSh.EndAction();
diff --git a/sw/source/uibase/inc/outline.hxx b/sw/source/uibase/inc/outline.hxx
index 27a5459..b97af7a 100644
--- a/sw/source/uibase/inc/outline.hxx
+++ b/sw/source/uibase/inc/outline.hxx
@@ -52,7 +52,7 @@ class SwOutlineTabDialog : public SfxTabDialog
OUString aCollNames[MAXLEVEL];
SwWrtShell& rWrtSh;
SwNumRule* pNumRule;
std::unique_ptr<SwNumRule> xNumRule;
SwChapterNumRules* pChapterNumRules;
bool bModified : 1;
@@ -72,7 +72,7 @@ public:
virtual ~SwOutlineTabDialog() override;
virtual void dispose() override;
SwNumRule* GetNumRule() {return pNumRule;}
SwNumRule* GetNumRule() { return xNumRule.get(); }
sal_uInt16 GetLevel(const OUString &rFormatName) const;
OUString* GetCollNames() {return aCollNames;}