summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-09-16 23:18:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-09-17 16:33:53 +0000
commit4d6a17c60b38d453b6444a59da31fb7378e7f3b1 (patch)
treebad0df4e8a2bf3ab27b60cc8e068ad6028741f8c /oox
parent2aa61f07eccd3749d9e9f4a02f2e642bb03cad55 (diff)
convert ShapePropertyId to scoped enum and use it for enumarray
new type ShapePropertyIds replaces vector and plain arrays replace END enum member with LAST remove PROP_END_LIST from plain arrays and properties script store ShapepropertyInfo as reference in ObjectTypeFormatEntry store ShapePropertyIds as reference ShapePropertyInfo Change-Id: If273cc9e6c7bbd625dba5dc79f1c4ae0b21bdb3c Reviewed-on: https://gerrit.libreoffice.org/28960 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/chart/objectformatter.cxx78
-rw-r--r--oox/source/drawingml/fillproperties.cxx38
-rw-r--r--oox/source/drawingml/lineproperties.cxx24
-rw-r--r--oox/source/drawingml/shapepropertymap.cxx35
-rw-r--r--oox/source/token/properties.pl1
5 files changed, 80 insertions, 96 deletions
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index a26edfae72fd..b32cd560c0cf 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -442,32 +442,27 @@ const AutoTextEntry* lclGetAutoTextEntry( const AutoTextEntry* pEntries, sal_Int
return nullptr;
}
-// These PropIds arrays will be indexed into using a ShapePropertyId enum (include/oox/drawingml/shapepropertymap.hxx)
+// These PropIds arrays will be indexed into using a ShapeProperty enum
-/** Property identifiers for common chart objects, to be used in ShapePropertyInfo. */
-static const sal_Int32 spnCommonPropIds[] =
+static const ShapePropertyIds spnCommonPropIds =
{
PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDashName,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_INVALID, PROP_FillGradientName,
PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
- PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
- PROP_END_LIST
+ PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint
};
-/** Property identifiers for linear data series, to be used in ShapePropertyInfo. */
-static const sal_Int32 spnLinearPropIds[] =
+static const ShapePropertyIds spnLinearPropIds =
{
PROP_LineStyle, PROP_LineWidth, PROP_Color, PROP_Transparency, PROP_LineDashName,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
- PROP_INVALID, PROP_INVALID, PROP_INVALID,
- PROP_END_LIST
+ PROP_INVALID, PROP_INVALID, PROP_INVALID
};
-/** Property identifiers for filled data series, to be used in ShapePropertyInfo. */
-static const sal_Int32 spnFilledPropIds[] =
+static const ShapePropertyIds spnFilledPropIds =
{
PROP_BorderStyle,
PROP_BorderWidth,
@@ -493,8 +488,7 @@ static const sal_Int32 spnFilledPropIds[] =
PROP_FillBitmapPositionOffsetX,
PROP_FillBitmapPositionOffsetY,
PROP_FillBitmapRectanglePoint,
- PROP_FillHatch,
- PROP_END_LIST
+ PROP_FillHatch
};
/** Property info for common chart objects, to be used in ShapePropertyMap. */
@@ -508,7 +502,7 @@ static const ShapePropertyInfo saFilledPropInfo( spnFilledPropIds, false, true,
struct ObjectTypeFormatEntry
{
ObjectType meObjType; /// Object type for automatic format.
- const ShapePropertyInfo* mpPropInfo; /// Property info for the ShapePropertyMap class.
+ const ShapePropertyInfo& mrPropInfo; /// Property info for the ShapePropertyMap class.
const AutoFormatEntry* mpAutoLines; /// Automatic line formatting for all chart styles.
const AutoFormatEntry* mpAutoFills; /// Automatic fill formatting for all chart styles.
const AutoTextEntry* mpAutoTexts; /// Automatic text attributes for all chart styles.
@@ -524,32 +518,32 @@ struct ObjectTypeFormatEntry
static const ObjectTypeFormatEntry spObjTypeFormatEntries[] =
{
// object type property info auto text auto line auto fill
- TYPEFORMAT_FRAME( OBJECTTYPE_CHARTSPACE, &saCommonPropInfo, nullptr, spNoFormats, spChartSpaceFill ),
- TYPEFORMAT_FRAME( OBJECTTYPE_CHARTTITLE, &saCommonPropInfo, spChartTitleTexts, nullptr /* eq to Ch2 */, nullptr /* eq to Ch2 */),
- TYPEFORMAT_FRAME( OBJECTTYPE_LEGEND, &saCommonPropInfo, spOtherTexts, spNoFormats, spNoFormats ),
- TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA2D, &saCommonPropInfo, nullptr, nullptr /* eq to Ch2 */, spPlotArea2dFills ),
- TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA3D, &saCommonPropInfo, nullptr, nullptr /* eq to Ch2 */, nullptr /* eq to Ch2 */ ),
- TYPEFORMAT_FRAME( OBJECTTYPE_WALL, &saCommonPropInfo, nullptr, spWallFloorLines, spWallFloorFills ),
- TYPEFORMAT_FRAME( OBJECTTYPE_FLOOR, &saCommonPropInfo, nullptr, spWallFloorLines, spWallFloorFills ),
- TYPEFORMAT_LINE( OBJECTTYPE_AXIS, &saCommonPropInfo, spOtherTexts, spAxisLines ),
- TYPEFORMAT_FRAME( OBJECTTYPE_AXISTITLE, &saCommonPropInfo, spAxisTitleTexts, nullptr /* eq to Ch2 */, nullptr /* eq to Ch2 */ ),
- TYPEFORMAT_FRAME( OBJECTTYPE_AXISUNIT, &saCommonPropInfo, spAxisTitleTexts, nullptr /* eq in Ch2 */, nullptr /* eq in Ch2 */ ),
- TYPEFORMAT_LINE( OBJECTTYPE_MAJORGRIDLINE, &saCommonPropInfo, nullptr, spMajorGridLines ),
- TYPEFORMAT_LINE( OBJECTTYPE_MINORGRIDLINE, &saCommonPropInfo, nullptr, spMinorGridLines ),
- TYPEFORMAT_LINE( OBJECTTYPE_LINEARSERIES2D, &saLinearPropInfo, nullptr, spLinearSeriesLines ),
- TYPEFORMAT_FRAME( OBJECTTYPE_FILLEDSERIES2D, &saFilledPropInfo, nullptr, spFilledSeriesLines, spFilledSeries2dFills ),
- TYPEFORMAT_FRAME( OBJECTTYPE_FILLEDSERIES3D, &saFilledPropInfo, nullptr, spFilledSeriesLines, spFilledSeries3dFills ),
- TYPEFORMAT_FRAME( OBJECTTYPE_DATALABEL, &saCommonPropInfo, spOtherTexts, nullptr /* eq to Ch2 */, nullptr /* eq to Ch2 */ ),
- TYPEFORMAT_LINE( OBJECTTYPE_TRENDLINE, &saCommonPropInfo, nullptr, spOtherLines ),
- TYPEFORMAT_FRAME( OBJECTTYPE_TRENDLINELABEL, &saCommonPropInfo, spOtherTexts, nullptr /* eq to Ch2 */, nullptr /* eq to Ch2 */ ),
- TYPEFORMAT_LINE( OBJECTTYPE_ERRORBAR, &saCommonPropInfo, nullptr, spOtherLines ),
- TYPEFORMAT_LINE( OBJECTTYPE_SERLINE, &saCommonPropInfo, nullptr, spOtherLines ),
- TYPEFORMAT_LINE( OBJECTTYPE_LEADERLINE, &saCommonPropInfo, nullptr, spOtherLines ),
- TYPEFORMAT_LINE( OBJECTTYPE_DROPLINE, &saCommonPropInfo, nullptr, spOtherLines ),
- TYPEFORMAT_LINE( OBJECTTYPE_HILOLINE, &saLinearPropInfo, nullptr, spOtherLines ),
- TYPEFORMAT_FRAME( OBJECTTYPE_UPBAR, &saCommonPropInfo, nullptr, spUpDownBarLines, spUpBarFills ),
- TYPEFORMAT_FRAME( OBJECTTYPE_DOWNBAR, &saCommonPropInfo, nullptr, spUpDownBarLines, spDownBarFills ),
- TYPEFORMAT_LINE( OBJECTTYPE_DATATABLE, &saCommonPropInfo, spOtherTexts, spDataTableLines )
+ TYPEFORMAT_FRAME( OBJECTTYPE_CHARTSPACE, saCommonPropInfo, nullptr, spNoFormats, spChartSpaceFill ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_CHARTTITLE, saCommonPropInfo, spChartTitleTexts, nullptr /* eq to Ch2 */, nullptr /* eq to Ch2 */),
+ TYPEFORMAT_FRAME( OBJECTTYPE_LEGEND, saCommonPropInfo, spOtherTexts, spNoFormats, spNoFormats ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA2D, saCommonPropInfo, nullptr, nullptr /* eq to Ch2 */, spPlotArea2dFills ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA3D, saCommonPropInfo, nullptr, nullptr /* eq to Ch2 */, nullptr /* eq to Ch2 */ ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_WALL, saCommonPropInfo, nullptr, spWallFloorLines, spWallFloorFills ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_FLOOR, saCommonPropInfo, nullptr, spWallFloorLines, spWallFloorFills ),
+ TYPEFORMAT_LINE( OBJECTTYPE_AXIS, saCommonPropInfo, spOtherTexts, spAxisLines ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_AXISTITLE, saCommonPropInfo, spAxisTitleTexts, nullptr /* eq to Ch2 */, nullptr /* eq to Ch2 */ ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_AXISUNIT, saCommonPropInfo, spAxisTitleTexts, nullptr /* eq in Ch2 */, nullptr /* eq in Ch2 */ ),
+ TYPEFORMAT_LINE( OBJECTTYPE_MAJORGRIDLINE, saCommonPropInfo, nullptr, spMajorGridLines ),
+ TYPEFORMAT_LINE( OBJECTTYPE_MINORGRIDLINE, saCommonPropInfo, nullptr, spMinorGridLines ),
+ TYPEFORMAT_LINE( OBJECTTYPE_LINEARSERIES2D, saLinearPropInfo, nullptr, spLinearSeriesLines ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_FILLEDSERIES2D, saFilledPropInfo, nullptr, spFilledSeriesLines, spFilledSeries2dFills ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_FILLEDSERIES3D, saFilledPropInfo, nullptr, spFilledSeriesLines, spFilledSeries3dFills ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_DATALABEL, saCommonPropInfo, spOtherTexts, nullptr /* eq to Ch2 */, nullptr /* eq to Ch2 */ ),
+ TYPEFORMAT_LINE( OBJECTTYPE_TRENDLINE, saCommonPropInfo, nullptr, spOtherLines ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_TRENDLINELABEL, saCommonPropInfo, spOtherTexts, nullptr /* eq to Ch2 */, nullptr /* eq to Ch2 */ ),
+ TYPEFORMAT_LINE( OBJECTTYPE_ERRORBAR, saCommonPropInfo, nullptr, spOtherLines ),
+ TYPEFORMAT_LINE( OBJECTTYPE_SERLINE, saCommonPropInfo, nullptr, spOtherLines ),
+ TYPEFORMAT_LINE( OBJECTTYPE_LEADERLINE, saCommonPropInfo, nullptr, spOtherLines ),
+ TYPEFORMAT_LINE( OBJECTTYPE_DROPLINE, saCommonPropInfo, nullptr, spOtherLines ),
+ TYPEFORMAT_LINE( OBJECTTYPE_HILOLINE, saLinearPropInfo, nullptr, spOtherLines ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_UPBAR, saCommonPropInfo, nullptr, spUpDownBarLines, spUpBarFills ),
+ TYPEFORMAT_FRAME( OBJECTTYPE_DOWNBAR, saCommonPropInfo, nullptr, spUpDownBarLines, spDownBarFills ),
+ TYPEFORMAT_LINE( OBJECTTYPE_DATATABLE, saCommonPropInfo, spOtherTexts, spDataTableLines )
};
#undef TYPEFORMAT_FRAME
@@ -924,7 +918,7 @@ ObjectTypeFormatter::ObjectTypeFormatter( ObjectFormatterData& rData, const Obje
void ObjectTypeFormatter::convertFrameFormatting( PropertySet& rPropSet, const ModelRef< Shape >& rxShapeProp, const PictureOptionsModel* pPicOptions, sal_Int32 nSeriesIdx )
{
- ShapePropertyMap aPropMap( mrModelObjHelper, *mrEntry.mpPropInfo );
+ ShapePropertyMap aPropMap( mrModelObjHelper, mrEntry.mrPropInfo );
maLineFormatter.convertFormatting( aPropMap, rxShapeProp, nSeriesIdx );
if( mrEntry.mbIsFrame )
maFillFormatter.convertFormatting( aPropMap, rxShapeProp, pPicOptions, nSeriesIdx );
@@ -949,7 +943,7 @@ void ObjectTypeFormatter::convertTextFormatting( PropertySet& rPropSet, const Te
void ObjectTypeFormatter::convertAutomaticFill( PropertySet& rPropSet, sal_Int32 nSeriesIdx )
{
- ShapePropertyMap aPropMap( mrModelObjHelper, *mrEntry.mpPropInfo );
+ ShapePropertyMap aPropMap( mrModelObjHelper, mrEntry.mrPropInfo );
ModelRef< Shape > xShapeProp;
maFillFormatter.convertFormatting( aPropMap, xShapeProp, nullptr, nSeriesIdx );
rPropSet.setProperties( aPropMap );
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 81a3726b8088..370be6804d6a 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -326,16 +326,16 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
case XML_solidFill:
if( maFillColor.isUsed() )
{
- rPropMap.setProperty( SHAPEPROP_FillColor, maFillColor.getColor( rGraphicHelper, nPhClr ) );
+ rPropMap.setProperty( ShapeProperty::FillColor, maFillColor.getColor( rGraphicHelper, nPhClr ) );
if( maFillColor.hasTransparency() )
- rPropMap.setProperty( SHAPEPROP_FillTransparency, maFillColor.getTransparency() );
+ rPropMap.setProperty( ShapeProperty::FillTransparency, maFillColor.getTransparency() );
eFillStyle = FillStyle_SOLID;
}
break;
case XML_gradFill:
// do not create gradient struct if property is not supported...
- if( rPropMap.supportsProperty( SHAPEPROP_FillGradient ) )
+ if( rPropMap.supportsProperty( ShapeProperty::FillGradient ) )
{
sal_Int32 nEndTrans = 0;
sal_Int32 nStartTrans = 0;
@@ -570,7 +570,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
}
// push gradient or named gradient to property map
- if( rPropMap.setProperty( SHAPEPROP_FillGradient, aGradient ) )
+ if( rPropMap.setProperty( ShapeProperty::FillGradient, aGradient ) )
eFillStyle = FillStyle_GRADIENT;
// push gradient transparency to property map
@@ -581,7 +581,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
aGrad.EndColor = (sal_Int32)( nEndTrans | nEndTrans << 8 | nEndTrans << 16 );
aGrad.StartColor = (sal_Int32)( nStartTrans | nStartTrans << 8 | nStartTrans << 16 );
aVal <<= aGrad;
- rPropMap.setProperty( SHAPEPROP_GradientTransparency, aGrad );
+ rPropMap.setProperty( ShapeProperty::GradientTransparency, aGrad );
}
}
@@ -589,16 +589,16 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
case XML_blipFill:
// do not start complex graphic transformation if property is not supported...
- if( maBlipProps.mxGraphic.is() && rPropMap.supportsProperty( SHAPEPROP_FillBitmapUrl ) )
+ if( maBlipProps.mxGraphic.is() && rPropMap.supportsProperty( ShapeProperty::FillBitmapUrl ) )
{
Reference< XGraphic > xGraphic = lclCheckAndApplyDuotoneTransform( maBlipProps, maBlipProps.mxGraphic, rGraphicHelper, nPhClr );
// TODO: "rotate with shape" is not possible with our current core
OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic );
// push bitmap or named bitmap to property map
- if( !aGraphicUrl.isEmpty() && rPropMap.supportsProperty( SHAPEPROP_FillBitmapNameFromUrl ) && rPropMap.setProperty( SHAPEPROP_FillBitmapNameFromUrl, aGraphicUrl ) )
+ if( !aGraphicUrl.isEmpty() && rPropMap.supportsProperty( ShapeProperty::FillBitmapNameFromUrl ) && rPropMap.setProperty( ShapeProperty::FillBitmapNameFromUrl, aGraphicUrl ) )
eFillStyle = FillStyle_BITMAP;
- else if( !aGraphicUrl.isEmpty() && rPropMap.setProperty( SHAPEPROP_FillBitmapUrl, aGraphicUrl ) )
+ else if( !aGraphicUrl.isEmpty() && rPropMap.setProperty( ShapeProperty::FillBitmapUrl, aGraphicUrl ) )
eFillStyle = FillStyle_BITMAP;
// set other bitmap properties, if bitmap has been inserted into the map
@@ -606,14 +606,14 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
{
// bitmap mode (single, repeat, stretch)
BitmapMode eBitmapMode = lclGetBitmapMode( maBlipProps.moBitmapMode.get( XML_TOKEN_INVALID ) );
- rPropMap.setProperty( SHAPEPROP_FillBitmapMode, eBitmapMode );
+ rPropMap.setProperty( ShapeProperty::FillBitmapMode, eBitmapMode );
// additional settings for repeated bitmap
if( eBitmapMode == BitmapMode_REPEAT )
{
// anchor position inside bitmap
RectanglePoint eRectPoint = lclGetRectanglePoint( maBlipProps.moTileAlign.get( XML_tl ) );
- rPropMap.setProperty( SHAPEPROP_FillBitmapRectanglePoint, eRectPoint );
+ rPropMap.setProperty( ShapeProperty::FillBitmapRectanglePoint, eRectPoint );
awt::Size aOriginalSize = lclGetOriginalSize( rGraphicHelper, maBlipProps.mxGraphic );
if( (aOriginalSize.Width > 0) && (aOriginalSize.Height > 0) )
@@ -621,16 +621,16 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
// size of one bitmap tile (given as 1/1000 percent of bitmap size), convert to 1/100 mm
double fScaleX = maBlipProps.moTileScaleX.get( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT );
sal_Int32 nFillBmpSizeX = getLimitedValue< sal_Int32, double >( aOriginalSize.Width * fScaleX, 1, SAL_MAX_INT32 );
- rPropMap.setProperty( SHAPEPROP_FillBitmapSizeX, nFillBmpSizeX );
+ rPropMap.setProperty( ShapeProperty::FillBitmapSizeX, nFillBmpSizeX );
double fScaleY = maBlipProps.moTileScaleY.get( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT );
sal_Int32 nFillBmpSizeY = getLimitedValue< sal_Int32, double >( aOriginalSize.Height * fScaleY, 1, SAL_MAX_INT32 );
- rPropMap.setProperty( SHAPEPROP_FillBitmapSizeY, nFillBmpSizeY );
+ rPropMap.setProperty( ShapeProperty::FillBitmapSizeY, nFillBmpSizeY );
// offset of the first bitmap tile (given as EMUs), convert to percent
sal_Int16 nTileOffsetX = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetX.get( 0 ) / 3.6 / aOriginalSize.Width, 0, 100 );
- rPropMap.setProperty( SHAPEPROP_FillBitmapOffsetX, nTileOffsetX );
+ rPropMap.setProperty( ShapeProperty::FillBitmapOffsetX, nTileOffsetX );
sal_Int16 nTileOffsetY = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetY.get( 0 ) / 3.6 / aOriginalSize.Height, 0, 100 );
- rPropMap.setProperty( SHAPEPROP_FillBitmapOffsetY, nTileOffsetY );
+ rPropMap.setProperty( ShapeProperty::FillBitmapOffsetY, nTileOffsetY );
}
}
else if ( eBitmapMode == BitmapMode_STRETCH && maBlipProps.moFillRect.has() )
@@ -657,7 +657,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
case XML_pattFill:
{
- if( rPropMap.supportsProperty( SHAPEPROP_FillHatch ) )
+ if( rPropMap.supportsProperty( ShapeProperty::FillHatch ) )
{
Color aColor( maPatternProps.maPattFgColor );
if( aColor.isUsed() && maPatternProps.moPattPreset.has() )
@@ -665,14 +665,14 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
// we do not support hatches that have background
// color too, so all this is some best-effort approach
eFillStyle = FillStyle_HATCH;
- rPropMap.setProperty( SHAPEPROP_FillHatch, createHatch( maPatternProps.moPattPreset.get(), aColor.getColor( rGraphicHelper, nPhClr ) ) );
+ rPropMap.setProperty( ShapeProperty::FillHatch, createHatch( maPatternProps.moPattPreset.get(), aColor.getColor( rGraphicHelper, nPhClr ) ) );
}
else if ( maPatternProps.maPattBgColor.isUsed() )
{
aColor = maPatternProps.maPattBgColor;
- rPropMap.setProperty( SHAPEPROP_FillColor, aColor.getColor( rGraphicHelper, nPhClr ) );
+ rPropMap.setProperty( ShapeProperty::FillColor, aColor.getColor( rGraphicHelper, nPhClr ) );
if( aColor.hasTransparency() )
- rPropMap.setProperty( SHAPEPROP_FillTransparency, aColor.getTransparency() );
+ rPropMap.setProperty( ShapeProperty::FillTransparency, aColor.getTransparency() );
eFillStyle = FillStyle_SOLID;
}
}
@@ -686,7 +686,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
}
// set final fill style property
- rPropMap.setProperty( SHAPEPROP_FillStyle, eFillStyle );
+ rPropMap.setProperty( ShapeProperty::FillStyle, eFillStyle );
}
}
diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx
index 003dde4329f5..b6dd5973a900 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -320,15 +320,15 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap,
{
if( bLineEnd )
{
- rPropMap.setProperty( SHAPEPROP_LineEnd, aNamedMarker );
- rPropMap.setProperty( SHAPEPROP_LineEndWidth, nMarkerWidth );
- rPropMap.setProperty( SHAPEPROP_LineEndCenter, bMarkerCenter );
+ rPropMap.setProperty( ShapeProperty::LineEnd, aNamedMarker );
+ rPropMap.setProperty( ShapeProperty::LineEndWidth, nMarkerWidth );
+ rPropMap.setProperty( ShapeProperty::LineEndCenter, bMarkerCenter );
}
else
{
- rPropMap.setProperty( SHAPEPROP_LineStart, aNamedMarker );
- rPropMap.setProperty( SHAPEPROP_LineStartWidth, nMarkerWidth );
- rPropMap.setProperty( SHAPEPROP_LineStartCenter, bMarkerCenter );
+ rPropMap.setProperty( ShapeProperty::LineStart, aNamedMarker );
+ rPropMap.setProperty( ShapeProperty::LineStartWidth, nMarkerWidth );
+ rPropMap.setProperty( ShapeProperty::LineStartCenter, bMarkerCenter );
}
}
}
@@ -386,27 +386,27 @@ void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap,
aLineDash.DashLen *= nBaseLineWidth;
aLineDash.Distance *= nBaseLineWidth;
- if( rPropMap.setProperty( SHAPEPROP_LineDash, aLineDash ) )
+ if( rPropMap.setProperty( ShapeProperty::LineDash, aLineDash ) )
eLineStyle = drawing::LineStyle_DASH;
}
// set final line style property
- rPropMap.setProperty( SHAPEPROP_LineStyle, eLineStyle );
+ rPropMap.setProperty( ShapeProperty::LineStyle, eLineStyle );
// line joint type
if( moLineJoint.has() )
- rPropMap.setProperty( SHAPEPROP_LineJoint, lclGetLineJoint( moLineJoint.get() ) );
+ rPropMap.setProperty( ShapeProperty::LineJoint, lclGetLineJoint( moLineJoint.get() ) );
// line width in 1/100mm
- rPropMap.setProperty( SHAPEPROP_LineWidth, nLineWidth );
+ rPropMap.setProperty( ShapeProperty::LineWidth, nLineWidth );
// line color and transparence
Color aLineColor = maLineFill.getBestSolidColor();
if( aLineColor.isUsed() )
{
- rPropMap.setProperty( SHAPEPROP_LineColor, aLineColor.getColor( rGraphicHelper, nPhClr ) );
+ rPropMap.setProperty( ShapeProperty::LineColor, aLineColor.getColor( rGraphicHelper, nPhClr ) );
if( aLineColor.hasTransparency() )
- rPropMap.setProperty( SHAPEPROP_LineTransparency, aLineColor.getTransparency() );
+ rPropMap.setProperty( ShapeProperty::LineTransparency, aLineColor.getTransparency() );
}
// line markers
diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx
index 7ffecabd9135..aca31842bae9 100644
--- a/oox/source/drawingml/shapepropertymap.cxx
+++ b/oox/source/drawingml/shapepropertymap.cxx
@@ -36,7 +36,7 @@ using namespace ::com::sun::star::uno;
namespace {
-static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END + 1 ] = // one for the PROP_END_LIST
+static const ShapePropertyIds spnDefaultShapeIds =
{
PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDash, PROP_LineJoint,
PROP_LineStartName, PROP_LineStartWidth, PROP_LineStartCenter, PROP_LineEndName, PROP_LineEndWidth, PROP_LineEndCenter,
@@ -45,30 +45,21 @@ static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END + 1 ] = // one for the
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
PROP_FillHatch,
PROP_ShadowXDistance,
- PROP_FillBitmapName,
- PROP_END_LIST
+ PROP_FillBitmapName
};
} // namespace
ShapePropertyInfo ShapePropertyInfo::DEFAULT( spnDefaultShapeIds, true, false, false, false );
-ShapePropertyInfo::ShapePropertyInfo( const sal_Int32* pnPropertyIds,
+ShapePropertyInfo::ShapePropertyInfo( const ShapePropertyIds& rnPropertyIds,
bool bNamedLineMarker, bool bNamedLineDash, bool bNamedFillGradient, bool bNamedFillBitmapUrl ) :
+ mrPropertyIds(rnPropertyIds),
mbNamedLineMarker( bNamedLineMarker ),
mbNamedLineDash( bNamedLineDash ),
mbNamedFillGradient( bNamedFillGradient ),
mbNamedFillBitmapUrl( bNamedFillBitmapUrl )
{
- assert(pnPropertyIds);
- // normally we should not reach PROP_COUNT but it prevents infinite loops if we hit a bug
- for(size_t i = 0; i < static_cast<size_t>(PROP_COUNT); ++i)
- {
- if(pnPropertyIds[i] == PROP_END_LIST)
- break;
-
- maPropertyIds.push_back(pnPropertyIds[i]);
- }
}
ShapePropertyMap::ShapePropertyMap( ModelObjectHelper& rModelObjHelper, const ShapePropertyInfo& rShapePropInfo ) :
@@ -77,7 +68,7 @@ ShapePropertyMap::ShapePropertyMap( ModelObjectHelper& rModelObjHelper, const Sh
{
}
-bool ShapePropertyMap::supportsProperty( ShapePropertyId ePropId ) const
+bool ShapePropertyMap::supportsProperty( ShapeProperty ePropId ) const
{
return maShapePropInfo.has( ePropId );
}
@@ -87,7 +78,7 @@ bool ShapePropertyMap::hasNamedLineMarkerInTable( const OUString& rMarkerName )
return maShapePropInfo.mbNamedLineMarker && mrModelObjHelper.hasLineMarker( rMarkerName );
}
-bool ShapePropertyMap::setAnyProperty( ShapePropertyId ePropId, const Any& rValue )
+bool ShapePropertyMap::setAnyProperty( ShapeProperty ePropId, const Any& rValue )
{
// get current property identifier for the specified property
sal_Int32 nPropId = maShapePropInfo[ ePropId ];
@@ -96,23 +87,23 @@ bool ShapePropertyMap::setAnyProperty( ShapePropertyId ePropId, const Any& rValu
// special handling for properties supporting named objects in tables
switch( ePropId )
{
- case SHAPEPROP_LineStart:
- case SHAPEPROP_LineEnd:
+ case ShapeProperty::LineStart:
+ case ShapeProperty::LineEnd:
return setLineMarker( nPropId, rValue );
- case SHAPEPROP_LineDash:
+ case ShapeProperty::LineDash:
return setLineDash( nPropId, rValue );
- case SHAPEPROP_FillGradient:
+ case ShapeProperty::FillGradient:
return setFillGradient( nPropId, rValue );
- case SHAPEPROP_GradientTransparency:
+ case ShapeProperty::GradientTransparency:
return setGradientTrans( nPropId, rValue );
- case SHAPEPROP_FillBitmapUrl:
+ case ShapeProperty::FillBitmapUrl:
return setFillBitmapUrl( nPropId, rValue );
- case SHAPEPROP_FillBitmapNameFromUrl:
+ case ShapeProperty::FillBitmapNameFromUrl:
return setFillBitmapNameFromUrl( nPropId, rValue );
default:; // suppress compiler warnings
diff --git a/oox/source/token/properties.pl b/oox/source/token/properties.pl
index 3a8e87208410..d2a2d80153ef 100644
--- a/oox/source/token/properties.pl
+++ b/oox/source/token/properties.pl
@@ -53,7 +53,6 @@ foreach( sort( keys( %props ) ) )
print( IDFILE "const sal_Int32 PROP_COUNT = $i;\n" );
print( IDFILE "const sal_Int32 PROP_INVALID = -1;\n" );
-print( IDFILE "const sal_Int32 PROP_END_LIST = -2;\n" );
close( IDFILE );
close( NAMEFILE );