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;
class E3dPolyScene;
class E3dObject;
#define PREVIEW_OBJECTTYPE_SPHERE 0x0000
#define PREVIEW_OBJECTTYPE_CUBE 0x0001
enum class SvxPreviewObjectType { SPHERE, CUBE };
class SVX_DLLPUBLIC SAL_WARN_UNUSED Svx3DPreviewControl : public Control
{
......@@ -44,7 +43,7 @@ protected:
E3dView* mp3DView;
E3dPolyScene* mpScene;
E3dObject* mp3DObj;
sal_uInt16 mnObjectType;
SvxPreviewObjectType mnObjectType;
void Construct();
......@@ -59,8 +58,8 @@ public:
virtual Size GetOptimalSize() const SAL_OVERRIDE;
void Reset();
virtual void SetObjectType(sal_uInt16 nType);
sal_uInt16 GetObjectType() const { return mnObjectType; }
virtual void SetObjectType(SvxPreviewObjectType nType);
SvxPreviewObjectType GetObjectType() const { return mnObjectType; }
SfxItemSet Get3DAttributes() const;
virtual void Set3DAttributes(const SfxItemSet& rAttr);
};
......@@ -111,7 +110,7 @@ public:
virtual void Tracking( const TrackingEvent& rTEvt ) 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
void SetUserInteractiveChangeCallback(Link aNew) { maUserInteractiveChangeCallback = aNew; }
......
......@@ -48,7 +48,7 @@ Svx3DPreviewControl::Svx3DPreviewControl(vcl::Window* pParent, WinBits nStyle)
mp3DView(0),
mpScene(0),
mp3DObj(0),
mnObjectType(PREVIEW_OBJECTTYPE_SPHERE)
mnObjectType(SvxPreviewObjectType::SPHERE)
{
Construct();
......@@ -103,7 +103,7 @@ void Svx3DPreviewControl::Construct()
mpScene = new E3dPolyScene(mp3DView->Get3DDefaultAttributes());
// initially create object
SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
SetObjectType(SvxPreviewObjectType::SPHERE);
// camera and perspective
Camera3D& rCamera = (Camera3D&) mpScene->GetCamera();
......@@ -177,18 +177,18 @@ void Svx3DPreviewControl::MouseButtonDown(const MouseEvent& rMEvt)
if( rMEvt.IsShift() && rMEvt.IsMod1() )
{
if(PREVIEW_OBJECTTYPE_SPHERE == GetObjectType())
if(SvxPreviewObjectType::SPHERE == GetObjectType())
{
SetObjectType(PREVIEW_OBJECTTYPE_CUBE);
SetObjectType(SvxPreviewObjectType::CUBE);
}
else
{
SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
SetObjectType(SvxPreviewObjectType::SPHERE);
}
}
}
void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType)
void Svx3DPreviewControl::SetObjectType(SvxPreviewObjectType nType)
{
if( mnObjectType != nType || !mp3DObj)
{
......@@ -205,7 +205,7 @@ void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType)
switch( nType )
{
case PREVIEW_OBJECTTYPE_SPHERE:
case SvxPreviewObjectType::SPHERE:
{
mp3DObj = new E3dSphereObj(
mp3DView->Get3DDefaultAttributes(),
......@@ -214,7 +214,7 @@ void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType)
}
break;
case PREVIEW_OBJECTTYPE_CUBE:
case SvxPreviewObjectType::CUBE:
{
mp3DObj = new E3dCubeObj(
mp3DView->Get3DDefaultAttributes(),
......@@ -713,7 +713,7 @@ void Svx3DLightControl::Resize()
mpScene->SetSnapRect(Rectangle(Point(0, 0), aSize));
}
void Svx3DLightControl::SetObjectType(sal_uInt16 nType)
void Svx3DLightControl::SetObjectType(SvxPreviewObjectType nType)
{
// call parent
Svx3DPreviewControl::SetObjectType(nType);
......@@ -1251,13 +1251,13 @@ IMPL_LINK_NOARG(SvxLightCtl3D, ScrollBarMove)
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
{
GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::SPHERE);
}
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