diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-14 10:46:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-14 15:14:27 +0200 |
commit | 546c35519125a769755330c961c7b8fc61e24d89 (patch) | |
tree | 0b73735081bd279b89b93dabc5c35dee6ec08b94 /svx/source | |
parent | 92b7acdf2a1159af8a31da22ce6227950f709040 (diff) |
use more SAL_N_ELEMENTS part 2
Change-Id: If00e371c3cd3ae616309a172c875faed016e391b
Reviewed-on: https://gerrit.libreoffice.org/38773
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeGeometry.cxx | 32 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx | 4 | ||||
-rw-r--r-- | svx/source/sidebar/nbdtmg.cxx | 55 | ||||
-rw-r--r-- | svx/source/unodraw/unoprov.cxx | 4 |
4 files changed, 24 insertions, 71 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index c2f8109af231..72cc92e3f479 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -4657,15 +4657,15 @@ static const SvxMSDffHandle mso_sptEllipseRibbonHandle[] = static const mso_CustomShape msosptEllipseRibbon = { - const_cast<SvxMSDffVertPair*>(mso_sptEllipseRibbonVert), sizeof( mso_sptEllipseRibbonVert ) / sizeof( SvxMSDffVertPair ), + const_cast<SvxMSDffVertPair*>(mso_sptEllipseRibbonVert), SAL_N_ELEMENTS( mso_sptEllipseRibbonVert ), const_cast<sal_uInt16*>(mso_sptEllipseRibbonSegm), sizeof( mso_sptEllipseRibbonSegm ) >> 1, - const_cast<SvxMSDffCalculationData*>(mso_sptEllipseRibbonCalc), sizeof( mso_sptEllipseRibbonCalc ) / sizeof( SvxMSDffCalculationData ), + const_cast<SvxMSDffCalculationData*>(mso_sptEllipseRibbonCalc), SAL_N_ELEMENTS( mso_sptEllipseRibbonCalc ), const_cast<sal_Int32*>(mso_sptEllipseRibbonDefault), - const_cast<SvxMSDffTextRectangles*>(mso_sptEllipseRibbonTextRect), sizeof( mso_sptEllipseRibbonTextRect ) / sizeof( SvxMSDffTextRectangles ), + const_cast<SvxMSDffTextRectangles*>(mso_sptEllipseRibbonTextRect), SAL_N_ELEMENTS( mso_sptEllipseRibbonTextRect ), 21600, 21600, MIN_INT32, MIN_INT32, nullptr, 0, - const_cast<SvxMSDffHandle*>(mso_sptEllipseRibbonHandle), sizeof( mso_sptEllipseRibbonHandle ) / sizeof( SvxMSDffHandle ) + const_cast<SvxMSDffHandle*>(mso_sptEllipseRibbonHandle), SAL_N_ELEMENTS( mso_sptEllipseRibbonHandle ) }; //msosptEllipseRibbon2 @@ -4797,15 +4797,15 @@ static const SvxMSDffHandle mso_sptEllipseRibbon2Handle[] = static const mso_CustomShape msosptEllipseRibbon2 = { - const_cast<SvxMSDffVertPair*>(mso_sptEllipseRibbon2Vert), sizeof( mso_sptEllipseRibbon2Vert ) / sizeof( SvxMSDffVertPair ), + const_cast<SvxMSDffVertPair*>(mso_sptEllipseRibbon2Vert), SAL_N_ELEMENTS( mso_sptEllipseRibbon2Vert ), const_cast<sal_uInt16*>(mso_sptEllipseRibbon2Segm), sizeof( mso_sptEllipseRibbon2Segm ) >> 1, - const_cast<SvxMSDffCalculationData*>(mso_sptEllipseRibbon2Calc), sizeof( mso_sptEllipseRibbon2Calc ) / sizeof( SvxMSDffCalculationData ), + const_cast<SvxMSDffCalculationData*>(mso_sptEllipseRibbon2Calc), SAL_N_ELEMENTS( mso_sptEllipseRibbon2Calc ), const_cast<sal_Int32*>(mso_sptEllipseRibbon2Default), - const_cast<SvxMSDffTextRectangles*>(mso_sptEllipseRibbon2TextRect), sizeof( mso_sptEllipseRibbon2TextRect ) / sizeof( SvxMSDffTextRectangles ), + const_cast<SvxMSDffTextRectangles*>(mso_sptEllipseRibbon2TextRect), SAL_N_ELEMENTS( mso_sptEllipseRibbon2TextRect ), 21600, 21600, MIN_INT32, MIN_INT32, nullptr, 0, - const_cast<SvxMSDffHandle*>(mso_sptEllipseRibbon2Handle), sizeof( mso_sptEllipseRibbon2Handle ) / sizeof( SvxMSDffHandle ) + const_cast<SvxMSDffHandle*>(mso_sptEllipseRibbon2Handle), SAL_N_ELEMENTS( mso_sptEllipseRibbon2Handle ) }; // End static const SvxMSDffVertPair mso_sptVerticalScrollVert[] = // adjustment1 : 0 - 5400 @@ -6488,15 +6488,15 @@ static const SvxMSDffHandle mso_sptTextRingInsideHandle[] = }; static const mso_CustomShape msoTextRingInside = { - const_cast<SvxMSDffVertPair*>(mso_sptTextRingInsideVert), sizeof( mso_sptTextRingInsideVert ) / sizeof( SvxMSDffVertPair ), + const_cast<SvxMSDffVertPair*>(mso_sptTextRingInsideVert), SAL_N_ELEMENTS( mso_sptTextRingInsideVert ), const_cast<sal_uInt16*>(mso_sptTextRingInsideSegm), sizeof( mso_sptTextRingInsideSegm ) >> 1, - const_cast<SvxMSDffCalculationData*>(mso_sptTextRingInsideCalc), sizeof( mso_sptTextRingInsideCalc ) / sizeof( SvxMSDffCalculationData ), + const_cast<SvxMSDffCalculationData*>(mso_sptTextRingInsideCalc), SAL_N_ELEMENTS( mso_sptTextRingInsideCalc ), const_cast<sal_Int32*>(mso_sptDefault13500), - const_cast<SvxMSDffTextRectangles*>(mso_sptFontWorkTextRect), sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ), + const_cast<SvxMSDffTextRectangles*>(mso_sptFontWorkTextRect), SAL_N_ELEMENTS( mso_sptFontWorkTextRect ), 21600, 21600, MIN_INT32, MIN_INT32, nullptr, 0, - const_cast<SvxMSDffHandle*>(mso_sptTextRingInsideHandle), sizeof( mso_sptTextRingInsideHandle ) / sizeof( SvxMSDffHandle ) + const_cast<SvxMSDffHandle*>(mso_sptTextRingInsideHandle), SAL_N_ELEMENTS( mso_sptTextRingInsideHandle ) }; //mso_sptTextRingOutside //path = U 10800 ?f0 21600 ?f2 180 539 N U 10800 ?f1 21600 ?f2 180 539 N @@ -8334,15 +8334,15 @@ static const sal_Int32 mso_sptTearDropDefault[] = static const mso_CustomShape msoTearDrop = { - const_cast<SvxMSDffVertPair*>(mso_sptTearDropVert), sizeof( mso_sptTearDropVert ) / sizeof( SvxMSDffVertPair ), + const_cast<SvxMSDffVertPair*>(mso_sptTearDropVert), SAL_N_ELEMENTS( mso_sptTearDropVert ), const_cast<sal_uInt16*>(mso_sptTearDropSegm), sizeof( mso_sptTearDropSegm ) >> 1, - const_cast<SvxMSDffCalculationData*>(mso_sptTearDropCalc), sizeof(mso_sptTearDropCalc)/sizeof(SvxMSDffCalculationData), + const_cast<SvxMSDffCalculationData*>(mso_sptTearDropCalc), SAL_N_ELEMENTS(mso_sptTearDropCalc), const_cast<sal_Int32*>(mso_sptTearDropDefault), - const_cast<SvxMSDffTextRectangles*>(mso_sptTearDropTextRect), sizeof( mso_sptTearDropTextRect ) / sizeof( SvxMSDffTextRectangles ), + const_cast<SvxMSDffTextRectangles*>(mso_sptTearDropTextRect), SAL_N_ELEMENTS( mso_sptTearDropTextRect ), 21600, 21600, MIN_INT32, MIN_INT32, nullptr, 0, - const_cast<SvxMSDffHandle*>(mso_sptTearDropHandle), sizeof(mso_sptTearDropHandle)/sizeof(SvxMSDffHandle) // handles + const_cast<SvxMSDffHandle*>(mso_sptTearDropHandle), SAL_N_ELEMENTS(mso_sptTearDropHandle) // handles }; diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx index 4ff01ba4ca22..4e48445c0c89 100644 --- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx @@ -281,7 +281,7 @@ MSO_SPT EnhancedCustomShapeTypeNames::Get( const OUString& rShapeType ) { TypeNameHashMap* pH = new TypeNameHashMap; const NameTypeTable* pPtr = pNameTypeTableArray; - const NameTypeTable* pEnd = pPtr + ( sizeof( pNameTypeTableArray ) / sizeof( NameTypeTable ) ); + const NameTypeTable* pEnd = pPtr + SAL_N_ELEMENTS( pNameTypeTableArray ); for ( ; pPtr < pEnd; pPtr++ ) (*pH)[ pPtr->pS ] = pPtr->pE; pHashMap = pH; @@ -536,7 +536,7 @@ OUString EnhancedCustomShapeTypeNames::GetAccName( const OUString& rShapeType ) { TypeACCNameHashMap* pH = new TypeACCNameHashMap; const ACCNameTypeTable* pPtr = pACCNameTypeTableArray; - const ACCNameTypeTable* pEnd = pPtr + ( sizeof( pACCNameTypeTableArray ) / sizeof( ACCNameTypeTable ) ); + const ACCNameTypeTable* pEnd = pPtr + SAL_N_ELEMENTS( pACCNameTypeTableArray ); for ( ; pPtr < pEnd; pPtr++ ) (*pH)[ pPtr->pS ] = pPtr->pE; pACCHashMap = pH; diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index 7dac15f83f22..a23d69a54305 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -285,33 +285,6 @@ sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLe SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); sal_Unicode cChar = aFmt.GetBulletChar(); - //const vcl::Font* pFont = aFmt.GetBulletFont(); - //sal_uInt16 nLength = 0; - /*if( AllSettings::GetLayoutRTL() ) - { - nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); - for(sal_uInt16 i = 0; i < nLength; i++) - { - if ( cChar == aDynamicRTLBulletTypes[i] || - (cChar == 9830 && 57356 == aDynamicRTLBulletTypes[i]) || - (cChar == 9632 && 57354 == aDynamicRTLBulletTypes[i]) ) - { - return i+1; - } - } - } else - { - nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); - for(sal_uInt16 i = 0; i < nLength; i++) - { - if ( cChar == aDynamicBulletTypes[i] || - (cChar == 9830 && 57356 == aDynamicBulletTypes[i]) || - (cChar == 9632 && 57354 == aDynamicBulletTypes[i]) ) - { - return i+1; - } - } - }*/ for(sal_uInt16 i = nFromIndex; i < DEFAULT_BULLET_TYPES; i++) { if ( (cChar == pActualBullets[i]->cBulletChar|| @@ -341,24 +314,6 @@ void BulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uI SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); sal_Unicode cChar = aFmt.GetBulletChar(); const vcl::Font* pFont = aFmt.GetBulletFont(); - //sal_uInt16 nLength = 0; - /*if( AllSettings::GetLayoutRTL() ) - { - nLength = sizeof(aDynamicRTLBulletTypes)/sizeof(sal_Unicode); - - if ( nIndex >= nLength ) - return sal_False; - - aDynamicRTLBulletTypes[nIndex] = cChar; - } else - { - nLength = sizeof(aDynamicBulletTypes)/sizeof(sal_Unicode); - - if ( nIndex >= nLength ) - return sal_False; - - aDynamicBulletTypes[nIndex] = cChar; - }*/ if ( nIndex >= DEFAULT_BULLET_TYPES ) return; @@ -675,7 +630,7 @@ void OutlineTypeMgr::Init() sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /*mLevel*/,sal_uInt16 nFromIndex) { - sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + sal_uInt16 nLength = SAL_N_ELEMENTS(pOutlineSettingsArrs); for(sal_uInt16 iDex = nFromIndex; iDex < nLength; iDex++) { bool bNotMatch = false; @@ -749,7 +704,7 @@ sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /*m void OutlineTypeMgr::RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) { - sal_uInt16 nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + sal_uInt16 nLength = SAL_N_ELEMENTS(pOutlineSettingsArrs); if ( nIndex >= nLength ) return; @@ -925,8 +880,7 @@ void OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1 OUString OutlineTypeMgr::GetDescription(sal_uInt16 nIndex, bool isDefault) { OUString sRet; - sal_uInt16 nLength = 0; - nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + sal_uInt16 nLength = SAL_N_ELEMENTS(pOutlineSettingsArrs); if ( nIndex >= nLength ) return sRet; @@ -946,8 +900,7 @@ bool OutlineTypeMgr::IsCustomized(sal_uInt16 nIndex) { bool bRet = false; - sal_uInt16 nLength = 0; - nLength = sizeof(pOutlineSettingsArrs)/sizeof(OutlineSettings_Impl*); + sal_uInt16 nLength = SAL_N_ELEMENTS(pOutlineSettingsArrs); if ( nIndex >= nLength ) return bRet; diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index c3cb7b9a23f3..0329d9018254 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -1276,7 +1276,7 @@ OUString SvxUnogetApiNameForItem(const sal_Int16 nWhich, const OUString& rIntern if( nWhich == XATTR_LINECOLOR ) { - if( SvxUnoConvertResourceString( SvxUnoColorNameResId, SvxUnoColorNameDefResId, sizeof( SvxUnoColorNameResId ) / sizeof( sal_uInt16 ), aNew ) ) + if( SvxUnoConvertResourceString( SvxUnoColorNameResId, SvxUnoColorNameDefResId, SAL_N_ELEMENTS( SvxUnoColorNameResId ), aNew ) ) { return aNew; } @@ -1309,7 +1309,7 @@ OUString SvxUnogetInternalNameForItem(const sal_Int16 nWhich, const OUString& rA if( nWhich == XATTR_LINECOLOR ) { - if( SvxUnoConvertResourceString( SvxUnoColorNameDefResId, SvxUnoColorNameResId, sizeof( SvxUnoColorNameResId ) / sizeof( sal_uInt16 ), aNew ) ) + if( SvxUnoConvertResourceString( SvxUnoColorNameDefResId, SvxUnoColorNameResId, SAL_N_ELEMENTS( SvxUnoColorNameResId ), aNew ) ) { return aNew; } |