diff options
Diffstat (limited to 'sfx2/source/control/bindings.cxx')
-rw-r--r-- | sfx2/source/control/bindings.cxx | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 3f788bf8183f..39f85b12653f 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -231,7 +231,7 @@ public: SfxBindings::SfxBindings() : pImp(new SfxBindings_Impl), - pDispatcher(0), + pDispatcher(nullptr), nRegLevel(1) // first becomes 0, when the Dispatcher is set { pImp->nMsgPos = 0; @@ -246,10 +246,10 @@ SfxBindings::SfxBindings() pImp->bFirstRound = false; pImp->bInNextJob = false; pImp->bInUpdate = false; - pImp->pSubBindings = NULL; - pImp->pSuperBindings = NULL; - pImp->pWorkWin = NULL; - pImp->pUnoCtrlArr = NULL; + pImp->pSubBindings = nullptr; + pImp->pSuperBindings = nullptr; + pImp->pWorkWin = nullptr; + pImp->pUnoCtrlArr = nullptr; pImp->nOwnRegLevel = nRegLevel; // all caches are valid (no pending invalidate-job) @@ -276,7 +276,7 @@ SfxBindings::~SfxBindings() { // The SubBindings should not be locked! - pImp->pSubBindings = NULL; + pImp->pSubBindings = nullptr; ENTERREGISTRATIONS(); @@ -410,8 +410,8 @@ void SfxBindings::Update_Impl // gather together all with the same status method which are dirty SfxDispatcher &rDispat = *pDispatcher; - const SfxSlot *pRealSlot = 0; - const SfxSlotServer* pMsgServer = 0; + const SfxSlot *pRealSlot = nullptr; + const SfxSlotServer* pMsgServer = nullptr; SfxFoundCacheArr_Impl aFound; SfxItemSet *pSet = CreateSet_Impl( pCache, pRealSlot, &pMsgServer, aFound ); bool bUpdated = false; @@ -427,7 +427,7 @@ void SfxBindings::Update_Impl { const SfxFoundCache_Impl& rFound = aFound[nPos]; sal_uInt16 nWhich = rFound.nWhichId; - const SfxPoolItem *pItem = 0; + const SfxPoolItem *pItem = nullptr; SfxItemState eState = pSet->GetItemState(nWhich, true, &pItem); if ( eState == SfxItemState::DEFAULT && SfxItemPool::IsWhich(nWhich) ) pItem = &pSet->Get(nWhich); @@ -447,7 +447,7 @@ void SfxBindings::Update_Impl SfxFoundCache_Impl aFoundCache( pCache->GetId(), 0, pRealSlot, pCache ); - UpdateControllers_Impl( 0, aFoundCache, 0, SfxItemState::DISABLED); + UpdateControllers_Impl( nullptr, aFoundCache, nullptr, SfxItemState::DISABLED); } } @@ -478,7 +478,7 @@ void SfxBindings::Update sal_uInt16 nId // the bound and up-to-date Slot-Id ) { - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); if ( pDispatcher ) pDispatcher->Flush(); @@ -502,13 +502,13 @@ void SfxBindings::Update if( pCache->GetDispatch().is() && pCache->GetItemLink() ) { pCache->SetCachedState(true); - bInternalUpdate = ( pCache->GetInternalController() != 0 ); + bInternalUpdate = ( pCache->GetInternalController() != nullptr ); } if ( bInternalUpdate ) { // Query Status - const SfxSlotServer* pMsgServer = pDispatcher ? pCache->GetSlotServer(*pDispatcher, pImp->xProv) : NULL; + const SfxSlotServer* pMsgServer = pDispatcher ? pCache->GetSlotServer(*pDispatcher, pImp->xProv) : nullptr; if ( !pCache->IsControllerDirty() && ( !pMsgServer || !pMsgServer->GetSlot()->IsMode(SfxSlotMode::VOLATILE) ) ) @@ -519,7 +519,7 @@ void SfxBindings::Update } if (!pMsgServer) { - pCache->SetState(SfxItemState::DISABLED, 0); + pCache->SetState(SfxItemState::DISABLED, nullptr); pImp->bInUpdate = false; InvalidateSlotsInMap_Impl(); return; @@ -540,7 +540,7 @@ void SfxBindings::Update void SfxBindings::Update() { - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); if ( pImp->pSubBindings ) pImp->pSubBindings->Update(); @@ -553,7 +553,7 @@ void SfxBindings::Update() pImp->bInUpdate = true; pDispatcher->Flush(); pDispatcher->Update_Impl(); - while ( !NextJob_Impl(0) ) + while ( !NextJob_Impl(nullptr) ) ; // loop pImp->bInUpdate = false; InvalidateSlotsInMap_Impl(); @@ -653,7 +653,7 @@ SfxStateCache* SfxBindings::GetStateCache sal_uInt16 nId /* Slot-Id, which SfxStatusCache is to be found */ ) { - return GetStateCache(nId, 0); + return GetStateCache(nId, nullptr); } SfxStateCache* SfxBindings::GetStateCache @@ -665,7 +665,7 @@ SfxStateCache* SfxBindings::GetStateCache or where it was inserted. */ ) { - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); // is the specified function bound? const sal_uInt16 nStart = ( pPos ? *pPos : 0 ); const sal_uInt16 nPos = GetSlotPos( nId, nStart ); @@ -677,7 +677,7 @@ SfxStateCache* SfxBindings::GetStateCache *pPos = nPos; return (*pImp->pCaches)[nPos]; } - return 0; + return nullptr; } @@ -902,15 +902,15 @@ void SfxBindings::Invalidate bool SfxBindings::IsBound( sal_uInt16 nSlotId, sal_uInt16 nStartSearchAt ) { - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); - return GetStateCache(nSlotId, &nStartSearchAt ) != 0; + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); + return GetStateCache(nSlotId, &nStartSearchAt ) != nullptr; } sal_uInt16 SfxBindings::GetSlotPos( sal_uInt16 nId, sal_uInt16 nStartSearchAt ) { - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); // answer immediately if a function-seek comes repeated if ( pImp->nCachedFunc1 < pImp->pCaches->size() && @@ -1022,14 +1022,14 @@ void SfxBindings::Register_Impl( SfxControllerItem& rItem, bool bInternal ) void SfxBindings::Release( SfxControllerItem& rItem ) { - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); DBG_ASSERT( !pImp->bInNextJob, "SfxBindings::Release while status-updating" ); ENTERREGISTRATIONS(); // find the bound function sal_uInt16 nId = rItem.GetId(); sal_uInt16 nPos = GetSlotPos(nId); - SfxStateCache* pCache = (nPos < pImp->pCaches->size()) ? (*pImp->pCaches)[nPos] : 0; + SfxStateCache* pCache = (nPos < pImp->pCaches->size()) ? (*pImp->pCaches)[nPos] : nullptr; if ( pCache && pCache->GetId() == nId ) { if ( pCache->GetInternalController() == &rItem ) @@ -1055,7 +1055,7 @@ void SfxBindings::Release( SfxControllerItem& rItem ) } // was this the last controller? - if ( pCache->GetItemLink() == 0 && !pCache->GetInternalController() ) + if ( pCache->GetItemLink() == nullptr && !pCache->GetInternalController() ) { pImp->bCtrlReleased = true; } @@ -1068,10 +1068,10 @@ void SfxBindings::Release( SfxControllerItem& rItem ) const SfxPoolItem* SfxBindings::ExecuteSynchron( sal_uInt16 nId, const SfxPoolItem** ppItems, sal_uInt16 nModi, const SfxPoolItem **ppInternalArgs ) { - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); if( !nId || !pDispatcher ) - return NULL; + return nullptr; return Execute_Impl( nId, ppItems, nModi, SfxCallMode::SYNCHRON, ppInternalArgs ); } @@ -1079,13 +1079,13 @@ const SfxPoolItem* SfxBindings::ExecuteSynchron( sal_uInt16 nId, const SfxPoolIt bool SfxBindings::Execute( sal_uInt16 nId, const SfxPoolItem** ppItems, sal_uInt16 nModi, SfxCallMode nCallMode, const SfxPoolItem **ppInternalArgs ) { - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); if( !nId || !pDispatcher ) return false; const SfxPoolItem* pRet = Execute_Impl( nId, ppItems, nModi, nCallMode, ppInternalArgs ); - return ( pRet != 0 ); + return ( pRet != nullptr ); } const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem** ppItems, sal_uInt16 nModi, SfxCallMode nCallMode, @@ -1139,13 +1139,13 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* if ( pImp->bMsgDirty ) UpdateSlotServer_Impl(); - SfxShell *pShell=0; - const SfxSlot *pSlot=0; + SfxShell *pShell=nullptr; + const SfxSlot *pSlot=nullptr; const SfxSlotServer* pServer = pCache->GetSlotServer( rDispatcher, pImp->xProv ); if ( !pServer ) { - return NULL; + return nullptr; } else { @@ -1155,7 +1155,7 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* if ( bGlobalOnly ) if ( dynamic_cast< const SfxModule *>( pShell ) == nullptr && dynamic_cast< const SfxApplication *>( pShell ) == nullptr && dynamic_cast< const SfxViewFrame *>( pShell ) == nullptr ) - return NULL; + return nullptr; SfxItemPool &rPool = pShell->GetPool(); SfxRequest aReq( nId, nCallMode, rPool ); @@ -1286,7 +1286,7 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell void SfxBindings::UpdateSlotServer_Impl() { - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); // synchronize pDispatcher->Flush(); @@ -1324,27 +1324,27 @@ SfxItemSet* SfxBindings::CreateSet_Impl SfxFoundCacheArr_Impl& rFound // out: List of Caches for Siblings ) { - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); DBG_ASSERT( !pImp->bMsgDirty, "CreateSet_Impl with dirty MessageServer" ); assert(pDispatcher); const SfxSlotServer* pMsgSvr = pCache->GetSlotServer(*pDispatcher, pImp->xProv); if (!pMsgSvr) - return 0; + return nullptr; - pRealSlot = 0; + pRealSlot = nullptr; *pMsgServer = pMsgSvr; sal_uInt16 nShellLevel = pMsgSvr->GetShellLevel(); SfxShell *pShell = pDispatcher->GetShell( nShellLevel ); if ( !pShell ) // rare GPF when browsing through update from Inet-Notify - return 0; + return nullptr; SfxItemPool &rPool = pShell->GetPool(); // get the status method, which is served by the pCache - SfxStateFunc pFnc = 0; + SfxStateFunc pFnc = nullptr; const SfxInterface *pInterface = pShell->GetInterface(); if ( SFX_KIND_ENUM == pMsgSvr->GetSlot()->GetKind() ) { @@ -1372,7 +1372,7 @@ SfxItemSet* SfxBindings::CreateSet_Impl // the Slots ODF a interfaces ar linked in a circle while ( pSibling > pRealSlot ) { - SfxStateFunc pSiblingFnc=0; + SfxStateFunc pSiblingFnc=nullptr; SfxStateCache *pSiblingCache = GetStateCache( pSibling->GetSlotId(), &nCachePos ); @@ -1481,17 +1481,17 @@ void SfxBindings::UpdateControllers_Impl pCache->SetState( SfxItemState::UNKNOWN, &aVoid ); } else if ( SfxItemState::DISABLED == eState ) - pCache->SetState(SfxItemState::DISABLED, 0); + pCache->SetState(SfxItemState::DISABLED, nullptr); else pCache->SetState(SfxItemState::DEFAULT, pItem); } // Update the slots for so far available and bound Controllers for // Slave-Slots (Enum-value) - DBG_ASSERT( !pSlot || 0 == pSlot->GetLinkedSlot() || !pItem || + DBG_ASSERT( !pSlot || nullptr == pSlot->GetLinkedSlot() || !pItem || dynamic_cast< const SfxEnumItemInterface *>( pItem ) != nullptr, "master slot with non-enum-type found" ); - const SfxSlot *pFirstSlave = pSlot ? pSlot->GetLinkedSlot() : 0; + const SfxSlot *pFirstSlave = pSlot ? pSlot->GetLinkedSlot() : nullptr; if ( pIF && pFirstSlave) { // Items cast on EnumItem @@ -1529,7 +1529,7 @@ void SfxBindings::UpdateControllers_Impl if ( SfxItemState::DISABLED == eState || (pEnumItem && !pEnumItem->IsEnabled( pSlave->GetSlotId())) ) { // disabled - pEnumCache->SetState(SfxItemState::DISABLED, 0); + pEnumCache->SetState(SfxItemState::DISABLED, nullptr); } else if ( SfxItemState::DEFAULT == eState && pEnumItem ) { @@ -1566,7 +1566,7 @@ bool SfxBindings::NextJob_Impl(Timer * pTimer) #endif const unsigned MAX_INPUT_DELAY = 200; - DBG_ASSERT( pImp->pCaches != 0, "SfxBindings not initialized" ); + DBG_ASSERT( pImp->pCaches != nullptr, "SfxBindings not initialized" ); if ( Application::GetLastInputInterval() < MAX_INPUT_DELAY && pTimer ) { @@ -1580,7 +1580,7 @@ bool SfxBindings::NextJob_Impl(Timer * pTimer) pDispatcher->Update_Impl(); // modifying the SfxObjectInterface-stack without SfxBindings => nothing to do - SfxViewFrame* pFrame = pDispatcher ? pDispatcher->GetFrame() : NULL; + SfxViewFrame* pFrame = pDispatcher ? pDispatcher->GetFrame() : nullptr; if ( (pFrame && !pFrame->GetObjectShell()->AcceptStateUpdate()) || pSfxApp->IsDowning() || pImp->pCaches->empty() ) { return true; @@ -1762,7 +1762,7 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int SfxStateCache *pCache = (*pImp->pCaches)[nCache-1]; // No interested Controller present - if ( pCache->GetItemLink() == 0 && !pCache->GetInternalController() ) + if ( pCache->GetItemLink() == nullptr && !pCache->GetInternalController() ) { // Remove Cache. Safety: first remove and then delete pImp->pCaches->erase(pImp->pCaches->begin() + nCache - 1); @@ -1804,7 +1804,7 @@ void SfxBindings::SetDispatcher( SfxDispatcher *pDisp ) while ( pBind ) { if ( pBind->pImp->pSubBindings == this && pBind->pDispatcher != pDisp ) - pBind->SetSubBindings_Impl( NULL ); + pBind->SetSubBindings_Impl( nullptr ); pBind = pBind->pImp->pSubBindings; } } @@ -1878,7 +1878,7 @@ void SfxBindings::StartUpdate_Impl( bool bComplete ) NextJob_Impl(&pImp->aTimer); else // Update all slots in a row - NextJob_Impl(0); + NextJob_Impl(nullptr); } @@ -1909,7 +1909,7 @@ SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, SfxPoolItem* &rpState ) if ( xDisp.is() ) { css::uno::Reference< css::lang::XUnoTunnel > xTunnel( xDisp, css::uno::UNO_QUERY ); - SfxOfficeDispatch* pDisp = NULL; + SfxOfficeDispatch* pDisp = nullptr; if ( xTunnel.is() ) { sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier()); @@ -1927,7 +1927,7 @@ SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, SfxPoolItem* &rpState ) } SfxItemState eState = SfxItemState::SET; - SfxPoolItem *pItem=NULL; + SfxPoolItem *pItem=nullptr; BindDispatch_Impl *pBind = new BindDispatch_Impl( xDisp, aURL, pCache, pSlot ); pBind->acquire(); xDisp->addStatusListener( pBind, aURL ); @@ -1981,7 +1981,7 @@ SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, SfxPoolItem* &rpState ) // Then test at the dispatcher to check if the returned items from // there are always DELETE_ON_IDLE, a copy of it has to be made in // order to allow for transition of ownership. - const SfxPoolItem *pItem = NULL; + const SfxPoolItem *pItem = nullptr; SfxItemState eState = pDispatcher->QueryState( nSlot, pItem ); if ( eState == SfxItemState::SET ) { @@ -2002,7 +2002,7 @@ void SfxBindings::SetSubBindings_Impl( SfxBindings *pSub ) if ( pImp->pSubBindings ) { pImp->pSubBindings->SetDispatchProvider_Impl( css::uno::Reference< css::frame::XDispatchProvider > () ); - pImp->pSubBindings->pImp->pSuperBindings = NULL; + pImp->pSubBindings->pImp->pSuperBindings = nullptr; } pImp->pSubBindings = pSub; |