summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-07-23 10:48:58 +0200
committerNoel Grandin <noel@peralex.com>2014-07-23 13:26:19 +0200
commit88a874fcb3a3735634c638f34dcb0cc7bd2260ac (patch)
tree9d4d00f5c29ed08db69b0ff7aa334045cb879b82 /editeng
parent11e66edd0e60d55fe5b6d285b919c012ae7500ce (diff)
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
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/uno/unoedprx.cxx4
-rw-r--r--editeng/source/uno/unofored.cxx6
-rw-r--r--editeng/source/uno/unofored_internal.hxx2
-rw-r--r--editeng/source/uno/unoforou.cxx4
-rw-r--r--editeng/source/uno/unotext.cxx19
5 files changed, 19 insertions, 16 deletions
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::vector<sal_Int
mpTextForwarder->GetPortions( 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<EECharAttrib> 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<sal_Int32>& ) 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