Kaydet (Commit) 7dde56f2 authored tarafından Caolán McNamara's avatar Caolán McNamara

use a std::unique_ptr

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