summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/oox/drawingml/shapepropertymap.hxx79
-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
6 files changed, 121 insertions, 134 deletions
diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
index c75beb050fcb..3d793a4ee143 100644
--- a/include/oox/drawingml/shapepropertymap.hxx
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -24,6 +24,7 @@
#include <vector>
#include <com/sun/star/uno/Any.hxx>
+#include <o3tl/enumarray.hxx>
#include <oox/dllapi.h>
#include <oox/helper/propertymap.hxx>
#include <rtl/ustring.hxx>
@@ -43,41 +44,43 @@ namespace drawingml {
and spnFilledPropIds of oox/source/drawingml/chart/objectformatter.cxx if
the newly inserted enum is inside the range they cover
*/
-enum ShapePropertyId
+enum class ShapeProperty
{
- SHAPEPROP_LineStyle,
- SHAPEPROP_LineWidth,
- SHAPEPROP_LineColor,
- SHAPEPROP_LineTransparency,
- SHAPEPROP_LineDash, /// Explicit line dash or name of a line dash stored in a global container.
- SHAPEPROP_LineJoint,
- SHAPEPROP_LineStart, /// Explicit line start marker or name of a line marker stored in a global container.
- SHAPEPROP_LineStartWidth,
- SHAPEPROP_LineStartCenter,
- SHAPEPROP_LineEnd, /// Explicit line end marker or name of a line marker stored in a global container.
- SHAPEPROP_LineEndWidth,
- SHAPEPROP_LineEndCenter,
- SHAPEPROP_FillStyle,
- SHAPEPROP_FillColor,
- SHAPEPROP_FillTransparency,
- SHAPEPROP_GradientTransparency,
- SHAPEPROP_FillGradient, /// Explicit fill gradient or name of a fill gradient stored in a global container.
- SHAPEPROP_FillBitmapUrl, /// Explicit fill bitmap URL or name of a fill bitmap URL stored in a global container.
- SHAPEPROP_FillBitmapMode,
- SHAPEPROP_FillBitmapSizeX,
- SHAPEPROP_FillBitmapSizeY,
- SHAPEPROP_FillBitmapOffsetX,
- SHAPEPROP_FillBitmapOffsetY,
- SHAPEPROP_FillBitmapRectanglePoint,
- SHAPEPROP_FillHatch,
- SHAPEPROP_ShadowXDistance,
- SHAPEPROP_FillBitmapNameFromUrl,
- SHAPEPROP_END
+ LineStyle,
+ LineWidth,
+ LineColor,
+ LineTransparency,
+ LineDash, /// Explicit line dash or name of a line dash stored in a global container.
+ LineJoint,
+ LineStart, /// Explicit line start marker or name of a line marker stored in a global container.
+ LineStartWidth,
+ LineStartCenter,
+ LineEnd, /// Explicit line end marker or name of a line marker stored in a global container.
+ LineEndWidth,
+ LineEndCenter,
+ FillStyle,
+ FillColor,
+ FillTransparency,
+ GradientTransparency,
+ FillGradient, /// Explicit fill gradient or name of a fill gradient stored in a global container.
+ FillBitmapUrl, /// Explicit fill bitmap URL or name of a fill bitmap URL stored in a global container.
+ FillBitmapMode,
+ FillBitmapSizeX,
+ FillBitmapSizeY,
+ FillBitmapOffsetX,
+ FillBitmapOffsetY,
+ FillBitmapRectanglePoint,
+ FillHatch,
+ ShadowXDistance,
+ FillBitmapNameFromUrl,
+ LAST = FillBitmapNameFromUrl
};
+typedef o3tl::enumarray<ShapeProperty, sal_Int32> ShapePropertyIds;
+
struct OOX_DLLPUBLIC ShapePropertyInfo
{
- std::vector<sal_Int32> maPropertyIds;
+ const ShapePropertyIds& mrPropertyIds;
bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker.
bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash.
bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient.
@@ -86,14 +89,14 @@ struct OOX_DLLPUBLIC ShapePropertyInfo
static ShapePropertyInfo DEFAULT; /// Default property info (used as default parameter of other methods).
explicit ShapePropertyInfo(
- const sal_Int32* pnPropertyIds,
+ const ShapePropertyIds& rnPropertyIds,
bool bNamedLineMarker,
bool bNamedLineDash,
bool bNamedFillGradient,
bool bNamedFillBitmapUrl );
- bool has( ShapePropertyId ePropId ) const { return maPropertyIds.size() > size_t(ePropId) && maPropertyIds[ ePropId ] >= 0; }
- sal_Int32 operator[]( ShapePropertyId ePropId ) const { return maPropertyIds[ ePropId ]; }
+ bool has( ShapeProperty ePropId ) const { return mrPropertyIds[ ePropId ] >= 0; }
+ sal_Int32 operator[]( ShapeProperty ePropId ) const { return mrPropertyIds[ ePropId ]; }
};
@@ -105,18 +108,18 @@ public:
const ShapePropertyInfo& rShapePropInfo = ShapePropertyInfo::DEFAULT );
/** Returns true, if the specified property is supported. */
- bool supportsProperty( ShapePropertyId ePropId ) const;
+ bool supportsProperty( ShapeProperty ePropId ) const;
/** Returns true, if named line markers are supported, and the specified
line marker has already been inserted into the marker table. */
bool hasNamedLineMarkerInTable( const OUString& rMarkerName ) const;
/** Sets the specified shape property to the passed value. */
- bool setAnyProperty( ShapePropertyId ePropId, const css::uno::Any& rValue );
+ bool setAnyProperty( ShapeProperty ePropId, const css::uno::Any& rValue );
/** Sets the specified shape property to the passed value. */
template< typename Type >
- bool setProperty( ShapePropertyId ePropId, const Type& rValue )
+ bool setProperty( ShapeProperty ePropId, const Type& rValue )
{ return setAnyProperty( ePropId, css::uno::Any( rValue ) ); }
using PropertyMap::setAnyProperty;
@@ -137,8 +140,8 @@ private:
bool setFillBitmapNameFromUrl( sal_Int32 nPropId, const css::uno::Any& rValue );
// not implemented, to prevent implicit conversion from enum to int
- css::uno::Any& operator[]( ShapePropertyId ePropId ) = delete;
- const css::uno::Any& operator[]( ShapePropertyId ePropId ) const = delete;
+ css::uno::Any& operator[]( ShapeProperty ePropId ) = delete;
+ const css::uno::Any& operator[]( ShapeProperty ePropId ) const = delete;
private:
ModelObjectHelper& mrModelObjHelper;
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 );