diff options
author | Kenneth Venken <kenneth.venken@gmail.com> | 2010-12-03 13:59:47 +0000 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2010-12-03 13:59:47 +0000 |
commit | 39fc2df3c1d8e8bc8b689e2d21c193bc4886bf8c (patch) | |
tree | c663b430fd156eab527bbc3efa3def2b85b8ede2 /cui/source/tabpages | |
parent | 0bdef7cec695042a2259c327fc4ea84c74babd0f (diff) |
more Sal n elements
Diffstat (limited to 'cui/source/tabpages')
-rw-r--r-- | cui/source/tabpages/border.cxx | 5 | ||||
-rw-r--r-- | cui/source/tabpages/page.cxx | 9 | ||||
-rw-r--r-- | cui/source/tabpages/swpossizetabpage.cxx | 106 |
3 files changed, 58 insertions, 62 deletions
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index d4abee233e50..7ac6acad9278 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -56,6 +56,7 @@ #include <sfx2/request.hxx> #include <svl/intitem.hxx> #include <sfx2/itemconnect.hxx> +#include <sal/macros.h> #include "borderconn.hxx" // ----------------------------------------------------------------------- @@ -691,7 +692,7 @@ BOOL SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) TBorderPair(svx::FRAMEBORDER_RIGHT,BOX_LINE_RIGHT), }; - for (sal_uInt32 i=0; i < sizeof(eTypes1)/sizeof(TBorderPair); ++i) + for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(eTypes1); ++i) aBoxItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes1[i].first ), eTypes1[i].second ); //-------------------------------- @@ -701,7 +702,7 @@ BOOL SvxBorderTabPage::FillItemSet( SfxItemSet& rCoreAttrs ) TBorderPair(svx::FRAMEBORDER_HOR,BOXINFO_LINE_HORI), TBorderPair(svx::FRAMEBORDER_VER,BOXINFO_LINE_VERT) }; - for (sal_uInt32 j=0; j < sizeof(eTypes2)/sizeof(TBorderPair); ++j) + for (sal_uInt32 j=0; j < SAL_N_ELEMENTS(eTypes2); ++j) aBoxInfoItem.SetLine( aFrameSel.GetFrameBorderStyle( eTypes2[j].first ), eTypes2[j].second ); aBoxInfoItem.EnableHor( mbHorEnabled ); diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 5ac69582c99e..7eebcd56dd9f 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -40,6 +40,7 @@ #include <vcl/msgbox.hxx> #include <unotools/configitem.hxx> #include "svx/htmlmode.hxx" +#include <sal/macros.h> #define _SVX_PAGE_CXX @@ -155,9 +156,7 @@ USHORT aArr[] = USHORT PageUsageToPos_Impl( USHORT nUsage ) { - const USHORT nCount = sizeof(aArr) / sizeof(USHORT); - - for ( USHORT i = 0; i < nCount; ++i ) + for ( USHORT i = 0; i < SAL_N_ELEMENTS(aArr); ++i ) if ( aArr[i] == ( nUsage & 0x000f ) ) return i; return SVX_PAGE_ALL; @@ -167,9 +166,7 @@ USHORT PageUsageToPos_Impl( USHORT nUsage ) USHORT PosToPageUsage_Impl( USHORT nPos ) { - const USHORT nCount = sizeof(aArr) / sizeof(USHORT); - - if ( nPos >= nCount ) + if ( nPos >= SAL_N_ELEMENTS(aArr) ) return 0; return aArr[nPos]; } diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index 5cb7ccce540e..df4e13900a23 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -43,6 +43,7 @@ #include <svx/svdview.hxx> #include <svx/svdpagv.hxx> #include <svx/rectenum.hxx> +#include <sal/macros.h> #include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/VertOrientation.hpp> @@ -368,55 +369,53 @@ static FrmMap __FAR_DATA aVAsCharHtmlMap[] = std::size_t lcl_GetFrmMapCount(const FrmMap* pMap) { - if ( pMap ) + if( pMap ) { - std::size_t aSizeOf = sizeof(FrmMap); - if( pMap == aVParaHtmlMap) - return sizeof(aVParaHtmlMap) / aSizeOf; - if( pMap == aVAsCharHtmlMap) - return sizeof(aVAsCharHtmlMap) / aSizeOf; - if( pMap == aHParaHtmlMap) - return sizeof(aHParaHtmlMap) / aSizeOf; - if( pMap == aHParaHtmlAbsMap) - return sizeof(aHParaHtmlAbsMap) / aSizeOf; - if ( pMap == aVPageMap ) - return sizeof(aVPageMap) / aSizeOf; - if ( pMap == aVPageHtmlMap ) - return sizeof(aVPageHtmlMap) / aSizeOf; - if ( pMap == aVAsCharMap ) - return sizeof(aVAsCharMap) / aSizeOf; - if ( pMap == aVParaMap ) - return sizeof(aVParaMap) / aSizeOf; - if ( pMap == aHParaMap ) - return sizeof(aHParaMap) / aSizeOf; - if ( pMap == aHFrameMap ) - return sizeof(aHFrameMap) / aSizeOf; - // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects - if ( pMap == aVFrameMap ) - return sizeof(aVFrameMap) / aSizeOf; - if ( pMap == aHCharMap ) - return sizeof(aHCharMap) / aSizeOf; - if ( pMap == aHCharHtmlMap ) - return sizeof(aHCharHtmlMap) / aSizeOf; - if ( pMap == aHCharHtmlAbsMap ) - return sizeof(aHCharHtmlAbsMap) / aSizeOf; - if ( pMap == aVCharMap ) - return sizeof(aVCharMap) / aSizeOf; - if ( pMap == aVCharHtmlMap ) - return sizeof(aVCharHtmlMap) / aSizeOf; - if ( pMap == aVCharHtmlAbsMap ) - return sizeof(aVCharHtmlAbsMap) / aSizeOf; - if ( pMap == aHPageHtmlMap ) - return sizeof(aHPageHtmlMap) / aSizeOf; - if ( pMap == aHFlyHtmlMap ) - return sizeof(aHFlyHtmlMap) / aSizeOf; - if ( pMap == aVFlyHtmlMap ) - return sizeof(aVFlyHtmlMap) / aSizeOf; - if( pMap == aVMultiSelectionMap) - return sizeof(aVMultiSelectionMap) / aSizeOf; - if( pMap == aHMultiSelectionMap) - return sizeof(aHMultiSelectionMap) / aSizeOf; - return sizeof(aHPageMap) / aSizeOf; + if( pMap == aVParaHtmlMap ) + return SAL_N_ELEMENTS(aVParaHtmlMap); + if( pMap == aVAsCharHtmlMap ) + return SAL_N_ELEMENTS( aVAsCharHtmlMap ); + if( pMap == aHParaHtmlMap ) + return SAL_N_ELEMENTS( aHParaHtmlMap ); + if( pMap == aHParaHtmlAbsMap ) + return SAL_N_ELEMENTS( aHParaHtmlAbsMap ); + if( pMap == aVPageMap ) + return SAL_N_ELEMENTS( aVPageMap ); + if( pMap == aVPageHtmlMap ) + return SAL_N_ELEMENTS( aVPageHtmlMap ); + if( pMap == aVAsCharMap ) + return SAL_N_ELEMENTS( aVAsCharMap ); + if( pMap == aVParaMap ) + return SAL_N_ELEMENTS( aVParaMap ); + if( pMap == aHParaMap ) + return SAL_N_ELEMENTS( aHParaMap ); + if( pMap == aHFrameMap ) + return SAL_N_ELEMENTS( aHFrameMap ); + if( pMap == aVFrameMap ) + return SAL_N_ELEMENTS( aVFrameMap ); + if( pMap == aHCharMap ) + return SAL_N_ELEMENTS( aHCharMap ); + if( pMap == aHCharHtmlMap ) + return SAL_N_ELEMENTS( aHCharHtmlMap ); + if( pMap == aHCharHtmlAbsMap ) + return SAL_N_ELEMENTS( aHCharHtmlAbsMap ); + if( pMap == aVCharMap ) + return SAL_N_ELEMENTS( aVCharMap ); + if( pMap == aVCharHtmlMap ) + return SAL_N_ELEMENTS( aVCharHtmlMap ); + if( pMap == aVCharHtmlAbsMap ) + return SAL_N_ELEMENTS( aVCharHtmlAbsMap ); + if( pMap == aHPageHtmlMap ) + return SAL_N_ELEMENTS( aHPageHtmlMap ); + if( pMap == aHFlyHtmlMap ) + return SAL_N_ELEMENTS( aHFlyHtmlMap ); + if( pMap == aVFlyHtmlMap ) + return SAL_N_ELEMENTS( aVFlyHtmlMap ); + if( pMap == aVMultiSelectionMap ) + return SAL_N_ELEMENTS( aVMultiSelectionMap ); + if( pMap == aHMultiSelectionMap ) + return SAL_N_ELEMENTS( aHMultiSelectionMap ); + return SAL_N_ELEMENTS(aHPageMap); } return 0; } @@ -458,7 +457,7 @@ SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL( {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT } }; USHORT nIndex; - for(nIndex = 0; nIndex < sizeof(aHoriIds) / sizeof(StringIdPair_Impl); ++nIndex) + for(nIndex = 0; nIndex < SAL_N_ELEMENTS(aHoriIds); ++nIndex) { if(aHoriIds[nIndex].eHori == eStringId) { @@ -467,7 +466,7 @@ SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL( } } nIndex = 0; - for(nIndex = 0; nIndex < sizeof(aVertIds) / sizeof(StringIdPair_Impl); ++nIndex) + for(nIndex = 0; nIndex < SAL_N_ELEMENTS(aVertIds); ++nIndex) { if(aVertIds[nIndex].eHori == eStringId) { @@ -484,8 +483,7 @@ ULONG lcl_GetLBRelationsForRelations( const USHORT _nRel ) { ULONG nLBRelations = 0L; - sal_uInt16 nRelMapSize = sizeof(aRelationMap) / sizeof(RelationMap); - for ( sal_uInt16 nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos ) + for ( sal_uInt16 nRelMapPos = 0; nRelMapPos < SAL_N_ELEMENTS(aRelationMap); ++nRelMapPos ) { if ( aRelationMap[nRelMapPos].nRelation == _nRel ) { @@ -1628,7 +1626,7 @@ ULONG SvxSwPosSizeTabPage::FillRelLB(FrmMap *pMap, USHORT nMapPos, USHORT nAlign if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap) { String sOldEntry(rLB.GetSelectEntry()); - USHORT nRelCount = sizeof(aAsCharRelationMap) / sizeof(RelationMap); + USHORT nRelCount = SAL_N_ELEMENTS(aAsCharRelationMap); SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId; for (std::size_t _nMapPos = 0; _nMapPos < nMapCount; _nMapPos++) @@ -1675,7 +1673,7 @@ ULONG SvxSwPosSizeTabPage::FillRelLB(FrmMap *pMap, USHORT nMapPos, USHORT nAlign } else { - USHORT nRelCount = sizeof(aRelationMap) / sizeof(RelationMap); + USHORT nRelCount = SAL_N_ELEMENTS(aRelationMap); // OD 14.11.2003 #i22341# - special handling for map <aVCharMap>, // because its ambigous in its <eStrId>/<eMirrorStrId>. |