diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-27 14:11:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-28 08:25:18 +0000 |
commit | 7097037d5a20d2cad5a5e4b10f8f9d5aaf37589f (patch) | |
tree | f71ef6bde8c695261649b04ad8bceaa0cc08a897 /sfx2 | |
parent | 71403558cbffb6c1ce1c4993a177bf3364941e22 (diff) |
remove enum slot code from sfx2
since we only used it for the pseudo-slot stuff, which is now gone
Change-Id: I72146090e7741d5b71d581fa0b5c6d43c154445a
Reviewed-on: https://gerrit.libreoffice.org/35759
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/bindings.cxx | 122 | ||||
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 19 | ||||
-rw-r--r-- | sfx2/source/control/msg.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/control/objface.cxx | 102 | ||||
-rw-r--r-- | sfx2/source/control/shell.cxx | 13 |
5 files changed, 24 insertions, 241 deletions
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 7c08d1ad3176..1161d3cef9fb 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -325,8 +325,6 @@ void SfxBindings::Update_Impl if ( rDispat.FillState_( *pMsgServer, *pSet, pRealSlot ) ) { // Post Status - const SfxInterface *pInterface = - rDispat.GetShell(pMsgServer->GetShellLevel())->GetInterface(); for ( size_t nPos = 0; nPos < aFound.size(); ++nPos ) { const SfxFoundCache_Impl& rFound = aFound[nPos]; @@ -335,7 +333,7 @@ void SfxBindings::Update_Impl SfxItemState eState = pSet->GetItemState(nWhich, true, &pItem); if ( eState == SfxItemState::DEFAULT && SfxItemPool::IsWhich(nWhich) ) pItem = &pSet->Get(nWhich); - UpdateControllers_Impl( pInterface, aFound[nPos], pItem, eState ); + UpdateControllers_Impl( aFound[nPos], pItem, eState ); } bUpdated = true; } @@ -349,7 +347,7 @@ void SfxBindings::Update_Impl // (for example due to locked Dispatcher! ), // obviously do not try to update SfxFoundCache_Impl aFoundCache(0, pRealSlot, pCache ); - UpdateControllers_Impl( nullptr, aFoundCache, nullptr, SfxItemState::DISABLED); + UpdateControllers_Impl( aFoundCache, nullptr, SfxItemState::DISABLED); } } @@ -1059,17 +1057,7 @@ void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell { SfxItemPool &rPool = pShell->GetPool(); - if ( SfxSlotKind::Enum == pSlot->GetKind() ) - { - // for Enum-Slots, the Master has to be executed with the value - // of the enums - const SfxSlot *pRealSlot = pShell->GetInterface()->GetRealSlot(pSlot); - const sal_uInt16 nSlotId = pRealSlot->GetSlotId(); - aReq.SetSlot( nSlotId ); - aReq.AppendItem( SfxAllEnumItem( rPool.GetWhich(nSlotId), pSlot->GetValue() ) ); - pDispatcher->Execute_( *pShell, *pRealSlot, aReq, aReq.GetCallMode() | SfxCallMode::RECORD ); - } - else if ( SfxSlotKind::Attribute == pSlot->GetKind() ) + if ( SfxSlotKind::Attribute == pSlot->GetKind() ) { // Which value has to be mapped for Attribute slots const sal_uInt16 nSlotId = pSlot->GetSlotId(); @@ -1209,14 +1197,7 @@ SfxItemSet* SfxBindings::CreateSet_Impl // get the status method, which is served by the pCache SfxStateFunc pFnc = nullptr; - const SfxInterface *pInterface = pShell->GetInterface(); - if ( SfxSlotKind::Enum == pMsgSvr->GetSlot()->GetKind() ) - { - pRealSlot = pInterface->GetRealSlot(pMsgSvr->GetSlot()); - pCache = GetStateCache( pRealSlot->GetSlotId() ); - } - else - pRealSlot = pMsgSvr->GetSlot(); + pRealSlot = pMsgSvr->GetSlot(); // Note: pCache can be NULL! @@ -1254,33 +1235,6 @@ SfxItemSet* SfxBindings::CreateSet_Impl // It is not enough to ask for the same shell!! bool bSameMethod = pSiblingCache && pFnc == pSiblingFnc; - // If the slot is a non-dirty master slot, then maybe one of his slaves - // is dirty? Then the master slot is still inserted. - if ( !bInsert && bSameMethod && pSibling->GetLinkedSlot() ) - { - // Also check slave slots for Binding - const SfxSlot* pFirstSlave = pSibling->GetLinkedSlot(); - for ( const SfxSlot *pSlaveSlot = pFirstSlave; - !bInsert; - pSlaveSlot = pSlaveSlot->GetNextSlot()) - { - // the slaves points to its master - DBG_ASSERT(pSlaveSlot->GetLinkedSlot() == pSibling, - "Wrong Master/Slave relationship!"); - - std::size_t nCurMsgPos = pImpl->nMsgPos; - const SfxStateCache *pSlaveCache = - GetStateCache( pSlaveSlot->GetSlotId(), &nCurMsgPos ); - - // Is the slave slot chached and dirty ? - bInsert = pSlaveCache && pSlaveCache->IsControllerDirty(); - - // Slaves are chained together in a circle - if (pSlaveSlot->GetNextSlot() == pFirstSlave) - break; - } - } - if ( bInsert && bSameMethod ) { SfxFoundCache_Impl *pFoundCache = new SfxFoundCache_Impl( @@ -1315,15 +1269,11 @@ SfxItemSet* SfxBindings::CreateSet_Impl void SfxBindings::UpdateControllers_Impl ( - const SfxInterface* pIF, // Id of the current serving Interface const SfxFoundCache_Impl& rFound, // Cache, Slot, Which etc. const SfxPoolItem* pItem, // item to send to controller SfxItemState eState // state of item ) { - DBG_ASSERT( !rFound.pSlot || SfxSlotKind::Enum != rFound.pSlot->GetKind(), - "direct update of enum slot isn't allowed" ); - SfxStateCache* pCache = rFound.pCache; const SfxSlot* pSlot = rFound.pSlot; DBG_ASSERT( !pCache || !pSlot || pCache->GetId() == pSlot->GetSlotId(), "SID mismatch" ); @@ -1348,70 +1298,6 @@ void SfxBindings::UpdateControllers_Impl else pCache->SetState(SfxItemState::DEFAULT, pItem); } - - // Update the slots for so far available and bound Controllers for - // Slave-Slots (Enum-value) - 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() : nullptr; - if ( pIF && pFirstSlave) - { - // Items cast on EnumItem - const SfxEnumItemInterface *pEnumItem = dynamic_cast< const SfxEnumItemInterface* >(pItem); - if ( eState == SfxItemState::DEFAULT && !pEnumItem ) - eState = SfxItemState::DONTCARE; - else - eState = SfxControllerItem::GetItemState( pEnumItem ); - - // Iterate over all Slaves-Slots - for ( const SfxSlot *pSlave = pFirstSlave; pSlave; pSlave = pSlave->GetNextSlot() ) - { - DBG_ASSERT(pSlave, "Wrong SlaveSlot binding!"); - DBG_ASSERT(SfxSlotKind::Enum == pSlave->GetKind(),"non enum slaves aren't allowed"); - DBG_ASSERT(pSlave->GetMasterSlotId() == pSlot->GetSlotId(),"Wrong MasterSlot!"); - - // Binding exist for function ? - SfxStateCache *pEnumCache = GetStateCache( pSlave->GetSlotId() ); - if ( pEnumCache ) - { - pEnumCache->Invalidate(false); - - // HACK(CONTROL/SELECT Kram) ??? - if ( eState == SfxItemState::DONTCARE && rFound.nWhichId == 10144 ) - { - SfxVoidItem aVoid(0); - pEnumCache->SetState( SfxItemState::UNKNOWN, &aVoid ); - - if (pSlave->GetNextSlot() == pFirstSlave) - break; - - continue; - } - - if ( SfxItemState::DISABLED == eState || (pEnumItem && !pEnumItem->IsEnabled( pSlave->GetSlotId())) ) - { - // disabled - pEnumCache->SetState(SfxItemState::DISABLED, nullptr); - } - else if ( SfxItemState::DEFAULT == eState && pEnumItem ) - { - // Determine enum value - sal_uInt16 nValue = pEnumItem->GetEnumValue(); - SfxBoolItem aBool( rFound.nWhichId, pSlave->GetValue() == nValue ); - pEnumCache->SetState(SfxItemState::DEFAULT, &aBool); - } - else - { - // ambiguous - pEnumCache->SetState( SfxItemState::DONTCARE, INVALID_POOL_ITEM ); - } - } - - if (pSlave->GetNextSlot() == pFirstSlave) - break; - } - } } IMPL_LINK( SfxBindings, NextJob, Timer *, pTimer, void ) diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 4303cd9e0485..fd0cb6ec9cfa 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -396,24 +396,11 @@ void SfxDispatcher::Call_Impl(SfxShell& rShell, const SfxSlot &rSlot, SfxRequest { SfxBindings *pBindings = GetBindings(); - // When AutoUpdate update immediately; "Pseudoslots" must not be - // Autoupdate! + // When AutoUpdate update immediately if ( bAutoUpdate && pBindings ) { - const SfxSlot* pSlave = rSlot.GetLinkedSlot(); - if (pSlave) - { - // When enum slots take any bound slave slot - while (!pBindings->IsBound(pSlave->GetSlotId()) && pSlave != &rSlot ) - pSlave = pSlave->GetLinkedSlot(); - pBindings->Invalidate(pSlave->GetSlotId()); - pBindings->Update(pSlave->GetSlotId()); - } - else - { - pBindings->Invalidate(rSlot.GetSlotId()); - pBindings->Update(rSlot.GetSlotId()); - } + pBindings->Invalidate(rSlot.GetSlotId()); + pBindings->Update(rSlot.GetSlotId()); } } } diff --git a/sfx2/source/control/msg.cxx b/sfx2/source/control/msg.cxx index 947a5276fdfb..07bf409b8c61 100644 --- a/sfx2/source/control/msg.cxx +++ b/sfx2/source/control/msg.cxx @@ -29,13 +29,8 @@ SfxSlotKind SfxSlot::GetKind() const return SfxSlotKind::Standard; if ( nMasterSlotId && fnExec==nullptr && fnState==nullptr ) { - if ( *pType->pType == typeid(SfxBoolItem) ) - return SfxSlotKind::Enum; - else - { - OSL_FAIL( "invalid slot kind detected" ); - return SfxSlotKind::Enum; - } + assert(false); + return SfxSlotKind::Standard; } else return SfxSlotKind::Attribute; diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index 0bf304903c19..b5bc6f6ab7fa 100644 --- a/sfx2/source/control/objface.cxx +++ b/sfx2/source/control/objface.cxx @@ -145,32 +145,7 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) assert( nIter == nCount || pIter->GetSlotId() != (pIter+1)->GetSlotId() ); - // every master refers to his first slave (ENUM), - // all slaves refer to their master. - // Slaves refer in a circle to the other slaves with the same master - if ( pIter->GetKind() == SfxSlotKind::Enum ) - { - pIter->pLinkedSlot = GetSlot( pIter->nMasterSlotId ); - assert( pIter->pLinkedSlot ); - if ( !pIter->pLinkedSlot->pLinkedSlot ) - const_cast<SfxSlot*>(pIter->pLinkedSlot)->pLinkedSlot = pIter; - - if ( nullptr == pIter->GetNextSlot() ) - { - SfxSlot *pLastSlot = pIter; - for ( sal_uInt16 n = nIter; n < Count(); ++n ) - { - SfxSlot *pCurSlot = (pSlots+n); - if ( pCurSlot->nMasterSlotId == pIter->nMasterSlotId ) - { - pLastSlot->pNextSlot = pCurSlot; - pLastSlot = pCurSlot; - } - } - pLastSlot->pNextSlot = pIter; - } - } - else if ( nullptr == pIter->GetNextSlot() ) + if ( nullptr == pIter->GetNextSlot() ) { // Slots referring in circle to the next with the same // Status method. @@ -198,70 +173,21 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) if ( pNext->GetSlotId() <= pIter->GetSlotId() ) SAL_WARN( "sfx.control", "Wrong order" ); - if ( pIter->GetKind() == SfxSlotKind::Enum ) - { - const SfxSlot *pMasterSlot = GetSlot(pIter->nMasterSlotId); - const SfxSlot *pFirstSlave = pMasterSlot->pLinkedSlot; - const SfxSlot *pSlave = pFirstSlave; - do - { - if ( pSlave->pLinkedSlot != pMasterSlot ) - { - OStringBuffer aStr("Wrong Master/Slave- link: "); - aStr.append(static_cast<sal_Int32>( - pMasterSlot->GetSlotId())); - aStr.append(" , "); - aStr.append(static_cast<sal_Int32>( - pSlave->GetSlotId())); - SAL_WARN("sfx.control", aStr.getStr()); - } - - if ( pSlave->nMasterSlotId != pMasterSlot->GetSlotId() ) - { - OStringBuffer aStr("Wrong Master/Slave-Ids: "); - aStr.append(static_cast<sal_Int32>( - pMasterSlot->GetSlotId())); - aStr.append(" , "); - aStr.append(static_cast<sal_Int32>( - pSlave->GetSlotId())); - SAL_WARN("sfx.control", aStr.getStr()); - } - - pSlave = pSlave->pNextSlot; - } - while ( pSlave != pFirstSlave ); - } - else + const SfxSlot *pCurSlot = pIter; + do { - if ( pIter->pLinkedSlot ) - { - if ( pIter->pLinkedSlot->GetKind() != SfxSlotKind::Enum ) - { - OStringBuffer aStr("Slave is no enum: "); - aStr.append(static_cast<sal_Int32>(pIter->GetSlotId())); - aStr.append(" , "); - aStr.append(static_cast<sal_Int32>( - pIter->pLinkedSlot->GetSlotId())); - SAL_WARN("sfx.control", aStr.getStr()); - } - } - - const SfxSlot *pCurSlot = pIter; - do + pCurSlot = pCurSlot->pNextSlot; + if ( pCurSlot->GetStateFnc() != pIter->GetStateFnc() ) { - pCurSlot = pCurSlot->pNextSlot; - if ( pCurSlot->GetStateFnc() != pIter->GetStateFnc() ) - { - OStringBuffer aStr("Linked Slots with different State Methods : "); - aStr.append(static_cast<sal_Int32>( - pCurSlot->GetSlotId())); - aStr.append(" , "); - aStr.append(static_cast<sal_Int32>(pIter->GetSlotId())); - SAL_WARN("sfx.control", aStr.getStr()); - } + OStringBuffer aStr("Linked Slots with different State Methods : "); + aStr.append(static_cast<sal_Int32>( + pCurSlot->GetSlotId())); + aStr.append(" , "); + aStr.append(static_cast<sal_Int32>(pIter->GetSlotId())); + SAL_WARN("sfx.control", aStr.getStr()); } - while ( pCurSlot != pIter ); } + while ( pCurSlot != pIter ); pIter = pNext; } @@ -335,7 +261,7 @@ const SfxSlot* SfxInterface::GetRealSlot( const SfxSlot *pSlot ) const return nullptr; } - return pSlot->pLinkedSlot; + return nullptr; } @@ -354,7 +280,7 @@ const SfxSlot* SfxInterface::GetRealSlot( sal_uInt16 nSlotId ) const return nullptr; } - return pSlot->pLinkedSlot; + return nullptr; } void SfxInterface::RegisterPopupMenu( const OUString& rResourceName ) diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index a6afc6dcef9c..13b3be168c07 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -263,18 +263,8 @@ void SfxShell::Invalidate_Impl( SfxBindings& rBindings, sal_uInt16 nId ) const SfxSlot *pSlot = pIF->GetSlot(nId); if ( pSlot ) { - // At Enum-Slots invalidate the Master-Slot - if ( SfxSlotKind::Enum == pSlot->GetKind() ) - pSlot = pSlot->GetLinkedSlot(); - - // Invalidate the Slot itself and possible also all Slave-Slots + // Invalidate the Slot itself rBindings.Invalidate( pSlot->GetSlotId() ); - for ( const SfxSlot *pSlave = pSlot->GetLinkedSlot(); - pSlave && pIF->ContainsSlot_Impl( pSlave ) && - pSlave->GetLinkedSlot() == pSlot; - ++pSlave ) - rBindings.Invalidate( pSlave->GetSlotId() ); - return; } @@ -557,7 +547,6 @@ void SfxShell::SetVerbs(const css::uno::Sequence < css::embed::VerbDescriptor >& pNewSlot->fnExec = SFX_STUB_PTR(SfxShell,VerbExec); pNewSlot->fnState = SFX_STUB_PTR(SfxShell,VerbState); pNewSlot->pType = nullptr; // HACK(SFX_TYPE(SfxVoidItem)) ??? - pNewSlot->pLinkedSlot = nullptr; pNewSlot->nArgDefCount = 0; pNewSlot->pFirstArgDef = nullptr; pNewSlot->pUnoName = nullptr; |