diff options
author | Kayo Hamid <revol.code@yahoo.com> | 2010-10-09 22:17:25 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2010-10-09 22:17:25 -0500 |
commit | a06e8658b3b19d399bcc08a75cc14fad0f1ba4e4 (patch) | |
tree | 04d2239eb0ef45513255e8afa724e86bd72e6205 | |
parent | 8ba767a1257693e7c6a3dbfbc4a5f07dd8ecf1f1 (diff) |
Use SAL_N_ELEMENTS macro
56 files changed, 161 insertions, 138 deletions
diff --git a/dbaccess/inc/dataview.hxx b/dbaccess/inc/dataview.hxx index fa3e366d0..c2a08b57d 100644 --- a/dbaccess/inc/dataview.hxx +++ b/dbaccess/inc/dataview.hxx @@ -30,6 +30,7 @@ #include <vcl/window.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <svtools/acceleratorexecute.hxx> +#include <sal/macros.h> #include <memory> #include "dbaccessdllapi.h" diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 7eda90888..5f6f43b33 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1728,7 +1728,7 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS PROPERTY_ALIGN, PROPERTY_RELATIVEPOSITION, PROPERTY_WIDTH, PROPERTY_HIDDEN, PROPERTY_CONTROLMODEL, PROPERTY_HELPTEXT, PROPERTY_CONTROLDEFAULT }; - for ( size_t i=0; i<sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aPropertyNames ); ++i ) { if ( xInfo->hasPropertyByName( aPropertyNames[i] ) ) { diff --git a/dbaccess/source/core/api/columnsettings.cxx b/dbaccess/source/core/api/columnsettings.cxx index 1650d068a..58252b7dd 100644 --- a/dbaccess/source/core/api/columnsettings.cxx +++ b/dbaccess/source/core/api/columnsettings.cxx @@ -38,6 +38,7 @@ #include <comphelper/property.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <sal/macros.h> //........................................................................ namespace dbaccess @@ -163,7 +164,7 @@ namespace dbaccess { PROPERTY_HIDDEN, PROPERTY_ID_HIDDEN } }; - for ( size_t i=0; i < sizeof( aProps ) / sizeof( aProps[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aProps ); ++i ) { if ( xPSI->hasPropertyByName( aProps[i].sName ) ) if ( !isDefaulted( aProps[i].nHandle, _rxColumn->getPropertyValue( aProps[i].sName ) ) ) diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx index 7f1e7a244..2a0f26348 100644 --- a/dbaccess/source/core/api/definitioncolumn.cxx +++ b/dbaccess/source/core/api/definitioncolumn.cxx @@ -44,6 +44,7 @@ #include <cppuhelper/typeprovider.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <sal/macros.h> using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -230,7 +231,7 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME }, { PROPERTY_REALNAME, PROPERTY_ID_REALNAME } }; - for ( size_t i=0; i < sizeof( aProps ) / sizeof( aProps[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aProps ); ++i ) { if ( xPSI->hasPropertyByName( aProps[i].sName ) ) setFastPropertyValue_NoBroadcast( aProps[i].nHandle, _rxParserColumn->getPropertyValue( aProps[i].sName ) ); diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index 21b0c6844..0c62966bc 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -372,7 +372,7 @@ ObjectType OTableContainer::appendObject( const ::rtl::OUString& _rForName, cons , ::rtl::OUString(PROPERTY_ROW_HEIGHT), ::rtl::OUString(PROPERTY_TEXTCOLOR) , ::rtl::OUString(PROPERTY_TEXTLINECOLOR), ::rtl::OUString(PROPERTY_TEXTEMPHASIS) , ::rtl::OUString(PROPERTY_TEXTRELIEF) }; - Sequence< ::rtl::OUString> aNames(s_pTableProps,sizeof(s_pTableProps)/sizeof(s_pTableProps[0])); + Sequence< ::rtl::OUString> aNames(s_pTableProps,SAL_N_ELEMENTS(s_pTableProps)); if ( bModified || !lcl_isPropertySetDefaulted(aNames,xTableDefinition) ) ::dbaccess::notifyDataSourceModified(m_xTableDefinitions,sal_True); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 7ab170363..803ae2081 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -89,6 +89,7 @@ #include <connectivity/dbtools.hxx> #include <vcl/svapp.hxx> #include <vos/mutex.hxx> +#include <sal/macros.h> #include <com/sun/star/view/XViewSettingsSupplier.hpp> #include "core_resource.hxx" #include "core_resource.hrc" @@ -1561,7 +1562,7 @@ void ODocumentDefinition::separateOpenCommandArguments( const Sequence< Property { "RecoveryStorage" }; - for ( size_t i=0; i < sizeof( pObjectDescriptorArgs ) / sizeof( pObjectDescriptorArgs[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( pObjectDescriptorArgs ); ++i ) { if ( aOpenCommandArguments.has( pObjectDescriptorArgs[i] ) ) { diff --git a/dbaccess/source/core/inc/core_resource.hxx b/dbaccess/source/core/inc/core_resource.hxx index a45473303..695e61f20 100644 --- a/dbaccess/source/core/inc/core_resource.hxx +++ b/dbaccess/source/core/inc/core_resource.hxx @@ -30,6 +30,7 @@ #include <rtl/ustring.hxx> #include <osl/mutex.hxx> +#include <sal/macros.h> class ResMgr; //......................................................................... diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index 0ede9ff23..74271f633 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -35,6 +35,7 @@ #include <connectivity/dbtools.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/math.hxx> +#include <sal/macros.h> #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/sdb/XCompletedExecution.hpp> @@ -758,7 +759,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat { aRowLabels.push_back(::rtl::OUString::valueOf(h+1)); ::std::vector< double > aRow; - const sal_Int32 nSize = sizeof(fDefaultData)/sizeof(fDefaultData[0]); + const sal_Int32 nSize = SAL_N_ELEMENTS(fDefaultData); for (sal_Int32 j = 0; j < (nCount-1); ++j,++k) { if ( k >= nSize ) diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index f473586b4..778a65f7c 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -28,6 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" +#include <sal/macros.h> + #include "dsntypes.hxx" #include "dbamiscres.hrc" #include <unotools/confignode.hxx> @@ -440,7 +442,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const String& _rDsn) const KnownPrefix( "sdbc:address:macab", DST_MACAB, true ) }; - for ( size_t i=0; i < sizeof( aKnowPrefixes ) / sizeof( aKnowPrefixes[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aKnowPrefixes ); ++i ) { USHORT nMatchLen = aKnowPrefixes[i].bMatchComplete ? sDsn.Len() : (USHORT)rtl_str_getLength( aKnowPrefixes[i].pAsciiPrefix ); if ( sDsn.EqualsIgnoreCaseAscii( aKnowPrefixes[i].pAsciiPrefix, 0, nMatchLen ) ) diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx index 6833d7faf..67ef81a47 100644 --- a/dbaccess/source/core/recovery/dbdocrecovery.cxx +++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx @@ -48,6 +48,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> +#include <sal/macros.h> #include <algorithm> @@ -357,7 +358,7 @@ namespace dbaccess // read the map from sub storages to object names MapCompTypeToCompDescs aMapCompDescs; SubComponentType aKnownTypes[] = { TABLE, QUERY, FORM, REPORT, RELATION_DESIGN }; - for ( size_t i = 0; i < sizeof( aKnownTypes ) / sizeof( aKnownTypes[0] ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( aKnownTypes ); ++i ) { if ( !xRecoveryStorage->hasByName( SubComponentRecovery::getComponentsStorageName( aKnownTypes[i] ) ) ) continue; diff --git a/dbaccess/source/ext/macromigration/dbmm_types.hxx b/dbaccess/source/ext/macromigration/dbmm_types.hxx index 7695eb285..0e523cd8e 100644 --- a/dbaccess/source/ext/macromigration/dbmm_types.hxx +++ b/dbaccess/source/ext/macromigration/dbmm_types.hxx @@ -29,6 +29,7 @@ #define DBACCESS_DBMM_TYPES_HXX #include <tools/string.hxx> +#include <sal/macros.h> //........................................................................ namespace dbmm diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index 9e6781d10..2e25ef8b2 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -241,7 +241,7 @@ namespace dbmm LanguageMapping( "Python", ePython ), // TODO: is this correct? LanguageMapping( "Basic", eBasic ) }; - for ( size_t i=0; i < sizeof( aLanguageMapping ) / sizeof( aLanguageMapping[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aLanguageMapping ); ++i ) { if ( _rLanguage.equalsAscii( aLanguageMapping[i].pAsciiLanguage ) ) { @@ -1305,7 +1305,7 @@ namespace dbmm ScriptType aKnownStorageBasedTypes[] = { eBeanShell, eJavaScript, ePython, eJava }; - for ( size_t i=0; i<sizeof( aKnownStorageBasedTypes ) / sizeof( aKnownStorageBasedTypes[0] ); ++i ) + for ( size_t i=0; i< SAL_N_ELEMENTS( aKnownStorageBasedTypes ); ++i ) aElementNames.erase( lcl_getScriptsSubStorageName( aKnownStorageBasedTypes[i] ) ); if ( !aElementNames.empty() ) diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index e501032f8..2915b6d46 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -59,6 +59,7 @@ #include <tools/diagnose_ex.h> #include <connectivity/DriversConfig.hxx> #include <connectivity/dbtools.hxx> +#include <sal/macros.h> #include <boost/optional.hpp> @@ -370,7 +371,7 @@ void ODBExport::exportDataSource() }; bool bIsXMLDefault = false; - for ( size_t i=0; i < sizeof( aTokens ) / sizeof( aTokens[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aTokens ); ++i ) { if ( pProperties->Name == aTokens[i].sPropertyName ) { @@ -504,7 +505,7 @@ void ODBExport::exportApplicationConnectionSettings(const TSettingsMap& _aSettin ,XML_MAX_ROW_COUNT ,XML_SUPPRESS_VERSION_COLUMNS }; - for (size_t i = 0; i< sizeof(pSettings)/sizeof(pSettings[0]); ++i) + for (size_t i = 0; i< SAL_N_ELEMENTS(pSettings); ++i) { TSettingsMap::const_iterator aFind = _aSettings.find(pSettings[i]); if ( aFind != _aSettings.end() ) @@ -537,7 +538,7 @@ void ODBExport::exportDriverSettings(const TSettingsMap& _aSettings) ,XML_IS_FIRST_ROW_HEADER_LINE ,XML_PARAMETER_NAME_SUBSTITUTION }; - for (size_t i = 0; i< sizeof(pSettings)/sizeof(pSettings[0]); ++i) + for (size_t i = 0; i< SAL_N_ELEMENTS(pSettings); ++i) { TSettingsMap::const_iterator aFind = _aSettings.find(pSettings[i]); if ( aFind != _aSettings.end() ) @@ -640,7 +641,7 @@ void ODBExport::exportConnectionData() }; for ( size_t i=0; - i < sizeof( aProperties ) / sizeof( aProperties[0] ); + i < SAL_N_ELEMENTS( aProperties ); ++i ) { @@ -1160,7 +1161,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) }; ::std::vector< XMLPropertyState > aPropertyStates; - for (size_t i = 0 ; i < sizeof(pExportHelper)/sizeof(pExportHelper[0]); ++i) + for (size_t i = 0 ; i < SAL_N_ELEMENTS(pExportHelper); ++i) { aPropertyStates = pExportHelper[i].first->Filter(_xProp); if ( !aPropertyStates.empty() ) @@ -1204,7 +1205,7 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) TExportPropMapperPair(m_xColumnExportHelper,TEnumMapperPair(&m_aAutoStyleNames,XML_STYLE_FAMILY_TABLE_COLUMN )) ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XML_STYLE_FAMILY_TABLE_CELL)) }; - for (size_t i = 0 ; i < sizeof(pExportHelper)/sizeof(pExportHelper[0]); ++i) + for (size_t i = 0 ; i < SAL_N_ELEMENTS(pExportHelper); ++i) { ::std::vector< XMLPropertyState > aPropStates = pExportHelper[i].first->Filter( _xProp ); if ( !aPropStates.empty() ) diff --git a/dbaccess/source/sdbtools/connection/tablename.cxx b/dbaccess/source/sdbtools/connection/tablename.cxx index a63500027..ffec440e5 100644 --- a/dbaccess/source/sdbtools/connection/tablename.cxx +++ b/dbaccess/source/sdbtools/connection/tablename.cxx @@ -42,6 +42,7 @@ #include <connectivity/dbtools.hxx> #include <tools/diagnose_ex.h> #include <tools/string.hxx> +#include <sal/macros.h> //........................................................................ namespace sdbtools @@ -232,7 +233,7 @@ namespace sdbtools bool found = false; size_t i = 0; - for ( ; ( i < sizeof( TypeTable ) / sizeof( TypeTable[0] ) ) && !found; ++i ) + for ( ; ( i < SAL_N_ELEMENTS( TypeTable ) ) && !found; ++i ) if ( TypeTable[i].nCompositionType == _nType ) found = true; if ( !found ) diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index a10e12204..ef903c375 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -1247,7 +1247,7 @@ IMPL_LINK(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, /*pToolBox*/) , SID_DB_APP_VIEW_DOCINFO_PREVIEW }; - for(size_t i=0; i < sizeof(pActions)/sizeof(pActions[0]);++i) + for(size_t i=0; i < SAL_N_ELEMENTS(pActions);++i) { aMenu->CheckItem(pActions[i],m_aMenu->IsItemChecked(pActions[i])); } diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx index f18d4c5b9..c9ff27a89 100644 --- a/dbaccess/source/ui/app/AppIconControl.cxx +++ b/dbaccess/source/ui/app/AppIconControl.cxx @@ -62,7 +62,7 @@ OApplicationIconControl::OApplicationIconControl(Window* _pParent) { RID_STR_FORMS_CONTAINER, E_FORM, IMG_FORMFOLDER_TREE_L, IMG_FORMFOLDER_TREE_LHC }, { RID_STR_REPORTS_CONTAINER, E_REPORT, IMG_REPORTFOLDER_TREE_L,IMG_REPORTFOLDER_TREE_LHC } }; - for ( size_t i=0; i < sizeof(aCategories)/sizeof(aCategories[0]); ++i) + for ( size_t i=0; i < SAL_N_ELEMENTS(aCategories); ++i) { SvxIconChoiceCtrlEntry* pEntry = InsertEntry( String( ModuleRes( aCategories[i].nLabelResId ) ), diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx index cfd2a3c24..c9c96b597 100644 --- a/dbaccess/source/ui/app/AppTitleWindow.cxx +++ b/dbaccess/source/ui/app/AppTitleWindow.cxx @@ -52,7 +52,7 @@ OTitleWindow::OTitleWindow(Window* _pParent,USHORT _nTitleId,WinBits _nBits,BOOL ImplInitSettings( sal_True, sal_True, sal_True ); Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle }; - 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]->Show(); } // ----------------------------------------------------------------------------- @@ -166,7 +166,7 @@ void OTitleWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_B Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle}; - for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) { Font aFont = pWindows[i]->GetFont(); aFont.SetWeight(WEIGHT_BOLD); diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index 15ee52995..fb76e149c 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -59,6 +59,7 @@ #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <vcl/svapp.hxx> +#include <sal/macros.h> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -216,7 +217,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: Reference< XController2 > xController; const ::rtl::OUString sComponentURL( aParser.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - for ( size_t i=0; i < sizeof( aImplementations ) / sizeof( aImplementations[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aImplementations ); ++i ) { if ( sComponentURL.equalsAscii( aImplementations[i].pAsciiServiceName ) ) { diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index d0c59e90f..1843a4d4a 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -51,6 +51,7 @@ #include "UITools.hxx" #include "commontypes.hxx" +#include <sal/macros.h> #include <vcl/waitobj.hxx> #include <tools/urlobj.hxx> #include <svl/urihelper.hxx> @@ -1248,11 +1249,11 @@ namespace "com.sun.star.formula.FormularProperties", "smath", "com.sun.star.chart.ChartDocument", "schart" }; - OSL_ENSURE( ( sizeof( pTransTable ) / sizeof( pTransTable[0] ) ) % 2 == 0, + OSL_ENSURE( ( SAL_N_ELEMENTS( pTransTable ) ) % 2 == 0, "lcl_getModuleHelpModuleName: odd size of translation table!" ); // loop through the table - sal_Int32 nTableEntries = ( sizeof( pTransTable ) / sizeof( pTransTable[0] ) ) / 2; + sal_Int32 nTableEntries = ( SAL_N_ELEMENTS( pTransTable ) ) / 2; const sal_Char** pDocumentService = pTransTable; const sal_Char** pHelpModuleName = pTransTable + 1; for ( sal_Int32 j=0; j<nTableEntries; ++j ) diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 451840e9a..d62d8136f 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1194,7 +1194,7 @@ void SbaTableQueryBrowser::connectExternalDispatches() ID_BROWSER_INSERTCONTENT }; - for ( size_t i=0; i < sizeof( pURLs ) / sizeof( pURLs[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( pURLs ); ++i ) { URL aURL; aURL.Complete = ::rtl::OUString::createFromAscii( pURLs[i] ); diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index 98d5be61e..e1c3e9549 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -366,7 +366,7 @@ void OFieldDescControl::CheckScrollBars() // horizontal : long lMaxXPosition = 0; Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue}; - for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(ppAggregates); ++i) getMaxXPosition(ppAggregates[i],lMaxXPosition); if (m_pHorzScroll) @@ -484,9 +484,9 @@ void OFieldDescControl::ScrollAllAggregates() , pTextLenText, pLengthText , pScaleText, m_pColumnNameText , m_pTypeText, m_pAutoIncrementValueText}; - OSL_ENSURE(sizeof(ppAggregates)/sizeof(ppAggregates[0]) == sizeof(ppAggregatesText)/sizeof(ppAggregatesText[0]),"Lists are not identical!"); + OSL_ENSURE(SAL_N_ELEMENTS(ppAggregates) == SAL_N_ELEMENTS(ppAggregatesText),"Lists are not identical!"); - for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(ppAggregates); ++i) ScrollAggregate(ppAggregatesText[i],ppAggregates[i],NULL,nDeltaX, nDeltaY); ScrollAggregate(pFormatText,pFormatSample,pFormat,nDeltaX, nDeltaY); @@ -498,7 +498,7 @@ sal_uInt16 OFieldDescControl::CountActiveAggregates() const { Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue}; sal_uInt16 nVisibleAggregates = 0; - for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(ppAggregates); ++i) if (ppAggregates[i]) ++nVisibleAggregates; return nVisibleAggregates; @@ -508,7 +508,7 @@ sal_Int32 OFieldDescControl::GetMaxControlHeight() const { Size aHeight; Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue}; - for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(ppAggregates); ++i) { if ( ppAggregates[i] ) { @@ -539,9 +539,9 @@ void OFieldDescControl::SetReadOnly( sal_Bool bReadOnly ) , m_pTypeText, m_pAutoIncrementValueText , pFormatText}; - OSL_ENSURE(sizeof(ppAggregates)/sizeof(ppAggregates[0]) == sizeof(ppAggregatesText)/sizeof(ppAggregatesText[0]),"Lists are not identical!"); + OSL_ENSURE(SAL_N_ELEMENTS(ppAggregates) == SAL_N_ELEMENTS(ppAggregatesText),"Lists are not identical!"); - for (sal_uInt16 i=0; i<sizeof(ppAggregates)/sizeof(ppAggregates[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(ppAggregates); ++i) { if ( ppAggregatesText[i] ) ppAggregatesText[i]->Enable( !bReadOnly ); @@ -833,7 +833,7 @@ void OFieldDescControl::ArrangeAggregates() }; long nMaxWidth = 0; - for (size_t i=0; i<sizeof(adAggregates)/sizeof(adAggregates[0]); i++) + for (size_t i=0; i < SAL_N_ELEMENTS(adAggregates); i++) { if (adAggregates[i].pctrlTextControl) { @@ -846,7 +846,7 @@ void OFieldDescControl::ArrangeAggregates() // und los ... int nCurrentControlPos = 0; Control* pZOrderPredecessor = NULL; - for (size_t i=0; i<sizeof(adAggregates)/sizeof(adAggregates[0]); i++) + for (size_t i=0; i < SAL_N_ELEMENTS(adAggregates); i++) { if (adAggregates[i].pctrlInputControl) { diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx index 82521d2d5..4f401dbe0 100644 --- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx @@ -202,7 +202,7 @@ namespace dbaui //{ // String sDisplayName = m_pCollection->getTypeDisplayName(m_eType); // FixedText* ppTextControls[] ={&m_aFT_Connection}; - // for (size_t i = 0; i < sizeof(ppTextControls)/sizeof(ppTextControls[0]); ++i) + // for (size_t i = 0; i < SAL_N_ELEMENTS(ppTextControls); ++i) // { // ppTextControls[i]->SetText(sDisplayName); // } diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index 7187fcbdc..bebf41c9d 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -899,7 +899,7 @@ DBG_NAME(OFinalDBPageSetup) Point aPos(m_aFTFinalHeader.GetPosPixel()); Size aStart(m_aFTFinalHeader.GetSizePixel()); aPos.Y() += aStart.Height() + nUnrelatedHeight; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=0; i < nCount; ++i) { aPos.X() = pWindows[i].first->GetPosPixel().X(); diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 09f044434..b95044d60 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -152,7 +152,7 @@ DBG_NAME(OTextConnectionHelper) { 0, NULL } }; - for ( size_t section=0; section < sizeof( aSections ) / sizeof( aSections[0] ) - 1; ++section ) + for ( size_t section=0; section < SAL_N_ELEMENTS( aSections ) - 1; ++section ) { if ( ( m_nAvailableSections & aSections[section].nFlag ) != 0 ) { diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 481ee3981..3dc85cad4 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -475,7 +475,7 @@ SfxItemSet* ODbAdminDialog::createItemSet(SfxItemSet*& _rpSet, SfxItemPool*& _rp {0,0} }; - OSL_ENSURE(sizeof(aItemInfos)/sizeof(aItemInfos[0]) == DSID_LAST_ITEM_ID,"Invalid Ids!"); + OSL_ENSURE(SAL_N_ELEMENTS(aItemInfos) == DSID_LAST_ITEM_ID,"Invalid Ids!"); _rpPool = new SfxItemPool(String::CreateFromAscii("DSAItemPool"), DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID, aItemInfos, _rppDefaults); _rpPool->FreezeIdRanges(); diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx index 4a8bbcf9e..71a26f80c 100644 --- a/dbaccess/source/ui/dlg/detailpages.cxx +++ b/dbaccess/source/ui/dlg/detailpages.cxx @@ -113,7 +113,7 @@ namespace dbaui m_pAutoIncrementLabel, m_pAutoIncrement, m_pAutoRetrievingLabel, m_pAutoRetrieving }; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=1; i < nCount; ++i) { if ( pWindows[i] ) @@ -366,7 +366,7 @@ namespace dbaui ,m_pOptionsLabel,m_pOptions,&m_aUseCatalog }; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=1; i < nCount; ++i) pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); } @@ -547,7 +547,7 @@ namespace dbaui &m_aFTDriverClass, &m_aEDDriverClass,&m_aTestJavaDriver, m_pCharsetLabel, m_pCharset}; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=1; i < nCount; ++i) pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); @@ -679,7 +679,7 @@ namespace dbaui Window* pWindows[] = { &m_aMySQLSettings, &m_aSeparator2, &m_aUserNameLabel, &m_aUserName, &m_aPasswordRequired, m_pCharsetLabel, m_pCharset}; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=1; i < nCount; ++i) pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); @@ -819,7 +819,7 @@ namespace dbaui ,&m_CB_SHUTDB ,m_pCharsetLabel, m_pCharset,&m_PB_STAT}; - sal_Int32 nCount = sizeof(pWindows) / sizeof(pWindows[0]); + sal_Int32 nCount = SAL_N_ELEMENTS(pWindows); for (sal_Int32 i=1; i < nCount; ++i) pWindows[i]->SetZOrder(pWindows[i-1], WINDOW_ZORDER_BEHIND); } diff --git a/dbaccess/source/ui/dlg/dsselect.cxx b/dbaccess/source/ui/dlg/dsselect.cxx index 0ca0c66c5..1565c259e 100644 --- a/dbaccess/source/ui/dlg/dsselect.cxx +++ b/dbaccess/source/ui/dlg/dsselect.cxx @@ -34,6 +34,7 @@ #include <vcl/msgbox.hxx> #include "localresaccess.hxx" #include <tools/rcid.h> +#include <sal/macros.h> #include <com/sun/star/sdbcx/XCreateCatalog.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -99,7 +100,7 @@ ODatasourceSelectDialog::ODatasourceSelectDialog(Window* _pParent, const StringB // move the buttons PushButton* pButtons[] = { &m_aOk, &m_aCancel, &m_aHelp ,&m_aCreateAdabasDB}; - for (size_t i=0; i<sizeof(pButtons)/sizeof(pButtons[0]); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(pButtons); ++i) { Point aOldPos = pButtons[i]->GetPosPixel(); pButtons[i]->SetPosPixel(Point(aOldPos.X() - nLostPixels, aOldPos.Y())); diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 80134a070..e5c14d4b3 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -126,7 +126,7 @@ namespace dbaui &m_aTypePostLabel }; const long nOffset = m_aRB_OpenDocument.GetPosPixel().Y() - m_aRB_CreateDatabase.GetPosPixel().Y(); - for ( size_t i=0; i < sizeof( pWindowsToMove ) / sizeof( pWindowsToMove[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( pWindowsToMove ); ++i ) { Point aPos( pWindowsToMove[i]->GetPosPixel() ); aPos.Y() -= nOffset; diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx index c1d66c32e..43bd0aa67 100644 --- a/dbaccess/source/ui/inc/dbadmin.hxx +++ b/dbaccess/source/ui/inc/dbadmin.hxx @@ -28,6 +28,7 @@ #ifndef _DBAUI_DBADMIN_HXX_ #define _DBAUI_DBADMIN_HXX_ +#include <sal/macros.h> #include <sfx2/tabdlg.hxx> #include "dsntypes.hxx" #include "IItemSetHelper.hxx" diff --git a/dbaccess/source/ui/inc/moduledbu.hxx b/dbaccess/source/ui/inc/moduledbu.hxx index fd872c8f5..308f1bb1f 100644 --- a/dbaccess/source/ui/inc/moduledbu.hxx +++ b/dbaccess/source/ui/inc/moduledbu.hxx @@ -30,6 +30,7 @@ #include <osl/mutex.hxx> #include <tools/resid.hxx> +#include <sal/macros.h> class ResMgr; diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index d1266e43c..9332a2fab 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -364,7 +364,7 @@ void ODatabaseExport::insertValueIntoColumn() ,NumberFormat::NUMBER ,NumberFormat::LOGICAL }; - for (size_t i = 0; i < sizeof(nFormats)/sizeof(nFormats[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(nFormats); ++i) { try { diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 805a1fcf1..e8bac6f30 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1051,7 +1051,7 @@ sal_Bool callColumnFormatDialog(Window* _pParent, delete pFormatDescriptor; SfxItemPool::Free(pPool); - for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(pDefaults); ++i) delete pDefaults[i]; return bRet; diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index d59b5010f..4ae2a37c0 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -167,7 +167,7 @@ void ObjectCopySource::copyUISettingsTo( const Reference< XPropertySet >& _rxObj const ::rtl::OUString aCopyProperties[] = { PROPERTY_FONT, PROPERTY_ROW_HEIGHT, PROPERTY_TEXTCOLOR,PROPERTY_TEXTLINECOLOR,PROPERTY_TEXTEMPHASIS,PROPERTY_TEXTRELIEF }; - for ( size_t i=0; i < sizeof( aCopyProperties ) / sizeof( aCopyProperties[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aCopyProperties ); ++i ) { if ( m_xObjectPSI->hasPropertyByName( aCopyProperties[i] ) ) _rxObject->setPropertyValue( aCopyProperties[i], m_xObject->getPropertyValue( aCopyProperties[i] ) ); @@ -194,7 +194,7 @@ void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _ sStatement += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WHERE 0=1")); - for ( i=0; i < sizeof( aProperties ) / sizeof( aProperties[0] ); ++i ) + for ( i=0; i < SAL_N_ELEMENTS( aProperties ); ++i ) { if ( m_xObjectPSI->hasPropertyByName( aProperties[i].first ) ) { diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 6d54c40bf..17c99f692 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -211,12 +211,12 @@ void OSelectionBrowseBox::initialize() String sGroup = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount() - 1); m_aFunctionStrings = m_aFunctionStrings.GetToken(0); - for (size_t i = 0; i < sizeof(eFunctions)/sizeof(eFunctions[0]) ; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(eFunctions); ++i) { m_aFunctionStrings += String(RTL_CONSTASCII_USTRINGPARAM(";")); m_aFunctionStrings += String(ByteString(rContext.getIntlKeywordAscii(eFunctions[i])),RTL_TEXTENCODING_UTF8); - } // for (sal_Int32 i = 0; i < sizeof(eFunctions)/sizeof(eFunctions[0]) ; ++i) + } // for (sal_Int32 i = 0; i < SAL_N_ELEMENTS(eFunctions) ; ++i) m_aFunctionStrings += String(RTL_CONSTASCII_USTRINGPARAM(";")); m_aFunctionStrings += sGroup; @@ -361,12 +361,12 @@ void OSelectionBrowseBox::Init() Size aHeight; const Control* pControls[] = { m_pTextCell,m_pVisibleCell,m_pTableCell,m_pFieldCell }; - for(sal_Size i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i) + for(sal_Size i= 0; i < SAL_N_ELEMENTS(pControls);++i) { const Size aTemp( pControls[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) ); if ( aTemp.Height() > aHeight.Height() ) aHeight.Height() = aTemp.Height(); - } // for(int i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i + } // for(int i= 0; i < SAL_N_ELEMENTS(pControls);++i SetDataRowHeight(aHeight.Height()); SetTitleLines(1); // Anzahl der sichtbaren Zeilen ermitteln @@ -2195,7 +2195,7 @@ sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const { sal_Int32 nErg(0); // only the first 11 row are interesting - sal_Int32 nSize = sizeof(nVisibleRowMask) / sizeof(nVisibleRowMask[0]); + sal_Int32 nSize = SAL_N_ELEMENTS(nVisibleRowMask); for(sal_Int32 i=0;i<nSize;i++) { if(!m_bVisibleRow[i]) @@ -2207,7 +2207,7 @@ sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const void OSelectionBrowseBox::SetNoneVisbleRow(long nRows) { // only the first 11 row are interesting - sal_Int32 nSize = sizeof(nVisibleRowMask) / sizeof(nVisibleRowMask[0]); + sal_Int32 nSize = SAL_N_ELEMENTS(nVisibleRowMask); for(sal_Int32 i=0;i< nSize;i++) m_bVisibleRow[i] = !(nRows & nVisibleRowMask[i]); } diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 3df34e468..4e841d71b 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -307,12 +307,12 @@ void OTableEditorCtrl::InitCellController() Size aHeight; const Control* pControls[] = { pTypeCell,pDescrCell,pNameCell,pHelpTextCell}; - for(sal_Size i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i) + for(sal_Size i= 0; i < SAL_N_ELEMENTS(pControls);++i) { const Size aTemp( pControls[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) ); if ( aTemp.Height() > aHeight.Height() ) aHeight.Height() = aTemp.Height(); - } // for(int i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i + } // for(int i= 0; i < SAL_N_ELEMENTS(pControls);++i SetDataRowHeight(aHeight.Height()); ClearModified(); diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 032e5b117..7c9cd7691 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -746,7 +746,7 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X const ::rtl::OUString aSettings[] = { PROPERTY_FILTER, PROPERTY_ORDER, PROPERTY_HAVING_CLAUSE, PROPERTY_GROUP_BY }; - for ( size_t i=0; i < sizeof( aSettings ) / sizeof( aSettings[0] ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( aSettings ); ++i ) { if ( lcl_hasNonEmptyStringValue_throw( _rxSourceDescriptor, xPSI, aSettings[i] ) ) { diff --git a/reportdesign/source/core/api/FixedLine.cxx b/reportdesign/source/core/api/FixedLine.cxx index ae73f6e2e..1913f4f06 100644 --- a/reportdesign/source/core/api/FixedLine.cxx +++ b/reportdesign/source/core/api/FixedLine.cxx @@ -133,7 +133,7 @@ uno::Sequence< ::rtl::OUString > lcl_getLineOptionals() }; - return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0])); + return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); } DBG_NAME(rpt_OFixedLine) // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/core/api/FixedText.cxx b/reportdesign/source/core/api/FixedText.cxx index c43907a47..611443aa9 100644 --- a/reportdesign/source/core/api/FixedText.cxx +++ b/reportdesign/source/core/api/FixedText.cxx @@ -46,7 +46,7 @@ namespace reportdesign uno::Sequence< ::rtl::OUString > lcl_getFixedTextOptionals() { ::rtl::OUString pProps[] = { PROPERTY_DATAFIELD,PROPERTY_MASTERFIELDS,PROPERTY_DETAILFIELDS }; - return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0])); + return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); } DBG_NAME( rpt_OFixedText ) // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/core/api/FormattedField.cxx b/reportdesign/source/core/api/FormattedField.cxx index f20207a17..5d44fd149 100644 --- a/reportdesign/source/core/api/FormattedField.cxx +++ b/reportdesign/source/core/api/FormattedField.cxx @@ -53,7 +53,7 @@ uno::Reference< uno::XInterface > OFormattedField::create(uno::Reference< uno::X uno::Sequence< ::rtl::OUString > lcl_getFormattedFieldOptionals() { ::rtl::OUString pProps[] = { PROPERTY_MASTERFIELDS,PROPERTY_DETAILFIELDS }; - return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0])); + return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); } DBG_NAME( rpt_OFormattedField ) // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/core/api/ImageControl.cxx b/reportdesign/source/core/api/ImageControl.cxx index cb81d7d65..239b4e57a 100644 --- a/reportdesign/source/core/api/ImageControl.cxx +++ b/reportdesign/source/core/api/ImageControl.cxx @@ -116,7 +116,7 @@ uno::Sequence< ::rtl::OUString > lcl_getImageOptionals() , PROPERTY_CHARLOCALECOMPLEX }; - return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0])); + return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); } DBG_NAME( rpt_OImageControl ) diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 6e9408207..dbae40917 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -1870,7 +1870,7 @@ void SAL_CALL OReportDefinition::load( const uno::Sequence< beans::PropertyValue aArguments.get_ensureType( "ReadOnly", bReadOnly ); nFirstOpenMode = bReadOnly ? 1 : 0; } - const size_t nLastOpenMode = sizeof( nOpenModes ) / sizeof( nOpenModes[0] ) - 1; + const size_t nLastOpenMode = SAL_N_ELEMENTS( nOpenModes ) - 1; for ( size_t i=nFirstOpenMode; i <= nLastOpenMode; ++i ) { uno::Sequence< uno::Any > aStorageCreationArgs(2); @@ -2427,7 +2427,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OReportDefinition::getAvailableService ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable")) }; - static const sal_uInt16 nSvxComponentServiceNameListCount = sizeof(aSvxComponentServiceNameList) / sizeof ( aSvxComponentServiceNameList[0] ); + static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList); uno::Sequence< ::rtl::OUString > aSeq( nSvxComponentServiceNameListCount ); ::rtl::OUString* pStrings = aSeq.getArray(); diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx index 3c6e480a5..afdb50800 100644 --- a/reportdesign/source/core/api/Section.cxx +++ b/reportdesign/source/core/api/Section.cxx @@ -59,7 +59,7 @@ uno::Sequence< ::rtl::OUString> lcl_getGroupAbsent() ,PROPERTY_CANSHRINK }; - return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0])); + return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); } // ----------------------------------------------------------------------------- @@ -100,7 +100,7 @@ uno::Sequence< ::rtl::OUString> lcl_getAbsent(bool _bPageSection) ,PROPERTY_CANSHRINK ,PROPERTY_REPEATSECTION }; - return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0])); + return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); } ::rtl::OUString pProps[] = { @@ -109,7 +109,7 @@ uno::Sequence< ::rtl::OUString> lcl_getAbsent(bool _bPageSection) ,PROPERTY_REPEATSECTION }; - return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0])); + return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); } // ----------------------------------------------------------------------------- OSection::OSection(const uno::Reference< report::XReportDefinition >& _xParent diff --git a/reportdesign/source/core/api/Shape.cxx b/reportdesign/source/core/api/Shape.cxx index 6b5a58844..d9eac59ab 100644 --- a/reportdesign/source/core/api/Shape.cxx +++ b/reportdesign/source/core/api/Shape.cxx @@ -57,7 +57,7 @@ uno::Sequence< ::rtl::OUString > lcl_getShapeOptionals() ,PROPERTY_CONTROLBACKGROUND ,PROPERTY_CONTROLBACKGROUNDTRANSPARENT }; - return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0])); + return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); } DBG_NAME( rpt_OShape ) diff --git a/reportdesign/source/core/inc/Tools.hxx b/reportdesign/source/core/inc/Tools.hxx index 905395290..302cc8a00 100644 --- a/reportdesign/source/core/inc/Tools.hxx +++ b/reportdesign/source/core/inc/Tools.hxx @@ -37,6 +37,7 @@ #include <com/sun/star/report/XFixedText.hpp> #include <com/sun/star/report/XFormattedField.hpp> +#include <sal/macros.h> #include "Section.hxx" #include "corestrings.hrc" diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index f0902bc47..c82c53771 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -64,6 +64,7 @@ // for locking SolarMutex: svapp + mutex #include <vcl/svapp.hxx> #include <vos/mutex.hxx> +#include <sal/macros.h> #include <boost/bind.hpp> @@ -1643,7 +1644,7 @@ void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xG if ( sFunction.getLength() ) { sal_Unicode pReplaceChars[] = { '(',')',';',',','+','-','[',']','/','*'}; - for(sal_uInt32 j= 0; j < sizeof(pReplaceChars)/sizeof(pReplaceChars[0]);++j) + for(sal_uInt32 j= 0; j < SAL_N_ELEMENTS(pReplaceChars);++j) sFunctionName = sFunctionName.replace(pReplaceChars[j],'_'); xFunction->setName(sFunctionName); diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx index f6bcf7daa..a572d3b2d 100644 --- a/reportdesign/source/ui/dlg/CondFormat.cxx +++ b/reportdesign/source/ui/dlg/CondFormat.cxx @@ -368,7 +368,7 @@ namespace rptui aPos += LogicToPixel( Point( 0 , UNRELATED_CONTROLS ), MAP_APPFONT ); Window* pWindows[] = { &m_aPB_OK, &m_aPB_CANCEL, &m_aPB_Help }; - 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]->SetPosSizePixel( 0, aPos.Y(), 0, 0, WINDOW_POSSIZE_Y ); } diff --git a/reportdesign/source/ui/dlg/DateTime.cxx b/reportdesign/source/ui/dlg/DateTime.cxx index 4ec34a801..c28768278 100644 --- a/reportdesign/source/ui/dlg/DateTime.cxx +++ b/reportdesign/source/ui/dlg/DateTime.cxx @@ -105,7 +105,7 @@ ODateTimeDialog::ODateTimeDialog( Window* _pParent m_aTimeControlling.enableOnCheckMark( m_aTime, m_aFTTimeFormat, m_aTimeListBox); CheckBox* pCheckBoxes[] = { &m_aDate,&m_aTime}; - for ( size_t i = 0 ; i < sizeof(pCheckBoxes)/sizeof(pCheckBoxes[0]); ++i) + for ( size_t i = 0 ; i < SAL_N_ELEMENTS(pCheckBoxes); ++i) pCheckBoxes[i]->SetClickHdl(LINK(this,ODateTimeDialog,CBClickHdl)); FreeResource(); diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index 542ff4bfd..5d2c8e7bf 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,6 +34,7 @@ #include <com/sun/star/report/GroupOn.hpp> #include <com/sun/star/sdbc/DataType.hpp> +#include <sal/macros.h> #include <tools/debug.hxx> #include "RptResId.hrc" #include "rptui_slotid.hrc" @@ -135,7 +136,7 @@ public: inline ::svt::ComboBoxControl* getExpressionControl() const { return m_pComboCell; } - + /** returns the sequence with the selected groups */ uno::Sequence<uno::Any> fillSelectedGroups(); @@ -148,7 +149,7 @@ public: using OFieldExpressionControl_Base::GetRowCount; protected: virtual BOOL IsTabAllowed(BOOL bForward) const; - + virtual void InitController( ::svt::CellControllerRef& rController, long nRow, USHORT nCol ); virtual ::svt::CellController* GetController( long nRow, USHORT nCol ); @@ -292,7 +293,7 @@ sal_Int8 OFieldExpressionControl::ExecuteDrop( const BrowserExecuteDropEvent& rE DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL); sal_Int8 nAction = DND_ACTION_NONE; if ( IsDropFormatSupported( OGroupExchange::getReportGroupId() ) ) - { + { sal_Int32 nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), sal_False); SetNoSelection(); @@ -326,7 +327,7 @@ void OFieldExpressionControl::moveGroups(const uno::Sequence<uno::Any>& _aGroups { uno::Reference< report::XGroup> xGroup(*pIter,uno::UNO_QUERY); if ( xGroup.is() ) - { + { uno::Sequence< beans::PropertyValue > aArgs(1); aArgs[0].Name = PROPERTY_GROUP; aArgs[0].Value <<= xGroup; @@ -384,7 +385,7 @@ void OFieldExpressionControl::lateInit() m_pComboCell->SetHelpId(HID_RPT_FIELDEXPRESSION); Control* pControls[] = {m_pComboCell}; - for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i) { pControls[i]->SetGetFocusHdl(LINK(m_pParent, OGroupsSortingDialog, OnControlFocusGot)); pControls[i]->SetLoseFocusHdl(LINK(m_pParent, OGroupsSortingDialog, OnControlFocusLost)); @@ -485,7 +486,7 @@ BOOL OFieldExpressionControl::SaveModified(bool _bAppendRow) else xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]); if ( xGroup.is() ) - { + { USHORT nPos = m_pComboCell->GetSelectEntryPos(); ::rtl::OUString sExpression; if ( COMBOBOX_ENTRY_NOTFOUND == nPos ) @@ -497,7 +498,7 @@ BOOL OFieldExpressionControl::SaveModified(bool _bAppendRow) xGroup->setExpression( sExpression ); ::rptui::adjustSectionName(xGroup,nPos); - + if ( bAppend ) m_pParent->m_pController->getUndoMgr()->LeaveListAction(); } @@ -532,7 +533,7 @@ String OFieldExpressionControl::GetCellText( long nRow, USHORT /*nColId*/ ) cons { uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]); ::rtl::OUString sExpression = xGroup->getExpression(); - + for(::std::vector<ColumnInfo>::const_iterator aIter = m_aColumnInfo.begin(); aIter != m_aColumnInfo.end();++aIter) { if ( aIter->sColumnName == sExpression ) @@ -600,7 +601,7 @@ void OFieldExpressionControl::PaintCell( OutputDevice& rDev, const Rectangle& rR DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL); String aText =const_cast< OFieldExpressionControl*>(this)->GetCellText( m_nCurrentPos, nColumnId ); - Point aPos( rRect.TopLeft() ); + Point aPos( rRect.TopLeft() ); Size aTextSize( GetDataWindow().GetTextHeight(),GetDataWindow().GetTextWidth( aText )); if( aPos.X() < rRect.Right() || aPos.X() + aTextSize.Width() > rRect.Right() || @@ -669,7 +670,7 @@ void SAL_CALL OFieldExpressionControl::elementInserted(const container::Containe aFind = m_aGroupPositions.insert(aFind,nGroupPos); else *aFind = nGroupPos; - + ::std::vector<sal_Int32>::iterator aEnd = m_aGroupPositions.end(); for(++aFind;aFind != aEnd;++aFind) if ( *aFind != NO_GROUP ) @@ -799,7 +800,7 @@ void OFieldExpressionControl::Command(const CommandEvent& rEvt) void OFieldExpressionControl::DeleteRows() { DBG_CHKTHIS( rpt_OFieldExpressionControl,NULL); - + sal_Bool bIsEditing = IsEditing(); if (bIsEditing) { @@ -925,7 +926,7 @@ void OFieldExpressionControl::InsertRows( long nRow ) datatransfer::DataFlavor aFlavor; SotExchange::GetFormatDataFlavor(OGroupExchange::getReportGroupId(), aFlavor); uno::Sequence< uno::Any > aGroups; - + if( (aTransferData.GetAny(aFlavor) >>= aGroups) && aGroups.getLength() ) { m_bIgnoreEvent = false; @@ -1011,35 +1012,35 @@ OGroupsSortingDialog::OGroupsSortingDialog( Window* _pParent ,m_xGroups(m_pController->getReportDefinition()->getGroups()) ,m_bReadOnly(_bReadOnly) { - DBG_CTOR( rpt_OGroupsSortingDialog,NULL); - + DBG_CTOR( rpt_OGroupsSortingDialog,NULL); + Control* pControlsLst[] = { &m_aHeaderLst, &m_aFooterLst, &m_aGroupOnLst, &m_aKeepTogetherLst, &m_aOrderLst, &m_aGroupIntervalEd}; - for (size_t i = 0; i < sizeof(pControlsLst)/sizeof(pControlsLst[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pControlsLst); ++i) { pControlsLst[i]->SetGetFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusGot)); pControlsLst[i]->SetLoseFocusHdl(LINK(this, OGroupsSortingDialog, OnControlFocusLost)); pControlsLst[i]->Show(TRUE); - } // for (int i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + } // for (int i = 0; i < SAL_N_ELEMENTS(pControls); ++i) - for (size_t i = 0; i < (sizeof(pControlsLst)/sizeof(pControlsLst[0]))-1; ++i) + for (size_t i = 0; i < (SAL_N_ELEMENTS(pControlsLst))-1; ++i) static_cast<ListBox*>(pControlsLst[i])->SetSelectHdl(LINK(this,OGroupsSortingDialog,LBChangeHdl)); Control* pControls[] = { &m_aHeader, &m_aFooter, &m_aGroupOn, &m_aGroupInterval, &m_aKeepTogether, &m_aOrder , &m_aMove,&m_aFL2}; sal_Int32 nMaxTextWidth = 0; MnemonicGenerator aMnemonicGenerator; - for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i) aMnemonicGenerator.RegisterMnemonic( pControls[i]->GetText() ); - for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i) { pControls[i]->Show(TRUE); String sText = pControls[i]->GetText(); if ( aMnemonicGenerator.CreateMnemonic(sText) ) pControls[i]->SetText(sText); sal_Int32 nTextWidth = GetTextWidth(sText); - nMaxTextWidth = ::std::max<sal_Int32>(nTextWidth,nMaxTextWidth); + nMaxTextWidth = ::std::max<sal_Int32>(nTextWidth,nMaxTextWidth); } Size aSize(UNRELATED_CONTROLS, PAGE_HEIGHT); @@ -1085,7 +1086,7 @@ OGroupsSortingDialog::OGroupsSortingDialog( Window* _pParent //------------------------------------------------------------------------ OGroupsSortingDialog::~OGroupsSortingDialog() { - DBG_DTOR( rpt_OGroupsSortingDialog,NULL); + DBG_DTOR( rpt_OGroupsSortingDialog,NULL); delete m_pFieldExpression; m_xColumns.clear(); m_pReportListener->dispose(); @@ -1135,11 +1136,11 @@ void OGroupsSortingDialog::DisplayData( sal_Int32 _nRow ) if ( !bEmpty && nGroupPos != NO_GROUP ) { uno::Reference< report::XGroup> xGroup = getGroup(nGroupPos); - + m_pCurrentGroupListener = new OPropertyChangeMultiplexer(this,xGroup.get()); m_pCurrentGroupListener->addProperty(PROPERTY_HEADERON); m_pCurrentGroupListener->addProperty(PROPERTY_FOOTERON); - + displayGroup(xGroup); } } @@ -1150,7 +1151,7 @@ void OGroupsSortingDialog::SaveData( sal_Int32 _nRow) sal_Int32 nGroupPos = m_pFieldExpression->getGroupPosition(_nRow); if ( nGroupPos == NO_GROUP ) return; - + uno::Reference< report::XGroup> xGroup = getGroup(nGroupPos); if ( m_aHeaderLst.GetSavedValue() != m_aHeaderLst.GetSelectEntryPos() ) xGroup->setHeaderOn( m_aHeaderLst.GetSelectEntryPos() == 0 ); @@ -1172,7 +1173,7 @@ void OGroupsSortingDialog::SaveData( sal_Int32 _nRow) xGroup->setSortAscending( m_aOrderLst.GetSelectEntryPos() == 0 ); ListBox* pControls[] = { &m_aHeaderLst,&m_aFooterLst,&m_aGroupOnLst,&m_aKeepTogetherLst,&m_aOrderLst}; - for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i) pControls[i]->SaveValue(); } @@ -1195,7 +1196,7 @@ sal_Int32 OGroupsSortingDialog::getColumnDataType(const ::rtl::OUString& _sColum { OSL_ENSURE(0,"Eception caught while getting the type of a column"); } - + return nDataType; } //------------------------------------------------------------------------------ @@ -1204,7 +1205,7 @@ IMPL_LINK(OGroupsSortingDialog, OnControlFocusGot, Control*, pControl ) if ( m_pFieldExpression && m_pFieldExpression->getExpressionControl() ) { Control* pControls[] = { m_pFieldExpression->getExpressionControl(),&m_aHeaderLst,&m_aFooterLst,&m_aGroupOnLst,&m_aGroupIntervalEd,&m_aKeepTogetherLst,&m_aOrderLst}; - for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i) { if ( pControl == pControls[i] ) { @@ -1303,7 +1304,7 @@ IMPL_LINK( OGroupsSortingDialog, LBChangeHdl, ListBox*, pListBox ) uno::Sequence< beans::PropertyValue > aArgs(2); aArgs[1].Name = PROPERTY_GROUP; aArgs[1].Value <<= xGroup; - + if ( &m_aHeaderLst == pListBox ) aArgs[0].Name = PROPERTY_HEADERON; else @@ -1349,7 +1350,7 @@ void OGroupsSortingDialog::displayGroup(const uno::Reference<report::XGroup>& _x { m_aGroupOnLst.RemoveEntry(1); } - + switch(nDataType) { case sdbc::DataType::LONGVARCHAR: @@ -1363,7 +1364,7 @@ void OGroupsSortingDialog::displayGroup(const uno::Reference<report::XGroup>& _x case sdbc::DataType::TIMESTAMP: { USHORT nIds[] = { STR_RPT_YEAR, STR_RPT_QUARTER,STR_RPT_MONTH,STR_RPT_WEEK,STR_RPT_DAY,STR_RPT_HOUR,STR_RPT_MINUTE }; - for (USHORT i = 0; i < sizeof(nIds)/sizeof(nIds[0]); ++i) + for (USHORT i = 0; i < SAL_N_ELEMENTS(nIds); ++i) { m_aGroupOnLst.InsertEntry(String(ModuleRes(nIds[i]))); m_aGroupOnLst.SetEntryData(i+1,reinterpret_cast<void*>(i+2)); @@ -1419,12 +1420,12 @@ void OGroupsSortingDialog::displayGroup(const uno::Reference<report::XGroup>& _x m_aOrderLst.SelectEntryPos(_xGroup->getSortAscending() ? 0 : 1); ListBox* pControls[] = { &m_aHeaderLst,&m_aFooterLst,&m_aGroupOnLst,&m_aKeepTogetherLst,&m_aOrderLst}; - for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i) pControls[i]->SaveValue(); ListBox* pControlsLst2[] = { &m_aHeaderLst, &m_aFooterLst, &m_aGroupOnLst, &m_aKeepTogetherLst,&m_aOrderLst}; sal_Bool bReadOnly = !m_pController->isEditable(); - for (size_t i = 0; i < sizeof(pControlsLst2)/sizeof(pControlsLst2[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pControlsLst2); ++i) pControlsLst2[i]->SetReadOnly(bReadOnly); m_aGroupIntervalEd.SetReadOnly(bReadOnly); } @@ -1439,21 +1440,21 @@ void OGroupsSortingDialog::Resize() Control* pControlsLst[] = { &m_aHeaderLst, &m_aFooterLst, &m_aGroupOnLst, &m_aGroupIntervalEd,&m_aKeepTogetherLst,&m_aOrderLst}; Control* pControls[] = { &m_aHeader, &m_aFooter, &m_aGroupOn, &m_aGroupInterval, &m_aKeepTogether, &m_aOrder}; sal_Int32 nMaxTextWidth = 0; - for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i) { nMaxTextWidth = ::std::max<sal_Int32>(static_cast<sal_Int32>(GetTextWidth(pControls[i]->GetText())),nMaxTextWidth); - } // for (int i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + } // for (int i = 0; i < SAL_N_ELEMENTS(pControls); ++i) // aTotalOutputSize.Width() - m_aHeaderLst.GetSizePixel().Width() - 3*aSpace.Width() - for (size_t i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pControls); ++i) { pControls[i]->SetSizePixel(Size(nMaxTextWidth,pControls[i]->GetSizePixel().Height())); Point aPos = pControls[i]->GetPosPixel(); aPos.X() += nMaxTextWidth + aSpace.Width(); aPos.Y() = pControlsLst[i]->GetPosPixel().Y(); - + pControlsLst[i]->SetPosSizePixel(aPos,Size(aTotalOutputSize.Width() - aPos.X() - aSpace.Width(),pControlsLst[i]->GetSizePixel().Height())); - } // for (int i = 0; i < sizeof(pControls)/sizeof(pControls[0]); ++i) + } // for (int i = 0; i < SAL_N_ELEMENTS(pControls); ++i) m_aFL.SetSizePixel(Size(aTotalOutputSize.Width() - aSpace.Width(),m_aFL.GetSizePixel().Height())); m_aFL2.SetSizePixel(Size(aTotalOutputSize.Width() - aSpace.Width(),m_aFL2.GetSizePixel().Height())); @@ -1461,10 +1462,10 @@ void OGroupsSortingDialog::Resize() //BTN sal_Int32 nPos = aTotalOutputSize.Width() - aSpace.Width() - m_aPB_Up.GetSizePixel().Width(); //BTN m_aPB_Delete.SetPosPixel(Point(nPos,m_aPB_Delete.GetPosPixel().Y())); -//BTN +//BTN //BTN nPos -= (m_aPB_Up.GetSizePixel().Width() + LogicToPixel( Size( UNRELATED_CONTROLS, 0 ), MAP_APPFONT ).Width()); //BTN m_aPB_Down.SetPosPixel(Point(nPos,m_aPB_Down.GetPosPixel().Y())); -//BTN +//BTN //BTN nPos -= (m_aPB_Up.GetSizePixel().Width() + LogicToPixel( Size( RELATED_CONTROLS, 0 ), MAP_APPFONT ).Width()); //BTN m_aPB_Up.SetPosPixel(Point(nPos,m_aPB_Up.GetPosPixel().Y())); sal_Int32 nPos = aTotalOutputSize.Width() - aSpace.Width() - m_aToolBox.GetSizePixel().Width(); @@ -1499,7 +1500,7 @@ void OGroupsSortingDialog::checkButtons(sal_Int32 _nRow) //BTN m_aPB_Up.Enable(bEnable && _nRow > 0 ); //BTN m_aPB_Down.Enable(bEnable && _nRow < (m_pFieldExpression->GetRowCount()-1) ); // m_aToolBox.EnableItem(SID_RPT_GROUPSORT_MOVE_DOWN, bEnable && _nRow < (-1) ); - + sal_Int32 nGroupPos = m_pFieldExpression->getGroupPosition(_nRow); if ( nGroupPos != NO_GROUP ) { @@ -1538,7 +1539,7 @@ void OGroupsSortingDialog::resizeControls(const Size& _rDiff) } //------------------------------------------------------------------ -// load the images +// load the images ImageList OGroupsSortingDialog::getImageList(vcl::ImageListType _eType) SAL_THROW (( com::sun::star::lang::IllegalArgumentException )) { if (_eType == vcl::HIGHCONTRAST_NO) diff --git a/reportdesign/source/ui/inc/metadata.hxx b/reportdesign/source/ui/inc/metadata.hxx index 7d5bd2dcc..8da73fe62 100644 --- a/reportdesign/source/ui/inc/metadata.hxx +++ b/reportdesign/source/ui/inc/metadata.hxx @@ -29,6 +29,8 @@ #include "ModuleHelper.hxx" +#include <sal/macros.h> + /** === begin UNO includes === **/ #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/inspection/XPropertyHandler.hpp> diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx index df42cdb8a..10f5e06f0 100644 --- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx +++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx @@ -397,7 +397,7 @@ uno::Sequence< beans::Property > SAL_CALL DataProviderHandler::getSupportedPrope //,PROPERTY_TITLE }; - for (size_t nPos = 0; nPos < sizeof(s_pProperties)/sizeof(s_pProperties[0]) ;++nPos ) + for (size_t nPos = 0; nPos < SAL_N_ELEMENTS(s_pProperties) ;++nPos ) { aValue.Name = s_pProperties[nPos]; aNewProps.push_back(aValue); diff --git a/reportdesign/source/ui/inspection/DefaultInspection.cxx b/reportdesign/source/ui/inspection/DefaultInspection.cxx index 892bb29b8..8f50397c3 100644 --- a/reportdesign/source/ui/inspection/DefaultInspection.cxx +++ b/reportdesign/source/ui/inspection/DefaultInspection.cxx @@ -139,7 +139,7 @@ namespace rptui }; - const size_t nFactories = sizeof( aFactories ) / sizeof( aFactories[ 0 ] ); + const size_t nFactories = SAL_N_ELEMENTS( aFactories ); Sequence< Any > aReturn( nFactories ); Any* pReturn = aReturn.getArray(); for ( size_t i = 0; i < nFactories; ++i ) @@ -237,7 +237,7 @@ namespace rptui { "Data", RID_STR_PROPPAGE_DATA, HID_RPT_PROPDLG_TAB_DATA }, }; - const size_t nCategories = sizeof( aCategories ) / sizeof( aCategories[0] ); + const size_t nCategories = SAL_N_ELEMENTS( aCategories ); Sequence< PropertyCategoryDescriptor > aReturn( nCategories ); PropertyCategoryDescriptor* pReturn = aReturn.getArray(); for ( size_t i=0; i<nCategories; ++i, ++pReturn ) diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 7c0ffd7d1..408fd03de 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -1308,7 +1308,7 @@ uno::Sequence< beans::Property > SAL_CALL GeometryHandler::getSupportedPropertie }; const uno::Reference < beans::XPropertySetInfo > xInfo = m_xReportComponent->getPropertySetInfo(); const uno::Sequence< beans::Property> aSeq = xInfo->getProperties(); - for (size_t i = 0; i < sizeof(pIncludeProperties)/sizeof(pIncludeProperties[0]) ;++i ) + for (size_t i = 0; i < SAL_N_ELEMENTS(pIncludeProperties) ;++i ) { const beans::Property* pIter = aSeq.getConstArray(); const beans::Property* pEnd = pIter + aSeq.getLength(); @@ -1328,7 +1328,7 @@ uno::Sequence< beans::Property > SAL_CALL GeometryHandler::getSupportedPropertie } aNewProps.push_back(*pFind); } - } // for (size_t i = 0; i < sizeof(pIncludeProperties)/sizeof(pIncludeProperties[0]) ;++i ) + } // for (size_t i = 0; i < SAL_N_ELEMENTS(pIncludeProperties) ;++i ) // special property for shapes // if ( uno::Reference< report::XShape>(m_xReportComponent,uno::UNO_QUERY).is() ) diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx index 95fddcfd8..d3f33050d 100644 --- a/reportdesign/source/ui/inspection/metadata.cxx +++ b/reportdesign/source/ui/inspection/metadata.cxx @@ -319,9 +319,9 @@ namespace rptui for (; pPropsIter != pPropsEnd; ++pPropsIter) { size_t nPos = 0; - for (; nPos < sizeof(pExcludeProperties)/sizeof(pExcludeProperties[0]) && pExcludeProperties[nPos] != pPropsIter->Name;++nPos ) + for (; nPos < SAL_N_ELEMENTS(pExcludeProperties) && pExcludeProperties[nPos] != pPropsIter->Name;++nPos ) ; - if ( nPos == sizeof(pExcludeProperties)/sizeof(pExcludeProperties[0]) ) + if ( nPos == SAL_N_ELEMENTS(pExcludeProperties) ) _rExcludeProperties.push_back(*pPropsIter); } } diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 563b552ff..7c62eccb7 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -37,6 +37,7 @@ #include <tools/diagnose_ex.h> #include <tools/string.hxx> +#include <sal/macros.h> #include <vcl/svapp.hxx> #include <vcl/window.hxx> @@ -551,7 +552,7 @@ namespace ,{ITEMID_LANGUAGE_ASIAN,PROPERTY_CHARLOCALEASIAN} ,{ITEMID_LANGUAGE_COMPLEX,PROPERTY_CHARLOCALECOMPLEX} }; - for(size_t k = 0; k < sizeof(pItems)/sizeof(pItems[0]);++k) + for(size_t k = 0; k < SAL_N_ELEMENTS(pItems);++k) { if ( SFX_ITEM_SET == _rItemSet.GetItemState( pItems[k].nWhich,sal_True,&pItem) && pItem->ISA(SvxLanguageItem)) { @@ -706,7 +707,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep }; - OSL_ASSERT((sizeof(pDefaults)/sizeof(pDefaults[0])) == (sizeof(aItemInfos)/sizeof(aItemInfos[0]))); + OSL_ASSERT((SAL_N_ELEMENTS(pDefaults)) == (SAL_N_ELEMENTS(aItemInfos))); static USHORT pRanges[] = { @@ -743,7 +744,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep } SfxItemPool::Free(pPool); - for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(pDefaults); ++i) delete pDefaults[i]; return bSuccess; diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 6761732f8..99698dd9e 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -2162,7 +2162,7 @@ void OReportController::onLoadedMenu(const Reference< frame::XLayoutManager >& _ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/resizebar")) ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:resource/toolbar/sectionshrinkbar")) }; - for (size_t i = 0; i< sizeof(s_sMenu)/sizeof(s_sMenu[0]); ++i) + for (size_t i = 0; i< SAL_N_ELEMENTS(s_sMenu); ++i) { _xLayoutManager->createElement( s_sMenu[i] ); _xLayoutManager->requestElement( s_sMenu[i] ); @@ -2559,7 +2559,7 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ } SfxItemPool::Free(pPool); - for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(pDefaults); ++i) delete pDefaults[i]; } @@ -2757,7 +2757,7 @@ uno::Any SAL_CALL OReportController::getViewData(void) throw( uno::RuntimeExcept ,TStringIntPair(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SplitPosition")), SID_SPLIT_POSITION) }; - uno::Sequence<beans::PropertyValue> aCommandProps(sizeof(pViewDataList)/sizeof(pViewDataList[0])); + uno::Sequence<beans::PropertyValue> aCommandProps(SAL_N_ELEMENTS(pViewDataList)); beans::PropertyValue* pIter = aCommandProps.getArray(); beans::PropertyValue* pEnd = pIter + aCommandProps.getLength(); for (sal_Int32 i = 0; pIter != pEnd; ++pIter,++i) @@ -3224,11 +3224,11 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co ,PROPERTY_FORMATSSUPPLIER ,PROPERTY_BACKGROUNDCOLOR }; - for(size_t i = 0; i < sizeof(sProps)/sizeof(sProps[0]);++i) + for(size_t i = 0; i < SAL_N_ELEMENTS(sProps);++i) { if ( xInfo->hasPropertyByName(sProps[i]) && xShapeInfo->hasPropertyByName(sProps[i]) ) xUnoProp->setPropertyValue(sProps[i],xShapeProp->getPropertyValue(sProps[i])); - } // for(size_t i = 0; i < sizeof(sProps)/sizeof(sProps[0]);++i) + } // for(size_t i = 0; i < SAL_N_ELEMENTS(sProps);++i) if ( xInfo->hasPropertyByName(PROPERTY_BORDER) && xShapeInfo->hasPropertyByName(PROPERTY_CONTROLBORDER) ) xUnoProp->setPropertyValue(PROPERTY_BORDER,xShapeProp->getPropertyValue(PROPERTY_CONTROLBORDER)); @@ -3512,7 +3512,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) ::rtl::OUString sDefaultName; size_t i = 0; OUnoObject* pObjs[2]; - for(i = 0; i < sizeof(pControl)/sizeof(pControl[0]);++i) + for(i = 0; i < SAL_N_ELEMENTS(pControl);++i) { pObjs[i] = dynamic_cast<OUnoObject*>(pControl[i]); uno::Reference<beans::XPropertySet> xUnoProp(pObjs[i]->GetUnoControlModel(),uno::UNO_QUERY_THROW); @@ -3527,7 +3527,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) ,PROPERTY_BORDER ,PROPERTY_BACKGROUNDCOLOR }; - for(size_t k = 0; k < sizeof(sProps)/sizeof(sProps[0]);++k) + for(size_t k = 0; k < SAL_N_ELEMENTS(sProps);++k) { if ( xInfo->hasPropertyByName(sProps[k]) && xShapeInfo->hasPropertyByName(sProps[k]) ) xUnoProp->setPropertyValue(sProps[k],xShapeProp->getPropertyValue(sProps[k])); @@ -3594,7 +3594,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) uno::Reference< report::XFixedText> xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY_THROW); xShapeProp->setName(xShapeProp->getName() + sDefaultName ); - for(i = 0; i < sizeof(pControl)/sizeof(pControl[0]);++i) // insert controls + for(i = 0; i < SAL_N_ELEMENTS(pControl);++i) // insert controls { correctOverlapping(pControl[i],pSectionWindow[1-i]->getReportSection()); } @@ -3648,7 +3648,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) } else { - for(size_t i = 0; i < sizeof(pControl)/sizeof(pControl[0]);++i) + for(size_t i = 0; i < SAL_N_ELEMENTS(pControl);++i) delete pControl[i]; } } @@ -3709,7 +3709,7 @@ void OReportController::listen(const bool _bAdd) void (SAL_CALL XPropertySet::*pPropertyListenerAction)( const ::rtl::OUString&, const uno::Reference< XPropertyChangeListener >& ) = _bAdd ? &XPropertySet::addPropertyChangeListener : &XPropertySet::removePropertyChangeListener; - for (size_t i = 0; i < sizeof(aProps)/sizeof(aProps[0]); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aProps); ++i) (m_xReportDefinition.get()->*pPropertyListenerAction)( aProps[i], static_cast< XPropertyChangeListener* >( this ) ); OXUndoEnvironment& rUndoEnv = m_aReportModel->GetUndoEnv(); @@ -3718,7 +3718,7 @@ void OReportController::listen(const bool _bAdd) const beans::Property* pIter = aSeq.getConstArray(); const beans::Property* pEnd = pIter + aSeq.getLength(); const ::rtl::OUString* pPropsBegin = &aProps[0]; - const ::rtl::OUString* pPropsEnd = pPropsBegin + (sizeof(aProps)/sizeof(aProps[0])) - 3; + const ::rtl::OUString* pPropsEnd = pPropsBegin + (SAL_N_ELEMENTS(aProps)) - 3; for(;pIter != pEnd;++pIter) { if ( ::std::find(pPropsBegin,pPropsEnd,pIter->Name) == pPropsEnd ) @@ -4114,7 +4114,7 @@ void SAL_CALL OReportController::setMode( const ::rtl::OUString& aMode ) throw ( { static ::rtl::OUString s_sModes[] = { ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("remote")), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("normal")) }; - return uno::Sequence< ::rtl::OUString> (&s_sModes[0],sizeof(s_sModes)/sizeof(s_sModes[0])); + return uno::Sequence< ::rtl::OUString> (&s_sModes[0],SAL_N_ELEMENTS(s_sModes)); } ::sal_Bool SAL_CALL OReportController::supportsMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::uno::RuntimeException) { @@ -4305,7 +4305,7 @@ void OReportController::openZoomDialog() } SfxItemPool::Free(pPool); - for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i) + for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(pDefaults); ++i) delete pDefaults[i]; } // if(pFact) } diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 78192238f..cd53c7f3a 100644 --- a/reportdesign/source/ui/report/propbrw.cxx +++ b/reportdesign/source/ui/report/propbrw.cxx @@ -151,7 +151,7 @@ PropBrw::PropBrw(const Reference< XMultiServiceFactory >& _xORB,Window* pParent, ::cppu::ContextEntry_Init( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveConnection" ) ), makeAny( m_pDesignView->getController().getConnection() ) ), }; m_xInspectorContext.set( - ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), + ::cppu::createComponentContext( aHandlerContextInfo, SAL_N_ELEMENTS( aHandlerContextInfo ), xOwnContext ) ); // create a property browser controller bool bEnableHelpSection = lcl_shouldEnableHelpSection( m_xORB ); @@ -222,7 +222,7 @@ PropBrw::~PropBrw() const ::rtl::OUString pProps[] = { ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContextDocument" ) ) , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogParentWindow" ) ) , ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveConnection" ) )}; - 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]); } } |