diff options
author | Kayo Hamid <revol.code@yahoo.com> | 2010-10-14 21:14:52 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2010-10-14 21:15:24 +0100 |
commit | b7c82daa28526c566047e158ab2ace522fc442dc (patch) | |
tree | c71f33ee622add8de9013a170a7463ed564ad6e8 /svx/source | |
parent | 1b0c6da1c3bcc6a9c1412d221d029885f9998fa1 (diff) |
Switch to use SAL_N_ELEMENTS macro, everywhere
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/dialog/docrecovery.cxx | 4 | ||||
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 2 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridif.cxx | 8 | ||||
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 8 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/ParseContext.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/datanavi.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/fmPropBrw.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/fmdmod.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmpage.cxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 14 | ||||
-rw-r--r-- | svx/source/form/fmundo.cxx | 4 | ||||
-rw-r--r-- | svx/source/form/formcontrolling.cxx | 4 | ||||
-rw-r--r-- | svx/source/unodraw/unoprov.cxx | 2 | ||||
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 2 |
15 files changed, 33 insertions, 33 deletions
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 487e58b4c5a9..b501d5e95c6f 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -1863,7 +1863,7 @@ void BrokenRecoveryDialog::impl_askForSavePath() } // loop through all the other windows and adjust their size - for ( ; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) + for ( ; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent ) { Size aSize = (*pCurrent)->GetSizePixel(); aSize.Width() -= nDelta; @@ -1934,7 +1934,7 @@ void BrokenRecoveryDialog::impl_askForSavePath() &maProxyServerEd, &maProxyPortFT, &maProxyPortEd, &maDescriptionFT }; Window** pCurrent = pWins; - for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) + for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent ) { Point aPos = (*pCurrent)->GetPosPixel(); aPos.Y() -= nDelta; diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 1cd87c635008..d49a792786c0 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -895,7 +895,7 @@ void SvxSearchDialog::CalculateDelta_Impl() if ( nOffset > 0 ) { long nH = LogicToPixel( Size( 0, nOffset ), MAP_APPFONT ).Height(); - for ( i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) + for ( i = 0; i < SAL_N_ELEMENTS( pWins ); ++i, ++pCurrent ) { if ( ( bCalcApp && i < nCalcCtrlCount ) || ( i == nCalcCtrlCount && aCJKOptions.IsCJKFontEnabled() ) diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 37ae1ba1322d..76d1b23ae1cf 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1696,7 +1696,7 @@ void FmXGridPeer::addColumnListeners(const Reference< XPropertySet >& xCol) Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo(); Property aPropDesc; const ::rtl::OUString* pProps = aPropsListenedTo; - const ::rtl::OUString* pPropsEnd = pProps + sizeof( aPropsListenedTo ) / sizeof( aPropsListenedTo[ 0 ] ); + const ::rtl::OUString* pPropsEnd = pProps + SAL_N_ELEMENTS( aPropsListenedTo ); for (; pProps != pPropsEnd; ++pProps) { if ( xInfo->hasPropertyByName( *pProps ) ) @@ -1719,7 +1719,7 @@ void FmXGridPeer::removeColumnListeners(const Reference< XPropertySet >& xCol) }; Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo(); - for (sal_uInt16 i=0; i<sizeof(aPropsListenedTo)/sizeof(aPropsListenedTo[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(aPropsListenedTo); ++i) if (xInfo->hasPropertyByName(aPropsListenedTo[i])) xCol->removePropertyChangeListener(aPropsListenedTo[i], this); } @@ -2765,7 +2765,7 @@ Sequence<sal_uInt16>& FmXGridPeer::getSupportedGridSlots() DbGridControl::NavigationBar::RECORD_NEW, SID_FM_RECORD_UNDO }; - aSupported.realloc(sizeof(nSupported)/sizeof(nSupported[0])); + aSupported.realloc(SAL_N_ELEMENTS(nSupported)); sal_uInt16* pSupported = aSupported.getArray(); for (sal_uInt16 i=0; i<aSupported.getLength(); ++i, ++pSupported) *pSupported = nSupported[i]; @@ -2787,7 +2787,7 @@ Sequence< ::com::sun::star::util::URL>& FmXGridPeer::getSupportedURLs() FMURL_RECORD_MOVETONEW, FMURL_RECORD_UNDO }; - aSupported.realloc(sizeof(sSupported)/sizeof(sSupported[0])); + aSupported.realloc(SAL_N_ELEMENTS(sSupported)); ::com::sun::star::util::URL* pSupported = aSupported.getArray(); sal_uInt16 i; diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 30235a49f33b..91c48d63a438 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -736,7 +736,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni if ( ( _eInitWhat & InitWritingMode ) != 0 ) { - for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( pWindows ); ++i ) { if ( pWindows[i] ) pWindows[i]->EnableRTL( rParent.IsRTLEnabled() ); @@ -745,7 +745,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni if ( ( _eInitWhat & InitFont ) != 0 ) { - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) { if ( !pWindows[i] ) continue; @@ -777,7 +777,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni sal_Bool bTextLineColor = rParent.IsTextLineColor(); Color aTextLineColor( rParent.GetTextLineColor() ); - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) { if ( pWindows[i] ) { @@ -798,7 +798,7 @@ void DbCellControl::ImplInitWindow( Window& rParent, const InitWindowFacet _eIni if (rParent.IsControlBackground()) { Color aColor( rParent.GetControlBackground()); - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) { if ( pWindows[i] ) { diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 2cc46797f91b..fee65148e79a 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -778,7 +778,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) case STATE_CHANGE_MIRRORING: { BOOL bIsRTLEnabled = IsRTLEnabled(); - for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( pWindows ); ++i ) pWindows[i]->EnableRTL( bIsRTLEnabled ); } break; @@ -792,7 +792,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType ) if ( IsControlFont() ) aFont.Merge( GetControlFont() ); - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) { pWindows[i]->SetZoom(aZoom); pWindows[i]->SetZoomedPointFont(aFont); diff --git a/svx/source/form/ParseContext.cxx b/svx/source/form/ParseContext.cxx index 8ae03e65cbbd..e1fc934aa4c8 100644 --- a/svx/source/form/ParseContext.cxx +++ b/svx/source/form/ParseContext.cxx @@ -171,7 +171,7 @@ IParseContext::InternationalKeyCode OSystemParseContext::getIntlKeyCode(const :: KEY_COLLECT, KEY_FUSION, KEY_INTERSECTION }; - sal_uInt32 nCount = sizeof Intl_TokenID / sizeof Intl_TokenID[0]; + sal_uInt32 nCount = SAL_N_ELEMENTS( Intl_TokenID ); for (sal_uInt32 i = 0; i < nCount; i++) { ::rtl::OString aKey = getIntlKeywordAscii(Intl_TokenID[i]); diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 25f3102a115e..636ae515c49b 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -2925,7 +2925,7 @@ namespace svxform &m_aCalculateBtn }; Window** pCurrent = pWinsForHide; - for ( ; i < sizeof( pWinsForHide ) / sizeof( pWinsForHide[ 0 ] ); ++i, ++pCurrent ) + for ( ; i < SAL_N_ELEMENTS( pWinsForHide ); ++i, ++pCurrent ) (*pCurrent)->Hide(); Window* pWinsForMove[] = @@ -2933,7 +2933,7 @@ namespace svxform &m_aButtonsFL, &m_aOKBtn, &m_aEscBtn, &m_aHelpBtn }; pCurrent = pWinsForMove; - for ( i = 0; i < sizeof( pWinsForMove ) / sizeof( pWinsForMove[ 0 ] ); ++i, ++pCurrent ) + for ( i = 0; i < SAL_N_ELEMENTS( pWinsForMove ); ++i, ++pCurrent ) { Point aNewPos = (*pCurrent)->GetPosPixel(); aNewPos.Y() -= nDelta; diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index e6fd5a47a9e0..b5ae7f609e49 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -307,7 +307,7 @@ FmPropBrw::~FmPropBrw() , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ) , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlContext" ) ) , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlShapeAccess" ) ) }; - for ( size_t i = 0; i < sizeof(pProps)/sizeof(pProps[0]); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS(pProps); ++i ) xName->removeByName( pProps[i] ); } } @@ -594,7 +594,7 @@ void FmPropBrw::impl_createPropertyBrowser_throw( FmFormShell* _pFormShell ) ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlShapeAccess" ) ), makeAny( xControlMap ) ) }; m_xInspectorContext.set( - ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), + ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), xOwnContext ) ); bool bEnableHelpSection = lcl_shouldEnableHelpSection( m_xORB ); diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx index d92754c86b99..b875acf5bf9f 100644 --- a/svx/source/form/fmdmod.cxx +++ b/svx/source/form/fmdmod.cxx @@ -87,7 +87,7 @@ using namespace ::svxform; FM_SUN_COMPONENT_IMAGECONTROL }; - static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] ); + static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList); ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq( nSvxComponentServiceNameListCount ); ::rtl::OUString* pStrings = aSeq.getArray(); diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx index 42fe624bf80e..386ebbec87df 100644 --- a/svx/source/form/fmpage.cxx +++ b/svx/source/form/fmpage.cxx @@ -230,7 +230,7 @@ sal_Bool FmFormPage::RequestHelp( Window* pWindow, SdrView* pView, INET_PROT_HTTPS, INET_PROT_JAVASCRIPT, INET_PROT_IMAP, INET_PROT_POP3, INET_PROT_VIM, INET_PROT_LDAP }; - for (sal_uInt16 i=0; i<sizeof(s_aQuickHelpSupported)/sizeof(s_aQuickHelpSupported[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(s_aQuickHelpSupported); ++i) if (s_aQuickHelpSupported[i] == aProtocol) { aHelpText = INetURLObject::decode(aUrl.GetURLNoPass(), '%', INetURLObject::DECODE_UNAMBIGUOUS); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 09110e2d9b0f..7e084cac3043 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1139,7 +1139,7 @@ PopupMenu* FmXFormShell::GetConversionMenu() PopupMenu* pNewMenu = new PopupMenu(SVX_RES( RID_FMSHELL_CONVERSIONMENU )); ImageList aImageList( SVX_RES( bIsHiContrastMode ? RID_SVXIMGLIST_FMEXPL_HC : RID_SVXIMGLIST_FMEXPL) ); - for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( nConvertSlots ); ++i ) { // das entsprechende Image dran pNewMenu->SetItemImage(nConvertSlots[i], aImageList.GetImage(nCreateSlots[i])); @@ -1152,7 +1152,7 @@ PopupMenu* FmXFormShell::GetConversionMenu() bool FmXFormShell::isControlConversionSlot( sal_uInt16 nSlotId ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::isControlConversionSlot" ); - for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( nConvertSlots ); ++i ) if (nConvertSlots[i] == nSlotId) return true; return false; @@ -1190,7 +1190,7 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent OSL_ENSURE( isSolelySelected( _rxObject ), "FmXFormShell::executeControlConversionSlot: hmm ... shouldn't this parameter be redundant?" ); - for ( size_t lookupSlot = 0; lookupSlot < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++lookupSlot ) + for ( size_t lookupSlot = 0; lookupSlot < SAL_N_ELEMENTS( nConvertSlots ); ++lookupSlot ) { if (nConvertSlots[lookupSlot] == _nSlotId) { @@ -1406,10 +1406,10 @@ bool FmXFormShell::canConvertCurrentSelectionToControl( sal_Int16 nConversionSlo ) return false; // those types cannot be converted - DBG_ASSERT(sizeof(nConvertSlots)/sizeof(nConvertSlots[0]) == sizeof(nObjectTypes)/sizeof(nObjectTypes[0]), + DBG_ASSERT(SAL_N_ELEMENTS(nConvertSlots) == SAL_N_ELEMENTS(nObjectTypes), "FmXFormShell::canConvertCurrentSelectionToControl: nConvertSlots & nObjectTypes must have the same size !"); - for ( size_t i = 0; i < sizeof( nConvertSlots ) / sizeof( nConvertSlots[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( nConvertSlots ); ++i ) if (nConvertSlots[i] == nConversionSlot) return nObjectTypes[i] != nObjectType; @@ -2168,7 +2168,7 @@ bool FmXFormShell::setCurrentSelection( const InterfaceBag& _rSelection ) impl_updateCurrentForm( xNewCurrentForm ); // ensure some slots are updated - for ( size_t i = 0; i < sizeof( SelObjectSlotMap ) / sizeof( SelObjectSlotMap[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( SelObjectSlotMap ); ++i ) InvalidateSlot( SelObjectSlotMap[i], sal_False); return true; @@ -2211,7 +2211,7 @@ void FmXFormShell::impl_updateCurrentForm( const Reference< XForm >& _rxNewCurFo pPage->GetImpl().setCurForm( m_xCurrentForm ); // ensure the UI which depends on the current form is up-to-date - for ( size_t i = 0; i < sizeof( DlgSlotMap ) / sizeof( DlgSlotMap[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( DlgSlotMap ); ++i ) InvalidateSlot( DlgSlotMap[i], sal_False ); } diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 318524005e16..6135b9ab4b30 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -596,8 +596,8 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt) FM_PROP_TEXT, FM_PROP_STATE, FM_PROP_DATE, FM_PROP_TIME, FM_PROP_VALUE, FM_PROP_SELECT_SEQ, FM_PROP_EFFECTIVE_VALUE }; - sal_Int32 nDefaultValueProps = sizeof(pDefaultValueProperties)/sizeof(pDefaultValueProperties[0]); - OSL_ENSURE(sizeof(aValueProperties)/sizeof(aValueProperties[0]) == nDefaultValueProps, + sal_Int32 nDefaultValueProps = SAL_N_ELEMENTS(pDefaultValueProperties); + OSL_ENSURE(SAL_N_ELEMENTS(aValueProperties) == nDefaultValueProps, "FmXUndoEnvironment::propertyChange: inconsistence!"); for (sal_Int32 i=0; i<nDefaultValueProps; ++i) { diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx index af078e933847..afa9b8090b68 100644 --- a/svx/source/form/formcontrolling.cxx +++ b/svx/source/form/formcontrolling.cxx @@ -121,7 +121,7 @@ namespace svx { FMURL_FORM_APPLY_FILTER, SID_FM_FORM_FILTERED, FormFeature::ToggleApplyFilter }, { FMURL_FORM_REMOVE_FILTER, SID_FM_REMOVE_FILTER_SORT, FormFeature::RemoveFilterAndSort } }; - for ( size_t i=0; i<sizeof(aDescriptions)/sizeof(aDescriptions[0]); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS(aDescriptions); ++i ) s_aFeatureDescriptions.push_back( aDescriptions[i] ); } }; @@ -534,7 +534,7 @@ namespace svx SID_FM_FILTER_START, SID_FM_VIEW_AS_GRID }; - sal_Int32 nFeatureCount = sizeof( pSupportedFeatures ) / sizeof( pSupportedFeatures[ 0 ] ); + sal_Int32 nFeatureCount = SAL_N_ELEMENTS( pSupportedFeatures ); aSupportedFeatures.resize( nFeatureCount ); ::std::copy( pSupportedFeatures, pSupportedFeatures + nFeatureCount, aSupportedFeatures.begin() ); diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 71d8d865db5f..8b7461e7660d 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -879,7 +879,7 @@ namespace { { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DExtrudeObject"), E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG }, { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DPolygonObject"), E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG }, }; - for (sal_uInt32 i = 0; i < sizeof(aInit)/sizeof(aInit[0]); i++) + for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(aInit); i++) aImpl[rtl::OUString( aInit[i].name, aInit[i].length, RTL_TEXTENCODING_ASCII_US ) ] = aInit[i].id; bInited = true; } diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index f4300bdd09d6..2859eaedcf18 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -551,7 +551,7 @@ String SvXMLGraphicHelper::ImplGetGraphicMimeType( const String& rFileName ) con { const ByteString aExt( rFileName.Copy( rFileName.Len() - 3 ), RTL_TEXTENCODING_ASCII_US ); - for( long i = 0, nCount = sizeof( aMapper ) / sizeof( aMapper[ 0 ] ); ( i < nCount ) && !aMimeType.Len(); i++ ) + for( long i = 0, nCount = SAL_N_ELEMENTS( aMapper ); ( i < nCount ) && !aMimeType.Len(); i++ ) if( aExt == aMapper[ i ].pExt ) aMimeType = String( aMapper[ i ].pMimeType, RTL_TEXTENCODING_ASCII_US ); } |