remove STATIC_ARRAY_END and usages
used in loops, rewrite to range based loop oox/source/drawingml/color.cxx has some mappings in plain arrays make them arrays of pairs which can be used in range based loops Change-Id: Ib6693197d890f595c27ca24b9f9b4e0763747f4c Reviewed-on: https://gerrit.libreoffice.org/24809 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
This commit is contained in:
@@ -33,11 +33,6 @@ namespace oox {
|
||||
|
||||
// Helper macros ==============================================================
|
||||
|
||||
/** Expands to a pointer behind the last element of a STATIC data array (like
|
||||
STL end()). */
|
||||
#define STATIC_ARRAY_END( array ) \
|
||||
((array)+SAL_N_ELEMENTS(array))
|
||||
|
||||
/** Expands to the 'index'-th element of a STATIC data array, or to 'def', if
|
||||
'index' is out of the array limits. */
|
||||
#define STATIC_ARRAY_SELECT( array, index, def ) \
|
||||
|
@@ -960,9 +960,8 @@ ObjectFormatterData::ObjectFormatterData( const XmlFilterBase& rFilter, const Re
|
||||
maEnUsLocale( "en", "US", OUString() ),
|
||||
mnMaxSeriesIdx( -1 )
|
||||
{
|
||||
const ObjectTypeFormatEntry* pEntryEnd = STATIC_ARRAY_END( spObjTypeFormatEntries );
|
||||
for( const ObjectTypeFormatEntry* pEntry = spObjTypeFormatEntries; pEntry != pEntryEnd; ++pEntry )
|
||||
maTypeFormatters[ pEntry->meObjType ].reset( new ObjectTypeFormatter( *this, *pEntry, rChartSpace, pEntry->meObjType ) );
|
||||
for(auto const &rEntry : spObjTypeFormatEntries)
|
||||
maTypeFormatters[ rEntry.meObjType ].reset( new ObjectTypeFormatter( *this, rEntry, rChartSpace, rEntry.meObjType ) );
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -90,10 +90,11 @@ static const TypeGroupInfo saUnknownTypeInfo =
|
||||
|
||||
const TypeGroupInfo& lclGetTypeInfoFromTypeId( TypeId eTypeId )
|
||||
{
|
||||
const TypeGroupInfo* pEnd = STATIC_ARRAY_END( spTypeInfos );
|
||||
for( const TypeGroupInfo* pIt = spTypeInfos; pIt != pEnd; ++pIt )
|
||||
if( pIt->meTypeId == eTypeId )
|
||||
return *pIt;
|
||||
for( auto const &rIt : spTypeInfos)
|
||||
{
|
||||
if( rIt.meTypeId == eTypeId )
|
||||
return rIt;
|
||||
}
|
||||
OSL_ENSURE( eTypeId == TYPEID_UNKNOWN, "lclGetTypeInfoFromTypeId - unexpected chart type identifier" );
|
||||
return saUnknownTypeInfo;
|
||||
}
|
||||
|
@@ -48,96 +48,96 @@ PresetColorsPool::PresetColorsPool() :
|
||||
maVmlColors( static_cast< size_t >( XML_TOKEN_COUNT ), API_RGB_TRANSPARENT )
|
||||
{
|
||||
// predefined colors in DrawingML (map XML token identifiers to RGB values)
|
||||
static const sal_Int32 spnDmlColors[] =
|
||||
static const std::pair<sal_Int32, sal_Int32> spnDmlColors[] =
|
||||
{
|
||||
XML_aliceBlue, 0xF0F8FF, XML_antiqueWhite, 0xFAEBD7,
|
||||
XML_aqua, 0x00FFFF, XML_aquamarine, 0x7FFFD4,
|
||||
XML_azure, 0xF0FFFF, XML_beige, 0xF5F5DC,
|
||||
XML_bisque, 0xFFE4C4, XML_black, 0x000000,
|
||||
XML_blanchedAlmond, 0xFFEBCD, XML_blue, 0x0000FF,
|
||||
XML_blueViolet, 0x8A2BE2, XML_brown, 0xA52A2A,
|
||||
XML_burlyWood, 0xDEB887, XML_cadetBlue, 0x5F9EA0,
|
||||
XML_chartreuse, 0x7FFF00, XML_chocolate, 0xD2691E,
|
||||
XML_coral, 0xFF7F50, XML_cornflowerBlue, 0x6495ED,
|
||||
XML_cornsilk, 0xFFF8DC, XML_crimson, 0xDC143C,
|
||||
XML_cyan, 0x00FFFF, XML_deepPink, 0xFF1493,
|
||||
XML_deepSkyBlue, 0x00BFFF, XML_dimGray, 0x696969,
|
||||
XML_dkBlue, 0x00008B, XML_dkCyan, 0x008B8B,
|
||||
XML_dkGoldenrod, 0xB8860B, XML_dkGray, 0xA9A9A9,
|
||||
XML_dkGreen, 0x006400, XML_dkKhaki, 0xBDB76B,
|
||||
XML_dkMagenta, 0x8B008B, XML_dkOliveGreen, 0x556B2F,
|
||||
XML_dkOrange, 0xFF8C00, XML_dkOrchid, 0x9932CC,
|
||||
XML_dkRed, 0x8B0000, XML_dkSalmon, 0xE9967A,
|
||||
XML_dkSeaGreen, 0x8FBC8B, XML_dkSlateBlue, 0x483D8B,
|
||||
XML_dkSlateGray, 0x2F4F4F, XML_dkTurquoise, 0x00CED1,
|
||||
XML_dkViolet, 0x9400D3, XML_dodgerBlue, 0x1E90FF,
|
||||
XML_firebrick, 0xB22222, XML_floralWhite, 0xFFFAF0,
|
||||
XML_forestGreen, 0x228B22, XML_fuchsia, 0xFF00FF,
|
||||
XML_gainsboro, 0xDCDCDC, XML_ghostWhite, 0xF8F8FF,
|
||||
XML_gold, 0xFFD700, XML_goldenrod, 0xDAA520,
|
||||
XML_gray, 0x808080, XML_green, 0x008000,
|
||||
XML_greenYellow, 0xADFF2F, XML_honeydew, 0xF0FFF0,
|
||||
XML_hotPink, 0xFF69B4, XML_indianRed, 0xCD5C5C,
|
||||
XML_indigo, 0x4B0082, XML_ivory, 0xFFFFF0,
|
||||
XML_khaki, 0xF0E68C, XML_lavender, 0xE6E6FA,
|
||||
XML_lavenderBlush, 0xFFF0F5, XML_lawnGreen, 0x7CFC00,
|
||||
XML_lemonChiffon, 0xFFFACD, XML_lime, 0x00FF00,
|
||||
XML_limeGreen, 0x32CD32, XML_linen, 0xFAF0E6,
|
||||
XML_ltBlue, 0xADD8E6, XML_ltCoral, 0xF08080,
|
||||
XML_ltCyan, 0xE0FFFF, XML_ltGoldenrodYellow, 0xFAFA78,
|
||||
XML_ltGray, 0xD3D3D3, XML_ltGreen, 0x90EE90,
|
||||
XML_ltPink, 0xFFB6C1, XML_ltSalmon, 0xFFA07A,
|
||||
XML_ltSeaGreen, 0x20B2AA, XML_ltSkyBlue, 0x87CEFA,
|
||||
XML_ltSlateGray, 0x778899, XML_ltSteelBlue, 0xB0C4DE,
|
||||
XML_ltYellow, 0xFFFFE0, XML_magenta, 0xFF00FF,
|
||||
XML_maroon, 0x800000, XML_medAquamarine, 0x66CDAA,
|
||||
XML_medBlue, 0x0000CD, XML_medOrchid, 0xBA55D3,
|
||||
XML_medPurple, 0x9370DB, XML_medSeaGreen, 0x3CB371,
|
||||
XML_medSlateBlue, 0x7B68EE, XML_medSpringGreen, 0x00FA9A,
|
||||
XML_medTurquoise, 0x48D1CC, XML_medVioletRed, 0xC71585,
|
||||
XML_midnightBlue, 0x191970, XML_mintCream, 0xF5FFFA,
|
||||
XML_mistyRose, 0xFFE4E1, XML_moccasin, 0xFFE4B5,
|
||||
XML_navajoWhite, 0xFFDEAD, XML_navy, 0x000080,
|
||||
XML_oldLace, 0xFDF5E6, XML_olive, 0x808000,
|
||||
XML_oliveDrab, 0x6B8E23, XML_orange, 0xFFA500,
|
||||
XML_orangeRed, 0xFF4500, XML_orchid, 0xDA70D6,
|
||||
XML_paleGoldenrod, 0xEEE8AA, XML_paleGreen, 0x98FB98,
|
||||
XML_paleTurquoise, 0xAFEEEE, XML_paleVioletRed, 0xDB7093,
|
||||
XML_papayaWhip, 0xFFEFD5, XML_peachPuff, 0xFFDAB9,
|
||||
XML_peru, 0xCD853F, XML_pink, 0xFFC0CB,
|
||||
XML_plum, 0xDDA0DD, XML_powderBlue, 0xB0E0E6,
|
||||
XML_purple, 0x800080, XML_red, 0xFF0000,
|
||||
XML_rosyBrown, 0xBC8F8F, XML_royalBlue, 0x4169E1,
|
||||
XML_saddleBrown, 0x8B4513, XML_salmon, 0xFA8072,
|
||||
XML_sandyBrown, 0xF4A460, XML_seaGreen, 0x2E8B57,
|
||||
XML_seaShell, 0xFFF5EE, XML_sienna, 0xA0522D,
|
||||
XML_silver, 0xC0C0C0, XML_skyBlue, 0x87CEEB,
|
||||
XML_slateBlue, 0x6A5ACD, XML_slateGray, 0x708090,
|
||||
XML_snow, 0xFFFAFA, XML_springGreen, 0x00FF7F,
|
||||
XML_steelBlue, 0x4682B4, XML_tan, 0xD2B48C,
|
||||
XML_teal, 0x008080, XML_thistle, 0xD8BFD8,
|
||||
XML_tomato, 0xFF6347, XML_turquoise, 0x40E0D0,
|
||||
XML_violet, 0xEE82EE, XML_wheat, 0xF5DEB3,
|
||||
XML_white, 0xFFFFFF, XML_whiteSmoke, 0xF5F5F5,
|
||||
XML_yellow, 0xFFFF00, XML_yellowGreen, 0x9ACD32
|
||||
{XML_aliceBlue, 0xF0F8FF}, {XML_antiqueWhite, 0xFAEBD7},
|
||||
{XML_aqua, 0x00FFFF}, {XML_aquamarine, 0x7FFFD4},
|
||||
{XML_azure, 0xF0FFFF}, {XML_beige, 0xF5F5DC},
|
||||
{XML_bisque, 0xFFE4C4}, {XML_black, 0x000000},
|
||||
{XML_blanchedAlmond, 0xFFEBCD}, {XML_blue, 0x0000FF},
|
||||
{XML_blueViolet, 0x8A2BE2}, {XML_brown, 0xA52A2A},
|
||||
{XML_burlyWood, 0xDEB887}, {XML_cadetBlue, 0x5F9EA0},
|
||||
{XML_chartreuse, 0x7FFF00}, {XML_chocolate, 0xD2691E},
|
||||
{XML_coral, 0xFF7F50}, {XML_cornflowerBlue, 0x6495ED},
|
||||
{XML_cornsilk, 0xFFF8DC}, {XML_crimson, 0xDC143C},
|
||||
{XML_cyan, 0x00FFFF}, {XML_deepPink, 0xFF1493},
|
||||
{XML_deepSkyBlue, 0x00BFFF}, {XML_dimGray, 0x696969},
|
||||
{XML_dkBlue, 0x00008B}, {XML_dkCyan, 0x008B8B},
|
||||
{XML_dkGoldenrod, 0xB8860B}, {XML_dkGray, 0xA9A9A9},
|
||||
{XML_dkGreen, 0x006400}, {XML_dkKhaki, 0xBDB76B},
|
||||
{XML_dkMagenta, 0x8B008B}, {XML_dkOliveGreen, 0x556B2F},
|
||||
{XML_dkOrange, 0xFF8C00}, {XML_dkOrchid, 0x9932CC},
|
||||
{XML_dkRed, 0x8B0000}, {XML_dkSalmon, 0xE9967A},
|
||||
{XML_dkSeaGreen, 0x8FBC8B}, {XML_dkSlateBlue, 0x483D8B},
|
||||
{XML_dkSlateGray, 0x2F4F4F}, {XML_dkTurquoise, 0x00CED1},
|
||||
{XML_dkViolet, 0x9400D3}, {XML_dodgerBlue, 0x1E90FF},
|
||||
{XML_firebrick, 0xB22222}, {XML_floralWhite, 0xFFFAF0},
|
||||
{XML_forestGreen, 0x228B22}, {XML_fuchsia, 0xFF00FF},
|
||||
{XML_gainsboro, 0xDCDCDC}, {XML_ghostWhite, 0xF8F8FF},
|
||||
{XML_gold, 0xFFD700}, {XML_goldenrod, 0xDAA520},
|
||||
{XML_gray, 0x808080}, {XML_green, 0x008000},
|
||||
{XML_greenYellow, 0xADFF2F}, {XML_honeydew, 0xF0FFF0},
|
||||
{XML_hotPink, 0xFF69B4}, {XML_indianRed, 0xCD5C5C},
|
||||
{XML_indigo, 0x4B0082}, {XML_ivory, 0xFFFFF0},
|
||||
{XML_khaki, 0xF0E68C}, {XML_lavender, 0xE6E6FA},
|
||||
{XML_lavenderBlush, 0xFFF0F5}, {XML_lawnGreen, 0x7CFC00},
|
||||
{XML_lemonChiffon, 0xFFFACD}, {XML_lime, 0x00FF00},
|
||||
{XML_limeGreen, 0x32CD32}, {XML_linen, 0xFAF0E6},
|
||||
{XML_ltBlue, 0xADD8E6}, {XML_ltCoral, 0xF08080},
|
||||
{XML_ltCyan, 0xE0FFFF}, {XML_ltGoldenrodYellow, 0xFAFA78},
|
||||
{XML_ltGray, 0xD3D3D3}, {XML_ltGreen, 0x90EE90},
|
||||
{XML_ltPink, 0xFFB6C1}, {XML_ltSalmon, 0xFFA07A},
|
||||
{XML_ltSeaGreen, 0x20B2AA}, {XML_ltSkyBlue, 0x87CEFA},
|
||||
{XML_ltSlateGray, 0x778899}, {XML_ltSteelBlue, 0xB0C4DE},
|
||||
{XML_ltYellow, 0xFFFFE0}, {XML_magenta, 0xFF00FF},
|
||||
{XML_maroon, 0x800000}, {XML_medAquamarine, 0x66CDAA},
|
||||
{XML_medBlue, 0x0000CD}, {XML_medOrchid, 0xBA55D3},
|
||||
{XML_medPurple, 0x9370DB}, {XML_medSeaGreen, 0x3CB371},
|
||||
{XML_medSlateBlue, 0x7B68EE}, {XML_medSpringGreen, 0x00FA9A},
|
||||
{XML_medTurquoise, 0x48D1CC}, {XML_medVioletRed, 0xC71585},
|
||||
{XML_midnightBlue, 0x191970}, {XML_mintCream, 0xF5FFFA},
|
||||
{XML_mistyRose, 0xFFE4E1}, {XML_moccasin, 0xFFE4B5},
|
||||
{XML_navajoWhite, 0xFFDEAD}, {XML_navy, 0x000080},
|
||||
{XML_oldLace, 0xFDF5E6}, {XML_olive, 0x808000},
|
||||
{XML_oliveDrab, 0x6B8E23}, {XML_orange, 0xFFA500},
|
||||
{XML_orangeRed, 0xFF4500}, {XML_orchid, 0xDA70D6},
|
||||
{XML_paleGoldenrod, 0xEEE8AA}, {XML_paleGreen, 0x98FB98},
|
||||
{XML_paleTurquoise, 0xAFEEEE}, {XML_paleVioletRed, 0xDB7093},
|
||||
{XML_papayaWhip, 0xFFEFD5}, {XML_peachPuff, 0xFFDAB9},
|
||||
{XML_peru, 0xCD853F}, {XML_pink, 0xFFC0CB},
|
||||
{XML_plum, 0xDDA0DD}, {XML_powderBlue, 0xB0E0E6},
|
||||
{XML_purple, 0x800080}, {XML_red, 0xFF0000},
|
||||
{XML_rosyBrown, 0xBC8F8F}, {XML_royalBlue, 0x4169E1},
|
||||
{XML_saddleBrown, 0x8B4513}, {XML_salmon, 0xFA8072},
|
||||
{XML_sandyBrown, 0xF4A460}, {XML_seaGreen, 0x2E8B57},
|
||||
{XML_seaShell, 0xFFF5EE}, {XML_sienna, 0xA0522D},
|
||||
{XML_silver, 0xC0C0C0}, {XML_skyBlue, 0x87CEEB},
|
||||
{XML_slateBlue, 0x6A5ACD}, {XML_slateGray, 0x708090},
|
||||
{XML_snow, 0xFFFAFA}, {XML_springGreen, 0x00FF7F},
|
||||
{XML_steelBlue, 0x4682B4}, {XML_tan, 0xD2B48C},
|
||||
{XML_teal, 0x008080}, {XML_thistle, 0xD8BFD8},
|
||||
{XML_tomato, 0xFF6347}, {XML_turquoise, 0x40E0D0},
|
||||
{XML_violet, 0xEE82EE}, {XML_wheat, 0xF5DEB3},
|
||||
{XML_white, 0xFFFFFF}, {XML_whiteSmoke, 0xF5F5F5},
|
||||
{XML_yellow, 0xFFFF00}, {XML_yellowGreen, 0x9ACD32}
|
||||
};
|
||||
for( const sal_Int32* pnEntry = spnDmlColors; pnEntry < STATIC_ARRAY_END( spnDmlColors ); pnEntry += 2 )
|
||||
maDmlColors[ static_cast< size_t >( pnEntry[ 0 ] ) ] = pnEntry[ 1 ];
|
||||
for(auto const nEntry : spnDmlColors)
|
||||
maDmlColors[ static_cast< size_t >(nEntry.first) ] = nEntry.second;
|
||||
|
||||
// predefined colors in VML (map XML token identifiers to RGB values)
|
||||
static const sal_Int32 spnVmlColors[] =
|
||||
static const std::pair<sal_Int32, sal_Int32> spnVmlColors[] =
|
||||
{
|
||||
XML_aqua, 0x00FFFF, XML_black, 0x000000,
|
||||
XML_blue, 0x0000FF, XML_fuchsia, 0xFF00FF,
|
||||
XML_gray, 0x808080, XML_green, 0x008000,
|
||||
XML_lime, 0x00FF00, XML_maroon, 0x800000,
|
||||
XML_navy, 0x000080, XML_olive, 0x808000,
|
||||
XML_purple, 0x800080, XML_red, 0xFF0000,
|
||||
XML_silver, 0xC0C0C0, XML_teal, 0x008080,
|
||||
XML_white, 0xFFFFFF, XML_yellow, 0xFFFF00
|
||||
{XML_aqua, 0x00FFFF}, {XML_black, 0x000000},
|
||||
{XML_blue, 0x0000FF}, {XML_fuchsia, 0xFF00FF},
|
||||
{XML_gray, 0x808080}, {XML_green, 0x008000},
|
||||
{XML_lime, 0x00FF00}, {XML_maroon, 0x800000},
|
||||
{XML_navy, 0x000080}, {XML_olive, 0x808000},
|
||||
{XML_purple, 0x800080}, {XML_red, 0xFF0000},
|
||||
{XML_silver, 0xC0C0C0}, {XML_teal, 0x008080},
|
||||
{XML_white, 0xFFFFFF}, {XML_yellow, 0xFFFF00}
|
||||
};
|
||||
for( const sal_Int32* pnEntry = spnVmlColors; pnEntry < STATIC_ARRAY_END( spnVmlColors ); pnEntry += 2 )
|
||||
maVmlColors[ static_cast< size_t >( pnEntry[ 0 ] ) ] = pnEntry[ 1 ];
|
||||
for(auto const nEntry : spnVmlColors)
|
||||
maVmlColors[ static_cast< size_t >(nEntry.first) ] = nEntry.second;
|
||||
}
|
||||
|
||||
struct StaticPresetColorsPool : public ::rtl::Static< PresetColorsPool, StaticPresetColorsPool > {};
|
||||
|
@@ -1873,8 +1873,8 @@ OUString StorageObjectBase::getSysFileName( const OUString& rStrmName, const OUS
|
||||
// replace all characters reserved in file system
|
||||
OUString aFileName = aBuffer.makeStringAndClear();
|
||||
static const sal_Unicode spcReserved[] = { '/', '\\', ':', '*', '?', '<', '>', '|' };
|
||||
for( const sal_Unicode* pcChar = spcReserved; pcChar < STATIC_ARRAY_END( spcReserved ); ++pcChar )
|
||||
aFileName = aFileName.replace( *pcChar, '_' );
|
||||
for(const sal_Unicode cChar : spcReserved)
|
||||
aFileName = aFileName.replace(cChar, '_');
|
||||
|
||||
// build full path
|
||||
return rSysOutPath + "/" + aFileName;
|
||||
|
Reference in New Issue
Block a user