From 88a874fcb3a3735634c638f34dcb0cc7bd2260ac Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 23 Jul 2014 10:48:58 +0200 Subject: convert SfxItemState constants to a proper enum and while we're at it - use the enum type all over the place instead of passing around sal_uInt16 - don't use bitwise logic on enum values - use enum values instead of numeric constants Change-Id: I7f24cb4d242e1c00703e7bbcf1a00c18ef1e9fd4 --- chart2/source/controller/dialogs/tp_AxisLabel.cxx | 6 +++--- cui/source/tabpages/chardlg.cxx | 2 ++ cui/source/tabpages/paragrph.cxx | 2 +- cui/source/tabpages/tpcolor.cxx | 2 +- editeng/source/uno/unoedprx.cxx | 4 ++-- editeng/source/uno/unofored.cxx | 6 +++--- editeng/source/uno/unofored_internal.hxx | 2 +- editeng/source/uno/unoforou.cxx | 4 ++-- editeng/source/uno/unotext.cxx | 19 +++++++++++-------- include/editeng/unoedprx.hxx | 6 +++--- include/editeng/unoedsrc.hxx | 4 ++-- include/editeng/unofored.hxx | 4 ++-- include/editeng/unoforou.hxx | 4 ++-- include/editeng/unotext.hxx | 4 ++-- include/svl/poolitem.hxx | 19 +++++++++---------- sfx2/source/control/querystatus.cxx | 2 +- sfx2/source/control/sfxstatuslistener.cxx | 2 +- sfx2/source/control/shell.cxx | 2 +- sfx2/source/control/statcach.cxx | 2 +- sfx2/source/statbar/stbitem.cxx | 2 +- sfx2/source/toolbox/tbxitem.cxx | 6 ++++-- starmath/source/accessibility.cxx | 10 +++++----- starmath/source/accessibility.hxx | 4 ++-- svl/source/items/itemset.cxx | 5 +++-- .../accessibility/AccessibleEmptyEditSource.cxx | 4 ++-- svx/source/svdraw/svdibrow.cxx | 1 + svx/source/tbxctrls/formatpaintbrushctrl.cxx | 2 +- svx/source/tbxctrls/tbcontrl.cxx | 3 +++ .../core/doc/DocumentContentOperationsManager.cxx | 8 ++++---- sw/source/ui/misc/num.cxx | 2 +- sw/source/uibase/app/docstyle.cxx | 19 ++++++++++--------- sw/source/uibase/shells/textsh1.cxx | 2 +- 32 files changed, 88 insertions(+), 76 deletions(-) diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx index 14892aac18ff..6bf9cab13ccf 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx @@ -153,7 +153,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); m_pCbShowDescription->Check( bCheck ); - if( ( aState & SFX_ITEM_DEFAULT ) == 0 ) + if( aState != SFX_ITEM_DEFAULT ) m_pCbShowDescription->Hide(); } @@ -201,7 +201,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); m_pCbTextOverlap->Check( bCheck ); - if( ( aState & SFX_ITEM_DEFAULT ) == 0 ) + if( aState != SFX_ITEM_DEFAULT ) m_pCbTextOverlap->Hide(); } @@ -220,7 +220,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); m_pCbTextBreak->Check( bCheck ); - if( ( aState & SFX_ITEM_DEFAULT ) == 0 ) + if( aState != SFX_ITEM_DEFAULT ) { m_pCbTextBreak->Hide(); if( ! m_pCbTextOverlap->IsVisible() ) diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 554d977725fd..98a0e17078a0 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -812,6 +812,8 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp pLangBox->SelectLanguage( eLangType ); break; } + case SFX_ITEM_DONTCARE: + break; } OUString sMapText(pFontList->GetFontMapText( diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 3b059ed069a4..bbeb896549c0 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -2187,7 +2187,7 @@ static void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, CheckBox& rBo { sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId); SfxItemState eState = rSet.GetItemState(_nWhich, true); - if(!eState || eState == SFX_ITEM_DISABLED ) + if( eState == SFX_ITEM_UNKNOWN || eState == SFX_ITEM_DISABLED ) rBox.Enable(false); else if(eState >= SFX_ITEM_AVAILABLE) { diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 2e016dfdcdb6..9a1218a266ef 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -594,7 +594,7 @@ void SvxColorTabPage::UpdateModified() void SvxColorTabPage::Reset( const SfxItemSet* rSet ) { - sal_uInt16 nState = rSet->GetItemState( XATTR_FILLCOLOR ); + SfxItemState nState = rSet->GetItemState( XATTR_FILLCOLOR ); Color aNewColor; diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 874c6b116156..81f64dd5842e 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -553,7 +553,7 @@ void SvxAccessibleTextAdapter::GetPortions( sal_Int32 nPara, std::vectorGetPortions( nPara, rList ); } -sal_uInt16 SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const +SfxItemState SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const { assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder"); @@ -567,7 +567,7 @@ sal_uInt16 SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal_u nWhich ); } -sal_uInt16 SvxAccessibleTextAdapter::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const +SfxItemState SvxAccessibleTextAdapter::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const { assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder"); diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index b454b6dcb34f..1f5ad40693b6 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -165,7 +165,7 @@ void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, sal_Int32 rEditEngine.FieldClicked( rField, nPara, nPos ); } -sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich ) +SfxItemState GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich ) { std::vector aAttribs; @@ -258,12 +258,12 @@ sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& return eState; } -sal_uInt16 SvxEditEngineForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const +SfxItemState SvxEditEngineForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const { return GetSvxEditEngineItemState( rEditEngine, rSel, nWhich ); } -sal_uInt16 SvxEditEngineForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const +SfxItemState SvxEditEngineForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const { const SfxItemSet& rSet = rEditEngine.GetParaAttribs( nPara ); return rSet.GetItemState( nWhich ); diff --git a/editeng/source/uno/unofored_internal.hxx b/editeng/source/uno/unofored_internal.hxx index 66758b08b4e0..4702e7692397 100644 --- a/editeng/source/uno/unofored_internal.hxx +++ b/editeng/source/uno/unofored_internal.hxx @@ -21,7 +21,7 @@ #define INCLUDED_EDITENG_SOURCE_UNO_UNFORED_INTERNAL_HXX -sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich ); +SfxItemState GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich ); #endif // INCLUDED_EDITENG_SOURCE_UNO_UNFORED_INTERNAL_HXX diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index b39b4531d782..f0d3fbb1be5c 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -244,12 +244,12 @@ bool SvxOutlinerForwarder::IsValid() const return rOutliner.GetUpdateMode(); } -sal_uInt16 SvxOutlinerForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const +SfxItemState SvxOutlinerForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const { return GetSvxEditEngineItemState( (EditEngine&)rOutliner.GetEditEngine(), rSel, nWhich ); } -sal_uInt16 SvxOutlinerForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const +SfxItemState SvxOutlinerForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const { const SfxItemSet& rSet = rOutliner.GetParaAttribs( nPara ); return rSet.GetItemState( nWhich ); diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 16727fff1771..135448b46906 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -699,7 +699,8 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet& rSet, const SfxIt case EE_PARA_NUMBULLET: { - if((rSet.GetItemState( EE_PARA_NUMBULLET, true ) & (SFX_ITEM_SET|SFX_ITEM_DEFAULT)) == 0) + SfxItemState eState = rSet.GetItemState( EE_PARA_NUMBULLET, true ); + if( eState != SFX_ITEM_SET && eState != SFX_ITEM_DEFAULT) throw uno::RuntimeException(); SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET, true ); @@ -740,7 +741,8 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet& rSet, const SfxIt case EE_PARA_BULLETSTATE: { bool bState = false; - if( rSet.GetItemState( EE_PARA_BULLETSTATE, true ) & (SFX_ITEM_SET|SFX_ITEM_DEFAULT)) + SfxItemState eState = rSet.GetItemState( EE_PARA_BULLETSTATE, true ); + if( eState == SFX_ITEM_SET || eState == SFX_ITEM_DEFAULT ) { SfxBoolItem* pItem = (SfxBoolItem*)rSet.GetItem( EE_PARA_BULLETSTATE, true ); bState = pItem->GetValue() ? sal_True : sal_False; @@ -971,7 +973,7 @@ beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const SfxIt case WID_FONTDESC: { const sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap; - SfxItemState eTempItemState; + SfxItemState eTempItemState = SFX_ITEM_UNKNOWN; while( *pWhichId ) { if(nPara != -1) @@ -1039,6 +1041,7 @@ beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const SfxIt return beans::PropertyState_DIRECT_VALUE; case SFX_ITEM_DEFAULT: return beans::PropertyState_DEFAULT_VALUE; + default: break; // case SFX_ITEM_UNKNOWN: } } @@ -1118,7 +1121,7 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf case WID_FONTDESC: { const sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap; - SfxItemState eTempItemState; + SfxItemState eTempItemState = SFX_ITEM_UNKNOWN; while( *pWhichId ) { eTempItemState = pSet->GetItemState( *pWhichId ); @@ -2425,14 +2428,14 @@ void SvxDummyTextSource::GetPortions( sal_Int32, std::vector& ) const { } -sal_uInt16 SvxDummyTextSource::GetItemState( const ESelection&, sal_uInt16 ) const +SfxItemState SvxDummyTextSource::GetItemState( const ESelection&, sal_uInt16 ) const { - return 0; + return SFX_ITEM_UNKNOWN; } -sal_uInt16 SvxDummyTextSource::GetItemState( sal_Int32, sal_uInt16 ) const +SfxItemState SvxDummyTextSource::GetItemState( sal_Int32, sal_uInt16 ) const { - return 0; + return SFX_ITEM_UNKNOWN; } SfxItemPool* SvxDummyTextSource::GetPool() const diff --git a/include/editeng/unoedprx.hxx b/include/editeng/unoedprx.hxx index a7cab62d196c..bbe67ff1feac 100644 --- a/include/editeng/unoedprx.hxx +++ b/include/editeng/unoedprx.hxx @@ -42,10 +42,10 @@ public: virtual void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) SAL_OVERRIDE; virtual void GetPortions( sal_Int32 nPara, std::vector& rList ) const SAL_OVERRIDE; - virtual sal_uInt16 CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex ); + virtual sal_uInt16 CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex ); - virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE; - virtual sal_uInt16 GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE; + virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE; + virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE; virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) SAL_OVERRIDE; virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) SAL_OVERRIDE; diff --git a/include/editeng/unoedsrc.hxx b/include/editeng/unoedsrc.hxx index a76db3396aca..4f52c50e1b8e 100644 --- a/include/editeng/unoedsrc.hxx +++ b/include/editeng/unoedsrc.hxx @@ -148,8 +148,8 @@ public: virtual void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) = 0; virtual void GetPortions( sal_Int32 nPara, std::vector& rList ) const = 0; - virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0; - virtual sal_uInt16 GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const = 0; + virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0; + virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const = 0; virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) = 0; virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) = 0; diff --git a/include/editeng/unofored.hxx b/include/editeng/unofored.hxx index a07a784f047b..1910bcde3406 100644 --- a/include/editeng/unofored.hxx +++ b/include/editeng/unofored.hxx @@ -44,8 +44,8 @@ public: virtual void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) SAL_OVERRIDE; virtual void GetPortions( sal_Int32 nPara, std::vector& rList ) const SAL_OVERRIDE; - virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE; - virtual sal_uInt16 GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE; + virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE; + virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE; virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) SAL_OVERRIDE; virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) SAL_OVERRIDE; diff --git a/include/editeng/unoforou.hxx b/include/editeng/unoforou.hxx index 7840909a115d..5403ef68e7ff 100644 --- a/include/editeng/unoforou.hxx +++ b/include/editeng/unoforou.hxx @@ -62,8 +62,8 @@ public: virtual void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) SAL_OVERRIDE; virtual void GetPortions( sal_Int32 nPara, std::vector& rList ) const SAL_OVERRIDE; - virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE; - virtual sal_uInt16 GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE; + virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE; + virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE; virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) SAL_OVERRIDE; virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) SAL_OVERRIDE; diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index 496de99c13f0..da7708ce98ea 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -184,8 +184,8 @@ public: virtual void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) SAL_OVERRIDE; virtual void GetPortions( sal_Int32 nPara, std::vector& rList ) const SAL_OVERRIDE; - sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE; - sal_uInt16 GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE; + SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE; + SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE; virtual SfxItemPool* GetPool() const SAL_OVERRIDE; diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index 892f2adaccd1..718a78bf05d0 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -130,16 +130,15 @@ enum SfxItemPresentation -typedef sal_uInt16 SfxItemState; - -#define SFX_ITEM_UNKNOWN 0x0000 - -#define SFX_ITEM_DISABLED 0x0001 -#define SFX_ITEM_READONLY 0x0002 - -#define SFX_ITEM_DONTCARE 0x0010 -#define SFX_ITEM_DEFAULT 0x0020 -#define SFX_ITEM_SET 0x0030 +enum SfxItemState { + // These values have to match the values in the com::sun::star::frame::status::ItemState IDL + SFX_ITEM_UNKNOWN = 0, + SFX_ITEM_DISABLED = 0x0001, + SFX_ITEM_READONLY = 0x0002, + SFX_ITEM_DONTCARE = 0x0010, + SFX_ITEM_DEFAULT = 0x0020, + SFX_ITEM_SET = 0x0030 +}; // old stuff - dont use!!! #define SFX_ITEM_AVAILABLE SFX_ITEM_DEFAULT diff --git a/sfx2/source/control/querystatus.cxx b/sfx2/source/control/querystatus.cxx index 04e91f04f178..64c1c0e2cdd0 100644 --- a/sfx2/source/control/querystatus.cxx +++ b/sfx2/source/control/querystatus.cxx @@ -139,7 +139,7 @@ throw( RuntimeException, std::exception ) { ItemStatus aItemStatus; rEvent.State >>= aItemStatus; - m_eState = aItemStatus.State; + m_eState = (SfxItemState) aItemStatus.State; m_pItem = new SfxVoidItem( m_nSlotID ); } else if ( pType == cppu::UnoType< ::com::sun::star::frame::status::Visibility>::get() ) diff --git a/sfx2/source/control/sfxstatuslistener.cxx b/sfx2/source/control/sfxstatuslistener.cxx index aeaaebf51385..703ad903d3e6 100644 --- a/sfx2/source/control/sfxstatuslistener.cxx +++ b/sfx2/source/control/sfxstatuslistener.cxx @@ -203,7 +203,7 @@ throw( RuntimeException, std::exception ) { ItemStatus aItemStatus; rEvent.State >>= aItemStatus; - eState = aItemStatus.State; + eState = (SfxItemState) aItemStatus.State; pItem = new SfxVoidItem( m_nSlotID ); } else if ( pType == cppu::UnoType< ::com::sun::star::frame::status::Visibility >::get() ) diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index 49e9ebacc27e..27f5a7689875 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -886,7 +886,7 @@ const SfxPoolItem* SfxShell::GetSlotState // Get Slot on the given Interface if ( !pIF ) pIF = GetInterface(); - SfxItemState eState; + SfxItemState eState = SFX_ITEM_UNKNOWN; SfxItemPool &rPool = GetPool(); const SfxSlot* pSlot = NULL; diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 8ee8d72a6699..b0a4e5935ea9 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -184,7 +184,7 @@ SfxStateCache::SfxStateCache( sal_uInt16 nFuncId ): pInternalController(0), pController(0), pLastItem( 0 ), - eLastState( 0 ), + eLastState( SFX_ITEM_UNKNOWN ), bItemVisible( true ) { bCtrlDirty = true; diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 882c4ea5d398..3de5bcd9ab84 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -290,7 +290,7 @@ throw ( ::com::sun::star::uno::RuntimeException, std::exception ) { frame::status::ItemStatus aItemStatus; rEvent.State >>= aItemStatus; - eState = aItemStatus.State; + eState = (SfxItemState) aItemStatus.State; pItem = new SfxVoidItem( nSlotID ); } else diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 8c443f11c605..d4152af0f4b4 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -548,7 +548,7 @@ throw ( ::com::sun::star::uno::RuntimeException, std::exception ) { ItemStatus aItemStatus; rEvent.State >>= aItemStatus; - eState = aItemStatus.State; + eState = (SfxItemState) aItemStatus.State; pItem = new SfxVoidItem( nSlotId ); } else if ( pType == cppu::UnoType< ::com::sun::star::frame::status::Visibility>::get() ) @@ -939,6 +939,8 @@ void SfxToolBoxControl::StateChanged nItemBits |= TIB_CHECKABLE; } break; + + default: break; // do nothing } pImpl->pBox->SetItemState( GetId(), eTri ); @@ -1094,7 +1096,7 @@ throw ( ::com::sun::star::uno::RuntimeException, std::exception ) { ItemStatus aItemStatus; rEvent.State >>= aItemStatus; - eState = aItemStatus.State; + eState = (SfxItemState) aItemStatus.State; pItem = new SfxVoidItem( nSlotId ); } else if ( pType == cppu::UnoType< ::com::sun::star::frame::status::Visibility>::get() ) diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index a037861ea704..835b009af840 100644 --- a/starmath/source/accessibility.cxx +++ b/starmath/source/accessibility.cxx @@ -1112,7 +1112,7 @@ void SmTextForwarder::FieldClicked(const SvxFieldItem&, sal_Int32, sal_Int32) { } -static sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich ) +static SfxItemState GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, sal_uInt16 nWhich ) { std::vector aAttribs; @@ -1204,18 +1204,18 @@ static sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESel return eState; } -sal_uInt16 SmTextForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const +SfxItemState SmTextForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const { - sal_uInt16 nState = SFX_ITEM_DISABLED; + SfxItemState nState = SFX_ITEM_DISABLED; EditEngine *pEditEngine = rEditAcc.GetEditEngine(); if (pEditEngine) nState = GetSvxEditEngineItemState( *pEditEngine, rSel, nWhich ); return nState; } -sal_uInt16 SmTextForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const +SfxItemState SmTextForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const { - sal_uInt16 nState = SFX_ITEM_DISABLED; + SfxItemState nState = SFX_ITEM_DISABLED; EditEngine *pEditEngine = rEditAcc.GetEditEngine(); if (pEditEngine) { diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx index 1b8f4da2a8db..1414b5353be9 100644 --- a/starmath/source/accessibility.hxx +++ b/starmath/source/accessibility.hxx @@ -210,8 +210,8 @@ public: virtual void RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich ) SAL_OVERRIDE; virtual void GetPortions( sal_Int32 nPara, std::vector& rList ) const SAL_OVERRIDE; - virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE; - virtual sal_uInt16 GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE; + virtual SfxItemState GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const SAL_OVERRIDE; + virtual SfxItemState GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const SAL_OVERRIDE; virtual void QuickInsertText( const OUString& rText, const ESelection& rSel ) SAL_OVERRIDE; virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) SAL_OVERRIDE; diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index cf15b267b5a9..33ed2d49b03e 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -737,7 +737,8 @@ void SfxItemSet::MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo ) { // special case: exactly one sal_uInt16 which is already included? - if ( nFrom == nTo && SFX_ITEM_AVAILABLE <= GetItemState(nFrom, false) ) + SfxItemState eItemState = GetItemState(nFrom, false); + if ( nFrom == nTo && ( eItemState == SFX_ITEM_DEFAULT || eItemState == SFX_ITEM_SET ) ) return; // merge new range @@ -1096,7 +1097,7 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet ) sal_uInt16 nWhich = IsInvalidItem( pItem ) ? GetWhichByPos( aIter.GetCurPos() ) : pItem->Which(); - if( 0 == rSet.GetItemState( nWhich, false ) ) + if( SFX_ITEM_UNKNOWN == rSet.GetItemState( nWhich, false ) ) ClearItem( nWhich ); // loeschen if( aIter.IsAtEnd() ) break; diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index 776e9643ec3d..d2d0ac252d42 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -107,8 +107,8 @@ namespace accessibility void RemoveAttribs( const ESelection& /*rSelection*/, bool /*bRemoveParaAttribs*/, sal_uInt16 /*nWhich*/ ) SAL_OVERRIDE {} void GetPortions( sal_Int32 /*nPara*/, std::vector& /*rList*/ ) const SAL_OVERRIDE {} - sal_uInt16 GetItemState( const ESelection& /*rSel*/, sal_uInt16 /*nWhich*/ ) const SAL_OVERRIDE { return 0; } - sal_uInt16 GetItemState( sal_Int32 /*nPara*/, sal_uInt16 /*nWhich*/ ) const SAL_OVERRIDE { return 0; } + SfxItemState GetItemState( const ESelection& /*rSel*/, sal_uInt16 /*nWhich*/ ) const SAL_OVERRIDE { return SFX_ITEM_UNKNOWN; } + SfxItemState GetItemState( sal_Int32 /*nPara*/, sal_uInt16 /*nWhich*/ ) const SAL_OVERRIDE { return SFX_ITEM_UNKNOWN; } SfxItemPool* GetPool() const SAL_OVERRIDE { return NULL; } diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx index 9f1322c98781..40ca0d9f212a 100644 --- a/svx/source/svdraw/svdibrow.cxx +++ b/svx/source/svdraw/svdibrow.cxx @@ -325,6 +325,7 @@ OUString _SdrItemBrowserControl::GetCellText(long _nRow, sal_uInt16 _nColId) con case SFX_ITEM_DONTCARE: sRet = "DontCare"; break; case SFX_ITEM_SET : sRet = "Set"; break; case SFX_ITEM_DEFAULT : sRet = "Default"; break; + case SFX_ITEM_READONLY: sRet = "ReadOnly"; break; } // switch } break; case ITEMBROWSER_TYPECOL_ID: sRet = pEntry->GetItemTypeStr(); break; diff --git a/svx/source/tbxctrls/formatpaintbrushctrl.cxx b/svx/source/tbxctrls/formatpaintbrushctrl.cxx index 0c977e6c5318..27c6c8aa8067 100644 --- a/svx/source/tbxctrls/formatpaintbrushctrl.cxx +++ b/svx/source/tbxctrls/formatpaintbrushctrl.cxx @@ -96,7 +96,7 @@ void FormatPaintBrushToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/) void FormatPaintBrushToolBoxControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) { - if( ( eState & SFX_ITEM_SET ) == 0 ) + if( eState != SFX_ITEM_SET ) m_bPersistentCopy = false; SfxToolBoxControl::StateChanged( nSID, eState, pState ); } diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index e0e8eb3abe80..816afbe16709 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2078,6 +2078,9 @@ void SvxStyleToolBoxControl::StateChanged( case SFX_ITEM_DONTCARE: eTri = TRISTATE_INDET; break; + + default: + break; } rTbx.SetItemState( nId, eTri ); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 70221d1f0bb3..795cb89583fc 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -4148,9 +4148,9 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos, // Safe numrule item at destination. // #i86492# - Safe also item of destination. - int aNumRuleState = SFX_ITEM_UNKNOWN; + SfxItemState aNumRuleState = SFX_ITEM_UNKNOWN; SwNumRuleItem aNumRuleItem; - int aListIdState = SFX_ITEM_UNKNOWN; + SfxItemState aListIdState = SFX_ITEM_UNKNOWN; SfxStringItem aListIdItem( RES_PARATR_LIST_ID, OUString() ); { const SfxItemSet * pAttrSet = pDestTxtNd->GetpSwAttrSet(); @@ -4293,9 +4293,9 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos, // Save numrule at destination // #i86492# - Safe also item of destination. - int aNumRuleState = SFX_ITEM_UNKNOWN; + SfxItemState aNumRuleState = SFX_ITEM_UNKNOWN; SwNumRuleItem aNumRuleItem; - int aListIdState = SFX_ITEM_UNKNOWN; + SfxItemState aListIdState = SFX_ITEM_UNKNOWN; SfxStringItem aListIdItem( RES_PARATR_LIST_ID, OUString() ); { const SfxItemSet* pAttrSet = pDestTxtNd->GetpSwAttrSet(); diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index 9973c2d5a340..3cde10f07f5e 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -366,7 +366,7 @@ void SwNumPositionTabPage::ActivatePage(const SfxItemSet& ) sal_uInt16 nTmpNumLvl = pOutlineDlg ? SwOutlineTabDialog::GetActNumLevel() : 0; const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet(); - if(pExampleSet && pExampleSet->GetItemState(FN_PARAM_NUM_PRESET, false, &pItem)) + if(pExampleSet && pExampleSet->GetItemState(FN_PARAM_NUM_PRESET, false, &pItem) != SFX_ITEM_UNKNOWN) { bPreset = ((const SfxBoolItem*)pItem)->GetValue(); } diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 7accf667fefa..e6d208ec8e79 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -1493,15 +1493,16 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, } break; case SFX_ITEM_DONTCARE: - // set NumRule to default values - // what are the default values? - { - SwNumRule aRule( pNumRule->GetName(), - // #i89178# - numfunc::GetDefaultPositionAndSpaceMode() ); - rDoc.ChgNumRuleFmts( aRule ); - } - break; + // set NumRule to default values + // what are the default values? + { + SwNumRule aRule( pNumRule->GetName(), + // #i89178# + numfunc::GetDefaultPositionAndSpaceMode() ); + rDoc.ChgNumRuleFmts( aRule ); + } + break; + default: break; } } break; diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 66b4f08dfd96..ad353428e23b 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1671,7 +1671,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) rSh.GetCurAttr(aSet); // If a hyperlink is selected, either alone or along with other text... - if( ((SFX_ITEM_DONTCARE & aSet.GetItemState( RES_TXTATR_INETFMT, true )) == 0) || rSh.HasReadonlySel()) + if(aSet.GetItemState( RES_TXTATR_INETFMT, true ) != SFX_ITEM_DONTCARE || rSh.HasReadonlySel()) { rSet.DisableItem(nWhich); } -- cgit