diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:23:17 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:38 +0100 |
commit | 28034eaf925aa50d379dd5cffccc20d7edc95aec (patch) | |
tree | 5cde1f141bc0ffc5cb04a12980d0c4bce69de0f0 /sfx2/source/menu | |
parent | d930b6c2e6e3dfb9e1ed19b84a3137cc0cfbfd8c (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: I7213b49b09ddcb00841aa5f63343baeab0e65fa4
Diffstat (limited to 'sfx2/source/menu')
-rw-r--r-- | sfx2/source/menu/mnuitem.cxx | 22 | ||||
-rw-r--r-- | sfx2/source/menu/mnumgr.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/menu/virtmenu.cxx | 64 |
3 files changed, 52 insertions, 52 deletions
diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index eabf1aa36a0d..40c6b6e726c4 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -77,7 +77,7 @@ void SfxMenuControl::Bind( { aTitle = rTitle; pOwnMenu = pOwn; - pSubMenu = 0; + pSubMenu = nullptr; if ( pOwn ) SfxControllerItem::Bind(nSlotId, &rBindings); else @@ -112,8 +112,8 @@ void SfxMenuControl::Bind( // Constructor for explicit registration SfxMenuControl::SfxMenuControl( bool bShowStrings ) -: pOwnMenu(0), - pSubMenu(0), +: pOwnMenu(nullptr), + pSubMenu(nullptr), b_ShowStrings(bShowStrings) { } @@ -122,8 +122,8 @@ SfxMenuControl::SfxMenuControl( bool bShowStrings ) // Constructor for array SfxMenuControl::SfxMenuControl(): - pOwnMenu(0), - pSubMenu(0), + pOwnMenu(nullptr), + pSubMenu(nullptr), b_ShowStrings(false) { } @@ -132,8 +132,8 @@ SfxMenuControl::SfxMenuControl(): SfxMenuControl::SfxMenuControl(sal_uInt16 nSlotId, SfxBindings& rBindings): SfxControllerItem(nSlotId, rBindings), - pOwnMenu(0), - pSubMenu(0), + pOwnMenu(nullptr), + pSubMenu(nullptr), b_ShowStrings(false) { // This constructor should make it possible already during the design @@ -164,7 +164,7 @@ void SfxMenuControl::StateChanged { (void)nSID; DBG_ASSERT( nSID == GetId(), "strange SID" ); - DBG_ASSERT( pOwnMenu != 0, "setting state to dangling SfxMenuControl" ); + DBG_ASSERT( pOwnMenu != nullptr, "setting state to dangling SfxMenuControl" ); bool bIsObjMenu = GetId() >= SID_OBJECTMENU0 && GetId() < SID_OBJECTMENU_LAST; @@ -177,7 +177,7 @@ void SfxMenuControl::StateChanged else #endif pOwnMenu->EnableItem( GetId(), bIsObjMenu - ? 0 != pOwnMenu->GetSVMenu()->GetPopupMenu( GetId() ) + ? nullptr != pOwnMenu->GetSVMenu()->GetPopupMenu( GetId() ) : eState != SfxItemState::DISABLED ); if ( eState != SfxItemState::DEFAULT ) @@ -263,7 +263,7 @@ SfxMenuControl* SfxMenuControl::CreateControl( sal_uInt16 nId, Menu &rMenu, SfxB { SfxApplication *pApp = SfxGetpApp(); SfxDispatcher *pDisp = rBindings.GetDispatcher_Impl(); - SfxModule *pMod = pDisp ? SfxModule::GetActiveModule( pDisp->GetFrame() ) :0; + SfxModule *pMod = pDisp ? SfxModule::GetActiveModule( pDisp->GetFrame() ) :nullptr; if ( pMod ) { SfxMenuCtrlFactArr_Impl *pFactories = pMod->GetMenuCtrlFactories_Impl(); @@ -286,7 +286,7 @@ SfxMenuControl* SfxMenuControl::CreateControl( sal_uInt16 nId, Menu &rMenu, SfxB ( rFactories[nFactory].nSlotId == nId) ) ) return rFactories[nFactory].pCtor( nId, rMenu, rBindings ); } - return 0; + return nullptr; } diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index 3655d8f2341e..908c3667938a 100644 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -65,7 +65,7 @@ #include "thessubmenu.hxx" // static member initialization -PopupMenu * SfxPopupMenuManager::pStaticThesSubMenu = NULL; +PopupMenu * SfxPopupMenuManager::pStaticThesSubMenu = nullptr; using namespace com::sun::star; @@ -133,8 +133,8 @@ PopupMenu* InsertThesaurusSubmenu_Impl( SfxBindings* pBindings, Menu* pSVMenu ) // build thesaurus sub menu if look-up string is available - PopupMenu* pThesSubMenu = 0; - SfxPoolItem *pItem = 0; + PopupMenu* pThesSubMenu = nullptr; + SfxPoolItem *pItem = nullptr; pBindings->QueryState( SID_THES, pItem ); OUString aThesLookUpStr; SfxStringItem *pStrItem = dynamic_cast< SfxStringItem * >(pItem); @@ -255,14 +255,14 @@ void SfxPopupMenuManager::RemoveDisabledEntries() sal_uInt16 SfxPopupMenuManager::Execute( const Point& rPos, vcl::Window* pWindow ) { sal_uInt16 nVal = static_cast<PopupMenu*>( GetMenu()->GetSVMenu() )->Execute( pWindow, rPos ); - delete pStaticThesSubMenu; pStaticThesSubMenu = NULL; + delete pStaticThesSubMenu; pStaticThesSubMenu = nullptr; return nVal; } SfxMenuManager::SfxMenuManager( Menu* pMenuArg, SfxBindings &rBindings ) -: pMenu(0), +: pMenu(nullptr), pBindings(&rBindings) { bAddClipboardFuncs = false; @@ -305,7 +305,7 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra } InsertVerbs_Impl( &pFrame->GetBindings(), pFrame->GetViewShell()->GetVerbs(), pSVMenu ); - Menu* pMenu = NULL; + Menu* pMenu = nullptr; css::ui::ContextMenuExecuteEvent aEvent; aEvent.SourceWindow = VCLUnoHelper::GetInterface( pWindow ); aEvent.ExecutePosition.X = rPoint.X(); @@ -324,7 +324,7 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra return aMgr; } - return 0; + return nullptr; } @@ -355,7 +355,7 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram } InsertVerbs_Impl( &pFrame->GetBindings(), pFrame->GetViewShell()->GetVerbs(), pSVMenu ); - Menu* pMenu = NULL; + Menu* pMenu = nullptr; css::ui::ContextMenuExecuteEvent aEvent; aEvent.SourceWindow = VCLUnoHelper::GetInterface( pWindow ); aEvent.ExecutePosition.X = rPoint.X(); @@ -377,7 +377,7 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram // the (manually inserted) sub-menu needs to be destroyed before // aPop gets destroyed. delete pThesSubMenu; - pThesSubMenu = 0; + pThesSubMenu = nullptr; } delete pThesSubMenu; diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index 55155f2bb22a..cdf4752a63d0 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -168,10 +168,10 @@ void SfxVirtualMenu::Construct_Impl() SfxVirtualMenu::SfxVirtualMenu( sal_uInt16 nOwnId, SfxVirtualMenu* pOwnParent, Menu& rMenu, bool bWithHelp, SfxBindings &rBindings, bool bOLEServer, bool bRes, bool bIsAddonMenu ): - pItems(0), - pImageControl(0), + pItems(nullptr), + pImageControl(nullptr), pBindings(&rBindings), - pResMgr(0), + pResMgr(nullptr), nLocks(0), bHelpInitialized( bWithHelp ), bIsAddonPopupMenu( bIsAddonMenu ) @@ -183,10 +183,10 @@ SfxVirtualMenu::SfxVirtualMenu( sal_uInt16 nOwnId, nId = nOwnId; pParent = pOwnParent; nVisibleItems = 0; - pAppCtrl = 0; - pWindowMenu = NULL; - pPickMenu = NULL; - pAddonsMenu = NULL; + pAppCtrl = nullptr; + pWindowMenu = nullptr; + pPickMenu = nullptr; + pAddonsMenu = nullptr; bIsActive = false; bControllersUnBound = false; CreateFromSVMenu(); @@ -200,10 +200,10 @@ SfxVirtualMenu::SfxVirtualMenu( sal_uInt16 nOwnId, SfxVirtualMenu::SfxVirtualMenu( Menu *pStarViewMenu, bool bWithHelp, SfxBindings &rBindings, bool bOLEServer, bool bRes, bool bIsAddonMenu ): - pItems(0), - pImageControl(0), + pItems(nullptr), + pImageControl(nullptr), pBindings(&rBindings), - pResMgr(0), + pResMgr(nullptr), nLocks(0), bHelpInitialized( bWithHelp ), bIsAddonPopupMenu( bIsAddonMenu ) @@ -214,12 +214,12 @@ SfxVirtualMenu::SfxVirtualMenu( Menu *pStarViewMenu, bool bWithHelp, bResCtor = bRes; bOLE = bOLEServer; nId = 0; - pParent = 0; - pAppCtrl = 0; + pParent = nullptr; + pAppCtrl = nullptr; nVisibleItems = 0; - pWindowMenu = NULL; - pPickMenu = NULL; - pAddonsMenu = NULL; + pWindowMenu = nullptr; + pPickMenu = nullptr; + pAddonsMenu = nullptr; bIsActive = false; bControllersUnBound = false; CreateFromSVMenu(); @@ -251,7 +251,7 @@ SfxVirtualMenu::~SfxVirtualMenu() } delete pAppCtrl; - pBindings = 0; + pBindings = nullptr; // All the menus, which were created by SV, will also be there deleted // again (i.e. created by loading them from the resource) @@ -262,13 +262,13 @@ SfxVirtualMenu::~SfxVirtualMenu() if ( pParent ) { if( pParent->pSVMenu->GetItemPos( nId ) != MENU_ITEM_NOTFOUND ) - pParent->pSVMenu->SetPopupMenu( nId, 0 ); + pParent->pSVMenu->SetPopupMenu( nId, nullptr ); if ( pParent->pPickMenu == pSVMenu ) - pParent->pPickMenu = 0; + pParent->pPickMenu = nullptr; if ( pParent->pWindowMenu == pSVMenu) - pParent->pWindowMenu = 0; + pParent->pWindowMenu = nullptr; if ( pParent->pAddonsMenu == pSVMenu ) - pParent->pAddonsMenu = 0; + pParent->pAddonsMenu = nullptr; } delete pSVMenu; @@ -344,7 +344,7 @@ void SfxVirtualMenu::CreateFromSVMenu() if( pPopup && nSlotId >= SID_OBJECTMENU0 && nSlotId <= SID_OBJECTMENU_LAST ) { // artefact in XML menuconfig: every entry in root menu must have a popup! - pSVMenu->SetPopupMenu( nSlotId, NULL ); + pSVMenu->SetPopupMenu( nSlotId, nullptr ); DELETEZ( pPopup ); } @@ -361,13 +361,13 @@ void SfxVirtualMenu::CreateFromSVMenu() // The pop was obviously not "real" and such are never loaded // from the resource and need thus to be explicitly deleted. if ( pSVMenu->GetPopupMenu( nSlotId ) == pPopup ) - pSVMenu->SetPopupMenu( nSlotId, NULL ); + pSVMenu->SetPopupMenu( nSlotId, nullptr ); delete pPopup; - pPopup = 0; + pPopup = nullptr; SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.push_back(pMnuCtrl); - (pItems+nPos)->Bind( 0, nSlotId, sItemText, *pBindings); + (pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings); pMnuCtrl->Bind( this, nSlotId, sItemText, *pBindings); if ( Application::GetSettings().GetStyleSettings().GetUseImagesInMenus() ) @@ -400,7 +400,7 @@ void SfxVirtualMenu::CreateFromSVMenu() case MenuItemType::STRING: case MenuItemType::STRINGIMAGE: { - SfxMenuControl *pMnuCtrl=0; + SfxMenuControl *pMnuCtrl=nullptr; OUString aCmd( pSVMenu->GetItemCommand( nSlotId ) ); if ( !aCmd.isEmpty() && (( nSlotId < SID_SFX_START ) || ( nSlotId > SHRT_MAX )) ) { @@ -410,7 +410,7 @@ void SfxVirtualMenu::CreateFromSVMenu() { SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.push_back(pMnuCtrl); - (pItems+nPos)->Bind( 0, nSlotId, sItemText, *pBindings); + (pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings); } } @@ -422,7 +422,7 @@ void SfxVirtualMenu::CreateFromSVMenu() { SfxMenuCtrlArr_Impl &rCtrlArr = GetAppCtrl_Impl(); rCtrlArr.push_back(pMnuCtrl); - (pItems+nPos)->Bind( 0, nSlotId, sItemText, *pBindings); + (pItems+nPos)->Bind( nullptr, nSlotId, sItemText, *pBindings); } else // take default control @@ -737,7 +737,7 @@ void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu ) ::framework::MenuConfiguration aConf( ::comphelper::getProcessComponentContext() ); Reference<css::frame::XFrame> xFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); - PopupMenu* pAddonMenu = NULL; + PopupMenu* pAddonMenu = nullptr; try { Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); @@ -914,7 +914,7 @@ IMPL_LINK_TYPED( SfxVirtualMenu, Deactivate, Menu *, pMenu, bool ) "sfx", "SfxVirtualMenu " << this << " deactivated " << pMenu << ", own " << pSVMenu); - if ( bIsActive && ( 0 == pMenu || pMenu == pSVMenu ) ) + if ( bIsActive && ( nullptr == pMenu || pMenu == pSVMenu ) ) { // All controllers can be unbinded all the way up to the Menubar, // when the menu is disabled (= closed) @@ -986,7 +986,7 @@ IMPL_LINK_TYPED( SfxVirtualMenu, Select, Menu *, pMenu, bool ) void SfxVirtualMenu::CheckItem( sal_uInt16 nItemId, bool bCheck ) { - DBG_ASSERT( pSVMenu != 0, "" ); + DBG_ASSERT( pSVMenu != nullptr, "" ); if (pSVMenu->GetItemPos( nItemId ) != MENU_ITEM_NOTFOUND ) pSVMenu->CheckItem( nItemId, bCheck ); } @@ -996,7 +996,7 @@ void SfxVirtualMenu::CheckItem( sal_uInt16 nItemId, bool bCheck ) void SfxVirtualMenu::EnableItem( sal_uInt16 nItemId, bool bEnable ) { - DBG_ASSERT( pSVMenu != 0, "" ); + DBG_ASSERT( pSVMenu != nullptr, "" ); if (pSVMenu->GetItemPos( nItemId ) != MENU_ITEM_NOTFOUND ) pSVMenu->EnableItem( nItemId, bEnable ); @@ -1007,7 +1007,7 @@ void SfxVirtualMenu::EnableItem( sal_uInt16 nItemId, bool bEnable ) void SfxVirtualMenu::SetItemText( sal_uInt16 nItemId, const OUString& rText ) { - DBG_ASSERT( pSVMenu != 0, "" ); + DBG_ASSERT( pSVMenu != nullptr, "" ); if (pSVMenu->GetItemPos( nItemId ) != MENU_ITEM_NOTFOUND ) pSVMenu->SetItemText( nItemId, rText ); } |