diff options
author | Armin Le Grand (Allotropia) <armin.le.grand@me.com> | 2021-06-11 11:07:16 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2021-06-11 16:58:40 +0200 |
commit | 3b46c3068af26d6be65cfe309c751e310a22d129 (patch) | |
tree | f6aa41fd42466f14f80a2471ad1b0a2eb19a053c /sfx2 | |
parent | eb0222e80ba6f5b7b11f1e43f3723162beb2ba71 (diff) |
tdf#130428 remove unnecessary usage of SfxItemState::UNKNOWN
Another place where SfxItemState was used as placeholder
Change-Id: I54e549db50b7485024a305eb39fda848cbed6b78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117036
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/shell.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index 795f25f708aa..78639a958a4f 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -452,7 +452,8 @@ const SfxPoolItem* SfxShell::GetSlotState // Get Slot on the given Interface if ( !pIF ) pIF = GetInterface(); - SfxItemState eState = SfxItemState::UNKNOWN; + SfxItemState eState(SfxItemState::DEFAULT); + bool bItemStateSet(false); SfxItemPool &rPool = GetPool(); const SfxSlot* pSlot = nullptr; @@ -467,13 +468,14 @@ const SfxPoolItem* SfxShell::GetSlotState // Get Item and Item status const SfxPoolItem *pItem = nullptr; SfxItemSet aSet( rPool, {{nSlotId, nSlotId}} ); // else pItem dies too soon - if ( pSlot ) + if ( nullptr != pSlot ) { // Call Status method SfxStateFunc pFunc = pSlot->GetStateFnc(); if ( pFunc ) (*pFunc)( this, aSet ); eState = aSet.GetItemState( nSlotId, true, &pItem ); + bItemStateSet = true; // get default Item if possible if ( eState == SfxItemState::DEFAULT ) @@ -484,24 +486,22 @@ const SfxPoolItem* SfxShell::GetSlotState eState = SfxItemState::DONTCARE; } } - else - eState = SfxItemState::UNKNOWN; // Evaluate Item and item status and possibly maintain them in pStateSet std::unique_ptr<SfxPoolItem> pRetItem; - if ( eState <= SfxItemState::DISABLED ) + if ( !bItemStateSet || eState <= SfxItemState::DISABLED ) { if ( pStateSet ) pStateSet->DisableItem(nSlotId); return nullptr; } - else if ( eState == SfxItemState::DONTCARE ) + else if ( bItemStateSet && eState == SfxItemState::DONTCARE ) { if ( pStateSet ) pStateSet->ClearItem(nSlotId); pRetItem.reset( new SfxVoidItem(0) ); } - else + else // bItemStateSet && eState >= SfxItemState::DEFAULT { if ( pStateSet && pStateSet->Put( *pItem ) ) return &pStateSet->Get( pItem->Which() ); |