summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-04-24 14:53:18 +0200
committerNoel Grandin <noel@peralex.com>2015-04-29 10:41:40 +0200
commit62f9bc737c928ceed89af09ff927c92bea4896ca (patch)
tree0aa7fa567232ff2040c7011bdce1d9ea3bbb87e9
parent336ace7cf0a1b5abf7a56983ed1a7510f9b0d231 (diff)
convert SDRGRAPHOBJ constants to scoped enum
Change-Id: Ie1fba429e809ae235b9c2390071b61d8b6d115c9
-rw-r--r--include/svx/svdograf.hxx21
-rw-r--r--svx/source/svdraw/svdedtv2.cxx2
-rw-r--r--svx/source/svdraw/svdograf.cxx10
3 files changed, 21 insertions, 12 deletions
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 399bcbd1774f..29499a180742 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -25,6 +25,7 @@
#include <svx/svdorect.hxx>
#include <svtools/grfmgr.hxx>
#include <svx/svxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
namespace sdr
{
@@ -38,11 +39,19 @@ namespace sdr
} // end of namespace contact
} // end of namespace sdr
-#define SDRGRAFOBJ_TRANSFORMATTR_NONE 0x00000000UL
-#define SDRGRAFOBJ_TRANSFORMATTR_COLOR 0x00000001UL
-#define SDRGRAFOBJ_TRANSFORMATTR_MIRROR 0x00000002UL
-#define SDRGRAFOBJ_TRANSFORMATTR_ROTATE 0x00000004UL
-#define SDRGRAFOBJ_TRANSFORMATTR_ALL 0xffffffffUL
+/* options for GetTransformedGraphic() */
+enum class SdrGrafObjTransformsAttrs
+{
+ NONE = 0x00,
+ COLOR = 0x01,
+ MIRROR = 0x02,
+ ROTATE = 0x04,
+ ALL = 0x07,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SdrGrafObjTransformsAttrs> : is_typed_flags<SdrGrafObjTransformsAttrs, 7> {};
+}
class SdrGrafObjGeoData : public SdrTextObjGeoData
{
@@ -120,7 +129,7 @@ public:
void SetGraphic(const Graphic& rGrf);
const Graphic& GetGraphic() const;
- Graphic GetTransformedGraphic( sal_uIntPtr nTransformFlags = SDRGRAFOBJ_TRANSFORMATTR_ALL ) const;
+ Graphic GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const;
GraphicType GetGraphicType() const;
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index e2fd8d2df57b..0a60082c2422 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -2006,7 +2006,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo)
if(pGraf->HasGDIMetaFile())
{
- aMetaFile = pGraf->GetTransformedGraphic(SDRGRAFOBJ_TRANSFORMATTR_COLOR|SDRGRAFOBJ_TRANSFORMATTR_MIRROR).GetGDIMetaFile();
+ aMetaFile = pGraf->GetTransformedGraphic(SdrGrafObjTransformsAttrs::COLOR|SdrGrafObjTransformsAttrs::MIRROR).GetGDIMetaFile();
}
else if(pGraf->isEmbeddedSvg())
{
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index b4cf3899dd2e..15df383d7e29 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -472,7 +472,7 @@ const Graphic& SdrGrafObj::GetGraphic() const
return pGraphic->GetGraphic();
}
-Graphic SdrGrafObj::GetTransformedGraphic( sal_uIntPtr nTransformFlags ) const
+Graphic SdrGrafObj::GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformFlags ) const
{
// Refactored most of the code to GraphicObject, where
// everybody can use e.g. the cropping functionality
@@ -480,15 +480,15 @@ Graphic SdrGrafObj::GetTransformedGraphic( sal_uIntPtr nTransformFlags ) const
GraphicType eType = GetGraphicType();
MapMode aDestMap( pModel->GetScaleUnit(), Point(), pModel->GetScaleFraction(), pModel->GetScaleFraction() );
const Size aDestSize( GetLogicRect().GetSize() );
- const bool bMirror = ( nTransformFlags & SDRGRAFOBJ_TRANSFORMATTR_MIRROR ) != 0;
- const bool bRotate = ( ( nTransformFlags & SDRGRAFOBJ_TRANSFORMATTR_ROTATE ) != 0 ) &&
+ const bool bMirror = bool( nTransformFlags & SdrGrafObjTransformsAttrs::MIRROR );
+ const bool bRotate = bool( nTransformFlags & SdrGrafObjTransformsAttrs::ROTATE ) &&
( aGeo.nRotationAngle && aGeo.nRotationAngle != 18000 ) && ( GRAPHIC_NONE != eType );
// Need cropping info earlier
const_cast<SdrGrafObj*>(this)->ImpSetAttrToGrafInfo();
GraphicAttr aActAttr;
- if( SDRGRAFOBJ_TRANSFORMATTR_NONE != nTransformFlags &&
+ if( SdrGrafObjTransformsAttrs::NONE != nTransformFlags &&
GRAPHIC_NONE != eType )
{
// Actually transform the graphic only in this case.
@@ -1062,7 +1062,7 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(bool bBezier, bool bAddText ) const
}
else if(GRAPHIC_GDIMETAFILE == aGraphicType)
{
- aMtf = GetTransformedGraphic(SDRGRAFOBJ_TRANSFORMATTR_COLOR|SDRGRAFOBJ_TRANSFORMATTR_MIRROR).GetGDIMetaFile();
+ aMtf = GetTransformedGraphic(SdrGrafObjTransformsAttrs::COLOR|SdrGrafObjTransformsAttrs::MIRROR).GetGDIMetaFile();
}
switch(aGraphicType)