summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-04-24 11:33:00 +0200
committerNoel Grandin <noel@peralex.com>2015-04-29 10:41:39 +0200
commitd66f266cf24d09c2ceb9320f1355ba27114187c2 (patch)
tree45e90b8e144057dd38ca6ea46c1cb30104174149 /svx
parentda9361374c45da7c3bda803aaed52485fb3b12d7 (diff)
convert SDR*ALIGN constants to scoped enum
Change-Id: I29b7b4fe1181133cbbb0bb43a1835941cf12210d
Diffstat (limited to 'svx')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx2
-rw-r--r--svx/source/svdraw/svdglev.cxx18
-rw-r--r--svx/source/svdraw/svdglue.cxx69
-rw-r--r--svx/source/unodraw/gluepts.cxx51
4 files changed, 70 insertions, 70 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 2c231601a9ed..a463eb8b5376 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2350,7 +2350,7 @@ void EnhancedCustomShape2d::ApplyGluePoints( SdrObject* pObj )
aGluePoint.SetPos( GetPoint( seqGluePoints[ i ], true, true ) );
aGluePoint.SetPercent( false );
- aGluePoint.SetAlign( SDRVERTALIGN_TOP | SDRHORZALIGN_LEFT );
+ aGluePoint.SetAlign( SdrAlign::VERT_TOP | SdrAlign::HORZ_LEFT );
aGluePoint.SetEscDir( SdrEscapeDirection::SMART );
SdrGluePointList* pList = pObj->ForceGluePointList();
if( pList )
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index 3492f47e076c..7f2faba3fa0e 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -169,11 +169,11 @@ void SdrGlueEditView::SetMarkedGluePointsPercent(bool bOn)
static void ImpGetAlign(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void* pbFirst, const void* pbDontCare, const void* pbVert, const void* pnRet, const void*)
{
- sal_uInt16& nRet=*const_cast<sal_uInt16 *>(static_cast<sal_uInt16 const *>(pnRet));
+ SdrAlign& nRet=*const_cast<SdrAlign *>(static_cast<SdrAlign const *>(pnRet));
bool& bDontCare=*const_cast<bool *>(static_cast<bool const *>(pbDontCare));
bool bVert=*static_cast<bool const *>(pbVert);
if (!bDontCare) {
- sal_uInt16 nAlg=0;
+ SdrAlign nAlg=SdrAlign::NONE;
if (bVert) {
nAlg=rGP.GetVertAlign();
} else {
@@ -183,21 +183,21 @@ static void ImpGetAlign(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const void
if (bFirst) { nRet=nAlg; bFirst=false; }
else if (nRet!=nAlg) {
if (bVert) {
- nRet=SDRVERTALIGN_DONTCARE;
+ nRet=SdrAlign::VERT_DONTCARE;
} else {
- nRet=SDRHORZALIGN_DONTCARE;
+ nRet=SdrAlign::HORZ_DONTCARE;
}
bDontCare=true;
}
}
}
-sal_uInt16 SdrGlueEditView::GetMarkedGluePointsAlign(bool bVert) const
+SdrAlign SdrGlueEditView::GetMarkedGluePointsAlign(bool bVert) const
{
ForceUndirtyMrkPnt();
bool bFirst=true;
bool bDontCare=false;
- sal_uInt16 nRet=0;
+ SdrAlign nRet=SdrAlign::NONE;
const_cast<SdrGlueEditView*>(this)->ImpDoMarkedGluePoints(ImpGetAlign,true,&bFirst,&bDontCare,&bVert,&nRet);
return nRet;
}
@@ -206,14 +206,14 @@ static void ImpSetAlign(SdrGluePoint& rGP, const SdrObject* pObj, const void* pb
{
Point aPos(rGP.GetAbsolutePos(*pObj));
if (*static_cast<bool const *>(pbVert)) { // bVert?
- rGP.SetVertAlign(*static_cast<sal_uInt16 const *>(pnAlign));
+ rGP.SetVertAlign(*static_cast<SdrAlign const *>(pnAlign));
} else {
- rGP.SetHorzAlign(*static_cast<sal_uInt16 const *>(pnAlign));
+ rGP.SetHorzAlign(*static_cast<SdrAlign const *>(pnAlign));
}
rGP.SetAbsolutePos(aPos,*pObj);
}
-void SdrGlueEditView::SetMarkedGluePointsAlign(bool bVert, sal_uInt16 nAlign)
+void SdrGlueEditView::SetMarkedGluePointsAlign(bool bVert, SdrAlign nAlign)
{
ForceUndirtyMrkPnt();
BegUndo(ImpGetResStr(STR_EditSetGlueAlign),GetDescriptionOfMarkedGluePoints());
diff --git a/svx/source/svdraw/svdglue.cxx b/svx/source/svdraw/svdglue.cxx
index ad7b1f3d0d86..cbfc3f58cb9f 100644
--- a/svx/source/svdraw/svdglue.cxx
+++ b/svx/source/svdraw/svdglue.cxx
@@ -52,12 +52,14 @@ Point SdrGluePoint::GetAbsolutePos(const SdrObject& rObj) const
Point aOfs(aSnap.Center());
switch (GetHorzAlign()) {
- case SDRHORZALIGN_LEFT : aOfs.X()=aSnap.Left(); break;
- case SDRHORZALIGN_RIGHT : aOfs.X()=aSnap.Right(); break;
+ case SdrAlign::HORZ_LEFT : aOfs.X()=aSnap.Left(); break;
+ case SdrAlign::HORZ_RIGHT : aOfs.X()=aSnap.Right(); break;
+ default: break;
}
switch (GetVertAlign()) {
- case SDRVERTALIGN_TOP : aOfs.Y()=aSnap.Top(); break;
- case SDRVERTALIGN_BOTTOM: aOfs.Y()=aSnap.Bottom(); break;
+ case SdrAlign::VERT_TOP : aOfs.Y()=aSnap.Top(); break;
+ case SdrAlign::VERT_BOTTOM: aOfs.Y()=aSnap.Bottom(); break;
+ default: break;
}
if (!bNoPercent) {
long nXMul=aSnap.Right()-aSnap.Left();
@@ -93,12 +95,14 @@ void SdrGluePoint::SetAbsolutePos(const Point& rNewPos, const SdrObject& rObj)
Point aOfs(aSnap.Center());
switch (GetHorzAlign()) {
- case SDRHORZALIGN_LEFT : aOfs.X()=aSnap.Left(); break;
- case SDRHORZALIGN_RIGHT : aOfs.X()=aSnap.Right(); break;
+ case SdrAlign::HORZ_LEFT : aOfs.X()=aSnap.Left(); break;
+ case SdrAlign::HORZ_RIGHT : aOfs.X()=aSnap.Right(); break;
+ default: break;
}
switch (GetVertAlign()) {
- case SDRVERTALIGN_TOP : aOfs.Y()=aSnap.Top(); break;
- case SDRVERTALIGN_BOTTOM: aOfs.Y()=aSnap.Bottom(); break;
+ case SdrAlign::VERT_TOP : aOfs.Y()=aSnap.Top(); break;
+ case SdrAlign::VERT_BOTTOM: aOfs.Y()=aSnap.Bottom(); break;
+ default: break;
}
aPt-=aOfs;
if (!bNoPercent) {
@@ -122,31 +126,38 @@ void SdrGluePoint::SetAbsolutePos(const Point& rNewPos, const SdrObject& rObj)
long SdrGluePoint::GetAlignAngle() const
{
- switch (nAlign) {
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER: return 0; // Invalid!
- case SDRHORZALIGN_RIGHT |SDRVERTALIGN_CENTER: return 0;
- case SDRHORZALIGN_RIGHT |SDRVERTALIGN_TOP : return 4500;
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP : return 9000;
- case SDRHORZALIGN_LEFT |SDRVERTALIGN_TOP : return 13500;
- case SDRHORZALIGN_LEFT |SDRVERTALIGN_CENTER: return 18000;
- case SDRHORZALIGN_LEFT |SDRVERTALIGN_BOTTOM: return 22500;
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM: return 27000;
- case SDRHORZALIGN_RIGHT |SDRVERTALIGN_BOTTOM: return 31500;
- } // switch
+ if (nAlign == (SdrAlign::HORZ_CENTER|SdrAlign::VERT_CENTER))
+ return 0; // Invalid!
+ else if (nAlign == (SdrAlign::HORZ_RIGHT |SdrAlign::VERT_CENTER))
+ return 0;
+ else if (nAlign == (SdrAlign::HORZ_RIGHT |SdrAlign::VERT_TOP))
+ return 4500;
+ else if (nAlign == (SdrAlign::HORZ_CENTER|SdrAlign::VERT_TOP))
+ return 9000;
+ else if (nAlign == (SdrAlign::HORZ_LEFT |SdrAlign::VERT_TOP))
+ return 13500;
+ else if (nAlign == (SdrAlign::HORZ_LEFT |SdrAlign::VERT_CENTER))
+ return 18000;
+ else if (nAlign == (SdrAlign::HORZ_LEFT |SdrAlign::VERT_BOTTOM))
+ return 22500;
+ else if (nAlign == (SdrAlign::HORZ_CENTER|SdrAlign::VERT_BOTTOM))
+ return 27000;
+ else if (nAlign == (SdrAlign::HORZ_RIGHT |SdrAlign::VERT_BOTTOM))
+ return 31500;
return 0;
}
void SdrGluePoint::SetAlignAngle(long nAngle)
{
nAngle=NormAngle360(nAngle);
- if (nAngle>=33750 || nAngle<2250) nAlign=SDRHORZALIGN_RIGHT |SDRVERTALIGN_CENTER;
- else if (nAngle< 6750) nAlign=SDRHORZALIGN_RIGHT |SDRVERTALIGN_TOP ;
- else if (nAngle<11250) nAlign=SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP ;
- else if (nAngle<15750) nAlign=SDRHORZALIGN_LEFT |SDRVERTALIGN_TOP ;
- else if (nAngle<20250) nAlign=SDRHORZALIGN_LEFT |SDRVERTALIGN_CENTER;
- else if (nAngle<24750) nAlign=SDRHORZALIGN_LEFT |SDRVERTALIGN_BOTTOM;
- else if (nAngle<29250) nAlign=SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM;
- else if (nAngle<33750) nAlign=SDRHORZALIGN_RIGHT |SDRVERTALIGN_BOTTOM;
+ if (nAngle>=33750 || nAngle<2250) nAlign=SdrAlign::HORZ_RIGHT |SdrAlign::VERT_CENTER;
+ else if (nAngle< 6750) nAlign=SdrAlign::HORZ_RIGHT |SdrAlign::VERT_TOP ;
+ else if (nAngle<11250) nAlign=SdrAlign::HORZ_CENTER|SdrAlign::VERT_TOP ;
+ else if (nAngle<15750) nAlign=SdrAlign::HORZ_LEFT |SdrAlign::VERT_TOP ;
+ else if (nAngle<20250) nAlign=SdrAlign::HORZ_LEFT |SdrAlign::VERT_CENTER;
+ else if (nAngle<24750) nAlign=SdrAlign::HORZ_LEFT |SdrAlign::VERT_BOTTOM;
+ else if (nAngle<29250) nAlign=SdrAlign::HORZ_CENTER|SdrAlign::VERT_BOTTOM;
+ else if (nAngle<33750) nAlign=SdrAlign::HORZ_RIGHT |SdrAlign::VERT_BOTTOM;
}
long SdrGluePoint::EscDirToAngle(SdrEscapeDirection nEsc)
@@ -179,7 +190,7 @@ void SdrGluePoint::Rotate(const Point& rRef, long nAngle, double sn, double cs,
Point aPt(pObj!=NULL ? GetAbsolutePos(*pObj) : GetPos());
RotatePoint(aPt,rRef,sn,cs);
// rotate reference edge
- if(nAlign != (SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER))
+ if(nAlign != (SdrAlign::HORZ_CENTER|SdrAlign::VERT_CENTER))
{
SetAlignAngle(GetAlignAngle()+nAngle);
}
@@ -199,7 +210,7 @@ void SdrGluePoint::Mirror(const Point& rRef1, const Point& rRef2, long nAngle, c
Point aPt(pObj!=NULL ? GetAbsolutePos(*pObj) : GetPos());
MirrorPoint(aPt,rRef1,rRef2);
// mirror reference edge
- if(nAlign != (SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER))
+ if(nAlign != (SdrAlign::HORZ_CENTER|SdrAlign::VERT_CENTER))
{
long nAW=GetAlignAngle();
nAW+=2*(nAngle-nAW);
diff --git a/svx/source/unodraw/gluepts.cxx b/svx/source/unodraw/gluepts.cxx
index 0738adbe4ac4..08108b2c8d8b 100644
--- a/svx/source/unodraw/gluepts.cxx
+++ b/svx/source/unodraw/gluepts.cxx
@@ -80,36 +80,25 @@ static void convert( const SdrGluePoint& rSdrGlue, drawing::GluePoint2& rUnoGlue
rUnoGlue.Position.Y = rSdrGlue.GetPos().Y();
rUnoGlue.IsRelative = rSdrGlue.IsPercent();
- switch( rSdrGlue.GetAlign() )
- {
- case SDRVERTALIGN_TOP|SDRHORZALIGN_LEFT:
+ SdrAlign eAlign = rSdrGlue.GetAlign();
+ if (eAlign == (SdrAlign::VERT_TOP|SdrAlign::HORZ_LEFT))
rUnoGlue.PositionAlignment = drawing::Alignment_TOP_LEFT;
- break;
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP:
+ else if (eAlign == (SdrAlign::HORZ_CENTER|SdrAlign::VERT_TOP))
rUnoGlue.PositionAlignment = drawing::Alignment_TOP;
- break;
- case SDRVERTALIGN_TOP|SDRHORZALIGN_RIGHT:
+ else if (eAlign == (SdrAlign::VERT_TOP|SdrAlign::HORZ_RIGHT))
rUnoGlue.PositionAlignment = drawing::Alignment_TOP_RIGHT;
- break;
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER:
+ else if (eAlign == (SdrAlign::HORZ_CENTER|SdrAlign::VERT_CENTER))
rUnoGlue.PositionAlignment = drawing::Alignment_CENTER;
- break;
- case SDRHORZALIGN_RIGHT|SDRVERTALIGN_CENTER:
+ else if (eAlign == (SdrAlign::HORZ_RIGHT|SdrAlign::VERT_CENTER))
rUnoGlue.PositionAlignment = drawing::Alignment_RIGHT;
- break;
- case SDRHORZALIGN_LEFT|SDRVERTALIGN_BOTTOM:
+ else if (eAlign == (SdrAlign::HORZ_LEFT|SdrAlign::VERT_BOTTOM))
rUnoGlue.PositionAlignment = drawing::Alignment_BOTTOM_LEFT;
- break;
- case SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM:
+ else if (eAlign == (SdrAlign::HORZ_CENTER|SdrAlign::VERT_BOTTOM))
rUnoGlue.PositionAlignment = drawing::Alignment_BOTTOM;
- break;
- case SDRHORZALIGN_RIGHT|SDRVERTALIGN_BOTTOM:
+ else if (eAlign == (SdrAlign::HORZ_RIGHT|SdrAlign::VERT_BOTTOM))
rUnoGlue.PositionAlignment = drawing::Alignment_BOTTOM_RIGHT;
- break;
-// case SDRHORZALIGN_LEFT:
- default:
+ else {
rUnoGlue.PositionAlignment = drawing::Alignment_LEFT;
- break;
}
switch( rSdrGlue.GetEscDir() )
@@ -147,32 +136,32 @@ static void convert( const drawing::GluePoint2& rUnoGlue, SdrGluePoint& rSdrGlue
switch( rUnoGlue.PositionAlignment )
{
case drawing::Alignment_TOP_LEFT:
- rSdrGlue.SetAlign( SDRVERTALIGN_TOP|SDRHORZALIGN_LEFT );
+ rSdrGlue.SetAlign( SdrAlign::VERT_TOP|SdrAlign::HORZ_LEFT );
break;
case drawing::Alignment_TOP:
- rSdrGlue.SetAlign( SDRHORZALIGN_CENTER|SDRVERTALIGN_TOP );
+ rSdrGlue.SetAlign( SdrAlign::HORZ_CENTER|SdrAlign::VERT_TOP );
break;
case drawing::Alignment_TOP_RIGHT:
- rSdrGlue.SetAlign( SDRVERTALIGN_TOP|SDRHORZALIGN_RIGHT );
+ rSdrGlue.SetAlign( SdrAlign::VERT_TOP|SdrAlign::HORZ_RIGHT );
break;
case drawing::Alignment_CENTER:
- rSdrGlue.SetAlign( SDRHORZALIGN_CENTER|SDRVERTALIGN_CENTER );
+ rSdrGlue.SetAlign( SdrAlign::HORZ_CENTER|SdrAlign::VERT_CENTER );
break;
case drawing::Alignment_RIGHT:
- rSdrGlue.SetAlign( SDRHORZALIGN_RIGHT|SDRVERTALIGN_CENTER );
+ rSdrGlue.SetAlign( SdrAlign::HORZ_RIGHT|SdrAlign::VERT_CENTER );
break;
case drawing::Alignment_BOTTOM_LEFT:
- rSdrGlue.SetAlign( SDRHORZALIGN_LEFT|SDRVERTALIGN_BOTTOM );
+ rSdrGlue.SetAlign( SdrAlign::HORZ_LEFT|SdrAlign::VERT_BOTTOM );
break;
case drawing::Alignment_BOTTOM:
- rSdrGlue.SetAlign( SDRHORZALIGN_CENTER|SDRVERTALIGN_BOTTOM );
+ rSdrGlue.SetAlign( SdrAlign::HORZ_CENTER|SdrAlign::VERT_BOTTOM );
break;
case drawing::Alignment_BOTTOM_RIGHT:
- rSdrGlue.SetAlign( SDRHORZALIGN_RIGHT|SDRVERTALIGN_BOTTOM );
+ rSdrGlue.SetAlign( SdrAlign::HORZ_RIGHT|SdrAlign::VERT_BOTTOM );
break;
-// case SDRHORZALIGN_LEFT:
+// case SdrAlign::HORZ_LEFT:
default:
- rSdrGlue.SetAlign( SDRHORZALIGN_LEFT );
+ rSdrGlue.SetAlign( SdrAlign::HORZ_LEFT );
break;
}
switch( rUnoGlue.Escape )