summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/oox/drawingml/shapepropertymap.hxx79
1 files changed, 41 insertions, 38 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;