filter/source/msfilter/escherex.cxx    |   47 ++++++------
 filter/source/msfilter/eschesdo.cxx    |   89 ++++++++++++------------
 filter/source/msfilter/msdffimp.cxx    |   77 +++++++++++----------
 filter/source/msfilter/svdfppt.cxx     |   14 +--
 include/filter/msfilter/escherex.hxx   |   33 ++++++---
 include/filter/msfilter/msdffimp.hxx   |   26 ++-----
 include/oox/export/vmlexport.hxx       |    4 -
 oox/source/export/shapes.cxx           |    2 
 oox/source/export/vmlexport.cxx        |   17 ++--
 sc/source/filter/excel/xeescher.cxx    |    7 +
 sc/source/filter/excel/xiescher.cxx    |   10 +-
 sc/source/filter/inc/xiescher.hxx      |   14 +--
 sc/source/filter/xcl97/xcl97rec.cxx    |    4 -
 sd/source/filter/eppt/eppt.cxx         |    9 +-
 sd/source/filter/eppt/eppt.hxx         |    2 
 sd/source/filter/eppt/epptso.cxx       |  120 +++++++++++++++++++++++----------
 sd/source/filter/eppt/escherex.cxx     |    4 -
 sw/source/filter/ww8/docxsdrexport.cxx |    2 
 sw/source/filter/ww8/escher.hxx        |    2 
 sw/source/filter/ww8/rtfsdrexport.cxx  |   18 +---
 sw/source/filter/ww8/rtfsdrexport.hxx  |    4 -
 sw/source/filter/ww8/wrtw8esh.cxx      |   34 +++++----
 sw/source/filter/ww8/ww8graf.cxx       |    4 -
 sw/source/filter/ww8/ww8par.cxx        |    8 +-
 24 files changed, 306 insertions(+), 245 deletions(-)

New commits:
commit 31ee13b5a40715e217711e48753eeb7170e3349c
Author: Jochen Nitschke <j.nitschke+loger...@ok.de>
Date:   Thu Aug 31 14:13:46 2017 +0200

    convert SHAPEFLAG defines to scoped enum ShapeFlag
    
    they were defined in escherex.hxx as SHAPEFLAG_*
    and in msdffimp.hxx as SP_*.
    
    Added include for escherex.hxx to msdffimp.hxx.
    Filled the missing flag bits.
    ShapeFlag::Deleted is not used at the moment.
    Convert ADD_SHAPE macro to lambda.
    Fix horizontal/vertical mixup in RtfSdrExport::AddLineDimensions.
    
    Comments for flag Connector were wrong. The flag applies to shapes
    which ARE connectors.
    MSO definition: "connector: A line that is used to connect two
    or more shapes and that remains connected to those shapes."
    So Rectangles and such with Connector flag don't make sense.
    
    Change-Id: I735de00110411b280a302840dc0fcdfac5156399
    Reviewed-on: https://gerrit.libreoffice.org/41754
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/filter/source/msfilter/escherex.cxx 
b/filter/source/msfilter/escherex.cxx
index 9660cbfccf07..84530d4e4269 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -2123,7 +2123,7 @@ void lcl_Rotate(sal_Int32 nAngle, Point center, Point& pt)
 Generally, draw the connector from top to bottom, from left to right when meet 
the adjust value,
 but when (X1>X2 or Y1>Y2),the draw director must be reverse, FlipV or FlipH 
should be set to true.
 */
-bool lcl_GetAngle(tools::Polygon &rPoly,sal_uInt16& rShapeFlags,sal_Int32& 
nAngle )
+bool lcl_GetAngle(tools::Polygon &rPoly, ShapeFlag& rShapeFlags,sal_Int32& 
nAngle )
 {
     Point aStart = rPoly[0];
     Point aEnd = rPoly[rPoly.GetSize()-1];
@@ -2139,22 +2139,22 @@ bool lcl_GetAngle(tools::Polygon &rPoly,sal_uInt16& 
rShapeFlags,sal_Int32& nAngl
     if (  p1.X() > p2.X() )
     {
         if ( nAngle )
-            rShapeFlags |= SHAPEFLAG_FLIPV;
+            rShapeFlags |= ShapeFlag::FlipV;
         else
-            rShapeFlags |= SHAPEFLAG_FLIPH;
+            rShapeFlags |= ShapeFlag::FlipH;
 
     }
     if (  p1.Y() > p2.Y()  )
     {
         if ( nAngle )
-            rShapeFlags |= SHAPEFLAG_FLIPH;
+            rShapeFlags |= ShapeFlag::FlipH;
         else
-            rShapeFlags |= SHAPEFLAG_FLIPV;
+            rShapeFlags |= ShapeFlag::FlipV;
     }
 
-    if ( (rShapeFlags&SHAPEFLAG_FLIPH) && (rShapeFlags&SHAPEFLAG_FLIPV) )
+    if ( (rShapeFlags&ShapeFlag::FlipH) && (rShapeFlags&ShapeFlag::FlipV) )
     {
-        rShapeFlags  &= ~( SHAPEFLAG_FLIPH | SHAPEFLAG_FLIPV );
+        rShapeFlags  &= ~ShapeFlag( ShapeFlag::FlipH | ShapeFlag::FlipV );
         nAngle +=18000;
     }
 
@@ -2171,10 +2171,11 @@ bool lcl_GetAngle(tools::Polygon &rPoly,sal_uInt16& 
rShapeFlags,sal_Int32& nAngl
 bool EscherPropertyContainer::CreateConnectorProperties(
     const css::uno::Reference< css::drawing::XShape > & rXShape,
     EscherSolverContainer& rSolverContainer, css::awt::Rectangle& rGeoRect,
-            sal_uInt16& rShapeType, sal_uInt16& rShapeFlags )
+            sal_uInt16& rShapeType, ShapeFlag& rShapeFlags )
 {
     bool bRetValue = false;
-    rShapeType = rShapeFlags = 0;
+    rShapeType = 0;
+    rShapeFlags = ShapeFlag::NONE;
 
     if ( rXShape.is() )
     {
@@ -2195,7 +2196,7 @@ bool EscherPropertyContainer::CreateConnectorProperties(
                     {
                         aEndPoint = *o3tl::doAccess<css::awt::Point>(aAny);
 
-                        rShapeFlags = SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_HAVESPT 
| SHAPEFLAG_CONNECTOR;
+                        rShapeFlags = ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty | ShapeFlag::Connector;
                         rGeoRect = css::awt::Rectangle( aStartPoint.X, 
aStartPoint.Y,
                                                             ( aEndPoint.X - 
aStartPoint.X ) + 1, ( aEndPoint.Y - aStartPoint.Y ) + 1 );
                         // set standard's FLIP in below code
@@ -2203,13 +2204,13 @@ bool EscherPropertyContainer::CreateConnectorProperties(
                         {
                             if ( rGeoRect.Height < 0 )          // justify
                             {
-                                rShapeFlags |= SHAPEFLAG_FLIPV;
+                                rShapeFlags |= ShapeFlag::FlipV;
                                 rGeoRect.Y = aEndPoint.Y;
                                 rGeoRect.Height = -rGeoRect.Height;
                             }
                             if ( rGeoRect.Width < 0 )
                             {
-                                rShapeFlags |= SHAPEFLAG_FLIPH;
+                                rShapeFlags |= ShapeFlag::FlipH;
                                 rGeoRect.X = aEndPoint.X;
                                 rGeoRect.Width = -rGeoRect.Width;
                             }
@@ -3720,10 +3721,10 @@ void 
EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
     }
 }
 
-MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< 
drawing::XShape > & rXShape, sal_uInt32& nMirrorFlags, OUString& rShapeType, 
bool bOOXML )
+MSO_SPT EscherPropertyContainer::GetCustomShapeType( const uno::Reference< 
drawing::XShape > & rXShape, ShapeFlag& nMirrorFlags, OUString& rShapeType, 
bool bOOXML )
 {
     MSO_SPT eShapeType = mso_sptNil;
-    nMirrorFlags = 0;
+    nMirrorFlags = ShapeFlag::NONE;
     uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
     if ( aXPropSet.is() )
     {
@@ -3760,13 +3761,13 @@ MSO_SPT EscherPropertyContainer::GetCustomShapeType( 
const uno::Reference< drawi
                     {
                         bool bMirroredX;
                         if ( ( rProp.Value >>= bMirroredX ) && bMirroredX )
-                            nMirrorFlags  |= SHAPEFLAG_FLIPH;
+                            nMirrorFlags  |= ShapeFlag::FlipH;
                     }
                     else if ( rProp.Name == "MirroredY" )
                     {
                         bool bMirroredY;
                         if ( ( rProp.Value >>= bMirroredY ) && bMirroredY )
-                            nMirrorFlags  |= SHAPEFLAG_FLIPV;
+                            nMirrorFlags  |= ShapeFlag::FlipV;
                     }
                 }
             }
@@ -5218,10 +5219,10 @@ sal_uInt32 EscherEx::EnterGroup( const OUString& 
rShapeName, const tools::Rectan
 
     sal_uInt32 nShapeId = GenerateShapeId();
     if ( !mnGroupLevel )
-        AddShape( ESCHER_ShpInst_Min, 5, nShapeId );                    // 
Flags: Group | Patriarch
+        AddShape( ESCHER_ShpInst_Min, ShapeFlag::Group | ShapeFlag::Patriarch, 
nShapeId );
     else
     {
-        AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId );                // 
Flags: Group | HaveAnchor
+        AddShape( ESCHER_ShpInst_Min, ShapeFlag::Group | 
ShapeFlag::HaveAnchor, nShapeId );
         EscherPropertyContainer aPropOpt;
         aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x00040004 );
         aPropOpt.AddOpt( ESCHER_Prop_dxWrapDistLeft, 0 );
@@ -5290,19 +5291,19 @@ void EscherEx::LeaveGroup()
     CloseContainer();
 }
 
-void EscherEx::AddShape( sal_uInt32 nShpInstance, sal_uInt32 nFlags, 
sal_uInt32 nShapeID )
+void EscherEx::AddShape( sal_uInt32 nShpInstance, ShapeFlag nFlags, sal_uInt32 
nShapeID )
 {
     AddAtom( 8, ESCHER_Sp, 2, nShpInstance );
 
     if ( !nShapeID )
         nShapeID = GenerateShapeId();
 
-    if ( nFlags ^ 1 )                           // is this a group shape ?
-    {                                           // if not
+    if (!(nFlags & ShapeFlag::Group))
+    {
         if ( mnGroupLevel > 1 )
-            nFlags |= 2;                        // this not a topmost shape
+            nFlags |= ShapeFlag::Child; // this not a topmost shape
     }
-    mpOutStrm->WriteUInt32( nShapeID ).WriteUInt32( nFlags );
+    mpOutStrm->WriteUInt32( nShapeID ).WriteUInt32( 
static_cast<sal_uInt32>(nFlags) );
 }
 
 void EscherEx::Commit( EscherPropertyContainer& rProps, const 
tools::Rectangle& )
diff --git a/filter/source/msfilter/eschesdo.cxx 
b/filter/source/msfilter/eschesdo.cxx
index d203e7827c5b..c84f80485857 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -143,15 +143,6 @@ void ImplEESdrWriter::ImplFlipBoundingBox( 
ImplEESdrObject& rObj, EscherProperty
 }
 
 
-#define ADD_SHAPE( nType, nFlags )                              \
-{                                                               \
-    nShapeType = nType;                                         \
-    nShapeID = mpEscherEx->GenerateShapeId();                   \
-    rObj.SetShapeId( nShapeID );                                \
-    mpEscherEx->AddShape( (sal_uInt32)nType, nFlags, nShapeID );    \
-    rSolverContainer.AddShape( rObj.GetShapeRef(), nShapeID );  \
-}
-
 sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
                                 EscherSolverContainer& rSolverContainer,
                                 const bool bOOxmlExport )
@@ -161,6 +152,14 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
     bool bDontWriteText = false;        // if a metafile is written as shape 
replacement, then the text is already part of the metafile
     bool bAdditionalText = false;
     sal_uInt32 nGrpShapeID = 0;
+    auto addShape = [this, &rObj, &rSolverContainer, &nShapeID, 
&nShapeType](sal_uInt16 nType, ShapeFlag nFlags)
+    {
+        nShapeType = nType;
+        nShapeID = mpEscherEx->GenerateShapeId();
+        rObj.SetShapeId( nShapeID );
+        mpEscherEx->AddShape( nType, nFlags, nShapeID );
+        rSolverContainer.AddShape( rObj.GetShapeRef(), nShapeID );
+    };
 
     do {
         mpHostAppData = mpEscherEx->StartShape( rObj.GetShapeRef(), 
(mpEscherEx->GetGroupLevel() > 1) ? &rObj.GetRect() : nullptr );
@@ -258,13 +257,14 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
         if ( rObj.GetType() == "drawing.Custom" )
         {
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            sal_uInt32 nMirrorFlags;
+            ShapeFlag nMirrorFlags;
 
             OUString sCustomShapeType;
             MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType( 
rObj.GetShapeRef(), nMirrorFlags, sCustomShapeType, rObj.GetOOXML() );
             if ( sCustomShapeType == "col-502ad400" || sCustomShapeType == 
"col-60da8460" )
             {
-                ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
+                addShape( ESCHER_ShpInst_PictureFrame, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
+
                 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, 
"MetaFile", false ) )
                 {
                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 
);
@@ -284,9 +284,8 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
             }
             else
             {
-                ADD_SHAPE(
-                    sal::static_int_cast< sal_uInt16 >(eShapeType),
-                    nMirrorFlags | 0xa00 );
+                addShape(sal::static_int_cast< sal_uInt16 >(eShapeType),
+                         nMirrorFlags | ShapeFlag::HaveShapeProperty | 
ShapeFlag::HaveAnchor);
                 aPropOpt.CreateCustomShapeProperties( eShapeType, 
rObj.GetShapeRef() );
                 aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
                 if ( rObj.ImplGetText() )
@@ -304,7 +303,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
             if( nRadius )
             {
                 nRadius = ImplMapSize( Size( nRadius, 0 )).Width();
-                ADD_SHAPE( ESCHER_ShpInst_RoundRectangle, 0xa00 );  // Flags: 
Connector | HasSpt
+                addShape( ESCHER_ShpInst_RoundRectangle, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
                 sal_Int32 nLength = rObj.GetRect().GetWidth();
                 if ( nLength > rObj.GetRect().GetHeight() )
                     nLength = rObj.GetRect().GetHeight();
@@ -317,7 +316,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
             }
             else
             {
-                ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0xa00 );           // 
Flags: Connector | HasSpt
+                addShape( ESCHER_ShpInst_Rectangle, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
             }
             aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
             if( rObj.ImplGetText() )
@@ -358,7 +357,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
             if ( eCircleKind == CircleKind_FULL )
             {
                 mpEscherEx->OpenContainer( ESCHER_SpContainer );
-                ADD_SHAPE( ESCHER_ShpInst_Ellipse, 0xa00 );         // Flags: 
Connector | HasSpt
+                addShape( ESCHER_ShpInst_Ellipse, ShapeFlag::HaveShapeProperty 
| ShapeFlag::HaveAnchor );
                 aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
             }
             else
@@ -390,7 +389,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
                     rObj.SetAngle( 0 );
                 }
                 mpEscherEx->OpenContainer( ESCHER_SpContainer );
-                ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 );        // 
Flags: Connector | HasSpt
+                addShape( ESCHER_ShpInst_NotPrimitive, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
                 css::awt::Rectangle aNewRect;
                 switch ( ePolyKind )
                 {
@@ -431,11 +430,11 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
                 mpEscherEx->OpenContainer( ESCHER_SpContainer );
                 if(bInline)
                 {
-                    ADD_SHAPE( ESCHER_ShpInst_PictureFrame, SHAPEFLAG_HAVESPT 
| SHAPEFLAG_HAVEANCHOR );
+                    addShape( ESCHER_ShpInst_PictureFrame, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
                 }
                 else
                 {
-                    ADD_SHAPE( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVESPT | 
SHAPEFLAG_HAVEANCHOR );
+                    addShape( ESCHER_ShpInst_HostControl, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
                 }
             }
             else
@@ -443,7 +442,8 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
         }
         else if ( rObj.GetType() == "drawing.Connector" )
         {
-            sal_uInt16 nSpType, nSpFlags;
+            sal_uInt16 nSpType;
+            ShapeFlag nSpFlags;
             css::awt::Rectangle aNewRect;
             if ( ! aPropOpt.CreateConnectorProperties( rObj.GetShapeRef(),
                             rSolverContainer, aNewRect, nSpType, nSpFlags ) )
@@ -452,7 +452,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
                                         ImplMapSize( Size( aNewRect.Width, 
aNewRect.Height ) ) ) );
 
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            ADD_SHAPE( nSpType, nSpFlags );
+            addShape( nSpType, nSpFlags );
         }
         else if ( rObj.GetType() == "drawing.Measure" )
         {
@@ -465,13 +465,13 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
             //i27942: Poly/Lines/Bezier do not support text.
 
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            sal_uInt32 nFlags = 0xa00;      // Flags: Connector | HasSpt
+            ShapeFlag nFlags = ShapeFlag::HaveShapeProperty | 
ShapeFlag::HaveAnchor;
             if( aNewRect.Height < 0 )
-                nFlags |= 0x80;             // Flags: VertMirror
+                nFlags |= ShapeFlag::FlipV;
             if( aNewRect.Width < 0 )
-                nFlags |= 0x40;             // Flags: HorzMirror
+                nFlags |= ShapeFlag::FlipH;
 
-            ADD_SHAPE( ESCHER_ShpInst_Line, nFlags );
+            addShape( ESCHER_ShpInst_Line, nFlags );
             aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
             aPropOpt.CreateLineProperties( rObj.mXPropSet, false );
             rObj.SetAngle( 0 );
@@ -484,7 +484,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
                 bAdditionalText = true;
             }
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 );        // Flags: 
Connector | HasSpt
+            addShape( ESCHER_ShpInst_NotPrimitive, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
             css::awt::Rectangle aNewRect;
             aPropOpt.CreatePolygonProperties( rObj.mXPropSet, 
ESCHER_CREATEPOLYGON_POLYPOLYGON, false, aNewRect );
             aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
@@ -495,7 +495,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
             //i27942: Poly/Lines/Bezier do not support text.
 
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 );        // Flags: 
Connector | HasSpt
+            addShape( ESCHER_ShpInst_NotPrimitive, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
             css::awt::Rectangle aNewRect;
             aPropOpt.CreatePolygonProperties( rObj.mXPropSet, 
ESCHER_CREATEPOLYGON_POLYLINE, false, aNewRect );
             aPropOpt.CreateLineProperties( rObj.mXPropSet, false );
@@ -506,7 +506,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
             //i27942: Poly/Lines/Bezier do not support text.
 
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 );        // Flags: 
Connector | HasSpt
+            addShape( ESCHER_ShpInst_NotPrimitive, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
             css::awt::Rectangle aNewRect;
             aPropOpt.CreatePolygonProperties( rObj.mXPropSet, 
ESCHER_CREATEPOLYGON_POLYLINE, true, aNewRect );
             aPropOpt.CreateLineProperties( rObj.mXPropSet, false );
@@ -520,7 +520,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
                 bAdditionalText = true;
             }
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            ADD_SHAPE( ESCHER_ShpInst_NotPrimitive, 0xa00 );        // Flags: 
Connector | HasSpt
+            addShape( ESCHER_ShpInst_NotPrimitive, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
             css::awt::Rectangle aNewRect;
             aPropOpt.CreatePolygonProperties( rObj.mXPropSet, 
ESCHER_CREATEPOLYGON_POLYPOLYGON, true, aNewRect );
             aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
@@ -533,7 +533,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
             // a GraphicObject can also be a ClickMe element
             if( rObj.IsEmptyPresObj() )
             {
-                ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0x220 );               // 
Flags: HaveAnchor | HaveMaster
+                addShape( ESCHER_ShpInst_Rectangle, ShapeFlag::HaveMaster | 
ShapeFlag::HaveAnchor );
                 sal_uInt32 nTxtBxId = mpEscherEx->QueryTextID( 
rObj.GetShapeRef(),
                                                         rObj.GetShapeId() );
                 aPropOpt.AddOpt( ESCHER_Prop_lTxid, nTxtBxId );
@@ -548,7 +548,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
                     /* SJ #i34951#: because M. documents are not allowing 
GraphicObjects containing text, we
                        have to create a simple Rectangle with fill bitmap 
instead (while not allowing BitmapMode_Repeat).
                     */
-                    ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0xa00 );           // 
Flags: Connector | HasSpt
+                    addShape( ESCHER_ShpInst_Rectangle, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
                     if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, 
"GraphicURL", true, true, false ) )
                     {
                         aPropOpt.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone 
);
@@ -564,7 +564,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
                 }
                 else
                 {
-                    ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
+                    addShape( ESCHER_ShpInst_PictureFrame, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
                     if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, 
"GraphicURL", false, true, true, bOOxmlExport ) )
                         aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 
0x800080 );
                 }
@@ -573,7 +573,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
         else if ( rObj.GetType() == "drawing.Text" )
         {
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            ADD_SHAPE( ESCHER_ShpInst_TextBox, 0xa00 );
+            addShape( ESCHER_ShpInst_TextBox, ShapeFlag::HaveShapeProperty | 
ShapeFlag::HaveAnchor );
             aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
             if( rObj.ImplGetText() )
                 aPropOpt.CreateTextProperties( rObj.mXPropSet,
@@ -583,7 +583,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
         else if ( rObj.GetType() == "drawing.Page" )
         {
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0xa00 );
+            addShape( ESCHER_ShpInst_Rectangle, ShapeFlag::HaveShapeProperty | 
ShapeFlag::HaveAnchor );
             aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x40004 );
             aPropOpt.AddOpt( ESCHER_Prop_fFillOK, 0x100001 );
             aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110011 );
@@ -599,7 +599,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
             if( rObj.IsEmptyPresObj() )
             {
-                ADD_SHAPE( ESCHER_ShpInst_Rectangle, 0x220 );               // 
Flags: HaveAnchor | HaveMaster
+                addShape( ESCHER_ShpInst_Rectangle, ShapeFlag::HaveMaster | 
ShapeFlag::HaveAnchor );
                 sal_uInt32 nTxtBxId = mpEscherEx->QueryTextID( 
rObj.GetShapeRef(),
                                                         rObj.GetShapeId() );
                 aPropOpt.AddOpt( ESCHER_Prop_lTxid, nTxtBxId );
@@ -611,8 +611,8 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
             {
                 //2do: could be made an option in HostAppData whether OLE 
object should be written or not
                 bool bAppOLE = true;
-                ADD_SHAPE( ESCHER_ShpInst_PictureFrame,
-                    0xa00 | (bAppOLE ? SHAPEFLAG_OLESHAPE : 0) );
+                addShape( ESCHER_ShpInst_PictureFrame,
+                    ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor | 
(bAppOLE ? ShapeFlag::OLEShape : ShapeFlag::NONE) );
                 if ( aPropOpt.CreateOLEGraphicProperties( rObj.GetShapeRef() ) 
)
                 {
                     if ( bAppOLE )
@@ -638,7 +638,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
                 break;
 
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
+            addShape( ESCHER_ShpInst_PictureFrame, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
 
                 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, 
"Bitmap", false ) )
                 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
@@ -647,7 +647,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
         {
             rObj.SetAngle( 0 );
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            ADD_SHAPE( ESCHER_ShpInst_TextBox, 0xa00 );
+            addShape( ESCHER_ShpInst_TextBox, ShapeFlag::HaveShapeProperty | 
ShapeFlag::HaveAnchor );
             if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, "MetaFile", 
false ) )
                 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
         }
@@ -655,7 +655,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
         {
             rObj.SetAngle( 0 );
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
+            addShape( ESCHER_ShpInst_PictureFrame, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
             if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, "MetaFile", 
false ) )
                 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
         }
@@ -740,7 +740,7 @@ void ImplEESdrWriter::ImplWriteAdditionalText( 
ImplEESdrObject& rObj,
                             Point( (sal_Int32)( rTextRefPoint.X() + fDist ), 
rTextRefPoint.Y() - 1 ) ) );
 
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
-            mpEscherEx->AddShape( ESCHER_ShpInst_TextBox, 0xa00 );
+            mpEscherEx->AddShape( ESCHER_ShpInst_TextBox, 
ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
             if ( rObj.ImplGetText() )
                 aPropOpt.CreateTextProperties( rObj.mXPropSet,
                     mpEscherEx->QueryTextID( rObj.GetShapeRef(),
@@ -758,7 +758,8 @@ void ImplEESdrWriter::ImplWriteAdditionalText( 
ImplEESdrObject& rObj,
         {
             mpEscherEx->OpenContainer( ESCHER_SpContainer );
             nShapeID = mpEscherEx->GenerateShapeId();
-            mpEscherEx->AddShape( nShapeType = ESCHER_ShpInst_TextBox, 0xa00, 
nShapeID );
+            nShapeType = ESCHER_ShpInst_TextBox;
+            mpEscherEx->AddShape( nShapeType, ShapeFlag::HaveShapeProperty | 
ShapeFlag::HaveAnchor, nShapeID );
             if ( rObj.ImplGetText() )
                 aPropOpt.CreateTextProperties( rObj.mXPropSet,
                     mpEscherEx->QueryTextID( rObj.GetShapeRef(),
@@ -989,7 +990,7 @@ sal_uInt32 EscherEx::AddDummyShape()
 {
     OpenContainer( ESCHER_SpContainer );
     sal_uInt32 nShapeID = GenerateShapeId();
-    AddShape( ESCHER_ShpInst_Rectangle, 0xa00, nShapeID );
+    AddShape( ESCHER_ShpInst_Rectangle, ShapeFlag::HaveShapeProperty | 
ShapeFlag::HaveAnchor, nShapeID );
     CloseContainer();
 
     return nShapeID;
diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index 294758de86ce..de7d3272329e 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -439,7 +439,8 @@ void SvxMSDffManager::SolveSolver( const 
SvxMSDffSolverContainer& rSolver )
             for ( int nN = 0; nN < 2; nN++ )
             {
                 SdrObject*  pO;
-                sal_uInt32  nC, nSpFlags;
+                sal_uInt32  nC;
+                ShapeFlag   nSpFlags;
                 if ( !nN )
                 {
                     pO = pPtr->pAObj;
@@ -479,12 +480,12 @@ void SvxMSDffManager::SolveSolver( const 
SvxMSDffSolverContainer& rSolver )
                             {
                                 if ( nC & 1 )
                                 {
-                                    if ( nSpFlags & SP_FFLIPH )
+                                    if ( nSpFlags & ShapeFlag::FlipH )
                                         nC ^= 2;    // 1 <-> 3
                                 }
                                 else
                                 {
-                                    if ( nSpFlags & SP_FFLIPV )
+                                    if ( nSpFlags & ShapeFlag::FlipV )
                                         nC ^= 1;    // 0 <-> 2
                                 }
                                 switch( nC )
@@ -614,12 +615,12 @@ void SvxMSDffManager::SolveSolver( const 
SvxMSDffSolverContainer& rSolver )
                                 {
                                     if ( nC & 1 )
                                     {
-                                        if ( nSpFlags & SP_FFLIPH )
+                                        if ( nSpFlags & ShapeFlag::FlipH )
                                             nC ^= 2;    // 1 <-> 3
                                     }
                                     else
                                     {
-                                        if ( nSpFlags & SP_FFLIPV )
+                                        if ( nSpFlags & ShapeFlag::FlipV )
                                             nC ^= 1;    // 0 <-> 2
                                     }
                                     switch( nC )
@@ -1253,9 +1254,9 @@ void ApplyRectangularGradientAsBitmap( const 
SvxMSDffManager& rManager, SvStream
                     aBitmap.Rotate( nFix16Angle / 10, rShadeColors[ 0 ].aColor 
);
 
                     BmpMirrorFlags nMirrorFlags = BmpMirrorFlags::NONE;
-                    if ( rObjData.nSpFlags & SP_FFLIPV )
+                    if ( rObjData.nSpFlags & ShapeFlag::FlipV )
                         nMirrorFlags |= BmpMirrorFlags::Vertical;
-                    if ( rObjData.nSpFlags & SP_FFLIPH )
+                    if ( rObjData.nSpFlags & ShapeFlag::FlipH )
                         nMirrorFlags |= BmpMirrorFlags::Horizontal;
                     if ( nMirrorFlags != BmpMirrorFlags::NONE )
                         aBitmap.Mirror( nMirrorFlags );
@@ -2684,7 +2685,7 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, 
SfxItemSet& rSet, DffObj
         ApplyCustomShapeTextAttributes( rSet );
         if ( rManager.GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_EXCEL )
         {
-            if ( mnFix16Angle || ( rObjData.nSpFlags & SP_FFLIPV ) )
+            if ( mnFix16Angle || ( rObjData.nSpFlags & ShapeFlag::FlipV ) )
                 CheckAndCorrectExcelTextRotation( rIn, rSet, rObjData );
         }
     }
@@ -2770,7 +2771,7 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( 
SvStream& rIn, SfxItem
 
         if ( rManager.mnFix16Angle )
             fExtraTextRotateAngle += mnFix16Angle / 100.0;
-        if ( rObjData.nSpFlags & SP_FFLIPV )
+        if ( rObjData.nSpFlags & ShapeFlag::FlipV )
             fExtraTextRotateAngle -= 180.0;
 
         css::beans::PropertyValue aTextRotateAngle;
@@ -3806,7 +3807,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, 
SfxItemSet& rSet, cons
             // the writer is doing its own cropping, so this part affects only 
impress and calc,
             // unless we're inside a group, in which case writer doesn't crop 
either
             if (( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_CROP_BITMAPS ) || 
rObjData.nCalledByGroup != 0 )
-                lcl_ApplyCropping( *this, ( rObjData.nSpFlags & SP_FOLESHAPE ) 
== 0 ? &rSet : nullptr, aGraf );
+                lcl_ApplyCropping( *this, !bool( rObjData.nSpFlags & 
ShapeFlag::OLEShape ) ? &rSet : nullptr, aGraf );
 
             if ( IsProperty( DFF_Prop_pictureTransparent ) )
             {
@@ -3881,7 +3882,7 @@ SdrObject* SvxMSDffManager::ImportGraphic( SvStream& rSt, 
SfxItemSet& rSet, cons
                 // contrast or brightness need to be altered, the result is 
the same, but if both are involved,
                 // there's no way to map that, so just force a conversion of 
the image.
                 bool needsConversion = nContrast != 0 && nBrightness != 0;
-                if ( ( rObjData.nSpFlags & SP_FOLESHAPE ) == 0 && 
!needsConversion )
+                if ( !bool(rObjData.nSpFlags & ShapeFlag::OLEShape) && 
!needsConversion )
                 {
                     if ( nBrightness )
                         rSet.Put( SdrGrafLuminanceItem( nBrightness ) );
@@ -4045,7 +4046,7 @@ SdrObject* SvxMSDffManager::ImportGroup( const 
DffRecordHeader& rHd, SvStream& r
         if ( pRet )
         {
             sal_Int32 nGroupRotateAngle = 0;
-            sal_Int32 nSpFlags = nGroupShapeFlags;
+            ShapeFlag nSpFlags = nGroupShapeFlags;
             nGroupRotateAngle = mnFix16Angle;
 
             tools::Rectangle aClientRect( rClientRect );
@@ -4116,13 +4117,13 @@ SdrObject* SvxMSDffManager::ImportGroup( const 
DffRecordHeader& rHd, SvStream& r
                 double a = nGroupRotateAngle * nPi180;
                 pRet->NbcRotate( aClientRect.Center(), nGroupRotateAngle, sin( 
a ), cos( a ) );
             }
-            if ( nSpFlags & SP_FFLIPV )     // Vertical flip?
+            if ( nSpFlags & ShapeFlag::FlipV )
             {   // BoundRect in aBoundRect
                 Point aLeft( aClientRect.Left(), ( aClientRect.Top() + 
aClientRect.Bottom() ) >> 1 );
                 Point aRight( aLeft.X() + 1000, aLeft.Y() );
                 pRet->NbcMirror( aLeft, aRight );
             }
-            if ( nSpFlags & SP_FFLIPH )     // Horizontal flip?
+            if ( nSpFlags & ShapeFlag::FlipH )
             {   // BoundRect in aBoundRect
                 Point aTop( ( aClientRect.Left() + aClientRect.Right() ) >> 1, 
aClientRect.Top() );
                 Point aBottom( aTop.X(), aTop.Y() + 1000 );
@@ -4180,14 +4181,16 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
     aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp );
     if ( aObjData.bShapeType )
     {
+        sal_uInt32 temp;
         rSt.ReadUInt32( aObjData.nShapeId )
-           .ReadUInt32( aObjData.nSpFlags );
+           .ReadUInt32( temp );
+        aObjData.nSpFlags = ShapeFlag(temp);
         aObjData.eShapeType = (MSO_SPT)maShapeRecords.Current()->nRecInstance;
     }
     else
     {
         aObjData.nShapeId = 0;
-        aObjData.nSpFlags = 0;
+        aObjData.nSpFlags = ShapeFlag::NONE;
         aObjData.eShapeType = mso_sptNil;
     }
 
@@ -4251,7 +4254,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
     if ( aObjData.bChildAnchor )
         aObjData.aBoundRect = aObjData.aChildAnchor;
 
-    if ( aObjData.nSpFlags & SP_FBACKGROUND )
+    if ( aObjData.nSpFlags & ShapeFlag::Background )
         aObjData.aBoundRect = tools::Rectangle( Point(), Size( 1, 1 ) );
 
     tools::Rectangle aTextRect;
@@ -4276,7 +4279,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
                             IsProperty( DFF_Prop_pibName ) ||
                             IsProperty( DFF_Prop_pibFlags );
 
-        if ( aObjData.nSpFlags & SP_FGROUP )
+        if ( aObjData.nSpFlags & ShapeFlag::Group )
         {
             pRet = new SdrObjGroup;
             /*  After CWS aw033 has been integrated, an empty group object
@@ -4293,7 +4296,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
 
             bool    bIsConnector = ( ( aObjData.eShapeType >= 
mso_sptStraightConnector1 ) && ( aObjData.eShapeType <= mso_sptCurvedConnector5 
) );
             sal_Int32   nObjectRotation = mnFix16Angle;
-            sal_uInt32  nSpFlags = aObjData.nSpFlags;
+            ShapeFlag   nSpFlags = aObjData.nSpFlags;
 
             if ( bGraphic )
             {
@@ -4588,7 +4591,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
                             if ( aPolyBoundRect.GetWidth() && 
aPolyPieRect.GetWidth() )
                             {
                                 fXScale = (double)aLogicRect.GetWidth() / 
(double)aPolyPieRect.GetWidth();
-                                if ( nSpFlags & SP_FFLIPH )
+                                if ( nSpFlags & ShapeFlag::FlipH )
                                     fXOfs = ( (double)aPolyPieRect.Right() - 
(double)aPolyBoundRect.Right() ) * fXScale;
                                 else
                                     fXOfs = ( (double)aPolyBoundRect.Left() - 
(double)aPolyPieRect.Left() ) * fXScale;
@@ -4596,7 +4599,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
                             if ( aPolyBoundRect.GetHeight() && 
aPolyPieRect.GetHeight() )
                             {
                                 fYScale = (double)aLogicRect.GetHeight() / 
(double)aPolyPieRect.GetHeight();
-                                if ( nSpFlags & SP_FFLIPV )
+                                if ( nSpFlags & ShapeFlag::FlipV )
                                     fYOfs = ( (double)aPolyPieRect.Bottom() - 
(double)aPolyBoundRect.Bottom() ) * fYScale;
                                 else
                                     fYOfs = ((double)aPolyBoundRect.Top() - 
(double)aPolyPieRect.Top() ) * fYScale;
@@ -4637,9 +4640,9 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
                             if ( mnFix16Angle )
                             {
                                 sal_Int32 nAngle = mnFix16Angle;
-                                if ( nSpFlags & SP_FFLIPH )
+                                if ( nSpFlags & ShapeFlag::FlipH )
                                     nAngle = 36000 - nAngle;
-                                if ( nSpFlags & SP_FFLIPV )
+                                if ( nSpFlags & ShapeFlag::FlipV )
                                     nAngle = -nAngle;
                                 double a = nAngle * F_PI18000;
                                 double ss = sin( a );
@@ -4681,7 +4684,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
                             pRet->NbcRotate( aObjData.aBoundRect.Center(), 
nObjectRotation, sin( a ), cos( a ) );
                         }
                         // mirrored horizontally?
-                        if ( nSpFlags & SP_FFLIPH )
+                        if ( nSpFlags & ShapeFlag::FlipH )
                         {
                             tools::Rectangle aBndRect( pRet->GetSnapRect() );
                             Point aTop( ( aBndRect.Left() + aBndRect.Right() ) 
>> 1, aBndRect.Top() );
@@ -4689,7 +4692,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
                             pRet->NbcMirror( aTop, aBottom );
                         }
                         // mirrored vertically?
-                        if ( nSpFlags & SP_FFLIPV )
+                        if ( nSpFlags & ShapeFlag::FlipV )
                         {
                             tools::Rectangle aBndRect( pRet->GetSnapRect() );
                             Point aLeft( aBndRect.Left(), ( aBndRect.Top() + 
aBndRect.Bottom() ) >> 1 );
@@ -4729,23 +4732,23 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
                         }
 
                         // rotate/mirror line within the area as we need it
-                        if ( nSpFlags & SP_FFLIPH )
+                        if ( nSpFlags & ShapeFlag::FlipH )
                         {
                             sal_Int32 n = aPoint1.X();
                             aPoint1.X() = aPoint2.X();
                             aPoint2.X() = n;
 
                             // #i120437# reset hor filp
-                            nSpFlags &= ~SP_FFLIPH;
+                            nSpFlags &= ~ShapeFlag::FlipH;
                         }
-                        if ( nSpFlags & SP_FFLIPV )
+                        if ( nSpFlags & ShapeFlag::FlipV )
                         {
                             sal_Int32 n = aPoint1.Y();
                             aPoint1.Y() = aPoint2.Y();
                             aPoint2.Y() = n;
 
                             // #i120437# reset ver filp
-                            nSpFlags &= ~SP_FFLIPV;
+                            nSpFlags &= ~ShapeFlag::FlipV;
                         }
 
                         pRet->NbcSetPoint(aPoint1, 0L); // start point
@@ -4792,7 +4795,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
                     pRet->NbcRotate( aObjData.aBoundRect.Center(), 
nObjectRotation, sin( a ), cos( a ) );
                 }
                 // mirrored horizontally?
-                if ( nSpFlags & SP_FFLIPH )
+                if ( nSpFlags & ShapeFlag::FlipH )
                 {
                     tools::Rectangle aBndRect( pRet->GetSnapRect() );
                     Point aTop( ( aBndRect.Left() + aBndRect.Right() ) >> 1, 
aBndRect.Top() );
@@ -4800,7 +4803,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
                     pRet->NbcMirror( aTop, aBottom );
                 }
                 // mirrored vertically?
-                if ( nSpFlags & SP_FFLIPV )
+                if ( nSpFlags & ShapeFlag::FlipV )
                 {
                     tools::Rectangle aBndRect( pRet->GetSnapRect() );
                     Point aLeft( aBndRect.Left(), ( aBndRect.Top() + 
aBndRect.Bottom() ) >> 1 );
@@ -5456,8 +5459,8 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
         pImpRec->nCropFromRight = GetPropertyValue(
                                     DFF_Prop_cropFromRight, 0 );
 
-        pImpRec->bVFlip = (rObjData.nSpFlags & SP_FFLIPV) != 0;
-        pImpRec->bHFlip = (rObjData.nSpFlags & SP_FFLIPH) != 0;
+        pImpRec->bVFlip = bool(rObjData.nSpFlags & ShapeFlag::FlipV);
+        pImpRec->bHFlip = bool(rObjData.nSpFlags & ShapeFlag::FlipH);
 
         sal_uInt32 nLineFlags = GetPropertyValue( DFF_Prop_fNoLineDrawDash, 0 
);
         pImpRec->eLineStyle = (nLineFlags & 8)
@@ -5498,7 +5501,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
             /*Only store objects which are not deep inside the tree*/
             if( ( rObjData.nCalledByGroup == 0 )
                 ||
-                ( (rObjData.nSpFlags & SP_FGROUP)
+                ( (rObjData.nSpFlags & ShapeFlag::Group)
                  && (rObjData.nCalledByGroup < 2) )
               )
                 StoreShapeOrder( pImpRec->nShapeId,
@@ -5594,7 +5597,7 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
      m_xShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ),
      nOffsDgg( nOffsDgg_ ),
      nBLIPCount(  USHRT_MAX ),              // initialize with error, since we 
fist check if the
-     nGroupShapeFlags(0),                   // ensure initialization here, as 
some corrupted
+     nGroupShapeFlags(ShapeFlag::NONE),     // ensure initialization here, as 
some corrupted
                                             // files may yield to this being 
uninitialized
      maBaseURL( rBaseURL ),
      mnIdClusters(0),
@@ -5638,7 +5641,7 @@ SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, 
const OUString& rBaseURL )
      m_xShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ),
      nOffsDgg( 0 ),
      nBLIPCount(  USHRT_MAX ),              // initialize with error, since we 
first have to check
-     nGroupShapeFlags(0),
+     nGroupShapeFlags(ShapeFlag::NONE),
      maBaseURL( rBaseURL ),
      mnIdClusters(0),
      rStCtrl(  rStCtrl_  ),
@@ -7281,7 +7284,7 @@ SvxMSDffImportRec::SvxMSDffImportRec()
       nXAlign( 0 ), // position n cm from left
       nYAlign( 0 ), // position n cm below
       nLayoutInTableCell( 0 ), // element is laid out in table cell
-      nFlags( 0 ),
+      nFlags( ShapeFlag::NONE ),
       nDxTextLeft( 144 ),
       nDyTextTop( 72 ),
       nDxTextRight( 144 ),
diff --git a/filter/source/msfilter/svdfppt.cxx 
b/filter/source/msfilter/svdfppt.cxx
index 50eeb81bb173..17128c1cda12 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -742,7 +742,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, 
DffObjData& rObjData, voi
     ProcessData& rData = *static_cast<ProcessData*>(pData);
     PptSlidePersistEntry& rPersistEntry = rData.rPersistEntry;
 
-    if ( ! ( rObjData.nSpFlags & SP_FGROUP  ) )     // sj: #114758# ...
+    if ( ! (rObjData.nSpFlags & ShapeFlag::Group) )     // sj: #114758# ...
     {
         PptOEPlaceholderAtom aPlaceholderAtom;
 
@@ -1169,17 +1169,17 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, 
DffObjData& rObjData, voi
                         }
                     }
                     // rotate text with shape?
-                    sal_Int32 nAngle = ( rObjData.nSpFlags & SP_FFLIPV ) ? 
-mnFix16Angle : mnFix16Angle;    // #72116# vertical flip -> rotate by using 
the other way
+                    sal_Int32 nAngle = ( rObjData.nSpFlags & ShapeFlag::FlipV 
) ? -mnFix16Angle : mnFix16Angle; // #72116# vertical flip -> rotate by using 
the other way
                     nAngle += nTextRotationAngle;
 
                     if ( dynamic_cast< const SdrObjCustomShape* >(pTObj) ==  
nullptr )
                     {
-                        if ( rObjData.nSpFlags & SP_FFLIPV )
+                        if ( rObjData.nSpFlags & ShapeFlag::FlipV )
                         {
                             double a = 18000 * nPi180;
                             pTObj->Rotate( rTextRect.Center(), 18000, sin( a 
), cos( a ) );
                         }
-                        if ( rObjData.nSpFlags & SP_FFLIPH )
+                        if ( rObjData.nSpFlags & ShapeFlag::FlipH )
                             nAngle = 36000 - nAngle;
                         if ( nAngle )
                         {
@@ -1237,7 +1237,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, 
DffObjData& rObjData, voi
     }
     if ( pRet ) // sj: #i38501#, and taking care of connections to group 
objects
     {
-        if ( rObjData.nSpFlags & SP_FBACKGROUND )
+        if ( rObjData.nSpFlags & ShapeFlag::Background )
         {
             pRet->NbcSetSnapRect( tools::Rectangle( Point(), 
rData.pPage.page->GetSize() ) );   // set size
         }
@@ -2830,7 +2830,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, 
const PptSlidePersistEntry*
                                         {
                                             sal_uInt32 nSpFlags;
                                             rStCtrl.ReadUInt32( nSpFlags 
).ReadUInt32( nSpFlags );
-                                            if ( nSpFlags & SP_FBACKGROUND )
+                                            if ( ShapeFlag(nSpFlags) & 
ShapeFlag::Background )
                                             {
                                                 
aEscherObjListHd.SeekToBegOfRecord( rStCtrl );
                                                 rSlidePersist.pBObj = 
ImportObj( rStCtrl, static_cast<void*>(&aProcessData), aPageSize, aPageSize );
@@ -6496,7 +6496,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, 
SdrPowerPointImport& rSdrPowerPointImport
         if ( pObjData )
         {
             mxImplTextObj->mnShapeId = pObjData->nShapeId;
-            if ( pObjData->nSpFlags & SP_FHAVEMASTER )
+            if ( pObjData->nSpFlags & ShapeFlag::HaveMaster )
                 mxImplTextObj->mnShapeMaster = 
rSdrPowerPointImport.GetPropertyValue( DFF_Prop_hspMaster, 0 );
         }
         // ClientData
diff --git a/include/filter/msfilter/escherex.hxx 
b/include/filter/msfilter/escherex.hxx
index f1468ef7f5df..47678f367739 100644
--- a/include/filter/msfilter/escherex.hxx
+++ b/include/filter/msfilter/escherex.hxx
@@ -79,12 +79,26 @@ namespace tools {
 #define ESCHER_ConnectorRule    0xF012u /*                           an 
FConnectorRule                                                      X   X   1 */
 #define ESCHER_UDefProp         0xF122u
 
-#define SHAPEFLAG_OLESHAPE      0x010   /* The shape is an OLE object */
-#define SHAPEFLAG_FLIPH         0x040   /* Shape is flipped horizontally */
-#define SHAPEFLAG_FLIPV         0x080   /* Shape is flipped vertically */
-#define SHAPEFLAG_CONNECTOR     0x100   /* Connector type of shape */
-#define SHAPEFLAG_HAVEANCHOR    0x200   /* Shape has an anchor of some kind */
-#define SHAPEFLAG_HAVESPT       0x800   /* Shape has a shape type property */
+enum class ShapeFlag : sal_uInt32
+{
+    NONE                = 0x000,
+    Group               = 0x001,   /* shape is a group shape */
+    Child               = 0x002,   /* shape is a child shape */
+    Patriarch           = 0x004,   /* shape is the topmost group shape.
+                                      Exactly one of these per drawing. */
+    Deleted             = 0x008,   /* shape has been deleted */
+    OLEShape            = 0x010,   /* shape is an OLE object */
+    HaveMaster          = 0x020,   /* shape has a valid master in hspMaster 
property */
+    FlipH               = 0x040,   /* shape is flipped horizontally */
+    FlipV               = 0x080,   /* shape is flipped vertically */
+    Connector           = 0x100,   /* shape is a connector shape */
+    HaveAnchor          = 0x200,   /* shape has an anchor of some kind */
+    Background          = 0x400,   /* shape is a background shape */
+    HaveShapeProperty   = 0x800    /* shape has a shape type property */
+};  /* 20 bits unused */
+namespace o3tl {
+    template<> struct typed_flags<ShapeFlag> : is_typed_flags<ShapeFlag, 
0x00000FFF> {};
+}
 
 #define ESCHER_ShpInst_Min                          0
 #define ESCHER_ShpInst_NotPrimitive                 ESCHER_ShpInst_Min
@@ -121,6 +135,7 @@ enum ESCHER_BlibType
    LastClient  = 255        // Last client defined blip type
 };
 
+
 enum ESCHER_FillStyle
 {
     ESCHER_FillSolid,       // Fill with a solid color
@@ -789,7 +804,7 @@ public:
                     EscherSolverContainer& rSolver,
                     css::awt::Rectangle& rGeoRect,
                     sal_uInt16& rShapeType,
-                    sal_uInt16& rShapeFlags
+                    ShapeFlag& rShapeFlags
                 );
 
                 // Because shadow properties depends to the line and 
fillstyle, the CreateShadowProperties method should be called at last.
@@ -814,7 +829,7 @@ public:
     static tools::PolyPolygon  GetPolyPolygon( const css::uno::Any& rSource );
     static MSO_SPT      GetCustomShapeType(
                             const css::uno::Reference< css::drawing::XShape > 
& rXShape,
-                            sal_uInt32& nMirrorFlags,
+                            ShapeFlag& nMirrorFlags,
                             OUString& rShapeType,
                             bool bOOXML = false
                         );
@@ -1124,7 +1139,7 @@ public:
     virtual void LeaveGroup();
 
                 // a ESCHER_Sp is being written ( a ESCHER_DgContainer has to 
be opened for this purpose!)
-    virtual void AddShape( sal_uInt32 nShpInstance, sal_uInt32 nFlagIds, 
sal_uInt32 nShapeID = 0 );
+    virtual void AddShape( sal_uInt32 nShpInstance, ShapeFlag nFlagIds, 
sal_uInt32 nShapeID = 0 );
 
     virtual void Commit( EscherPropertyContainer& rProps, const 
tools::Rectangle& rRect);
 
diff --git a/include/filter/msfilter/msdffimp.hxx 
b/include/filter/msfilter/msdffimp.hxx
index 82fb3751a3ed..41313001d772 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -33,6 +33,7 @@
 #include <comphelper/stl_types.hxx>
 #include <filter/msfilter/dffpropset.hxx>
 #include <filter/msfilter/dffrecordheader.hxx>
+#include <filter/msfilter/escherex.hxx>
 #include <filter/msfilter/msfilterdllapi.h>
 #include <rtl/string.hxx>
 #include <rtl/ustring.hxx>
@@ -134,15 +135,6 @@ typedef ::std::multiset< 
std::shared_ptr<SvxMSDffShapeInfo>,
 #define SVXMSDFF_SETTINGS_IMPORT_PPT        2
 #define SVXMSDFF_SETTINGS_IMPORT_EXCEL      4
 
-#define SP_FGROUP       0x001   ///< This shape is a group shape
-#define SP_FPATRIARCH   0x004   ///< This is the topmost group shape.
-                                ///< Exactly one of these per drawing.
-#define SP_FOLESHAPE    0x010   ///< The shape is an OLE object
-#define SP_FHAVEMASTER  0x020   ///< Shape has a hspMaster property
-#define SP_FFLIPH       0x040   ///< Shape is flipped horizontally
-#define SP_FFLIPV       0x080   ///< Shape is flipped vertically
-#define SP_FBACKGROUND  0x400   ///< Background shape
-
 // for the CreateSdrOLEFromStorage we need the information, how we handle
 // convert able OLE-Objects - this is stored in
 #define OLE_MATHTYPE_2_STARMATH             0x0001
@@ -157,9 +149,9 @@ struct SvxMSDffConnectorRule
     sal_uInt32  nShapeC;   ///< SPID of connector shape
     sal_uInt32  ncptiA;    ///< Connection site Index of shape A
     sal_uInt32  ncptiB;    ///< Connection site Index of shape B
-    sal_uInt32  nSpFlagsA; ///< SpFlags of shape A (the original mirror flags
+    ShapeFlag   nSpFlagsA; ///< SpFlags of shape A (the original mirror flags
                            ///< must be known when solving the Solver 
Container)
-    sal_uInt32  nSpFlagsB; ///< SpFlags of shape B
+    ShapeFlag   nSpFlagsB; ///< SpFlags of shape B
 
     SdrObject*  pAObj;     ///< pPtr of object (corresponding to shape A)
     SdrObject*  pBObj;     ///< pPtr of object (corresponding to shape B)
@@ -171,8 +163,8 @@ struct SvxMSDffConnectorRule
         , nShapeC(0)
         , ncptiA(0)
         , ncptiB(0)
-        , nSpFlagsA( 0 )
-        , nSpFlagsB( 0 )
+        , nSpFlagsA( ShapeFlag::NONE )
+        , nSpFlagsB( ShapeFlag::NONE )
         , pAObj( nullptr )
         , pBObj( nullptr )
         , pCObj( nullptr )
@@ -224,7 +216,7 @@ struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
     sal_uInt32      nYAlign;
     boost::optional<sal_uInt32> nYRelTo;
     sal_uInt32      nLayoutInTableCell;
-    sal_uInt32      nFlags;
+    ShapeFlag       nFlags;
     sal_Int32       nDxTextLeft;    ///< distance of text box from surrounding 
shape
     sal_Int32       nDyTextTop;
     sal_Int32       nDxTextRight;
@@ -290,7 +282,7 @@ struct DffObjData
     tools::Rectangle   aChildAnchor;
 
     sal_uInt32  nShapeId;
-    sal_uInt32  nSpFlags;
+    ShapeFlag   nSpFlags;
     MSO_SPT     eShapeType;
 
     bool        bShapeType     : 1;
@@ -309,7 +301,7 @@ struct DffObjData
         rSpHd( rObjHd ),
         aBoundRect( rBoundRect ),
         nShapeId( 0 ),
-        nSpFlags( 0 ),
+        nSpFlags( ShapeFlag::NONE ),
         eShapeType( mso_sptNil ),
         bShapeType( false ),
         bClientAnchor( false ),
@@ -405,7 +397,7 @@ class MSFILTER_DLLPUBLIC SvxMSDffManager : public 
DffPropertyReader
     SvxMSDffShapeOrders     m_aShapeOrders;
     sal_uInt32              nOffsDgg;
     sal_uInt16              nBLIPCount;
-    sal_uInt32              nGroupShapeFlags;
+    ShapeFlag               nGroupShapeFlags;
 
     void CheckTxBxStoryChain();
     void GetFidclData(sal_uInt32 nOffsDgg);
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 99313638374c..c50c6a77a53e 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -94,7 +94,7 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx
     sal_uInt32 m_nShapeType;
 
     /// Remember the shape flags.
-    sal_uInt32 m_nShapeFlags;
+    ShapeFlag m_nShapeFlags;
 
     /// Remember style, the most important shape attribute ;-)
     OStringBuffer m_ShapeStyle;
@@ -176,7 +176,7 @@ private:
     virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const 
tools::Rectangle* pBoundRect ) override;
     virtual void LeaveGroup() override;
 
-    virtual void AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, 
sal_uInt32 nShapeId = 0 ) override;
+    virtual void AddShape( sal_uInt32 nShapeType, ShapeFlag nShapeFlags, 
sal_uInt32 nShapeId = 0 ) override;
 
 private:
     /// Create an OString representing the id from a numerical id.
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 60bd7d0a80cf..7d2584da3641 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -725,7 +725,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
     bool bHasHandles = false;
 
     OUString sShapeType;
-    sal_uInt32 nMirrorFlags = 0;
+    ShapeFlag nMirrorFlags = ShapeFlag::NONE;
     MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType( xShape, 
nMirrorFlags, sShapeType );
     SdrObjCustomShape* pShape = static_cast<SdrObjCustomShape*>( 
GetSdrObjectFromXShape( xShape ) );
     bool bIsDefaultObject = EscherPropertyContainer::IsDefaultObject( pShape, 
eShapeType );
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index c4c3f3679861..dd2ed6300264 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -63,7 +63,7 @@ VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr const & 
pSerializer, VMLText
     , m_pSdrObject( nullptr )
     , m_pShapeAttrList( nullptr )
     , m_nShapeType( ESCHER_ShpInst_Nil )
-    , m_nShapeFlags(0)
+    , m_nShapeFlags(ShapeFlag::NONE)
     , m_ShapeStyle( 200 )
     , m_aShapeTypeWritten( ESCHER_ShpInst_COUNT )
     , m_bSkipwzName( false )
@@ -181,7 +181,7 @@ void VMLExport::LeaveGroup()
     m_pSerializer->endElementNS( XML_v, XML_group );
 }
 
-void VMLExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, 
sal_uInt32 nShapeId )
+void VMLExport::AddShape( sal_uInt32 nShapeType, ShapeFlag nShapeFlags, 
sal_uInt32 nShapeId )
 {
     m_nShapeType = nShapeType;
     m_nShapeFlags = nShapeFlags;
@@ -906,12 +906,15 @@ OString VMLExport::ShapeIdString( sal_uInt32 nId )
 
 void VMLExport::AddFlipXY( )
 {
-    const sal_uInt32 nFlipHandV = SHAPEFLAG_FLIPH + SHAPEFLAG_FLIPV;
-    switch ( m_nShapeFlags & nFlipHandV )
+    if (m_nShapeFlags & (ShapeFlag::FlipH | ShapeFlag::FlipV))
     {
-        case SHAPEFLAG_FLIPH:   m_ShapeStyle.append( ";flip:x" );  break;
-        case SHAPEFLAG_FLIPV:   m_ShapeStyle.append( ";flip:y" );  break;
-        case nFlipHandV:        m_ShapeStyle.append( ";flip:xy" ); break;
+        m_ShapeStyle.append( ";flip:" );
+
+        if (m_nShapeFlags & ShapeFlag::FlipH)
+            m_ShapeStyle.append( "x" );
+
+        if (m_nShapeFlags & ShapeFlag::FlipV)
+            m_ShapeStyle.append( "y" );
     }
 }
 
diff --git a/sc/source/filter/excel/xeescher.cxx 
b/sc/source/filter/excel/xeescher.cxx
index e456865197be..13a58328fce4 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -552,7 +552,8 @@ XclExpOcxControlObj::XclExpOcxControlObj( 
XclExpObjectManager& rObjMgr, Referenc
 
     // fill DFF property set
     mrEscherEx.OpenContainer( ESCHER_SpContainer );
-    mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVESPT | 
SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_OLESHAPE );
+    mrEscherEx.AddShape( ESCHER_ShpInst_HostControl,
+                         ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor 
| ShapeFlag::OLEShape );
     tools::Rectangle aDummyRect;
     EscherPropertyContainer aPropOpt( mrEscherEx.GetGraphicProvider(), 
mrEscherEx.QueryPictureStream(), aDummyRect );
     aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape,    0x00080008 );   // bool 
field
@@ -697,7 +698,7 @@ XclExpTbxControlObj::XclExpTbxControlObj( 
XclExpObjectManager& rRoot, Reference<
 
     // fill DFF property set
     mrEscherEx.OpenContainer( ESCHER_SpContainer );
-    mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVEANCHOR | 
SHAPEFLAG_HAVESPT );
+    mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty );
     EscherPropertyContainer aPropOpt;
     bool bVisible = aCtrlProp.GetBoolProperty( "EnableVisible" );
     aPropOpt.AddOpt( ESCHER_Prop_fPrint, bVisible ? 0x00080000 : 0x00080002 ); 
// visible flag
@@ -1074,7 +1075,7 @@ XclExpChartObj::XclExpChartObj( XclExpObjectManager& 
rObjMgr, Reference< XShape
 {
     // create the MSODRAWING record contents for the chart object
     mrEscherEx.OpenContainer( ESCHER_SpContainer );
-    mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVEANCHOR | 
SHAPEFLAG_HAVESPT );
+    mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty );
     EscherPropertyContainer aPropOpt;
     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x01040104 );
     aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 );
diff --git a/sc/source/filter/excel/xiescher.cxx 
b/sc/source/filter/excel/xiescher.cxx
index a5dfbf1b5332..3b08416f6d5d 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -150,7 +150,7 @@ XclImpDrawObjBase::XclImpDrawObjBase( const XclImpRoot& 
rRoot ) :
     mnTab( 0 ),
     mnObjType( EXC_OBJTYPE_UNKNOWN ),
     mnDffShapeId( 0 ),
-    mnDffFlags( 0 ),
+    mnDffFlags( ShapeFlag::NONE ),
     mbHasAnchor( false ),
     mbHidden( false ),
     mbVisible( true ),
@@ -3142,7 +3142,7 @@ void XclImpPictureObj::ReadPictFmla( XclImpStream& rStrm, 
sal_uInt16 nLinkSize )
 
 // DFF stream conversion ======================================================
 
-void XclImpSolverContainer::InsertSdrObjectInfo( SdrObject& rSdrObj, 
sal_uInt32 nDffShapeId, sal_uInt32 nDffFlags )
+void XclImpSolverContainer::InsertSdrObjectInfo( SdrObject& rSdrObj, 
sal_uInt32 nDffShapeId, ShapeFlag nDffFlags )
 {
     if( nDffShapeId > 0 )
     {
@@ -3195,7 +3195,7 @@ void XclImpSolverContainer::RemoveConnectorRules()
     maSdrObjMap.clear();
 }
 
-void XclImpSolverContainer::UpdateConnection( sal_uInt32 nDffShapeId, 
SdrObject*& rpSdrObj, sal_uInt32* pnDffFlags )
+void XclImpSolverContainer::UpdateConnection( sal_uInt32 nDffShapeId, 
SdrObject*& rpSdrObj, ShapeFlag* pnDffFlags )
 {
     XclImpSdrInfoMap::const_iterator aIt = maSdrInfoMap.find( nDffShapeId );
     if( aIt != maSdrInfoMap.end() )
@@ -3495,8 +3495,8 @@ SdrObject* XclImpDffConverter::ProcessObj( SvStream& 
rDffStrm, DffObjData& rDffO
     XclImpDrawObjRef xDrawObj = rConvData.mrDrawing.FindDrawObj( 
rDffObjData.rSpHd );
     const tools::Rectangle& rAnchorRect = rDffObjData.aChildAnchor;
 
-    // Do not process the global page group shape (flag SP_FPATRIARCH)
-    bool bGlobalPageGroup = ::get_flag< sal_uInt32 >( rDffObjData.nSpFlags, 
SP_FPATRIARCH );
+    // Do not process the global page group shape
+    bool bGlobalPageGroup( rDffObjData.nSpFlags & ShapeFlag::Patriarch );
     if( !xDrawObj || !xDrawObj->IsProcessSdrObj() || bGlobalPageGroup )
         return nullptr;   // simply return, xSdrObj will be destroyed
 
diff --git a/sc/source/filter/inc/xiescher.hxx 
b/sc/source/filter/inc/xiescher.hxx
index 03c554495b90..a4ac864c585d 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -103,7 +103,7 @@ public:
     /** Returns the shape identifier used in the DFF stream. */
     sal_uInt32   GetDffShapeId() const { return mnDffShapeId; }
     /** Returns the shape flags from the DFF stream. */
-    sal_uInt32   GetDffFlags() const { return mnDffFlags; }
+    ShapeFlag    GetDffFlags() const { return mnDffFlags; }
 
     /** Returns true, if the object is hidden. */
     bool         IsHidden() const { return mbHidden; }
@@ -193,7 +193,7 @@ private:
     SCTAB               mnTab;          /// Location of object
     sal_uInt16          mnObjType;      /// The Excel object type from OBJ 
record.
     sal_uInt32          mnDffShapeId;   /// Shape ID from DFF stream.
-    sal_uInt32          mnDffFlags;     /// Shape flags from DFF stream.
+    ShapeFlag           mnDffFlags;     /// Shape flags from DFF stream.
     OUString       maObjName;      /// Name of the object.
     OUString       maMacroName;    /// Name of an attached macro.
     OUString       maHyperlink;    /// On-click hyperlink URL.
@@ -881,7 +881,7 @@ class XclImpSolverContainer : public SvxMSDffSolverContainer
 public:
 
     /** Inserts information about a new SdrObject. */
-    void                InsertSdrObjectInfo( SdrObject& rSdrObj, sal_uInt32 
nDffShapeId, sal_uInt32 nDffFlags );
+    void                InsertSdrObjectInfo( SdrObject& rSdrObj, sal_uInt32 
nDffShapeId, ShapeFlag nDffFlags );
     /** Removes information of an SdrObject (and all child objects if it is a 
group). */
     void                RemoveSdrObjectInfo( SdrObject& rSdrObj );
 
@@ -892,16 +892,16 @@ public:
 
 private:
     /** Updates the data of a connected shape in a connector rule. */
-    void                UpdateConnection( sal_uInt32 nDffShapeId, SdrObject*& 
rpSdrObj, sal_uInt32* pnDffFlags = nullptr );
+    void                UpdateConnection( sal_uInt32 nDffShapeId, SdrObject*& 
rpSdrObj, ShapeFlag* pnDffFlags = nullptr );
 
 private:
     /** Stores data about an SdrObject processed during import. */
     struct XclImpSdrInfo
     {
         SdrObject*          mpSdrObj;       /// Pointer to an SdrObject.
-        sal_uInt32          mnDffFlags;     /// Shape flags from DFF stream.
-        explicit     XclImpSdrInfo() : mpSdrObj( nullptr ), mnDffFlags( 0 ) {}
-        void         Set( SdrObject* pSdrObj, sal_uInt32 nDffFlags )
+        ShapeFlag           mnDffFlags;     /// Shape flags from DFF stream.
+        explicit     XclImpSdrInfo() : mpSdrObj( nullptr ), mnDffFlags( 
ShapeFlag::NONE ) {}
+        void         Set( SdrObject* pSdrObj, ShapeFlag nDffFlags )
                                 { mpSdrObj = pSdrObj; mnDffFlags = nDffFlags; }
     };
     typedef std::map< sal_uInt32, XclImpSdrInfo > XclImpSdrInfoMap;
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx 
b/sc/source/filter/xcl97/xcl97rec.cxx
index d39baf7e439c..39ccc18970f0 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -564,7 +564,7 @@ void XclObjComment::ProcessEscherObj( const XclExpRoot& 
rRoot, const tools::Rect
 
     nGrbit = 0;     // all off: AutoLine, AutoFill, Printable, Locked
     mrEscherEx.OpenContainer( ESCHER_SpContainer );
-    mrEscherEx.AddShape( ESCHER_ShpInst_TextBox, SHAPEFLAG_HAVEANCHOR | 
SHAPEFLAG_HAVESPT );
+    mrEscherEx.AddShape( ESCHER_ShpInst_TextBox, ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty );
     aPropOpt.Commit( mrEscherEx.GetStream() );
 
     XclExpDffNoteAnchor( rRoot, rRect ).WriteDffData( mrEscherEx );
@@ -691,7 +691,7 @@ XclObjDropDown::XclObjDropDown( XclExpObjectManager& 
rObjMgr, const ScAddress& r
     SetAutoLine( false );
     nGrbit |= 0x0100;   // undocumented
     mrEscherEx.OpenContainer( ESCHER_SpContainer );
-    mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVEANCHOR | 
SHAPEFLAG_HAVESPT );
+    mrEscherEx.AddShape( ESCHER_ShpInst_HostControl, ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty );
     EscherPropertyContainer aPropOpt;
     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x01040104 ); // bool 
field
     aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 );      // bool 
field
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index ffcbd606cf03..c9224fd7aacc 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -297,7 +297,8 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, 
sal_uInt32 nMasterNum, sal_
     else
     {
         mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-        mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 );            
 // Flags: Connector | Background | HasSpt
+        mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle,
+                                 ShapeFlag::Background | 
ShapeFlag::HaveShapeProperty );
         EscherPropertyContainer aPropOpt;
         aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( 
maDestPageSize.Width ) );
         aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( 
maDestPageSize.Width ) );
@@ -1004,7 +1005,7 @@ bool PPTWriter::ImplCreateMainNotes()
 
     mpPptEscherEx->LeaveGroup();
     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-    mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 );
+    mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, ShapeFlag::Background | 
ShapeFlag::HaveShapeProperty );
     EscherPropertyContainer aPropOpt;
     aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff );                        
     // stock valued fill color
     aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
@@ -1133,7 +1134,7 @@ void PPTWriter::ImplWriteNotes( sal_uInt32 nPageNum )
 
     mpPptEscherEx->LeaveGroup();
     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-    mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: 
Connector | Background | HasSpt
+    mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, ShapeFlag::Background | 
ShapeFlag::HaveShapeProperty );
     EscherPropertyContainer aPropOpt;
     aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff );     // stock valued 
fill color
     aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
@@ -1164,7 +1165,7 @@ void PPTWriter::ImplWriteBackground( css::uno::Reference< 
css::beans::XPropertyS
     sal_uInt32 nFillBackColor = 0;
 
     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-    mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 );                
     // Flags: Connector | Background | HasSpt
+    mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, ShapeFlag::Background | 
ShapeFlag::HaveShapeProperty );
 
     // #i121183# Use real PageSize in 100th mm
     ::tools::Rectangle aRect(Point(0, 0), Size(maPageSize.Width, 
maPageSize.Height));
diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx
index dd342569566c..fe434116d955 100644
--- a/sd/source/filter/eppt/eppt.hxx
+++ b/sd/source/filter/eppt/eppt.hxx
@@ -230,7 +230,7 @@ class PPTWriter : public PPTWriterBase, public 
PPTExBulletProvider
         void                ImplWriteTextStyleAtom( SvStream& rOut, int 
nTextInstance, sal_uInt32 nAtomInstance,
                                 TextRuleEntry* pTextRule, SvStream& rExtBu, 
EscherPropertyContainer* );
         void                ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, 
EscherPropertyContainer& rPropOpt );
-        void                ImplCreateShape( sal_uInt32 nType, sal_uInt32 
nFlags, EscherSolverContainer& );
+        void                ImplCreateShape( sal_uInt32 nType, ShapeFlag 
nFlags, EscherSolverContainer& );
         void                ImplCreateTextShape( EscherPropertyContainer&, 
EscherSolverContainer&, bool bFill );
 
         void                ImplWritePage( const PHLayout& rLayout,
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index f8f3ff582417..5fe016dcbba7 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1564,7 +1564,8 @@ bool PPTWriter::ImplCreatePresentationPlaceholder( const 
bool bMasterPage,
     {
         mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
         sal_uInt32 nPresShapeID = mpPptEscherEx->GenerateShapeId();
-        mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, nPresShapeID 
);// Flags: HaveAnchor | HasSpt
+        mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle,
+                                 ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty, nPresShapeID );
         EscherPropertyContainer aPropOpt;
         aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
         aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
@@ -1609,7 +1610,7 @@ bool PPTWriter::ImplCreatePresentationPlaceholder( const 
bool bMasterPage,
     return bRet;
 }
 
-void PPTWriter::ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, 
EscherSolverContainer& rSolver )
+void PPTWriter::ImplCreateShape( sal_uInt32 nType, ShapeFlag nFlags, 
EscherSolverContainer& rSolver )
 {
     sal_uInt32 nId = mpPptEscherEx->GenerateShapeId();
     mpPptEscherEx->AddShape( nType, nFlags, nId );
@@ -1620,7 +1621,7 @@ void PPTWriter::ImplCreateTextShape( 
EscherPropertyContainer& rPropOpt, EscherSo
 {
     mnTextStyle = EPP_TEXTSTYLE_TEXT;
     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-    ImplCreateShape( ESCHER_ShpInst_TextBox, 0xa00, rSolver );
+    ImplCreateShape( ESCHER_ShpInst_TextBox, ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty, rSolver );
     if ( bFill )
         rPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
     if ( ImplGetText() )
@@ -1749,12 +1750,14 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
             if ( mType == "drawing.Custom" )
             {
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                sal_uInt32 nMirrorFlags;
+                ShapeFlag nMirrorFlags;
                 OUString sCustomShapeType;
                 MSO_SPT eShapeType = 
EscherPropertyContainer::GetCustomShapeType( mXShape, nMirrorFlags, 
sCustomShapeType );
                 if ( sCustomShapeType == "col-502ad400" || sCustomShapeType == 
"col-60da8460" )
                 {   // sj: creating metafile for customshapes that can't be 
saved to ms format properly
-                    ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, 
aSolverContainer );
+                    ImplCreateShape( ESCHER_ShpInst_PictureFrame,
+                                     ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                     aSolverContainer );
                     if ( aPropOpt.CreateGraphicProperties( mXPropSet, 
"MetaFile", false ) )
                     {
                         aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 
0x800080 );
@@ -1771,7 +1774,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                 }
                 else
                 {
-                    ImplCreateShape( eShapeType, nMirrorFlags | 0xa00, 
aSolverContainer );
+                    ImplCreateShape( eShapeType,
+                                     nMirrorFlags | ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                     aSolverContainer );
                     aPropOpt.CreateCustomShapeProperties( eShapeType, mXShape 
);
                     aPropOpt.CreateFillProperties( mXPropSet, true, mXShape);
                     if ( ImplGetText() )
@@ -1792,7 +1797,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                 }
                 if ( nRadius )
                 {
-                    ImplCreateShape( ESCHER_ShpInst_RoundRectangle, 0xa00, 
aSolverContainer ); // Flags: Connector | HasSpt
+                    ImplCreateShape( ESCHER_ShpInst_RoundRectangle,
+                                     ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                     aSolverContainer );
                     sal_Int32 nLength = maRect.GetWidth();
                     if ( nLength > maRect.GetHeight() )
                         nLength = maRect.GetHeight();
@@ -1805,7 +1812,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                 }
                 else
                 {
-                    ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, 
aSolverContainer );          // Flags: Connector | HasSpt
+                    ImplCreateShape( ESCHER_ShpInst_Rectangle,
+                                     ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                     aSolverContainer );
                 }
                 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
                 if ( ImplGetText() )
@@ -1844,7 +1853,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                 if ( eCircleKind == css::drawing::CircleKind_FULL )
                 {
                     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                    ImplCreateShape( ESCHER_ShpInst_Ellipse, 0xa00, 
aSolverContainer );            // Flags: Connector | HasSpt
+                    ImplCreateShape( ESCHER_ShpInst_Ellipse,
+                                     ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                     aSolverContainer );
                     aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
                     if ( ImplGetText() )
                         aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 
0x60, false, false );
@@ -1889,7 +1900,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                         mnAngle = 0;
                     }
                     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                    ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, 
aSolverContainer );       // Flags: Connector | HasSpt
+                    ImplCreateShape( ESCHER_ShpInst_NotPrimitive,
+                                     ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                     aSolverContainer );
                     css::awt::Rectangle aNewRect;
                     switch ( ePolyKind )
                     {
@@ -2012,7 +2025,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                 nOlePictureId = mnExEmbed;
 
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                sal_uInt32 const nSpFlags = SHAPEFLAG_HAVESPT | 
SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_OLESHAPE;
+                ShapeFlag const nSpFlags = ShapeFlag::HaveShapeProperty | 
ShapeFlag::HaveAnchor | ShapeFlag::OLEShape;
                 ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, 
aSolverContainer );
                 if ( aPropOpt.CreateGraphicProperties( mXPropSet, "MetaFile", 
false  ) )
                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 
);
@@ -2041,7 +2054,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
             }
             else if ( mType == "drawing.Connector" )
             {
-                sal_uInt16 nSpType, nSpFlags;
+                sal_uInt16 nSpType;
+                ShapeFlag nSpFlags;
                 css::awt::Rectangle aNewRect;
                 if ( !aPropOpt.CreateConnectorProperties( mXShape, 
aSolverContainer, aNewRect, nSpType, nSpFlags ) )
                     continue;
@@ -2076,11 +2090,12 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                     // mpPptEscherEx->EnterGroup( &maRect,0 );
                 }
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                sal_uInt32 nFlags = 0xa00;                                  // 
Flags: Connector | HasSpt
+                ShapeFlag nFlags = ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty;
+
                 if ( maRect.Top() > maRect.Bottom() )
-                    nFlags |= 0x80;                                         // 
Flags: VertMirror
+                    nFlags |= ShapeFlag::FlipV;
                 if ( maRect.Left() > maRect.Right() )
-                    nFlags |= 0x40;                                         // 
Flags: HorzMirror
+                    nFlags |= ShapeFlag::FlipH;
 
                 ImplCreateShape( ESCHER_ShpInst_Line, nFlags, aSolverContainer 
);
                 aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
@@ -2098,7 +2113,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                     mnTextSize = 0;
                 }
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, 
aSolverContainer );            // Flags: Connector | HasSpt
+                ImplCreateShape( ESCHER_ShpInst_NotPrimitive,
+                                 ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                 aSolverContainer );
                 css::awt::Rectangle aNewRect;
                 aPropOpt.CreatePolygonProperties( mXPropSet, 
ESCHER_CREATEPOLYGON_POLYPOLYGON, false, aNewRect );
                 maRect = MapRectangle( aNewRect );
@@ -2118,7 +2135,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                     mnTextSize = 0;
                 }
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, 
aSolverContainer );            // Flags: Connector | HasSpt
+                ImplCreateShape( ESCHER_ShpInst_NotPrimitive,
+                                 ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                 aSolverContainer );
                 css::awt::Rectangle aNewRect;
                 aPropOpt.CreatePolygonProperties( mXPropSet, 
ESCHER_CREATEPOLYGON_POLYLINE, false, aNewRect );
                 maRect = MapRectangle( aNewRect );
@@ -2138,7 +2157,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                     mnTextSize = 0;
                 }
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, 
aSolverContainer );            // Flags: Connector | HasSpt
+                ImplCreateShape( ESCHER_ShpInst_NotPrimitive,
+                                 ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                 aSolverContainer );
                 css::awt::Rectangle aNewRect;
                 aPropOpt.CreatePolygonProperties( mXPropSet, 
ESCHER_CREATEPOLYGON_POLYLINE, true, aNewRect );
                 maRect = MapRectangle( aNewRect );
@@ -2158,7 +2179,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                     mnTextSize = 0;
                 }
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, 
aSolverContainer );            // Flags: Connector | HasSpt
+                ImplCreateShape( ESCHER_ShpInst_NotPrimitive,
+                                 ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                 aSolverContainer );
                 css::awt::Rectangle aNewRect;
                 aPropOpt.CreatePolygonProperties( mXPropSet, 
ESCHER_CREATEPOLYGON_POLYPOLYGON, true, aNewRect );
                 maRect = MapRectangle( aNewRect );
@@ -2175,7 +2198,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                 if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
                 {
                     nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
-                    ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, 
aSolverContainer );           // Flags: HaveAnchor | HaveMaster
+                    ImplCreateShape( ESCHER_ShpInst_Rectangle, 
ShapeFlag::HaveAnchor | ShapeFlag::HaveMaster, aSolverContainer );
                     aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
                     aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
                     aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
@@ -2193,7 +2216,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                         /* SJ #i34951#: because M. documents are not allowing 
GraphicObjects containing text, we
                         have to create a simple Rectangle with fill bitmap 
instead (while not allowing BitmapMode_Repeat).
                         */
-                        ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, 
aSolverContainer );       // Flags: Connector | HasSpt
+                        ImplCreateShape( ESCHER_ShpInst_Rectangle,
+                                         ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                         aSolverContainer );
                         if ( aPropOpt.CreateGraphicProperties( mXPropSet, 
"GraphicURL", true, true, false ) )
                         {
                             aPropOpt.AddOpt( ESCHER_Prop_WrapText, 
ESCHER_WrapNone );
@@ -2207,7 +2232,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                     }
                     else
                     {
-                        ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, 
aSolverContainer );
+                        ImplCreateShape( ESCHER_ShpInst_PictureFrame,
+                                         ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                         aSolverContainer );
 
                         if ( aPropOpt.CreateGraphicProperties( mXPropSet, 
"GraphicURL", false, true ) )
                         {
@@ -2235,7 +2262,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                     {
                         mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                         nPlaceHolderAtom = 
EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE;
-                        ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x200, 
aSolverContainer );
+                        ImplCreateShape( ESCHER_ShpInst_Rectangle, 
ShapeFlag::HaveAnchor, aSolverContainer );
                         aPropOpt.CreateLineProperties( mXPropSet, false );
                         aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
                     }
@@ -2254,7 +2281,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
 
                                 mpPptEscherEx->OpenContainer( 
ESCHER_SpContainer );
                                 mnShapeMasterTitle = 
mpPptEscherEx->GenerateShapeId();
-                                mpPptEscherEx->AddShape( 
ESCHER_ShpInst_Rectangle, 0xa00, mnShapeMasterTitle );// Flags: HaveAnchor | 
HasSpt
+                                mpPptEscherEx->AddShape( 
ESCHER_ShpInst_Rectangle,
+                                                         ShapeFlag::HaveAnchor 
| ShapeFlag::HaveShapeProperty,
+                                                         mnShapeMasterTitle );
                                 EscherPropertyContainer aPropertyOptions;
                                 aPropertyOptions.AddOpt( 
ESCHER_Prop_LockAgainstGrouping, 0x50001 );
                                 aPropertyOptions.AddOpt( ESCHER_Prop_lTxid, 
mnTxId += 0x60 );
@@ -2305,7 +2334,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                             mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
                             mnTextStyle = EPP_TEXTSTYLE_TITLE;
                             nPlaceHolderAtom = rLayout.nTypeOfTitle;
-                            ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, 
aSolverContainer );          // Flags: HaveAnchor | HaveMaster
+                            ImplCreateShape( ESCHER_ShpInst_Rectangle,
+                                             ShapeFlag::HaveAnchor | 
ShapeFlag::HaveMaster,
+                                             aSolverContainer );
                             aPropOpt.AddOpt( ESCHER_Prop_hspMaster, 
mnShapeMasterTitle );
                             aPropOpt.CreateFillProperties( mXPropSet, true, 
mXShape );
                             aPropOpt.CreateTextProperties( mXPropSet, mnTxId 
+= 0x60 );
@@ -2346,7 +2377,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                             {
                                 mpPptEscherEx->OpenContainer( 
ESCHER_SpContainer );
                                 mnShapeMasterBody = 
mpPptEscherEx->GenerateShapeId();
-                                mpPptEscherEx->AddShape( 
ESCHER_ShpInst_Rectangle, 0xa00, mnShapeMasterBody );  // Flags: HaveAnchor | 
HasSpt
+                                mpPptEscherEx->AddShape( 
ESCHER_ShpInst_Rectangle,
+                                                         ShapeFlag::HaveAnchor 
| ShapeFlag::HaveShapeProperty,
+                                                         mnShapeMasterBody );
                                 EscherPropertyContainer aPropOpt2;
                                 aPropOpt2.AddOpt( 
ESCHER_Prop_LockAgainstGrouping, 0x50001 );
                                 aPropOpt2.AddOpt( ESCHER_Prop_lTxid, mnTxId += 
0x60 );
@@ -2406,7 +2439,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                             mnTextStyle = EPP_TEXTSTYLE_BODY;
                             nPlaceHolderAtom = rLayout.nTypeOfOutliner;
                             mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                            ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, 
aSolverContainer );          // Flags: HaveAnchor | HaveMaster
+                            ImplCreateShape( ESCHER_ShpInst_Rectangle,
+                                             ShapeFlag::HaveAnchor | 
ShapeFlag::HaveMaster,
+                                             aSolverContainer );
                             aPropOpt.AddOpt( ESCHER_Prop_hspMaster, 
mnShapeMasterBody );
                             aPropOpt.CreateFillProperties( mXPropSet, true, 
mXShape );
                             aPropOpt.CreateTextProperties( mXPropSet, mnTxId 
+= 0x60 );
@@ -2459,7 +2494,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                 if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
                 {
                     nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
-                    ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, 
aSolverContainer );              // Flags: HaveAnchor | HaveMaster
+                    ImplCreateShape( ESCHER_ShpInst_Rectangle,
+                                     ShapeFlag::HaveAnchor | 
ShapeFlag::HaveMaster,
+                                     aSolverContainer );
                     aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
                     aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
                     aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
@@ -2513,9 +2550,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                     mpExEmbed->Seek( STREAM_SEEK_TO_END );
                     nOlePictureId = mnExEmbed;
 
-                    sal_uInt32 nSpFlags = 0xa00;
+                    ShapeFlag nSpFlags = ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty;
                     if ( nOlePictureId )
-                        nSpFlags |= 0x10;
+                        nSpFlags |= ShapeFlag::OLEShape;
                     ImplCreateShape( ESCHER_ShpInst_PictureFrame, nSpFlags, 
aSolverContainer );
                     if ( aPropOpt.CreateOLEGraphicProperties( mXShape ) )
                         aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 
0x800080 );
@@ -2574,7 +2611,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
                     continue;
 
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, 
aSolverContainer );
+                ImplCreateShape( ESCHER_ShpInst_PictureFrame,
+                                 ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                 aSolverContainer );
 
                 if ( aPropOpt.CreateGraphicProperties( mXPropSet, "Bitmap", 
false ) )
                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 
);
@@ -2583,7 +2622,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
             {
                 mnAngle = 0;
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, 
aSolverContainer );
+                ImplCreateShape( ESCHER_ShpInst_PictureFrame,
+                                 ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                 aSolverContainer );
                 if ( aPropOpt.CreateMediaGraphicProperties( mXShape ) )
                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 
);
                 css::uno::Any aAny;
@@ -2666,7 +2707,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, 
EscherSolverContainer& a
             {
                 mnAngle = 0;
                 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
-                ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, 
aSolverContainer );
+                ImplCreateShape( ESCHER_ShpInst_PictureFrame,
+                                 ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty,
+                                 aSolverContainer );
                 if ( aPropOpt.CreateGraphicProperties( mXPropSet, "MetaFile", 
false ) )
                     aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 
);
             }
@@ -2933,7 +2976,9 @@ bool PPTWriter::ImplCreateCellBorder( const CellBorder* 
pCellBorder, sal_Int32 n
         EscherPropertyContainer aPropOptSp;
 
         sal_uInt32 nId = mpPptEscherEx->GenerateShapeId();
-        mpPptEscherEx->AddShape( ESCHER_ShpInst_Line, 0xa02, nId );
+        mpPptEscherEx->AddShape( ESCHER_ShpInst_Line,
+                                 ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty | ShapeFlag::Child,
+                                 nId );
         aPropOptSp.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
         aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0xa0008 );
         aPropOptSp.AddOpt( ESCHER_Prop_fshadowObscured, 0x20000 );
@@ -3072,7 +3117,8 @@ void PPTWriter::ImplCreateTable( uno::Reference< 
drawing::XShape > const & rXSha
                        .WriteInt32( maRect.Bottom() );
 
             sal_uInt32 nShapeId = mpPptEscherEx->GenerateShapeId();
-            mpPptEscherEx->AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId );    
 // Flags: Group | Patriarch
+            mpPptEscherEx->AddShape( ESCHER_ShpInst_Min, ShapeFlag::HaveAnchor 
| ShapeFlag::Group, nShapeId );
+            // TODO: check flags, comment does not match code // Flags: Group 
| Patriarch
             aSolverContainer.AddShape( rXShape, nShapeId );
             EscherPropertyContainer aPropOpt2;
 
@@ -3122,7 +3168,9 @@ void PPTWriter::ImplCreateTable( uno::Reference< 
drawing::XShape > const & rXSha
 
                         EscherPropertyContainer aPropOptSp;
                         std::unique_ptr<ContainerGuard> xCellContainer(new 
ContainerGuard(mpPptEscherEx, ESCHER_SpContainer));
-                        ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa02, 
aSolverContainer );          // Flags: Connector | HasSpt | Child
+                        ImplCreateShape( ESCHER_ShpInst_Rectangle,
+                                         ShapeFlag::HaveAnchor | 
ShapeFlag::HaveShapeProperty | ShapeFlag::Child,
+                                         aSolverContainer );
                         aPropOptSp.CreateFillProperties( mXPropSet, true );
                         aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 
0x90000 );
                         aPropOptSp.CreateTextProperties( mXPropSet, mnTxId += 
0x60 );
diff --git a/sd/source/filter/eppt/escherex.cxx 
b/sd/source/filter/eppt/escherex.cxx
index dc8844a87f76..d0894bd02216 100644
--- a/sd/source/filter/eppt/escherex.cxx
+++ b/sd/source/filter/eppt/escherex.cxx
@@ -227,10 +227,10 @@ sal_uInt32 PptEscherEx::EnterGroup( ::tools::Rectangle 
const * pBoundRect, SvMem
 
         nShapeId = GenerateShapeId();
         if ( !mnGroupLevel )
-            AddShape( ESCHER_ShpInst_Min, 5, nShapeId );                    // 
Flags: Group | Patriarch
+            AddShape( ESCHER_ShpInst_Min, ShapeFlag::Group | 
ShapeFlag::Patriarch, nShapeId );
         else
         {
-            AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId );                // 
Flags: Group | HaveAnchor
+            AddShape( ESCHER_ShpInst_Min, ShapeFlag::HaveAnchor | 
ShapeFlag::Group, nShapeId );
             if ( mnGroupLevel == 1 )
             {
                 AddAtom( 8, ESCHER_ClientAnchor );
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index ee2c646d536d..4509cc0b9bc9 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -935,7 +935,7 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* 
sdrObj, const SwFrame
 
     // Depending on the shape type, we actually don't write the shape as DML.
     OUString sShapeType;
-    sal_uInt32 nMirrorFlags = 0;
+    ShapeFlag nMirrorFlags = ShapeFlag::NONE;
     uno::Reference<drawing::XShape> 
xShape(const_cast<SdrObject*>(sdrObj)->getUnoShape(), uno::UNO_QUERY_THROW);
 
     // Locked canvas is OK inside DML.
diff --git a/sw/source/filter/ww8/escher.hxx b/sw/source/filter/ww8/escher.hxx
index 8d008133835c..a38f0c02b0e7 100644
--- a/sw/source/filter/ww8/escher.hxx
+++ b/sw/source/filter/ww8/escher.hxx
@@ -101,7 +101,7 @@ protected:
     void WriteBrushAttr(const SvxBrushItem &rBrush,
         EscherPropertyContainer& rPropOpt);
     void WriteOLEPicture(EscherPropertyContainer &rPropOpt,
-        sal_uInt32 nShapeFlags, const Graphic &rGraphic, const SdrObject &rObj,
+        ShapeFlag nShapeFlags, const Graphic &rGraphic, const SdrObject &rObj,
         sal_uInt32 nShapeId, const css::awt::Rectangle* pVisArea );
     static void WriteGrfAttr(const SwNoTextNode& rNd, const SwFrameFormat& 
rFormat, EscherPropertyContainer& rPropOpt);
 
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx 
b/sw/source/filter/ww8/rtfsdrexport.cxx
index e77f0d89bd85..b8d53faf704b 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -42,7 +42,7 @@ RtfSdrExport::RtfSdrExport(RtfExport& rExport)
       m_rAttrOutput(static_cast<RtfAttributeOutput&>(m_rExport.AttrOutput())),
       m_pSdrObject(nullptr),
       m_nShapeType(ESCHER_ShpInst_Nil),
-      m_nShapeFlags(0),
+      m_nShapeFlags(ShapeFlag::NONE),
       m_aShapeStyle(200),
       m_pShapeTypeWritten(new bool[ ESCHER_ShpInst_COUNT ])
 {
@@ -94,7 +94,7 @@ void RtfSdrExport::LeaveGroup()
     /* noop */
 }
 
-void RtfSdrExport::AddShape(sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, 
sal_uInt32 /*nShapeId*/)
+void RtfSdrExport::AddShape(sal_uInt32 nShapeType, ShapeFlag nShapeFlags, 
sal_uInt32 /*nShapeId*/)
 {
     m_nShapeType = nShapeType;
     m_nShapeFlags = nShapeFlags;
@@ -407,19 +407,11 @@ void RtfSdrExport::AddLineDimensions(const 
tools::Rectangle& rRectangle)
     // We get the position relative to (the current?) character
     m_aShapeProps.insert(std::pair<OString,OString>("posrelh", "3"));
 
-    switch (m_nShapeFlags & 0xC0)
-    {
-    case 0x40:
-        m_aShapeProps.insert(std::pair<OString,OString>("fFlipV", "1"));
-        break;
-    case 0x80:
-        m_aShapeProps.insert(std::pair<OString,OString>("fFlipH", "1"));
-        break;
-    case 0xC0:
+    if (m_nShapeFlags & ShapeFlag::FlipV)
         m_aShapeProps.insert(std::pair<OString,OString>("fFlipV", "1"));
+
+    if (m_nShapeFlags & ShapeFlag::FlipH)
         m_aShapeProps.insert(std::pair<OString,OString>("fFlipH", "1"));
-        break;
-    }
 
     // the actual dimensions
     
m_aShapeStyle.append(OOO_STRING_SVTOOLS_RTF_SHPLEFT).append(rRectangle.Left());
diff --git a/sw/source/filter/ww8/rtfsdrexport.hxx 
b/sw/source/filter/ww8/rtfsdrexport.hxx
index 2b1302ec0042..f8d29fbc5a8a 100644
--- a/sw/source/filter/ww8/rtfsdrexport.hxx
+++ b/sw/source/filter/ww8/rtfsdrexport.hxx
@@ -47,7 +47,7 @@ class RtfSdrExport : public EscherEx
     sal_uInt32 m_nShapeType;
 
     /// Remember the shape flags.
-    sal_uInt32 m_nShapeFlags;
+    ShapeFlag m_nShapeFlags;
 
     /// Remember style, the most important shape attribute ;-)
     OStringBuffer m_aShapeStyle;
@@ -94,7 +94,7 @@ private:
     sal_uInt32 EnterGroup(const OUString& rShapeName, const tools::Rectangle* 
pBoundRect) override;
     void LeaveGroup() override;
 
-    void AddShape(sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 
nShapeId = 0) override;
+    void AddShape(sal_uInt32 nShapeType, ShapeFlag nShapeFlags, sal_uInt32 
nShapeId = 0) override;
 
 private:
     /// Add starting and ending point of a line to the m_pShapeAttrList.
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index f5450722ce38..9027122be771 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx

... etc. - the rest is truncated
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to