diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-08-31 14:13:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-02 14:10:40 +0200 |
commit | 31ee13b5a40715e217711e48753eeb7170e3349c (patch) | |
tree | 116fa315d12b1a9505f91b52917cfbeafa69fba0 /include | |
parent | 1463625ae26900d2461fd72a5a2c894b9f1b8726 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/filter/msfilter/escherex.hxx | 33 | ||||
-rw-r--r-- | include/filter/msfilter/msdffimp.hxx | 26 | ||||
-rw-r--r-- | include/oox/export/vmlexport.hxx | 4 |
3 files changed, 35 insertions, 28 deletions
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. |