Kaydet (Commit) 9fb3b992 authored tarafından Noel Grandin's avatar Noel Grandin

convert PREVIEW_OBJECTTYPE constants to scoped enum

Change-Id: I5c370627bc8ccf1de2ae7f3764cf2236215d5379
üst c97b81ea
...@@ -33,8 +33,7 @@ class E3dView; ...@@ -33,8 +33,7 @@ class E3dView;
class E3dPolyScene; class E3dPolyScene;
class E3dObject; class E3dObject;
#define PREVIEW_OBJECTTYPE_SPHERE 0x0000 enum class SvxPreviewObjectType { SPHERE, CUBE };
#define PREVIEW_OBJECTTYPE_CUBE 0x0001
class SVX_DLLPUBLIC SAL_WARN_UNUSED Svx3DPreviewControl : public Control class SVX_DLLPUBLIC SAL_WARN_UNUSED Svx3DPreviewControl : public Control
{ {
...@@ -44,7 +43,7 @@ protected: ...@@ -44,7 +43,7 @@ protected:
E3dView* mp3DView; E3dView* mp3DView;
E3dPolyScene* mpScene; E3dPolyScene* mpScene;
E3dObject* mp3DObj; E3dObject* mp3DObj;
sal_uInt16 mnObjectType; SvxPreviewObjectType mnObjectType;
void Construct(); void Construct();
...@@ -59,8 +58,8 @@ public: ...@@ -59,8 +58,8 @@ public:
virtual Size GetOptimalSize() const SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE;
void Reset(); void Reset();
virtual void SetObjectType(sal_uInt16 nType); virtual void SetObjectType(SvxPreviewObjectType nType);
sal_uInt16 GetObjectType() const { return mnObjectType; } SvxPreviewObjectType GetObjectType() const { return mnObjectType; }
SfxItemSet Get3DAttributes() const; SfxItemSet Get3DAttributes() const;
virtual void Set3DAttributes(const SfxItemSet& rAttr); virtual void Set3DAttributes(const SfxItemSet& rAttr);
}; };
...@@ -111,7 +110,7 @@ public: ...@@ -111,7 +110,7 @@ public:
virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE; virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
virtual void SetObjectType(sal_uInt16 nType) SAL_OVERRIDE; virtual void SetObjectType(SvxPreviewObjectType nType) SAL_OVERRIDE;
// register user callback // register user callback
void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; } void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; }
......
...@@ -48,7 +48,7 @@ Svx3DPreviewControl::Svx3DPreviewControl(vcl::Window* pParent, WinBits nStyle) ...@@ -48,7 +48,7 @@ Svx3DPreviewControl::Svx3DPreviewControl(vcl::Window* pParent, WinBits nStyle)
mp3DView(0), mp3DView(0),
mpScene(0), mpScene(0),
mp3DObj(0), mp3DObj(0),
mnObjectType(PREVIEW_OBJECTTYPE_SPHERE) mnObjectType(SvxPreviewObjectType::SPHERE)
{ {
Construct(); Construct();
...@@ -103,7 +103,7 @@ void Svx3DPreviewControl::Construct() ...@@ -103,7 +103,7 @@ void Svx3DPreviewControl::Construct()
mpScene = new E3dPolyScene(mp3DView->Get3DDefaultAttributes()); mpScene = new E3dPolyScene(mp3DView->Get3DDefaultAttributes());
// initially create object // initially create object
SetObjectType(PREVIEW_OBJECTTYPE_SPHERE); SetObjectType(SvxPreviewObjectType::SPHERE);
// camera and perspective // camera and perspective
Camera3D& rCamera = (Camera3D&) mpScene->GetCamera(); Camera3D& rCamera = (Camera3D&) mpScene->GetCamera();
...@@ -177,18 +177,18 @@ void Svx3DPreviewControl::MouseButtonDown(const MouseEvent& rMEvt) ...@@ -177,18 +177,18 @@ void Svx3DPreviewControl::MouseButtonDown(const MouseEvent& rMEvt)
if( rMEvt.IsShift() && rMEvt.IsMod1() ) if( rMEvt.IsShift() && rMEvt.IsMod1() )
{ {
if(PREVIEW_OBJECTTYPE_SPHERE == GetObjectType()) if(SvxPreviewObjectType::SPHERE == GetObjectType())
{ {
SetObjectType(PREVIEW_OBJECTTYPE_CUBE); SetObjectType(SvxPreviewObjectType::CUBE);
} }
else else
{ {
SetObjectType(PREVIEW_OBJECTTYPE_SPHERE); SetObjectType(SvxPreviewObjectType::SPHERE);
} }
} }
} }
void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType) void Svx3DPreviewControl::SetObjectType(SvxPreviewObjectType nType)
{ {
if( mnObjectType != nType || !mp3DObj) if( mnObjectType != nType || !mp3DObj)
{ {
...@@ -205,7 +205,7 @@ void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType) ...@@ -205,7 +205,7 @@ void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType)
switch( nType ) switch( nType )
{ {
case PREVIEW_OBJECTTYPE_SPHERE: case SvxPreviewObjectType::SPHERE:
{ {
mp3DObj = new E3dSphereObj( mp3DObj = new E3dSphereObj(
mp3DView->Get3DDefaultAttributes(), mp3DView->Get3DDefaultAttributes(),
...@@ -214,7 +214,7 @@ void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType) ...@@ -214,7 +214,7 @@ void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType)
} }
break; break;
case PREVIEW_OBJECTTYPE_CUBE: case SvxPreviewObjectType::CUBE:
{ {
mp3DObj = new E3dCubeObj( mp3DObj = new E3dCubeObj(
mp3DView->Get3DDefaultAttributes(), mp3DView->Get3DDefaultAttributes(),
...@@ -713,7 +713,7 @@ void Svx3DLightControl::Resize() ...@@ -713,7 +713,7 @@ void Svx3DLightControl::Resize()
mpScene->SetSnapRect(Rectangle(Point(0, 0), aSize)); mpScene->SetSnapRect(Rectangle(Point(0, 0), aSize));
} }
void Svx3DLightControl::SetObjectType(sal_uInt16 nType) void Svx3DLightControl::SetObjectType(SvxPreviewObjectType nType)
{ {
// call parent // call parent
Svx3DPreviewControl::SetObjectType(nType); Svx3DPreviewControl::SetObjectType(nType);
...@@ -1251,13 +1251,13 @@ IMPL_LINK_NOARG(SvxLightCtl3D, ScrollBarMove) ...@@ -1251,13 +1251,13 @@ IMPL_LINK_NOARG(SvxLightCtl3D, ScrollBarMove)
IMPL_LINK_NOARG(SvxLightCtl3D, ButtonPress) IMPL_LINK_NOARG(SvxLightCtl3D, ButtonPress)
{ {
if(PREVIEW_OBJECTTYPE_SPHERE == GetSvx3DLightControl().GetObjectType()) if(SvxPreviewObjectType::SPHERE == GetSvx3DLightControl().GetObjectType())
{ {
GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_CUBE); GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::CUBE);
} }
else else
{ {
GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_SPHERE); GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::SPHERE);
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment