Kaydet (Commit) 84482f51 authored tarafından Noel Grandin's avatar Noel Grandin

convert SfxSlotFilterState to scoped enum

Change-Id: I424a1c71429078f8f83f8f0138c6e12567628ef8
üst 33d39064
...@@ -67,12 +67,12 @@ namespace o3tl ...@@ -67,12 +67,12 @@ namespace o3tl
template<> struct typed_flags<SfxDispatcherPopFlags> : is_typed_flags<SfxDispatcherPopFlags, 0x07> {}; template<> struct typed_flags<SfxDispatcherPopFlags> : is_typed_flags<SfxDispatcherPopFlags, 0x07> {};
} }
enum SfxSlotFilterState enum class SfxSlotFilterState
{ {
SFX_SLOT_FILTER_DISABLED, DISABLED,
SFX_SLOT_FILTER_ENABLED, ENABLED,
// enabled even if ReadOnlyDoc // enabled even if ReadOnlyDoc
SFX_SLOT_FILTER_ENABLED_READONLY, ENABLED_READONLY,
}; };
...@@ -168,7 +168,7 @@ public: ...@@ -168,7 +168,7 @@ public:
void Flush(); void Flush();
void Lock( bool bLock ); void Lock( bool bLock );
bool IsLocked( sal_uInt16 nSID = 0 ) const; bool IsLocked( sal_uInt16 nSID = 0 ) const;
void SetSlotFilter( SfxSlotFilterState nEnable = SFX_SLOT_FILTER_DISABLED, void SetSlotFilter( SfxSlotFilterState nEnable = SfxSlotFilterState::DISABLED,
sal_uInt16 nCount = 0, const sal_uInt16 *pSIDs = 0 ); sal_uInt16 nCount = 0, const sal_uInt16 *pSIDs = 0 );
void HideUI( bool bHide = true ); void HideUI( bool bHide = true );
......
...@@ -389,7 +389,7 @@ void DrawDocShell::ApplySlotFilter() const ...@@ -389,7 +389,7 @@ void DrawDocShell::ApplySlotFilter() const
SfxDispatcher* pDispatcher = pTestViewShell->GetViewFrame()->GetDispatcher(); SfxDispatcher* pDispatcher = pTestViewShell->GetViewFrame()->GetDispatcher();
if( mpFilterSIDs ) if( mpFilterSIDs )
pDispatcher->SetSlotFilter( mbFilterEnable ? SFX_SLOT_FILTER_ENABLED : SFX_SLOT_FILTER_DISABLED, mnFilterCount, mpFilterSIDs ); pDispatcher->SetSlotFilter( mbFilterEnable ? SfxSlotFilterState::ENABLED : SfxSlotFilterState::DISABLED, mnFilterCount, mpFilterSIDs );
else else
pDispatcher->SetSlotFilter(); pDispatcher->SetSlotFilter();
......
...@@ -2669,7 +2669,7 @@ void SAL_CALL SlideshowImpl::activate() throw (RuntimeException, std::exception) ...@@ -2669,7 +2669,7 @@ void SAL_CALL SlideshowImpl::activate() throw (RuntimeException, std::exception)
if( pDispatcher ) if( pDispatcher )
{ {
// filter all forbbiden slots // filter all forbbiden slots
pDispatcher->SetSlotFilter( SFX_SLOT_FILTER_ENABLED, sizeof(pAllowed) / sizeof(sal_uInt16), pAllowed ); pDispatcher->SetSlotFilter( SfxSlotFilterState::ENABLED, sizeof(pAllowed) / sizeof(sal_uInt16), pAllowed );
} }
if( getBindings() ) if( getBindings() )
......
...@@ -321,7 +321,7 @@ void SfxDispatcher::Construct_Impl( SfxDispatcher* pParent ) ...@@ -321,7 +321,7 @@ void SfxDispatcher::Construct_Impl( SfxDispatcher* pParent )
xImp->bQuiet = false; xImp->bQuiet = false;
xImp->bModal = false; xImp->bModal = false;
xImp->pInCallAliveFlag = 0; xImp->pInCallAliveFlag = 0;
xImp->nFilterEnabling = SFX_SLOT_FILTER_DISABLED; xImp->nFilterEnabling = SfxSlotFilterState::DISABLED;
xImp->nFilterCount = 0; xImp->nFilterCount = 0;
xImp->pFilterSIDs = 0; xImp->pFilterSIDs = 0;
xImp->nDisableFlags = 0; xImp->nDisableFlags = 0;
...@@ -1626,20 +1626,20 @@ SfxSlotFilterState SfxDispatcher::IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) ...@@ -1626,20 +1626,20 @@ SfxSlotFilterState SfxDispatcher::IsSlotEnabledByFilter_Impl( sal_uInt16 nSID )
// no filter? // no filter?
if ( 0 == xImp->nFilterCount ) if ( 0 == xImp->nFilterCount )
// => all SIDs allowed // => all SIDs allowed
return SFX_SLOT_FILTER_ENABLED; return SfxSlotFilterState::ENABLED;
// search // search
bool bFound = 0 != bsearch( &nSID, xImp->pFilterSIDs, xImp->nFilterCount, bool bFound = 0 != bsearch( &nSID, xImp->pFilterSIDs, xImp->nFilterCount,
sizeof(sal_uInt16), SfxCompareSIDs_Impl ); sizeof(sal_uInt16), SfxCompareSIDs_Impl );
// even if ReadOnlyDoc // even if ReadOnlyDoc
if ( SFX_SLOT_FILTER_ENABLED_READONLY == xImp->nFilterEnabling ) if ( SfxSlotFilterState::ENABLED_READONLY == xImp->nFilterEnabling )
return bFound ? SFX_SLOT_FILTER_ENABLED_READONLY : SFX_SLOT_FILTER_ENABLED; return bFound ? SfxSlotFilterState::ENABLED_READONLY : SfxSlotFilterState::ENABLED;
// Otherwise after Negative/Positive Filter // Otherwise after Negative/Positive Filter
else if ( SFX_SLOT_FILTER_ENABLED == xImp->nFilterEnabling ) else if ( SfxSlotFilterState::ENABLED == xImp->nFilterEnabling )
return bFound ? SFX_SLOT_FILTER_ENABLED : SFX_SLOT_FILTER_DISABLED; return bFound ? SfxSlotFilterState::ENABLED : SfxSlotFilterState::DISABLED;
else else
return bFound ? SFX_SLOT_FILTER_DISABLED : SFX_SLOT_FILTER_ENABLED; return bFound ? SfxSlotFilterState::DISABLED : SfxSlotFilterState::ENABLED;
} }
/** This helper method searches for the <Slot-Server> which currently serves /** This helper method searches for the <Slot-Server> which currently serves
...@@ -1706,11 +1706,11 @@ bool SfxDispatcher::_FindServer(sal_uInt16 nSlot, SfxSlotServer& rServer, bool b ...@@ -1706,11 +1706,11 @@ bool SfxDispatcher::_FindServer(sal_uInt16 nSlot, SfxSlotServer& rServer, bool b
} }
// SID check against set filter // SID check against set filter
SfxSlotFilterState nSlotEnableMode = SFX_SLOT_FILTER_DISABLED; SfxSlotFilterState nSlotEnableMode = SfxSlotFilterState::DISABLED;
if ( xImp->pFrame ) if ( xImp->pFrame )
{ {
nSlotEnableMode = IsSlotEnabledByFilter_Impl( nSlot ); nSlotEnableMode = IsSlotEnabledByFilter_Impl( nSlot );
if ( SFX_SLOT_FILTER_DISABLED == nSlotEnableMode ) if ( SfxSlotFilterState::DISABLED == nSlotEnableMode )
return false; return false;
} }
...@@ -1728,7 +1728,7 @@ bool SfxDispatcher::_FindServer(sal_uInt16 nSlot, SfxSlotServer& rServer, bool b ...@@ -1728,7 +1728,7 @@ bool SfxDispatcher::_FindServer(sal_uInt16 nSlot, SfxSlotServer& rServer, bool b
return false; return false;
} }
bool bReadOnly = ( SFX_SLOT_FILTER_ENABLED_READONLY != nSlotEnableMode && xImp->bReadOnly ); bool bReadOnly = ( SfxSlotFilterState::ENABLED_READONLY != nSlotEnableMode && xImp->bReadOnly );
// search through all the shells of the chained dispatchers // search through all the shells of the chained dispatchers
// from top to bottom // from top to bottom
......
...@@ -602,7 +602,7 @@ void SwView::_CheckReadonlyState() ...@@ -602,7 +602,7 @@ void SwView::_CheckReadonlyState()
} }
if ( SfxItemState::DISABLED == eStateRO ) if ( SfxItemState::DISABLED == eStateRO )
{ {
rDis.SetSlotFilter( SFX_SLOT_FILTER_ENABLED_READONLY, sizeof(aROIds)/sizeof(sal_uInt16), aROIds ); rDis.SetSlotFilter( SfxSlotFilterState::ENABLED_READONLY, sizeof(aROIds)/sizeof(sal_uInt16), aROIds );
bChgd = true; bChgd = true;
} }
} }
...@@ -617,7 +617,7 @@ void SwView::_CheckReadonlyState() ...@@ -617,7 +617,7 @@ void SwView::_CheckReadonlyState()
qsort( (void*)aAllProtIds, sizeof(aAllProtIds)/sizeof(sal_uInt16), sizeof(sal_uInt16), lcl_CmpIds ); qsort( (void*)aAllProtIds, sizeof(aAllProtIds)/sizeof(sal_uInt16), sizeof(sal_uInt16), lcl_CmpIds );
bAllProtFirst = false; bAllProtFirst = false;
} }
rDis.SetSlotFilter( SFX_SLOT_FILTER_ENABLED_READONLY, rDis.SetSlotFilter( SfxSlotFilterState::ENABLED_READONLY,
sizeof(aAllProtIds)/sizeof(sal_uInt16), sizeof(aAllProtIds)/sizeof(sal_uInt16),
aAllProtIds ); aAllProtIds );
bChgd = true; bChgd = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment