summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-16 12:49:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-23 08:15:26 +0200
commit7c256096962d73b360b870688ead7152b3378df9 (patch)
tree5d5f1e66564e5021878feb9fef3ad1c8864056c9 /vcl
parent8e0e2b7dd8d478c443351d0ea7ce271f7e839825 (diff)
loplugin:useuniqueptr in Menu
Change-Id: I4de2081597ffc55a95fe5b482c37461811f323e6 Reviewed-on: https://gerrit.libreoffice.org/53232 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/menu.cxx26
1 files changed, 9 insertions, 17 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index aea9e2dbab7b..a0cdd3b7f3de 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -228,8 +228,7 @@ void Menu::dispose()
bKilled = true;
pItemList->Clear();
- delete mpLayoutData;
- mpLayoutData = nullptr;
+ mpLayoutData.reset();
// Native-support: destroy SalMenu
ImplClearSalMenu();
@@ -452,8 +451,7 @@ void Menu::InsertItem(sal_uInt16 nItemId, const OUString& rStr, MenuItemBits nIt
NbcInsertItem(nItemId, nItemBits, rStr, this, nPos, rIdent);
vcl::Window* pWin = ImplGetWindow();
- delete mpLayoutData;
- mpLayoutData = nullptr;
+ mpLayoutData.reset();
if ( pWin )
{
ImplCalcSize( pWin );
@@ -518,8 +516,7 @@ void Menu::InsertSeparator(const OString &rIdent, sal_uInt16 nPos)
if( ImplGetSalMenu() && pData && pData->pSalMenuItem )
ImplGetSalMenu()->InsertItem( pData->pSalMenuItem, nPos );
- delete mpLayoutData;
- mpLayoutData = nullptr;
+ mpLayoutData.reset();
ImplCallEventListeners( VclEventId::MenuInsertItem, nPos );
}
@@ -545,8 +542,7 @@ void Menu::RemoveItem( sal_uInt16 nPos )
if ( pWin->IsVisible() )
pWin->Invalidate();
}
- delete mpLayoutData;
- mpLayoutData = nullptr;
+ mpLayoutData.reset();
if ( bRemove )
ImplCallEventListeners( VclEventId::MenuRemoveItem, nPos );
@@ -1005,8 +1001,7 @@ void Menu::SetItemText( sal_uInt16 nItemId, const OUString& rStr )
ImplGetSalMenu()->SetItemText( nPos, pData->pSalMenuItem, rStr );
vcl::Window* pWin = ImplGetWindow();
- delete mpLayoutData;
- mpLayoutData = nullptr;
+ mpLayoutData.reset();
if (pWin && IsMenuBar())
{
ImplCalcSize( pWin );
@@ -2201,8 +2196,7 @@ void Menu::RemoveDisabledEntries( bool bCheckPopups, bool bRemoveEmptyPopups )
if ( pItem->eType == MenuItemType::SEPARATOR )
RemoveItem( nLast );
}
- delete mpLayoutData;
- mpLayoutData = nullptr;
+ mpLayoutData.reset();
}
void Menu::UpdateNativeMenu()
@@ -2217,15 +2211,14 @@ void Menu::MenuBarKeyInput(const KeyEvent&)
void Menu::ImplKillLayoutData() const
{
- delete mpLayoutData;
- mpLayoutData = nullptr;
+ mpLayoutData.reset();
}
void Menu::ImplFillLayoutData() const
{
if (pWindow && pWindow->IsReallyVisible())
{
- mpLayoutData = new MenuLayoutData;
+ mpLayoutData.reset(new MenuLayoutData);
if (IsMenuBar())
{
ImplPaint(*pWindow, pWindow->GetOutputSizePixel(), 0, 0, nullptr, false, true); // FIXME
@@ -2813,8 +2806,7 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const tools::R
pMenuBarWindow->SetMBWHideAccel( !(pMenuBarWindow->GetMBWMenuKey()) );
}
- delete mpLayoutData;
- mpLayoutData = nullptr;
+ mpLayoutData.reset();
ImplSVData* pSVData = ImplGetSVData();