diff options
Diffstat (limited to 'svx/source/svdraw/svdopath.cxx')
-rw-r--r-- | svx/source/svdraw/svdopath.cxx | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index efd6a03fb692..262223694d50 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -80,7 +80,7 @@ struct ImpSdrPathDragData : public SdrDragStatUserData bool bClosed; // closed object? sal_uInt16 nPoly; // number of the polygon in the PolyPolygon sal_uInt16 nPnt; // number of point in the above polygon - sal_uInt16 nPntAnz; // number of points of the polygon + sal_uInt16 nPointCount; // number of points of the polygon sal_uInt16 nPntMax; // maximum index bool bBegPnt; // dragged point is first point of a Polyline bool bEndPnt; // dragged point is finishing point of a Polyline @@ -119,7 +119,7 @@ ImpSdrPathDragData::ImpSdrPathDragData(const SdrPathObj& rPO, const SdrHdl& rHdl , bClosed(false) , nPoly(0) , nPnt(0) - , nPntAnz(0) + , nPointCount(0) , nPntMax(0) , bBegPnt(false) , bEndPnt(false) @@ -171,14 +171,14 @@ ImpSdrPathDragData::ImpSdrPathDragData(const SdrPathObj& rPO, const SdrHdl& rHdl nPoly=(sal_uInt16)rHdl.GetPolyNum(); // number of the polygon in the PolyPolygon nPnt=(sal_uInt16)rHdl.GetPointNum(); // number of points in the above polygon const XPolygon aTmpXP(rPO.GetPathPoly().getB2DPolygon(nPoly)); - nPntAnz=aTmpXP.GetPointCount(); // number of point of the polygon - if (nPntAnz==0 || (bClosed && nPntAnz==1)) return; // minimum of 1 points for Lines, minimum of 2 points for Polygon - nPntMax=nPntAnz-1; // maximum index + nPointCount=aTmpXP.GetPointCount(); // number of point of the polygon + if (nPointCount==0 || (bClosed && nPointCount==1)) return; // minimum of 1 points for Lines, minimum of 2 points for Polygon + nPntMax=nPointCount-1; // maximum index bBegPnt=!bClosed && nPnt==0; // dragged point is first point of a Polyline bEndPnt=!bClosed && nPnt==nPntMax; // dragged point is finishing point of a Polyline - if (bClosed && nPntAnz<=3) { // if polygon is only a line - bBegPnt=(nPntAnz<3) || nPnt==0; - bEndPnt=(nPntAnz<3) || nPnt==nPntMax-1; + if (bClosed && nPointCount<=3) { // if polygon is only a line + bBegPnt=(nPointCount<3) || nPnt==0; + bEndPnt=(nPointCount<3) || nPnt==nPntMax-1; } nPrevPnt=nPnt; // index of previous point nNextPnt=nPnt; // index of next point @@ -269,11 +269,11 @@ public: XPolygon GetFormPoly() const; bool CalcBezier(const Point& rP1, const Point& rP2, const Point& rDir, bool bMouseDown); XPolygon GetBezierPoly() const; - XPolygon GetCurvePoly() const { return XPolygon(); } + static XPolygon GetCurvePoly() { return XPolygon(); } bool CalcCircle(const Point& rP1, const Point& rP2, const Point& rDir, SdrView* pView); XPolygon GetCirclePoly() const; bool CalcLine(const Point& rP1, const Point& rP2, const Point& rDir, SdrView* pView); - Point CalcLine(const Point& rCsr, long nDirX, long nDirY, SdrView* pView) const; + static Point CalcLine(const Point& rCsr, long nDirX, long nDirY, SdrView* pView); XPolygon GetLinePoly() const; bool CalcRect(const Point& rP1, const Point& rP2, const Point& rDir, SdrView* pView); XPolygon GetRectPoly() const; @@ -387,7 +387,7 @@ XPolygon ImpPathCreateUser::GetCirclePoly() const } } -Point ImpPathCreateUser::CalcLine(const Point& aCsr, long nDirX, long nDirY, SdrView* pView) const +Point ImpPathCreateUser::CalcLine(const Point& aCsr, long nDirX, long nDirY, SdrView* pView) { long x=aCsr.X(),x1=x,x2=x; long y=aCsr.Y(),y1=y,y2=y; @@ -529,14 +529,14 @@ public: Pointer GetCreatePointer() const; // helping stuff - bool IsClosed(SdrObjKind eKind) const { return eKind==OBJ_POLY || eKind==OBJ_PATHPOLY || eKind==OBJ_PATHFILL || eKind==OBJ_FREEFILL || eKind==OBJ_SPLNFILL; } - bool IsFreeHand(SdrObjKind eKind) const { return eKind==OBJ_FREELINE || eKind==OBJ_FREEFILL; } - bool IsBezier(SdrObjKind eKind) const { return eKind==OBJ_PATHLINE || eKind==OBJ_PATHFILL; } + static bool IsClosed(SdrObjKind eKind) { return eKind==OBJ_POLY || eKind==OBJ_PATHPOLY || eKind==OBJ_PATHFILL || eKind==OBJ_FREEFILL || eKind==OBJ_SPLNFILL; } + static bool IsFreeHand(SdrObjKind eKind) { return eKind==OBJ_FREELINE || eKind==OBJ_FREEFILL; } + static bool IsBezier(SdrObjKind eKind) { return eKind==OBJ_PATHLINE || eKind==OBJ_PATHFILL; } bool IsCreating() const { return mbCreating; } // get the polygon basegfx::B2DPolyPolygon TakeObjectPolyPolygon(const SdrDragStat& rDrag) const; - basegfx::B2DPolyPolygon TakeDragPolyPolygon(const SdrDragStat& rDrag) const; + static basegfx::B2DPolyPolygon TakeDragPolyPolygon(const SdrDragStat& rDrag); basegfx::B2DPolyPolygon getModifiedPolyPolygon() const { return aPathPolygon.getB2DPolyPolygon(); } }; @@ -685,11 +685,11 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const sal_uInt16 nPnt1=0xFFFF,nPnt2=0xFFFF; // its neighboring points Point aNeuPos1,aNeuPos2; // new alternative for aPos bool bPnt1 = false, bPnt2 = false; // are these valid alternatives? - if (!bClosed && mpSdrPathDragData->nPntAnz>=2) { // minimum of 2 points for lines + if (!bClosed && mpSdrPathDragData->nPointCount>=2) { // minimum of 2 points for lines if (!bBegPnt) nPnt1=nPrevPnt; if (!bEndPnt) nPnt2=nNextPnt; } - if (bClosed && mpSdrPathDragData->nPntAnz>=3) { // minimum of 3 points for polygon + if (bClosed && mpSdrPathDragData->nPointCount>=3) { // minimum of 3 points for polygon nPnt1=nPrevPnt; nPnt2=nNextPnt; } @@ -957,7 +957,7 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag if(pU->bCircle) { - mrSdrPathObject.GetModel()->TakeAngleStr(std::abs(pU->nCircRelAngle), aMetr); + SdrModel::TakeAngleStr(std::abs(pU->nCircRelAngle), aMetr); aStr += aMetr; aStr += " r="; mrSdrPathObject.GetModel()->TakeMetricStr(pU->nCircRadius, aMetr, true); @@ -981,7 +981,7 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag sal_Int32 nAngle(GetAngle(aNow)); aStr += " "; - mrSdrPathObject.GetModel()->TakeAngleStr(nAngle, aMetr); + SdrModel::TakeAngleStr(nAngle, aMetr); aStr += aMetr; } @@ -1049,11 +1049,11 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag { sal_uInt16 nPntNum((sal_uInt16)pHdl->GetPointNum()); const XPolygon& rXPoly = aPathPolygon[(sal_uInt16)rDrag.GetHdl()->GetPolyNum()]; - sal_uInt16 nPntAnz((sal_uInt16)rXPoly.GetPointCount()); + sal_uInt16 nPointCount((sal_uInt16)rXPoly.GetPointCount()); bool bClose(IsClosed(meObjectKind)); if(bClose) - nPntAnz--; + nPointCount--; if(pHdl->IsPlusHdl()) { @@ -1074,17 +1074,17 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag sal_Int32 nAngle(GetAngle(aNow)); aStr += " "; - mrSdrPathObject.GetModel()->TakeAngleStr(nAngle, aMetr); + SdrModel::TakeAngleStr(nAngle, aMetr); aStr += aMetr; } - else if(nPntAnz > 1) + else if(nPointCount > 1) { - sal_uInt16 nPntMax(nPntAnz - 1); + sal_uInt16 nPntMax(nPointCount - 1); bool bIsClosed(IsClosed(meObjectKind)); bool bPt1(nPntNum > 0); bool bPt2(nPntNum < nPntMax); - if(bIsClosed && nPntAnz > 2) + if(bIsClosed && nPointCount > 2) { bPt1 = true; bPt2 = true; @@ -1120,7 +1120,7 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag sal_Int32 nAngle(GetAngle(aPt)); aStr += " "; - mrSdrPathObject.GetModel()->TakeAngleStr(nAngle, aMetr); + SdrModel::TakeAngleStr(nAngle, aMetr); aStr += aMetr; } @@ -1141,7 +1141,7 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag sal_Int32 nAngle(GetAngle(aPt)); aStr += " "; - mrSdrPathObject.GetModel()->TakeAngleStr(nAngle, aMetr); + SdrModel::TakeAngleStr(nAngle, aMetr); aStr += aMetr; } } @@ -1176,7 +1176,7 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::getSpecialDragPoly(const SdrDra } // copy certain data locally to use less code and have faster access times bool bClosed =mpSdrPathDragData->bClosed ; // closed object? - sal_uInt16 nPntAnz =mpSdrPathDragData->nPntAnz ; // number of points + sal_uInt16 nPointCount = mpSdrPathDragData->nPointCount; // number of points sal_uInt16 nPnt =mpSdrPathDragData->nPnt ; // number of points in the polygon bool bBegPnt =mpSdrPathDragData->bBegPnt ; // dragged point is the first point of a Polyline bool bEndPnt =mpSdrPathDragData->bEndPnt ; // dragged point is the last point of a Polyline @@ -1249,7 +1249,7 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::getSpecialDragPoly(const SdrDra if (bEndPnt) aXPoly.Remove(aXPoly.GetPointCount()-1,1); } if (bClosed) { // "pear problem": 2 lines, 1 curve, everything smoothed, a point between both lines is dragged - if (aXPoly.GetPointCount()>nPntAnz && aXPoly.IsControl(1)) { + if (aXPoly.GetPointCount()>nPointCount && aXPoly.IsControl(1)) { sal_uInt16 a=aXPoly.GetPointCount(); aXPoly[a-2]=aXPoly[2]; aXPoly.SetFlags(a-2,aXPoly.GetFlags(2)); aXPoly[a-1]=aXPoly[3]; aXPoly.SetFlags(a-1,aXPoly.GetFlags(3)); @@ -1451,11 +1451,11 @@ bool ImpPathForDragAndCreate::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) nActPoint--; } if (pU->IsFormFlag()) { - sal_uInt16 nPtAnz0=rXPoly.GetPointCount(); + sal_uInt16 nPointCount0=rXPoly.GetPointCount(); rXPoly.Remove(nActPoint-1,2); // remove last two points and replace by form rXPoly.Insert(XPOLY_APPEND,pU->GetFormPoly()); - sal_uInt16 nPtAnz1=rXPoly.GetPointCount(); - for (sal_uInt16 i=nPtAnz0+1; i<nPtAnz1-1; i++) { // to make BckAction work + sal_uInt16 nPointCount1=rXPoly.GetPointCount(); + for (sal_uInt16 i=nPointCount0+1; i<nPointCount1-1; i++) { // to make BckAction work if (!rXPoly.IsControl(i)) rStat.NextPoint(); } nActPoint=rXPoly.GetPointCount()-1; @@ -1476,31 +1476,31 @@ bool ImpPathForDragAndCreate::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) } } - sal_uInt16 nPolyAnz=aPathPolygon.Count(); - if (nPolyAnz!=0) { + sal_uInt16 nPolyCount=aPathPolygon.Count(); + if (nPolyCount!=0) { // delete last point, if necessary if (eCmd==SDRCREATE_FORCEEND) { - XPolygon& rXP=aPathPolygon[nPolyAnz-1]; - sal_uInt16 nPtAnz=rXP.GetPointCount(); - if (nPtAnz>=2) { - if (!rXP.IsControl(nPtAnz-2)) { - if (rXP[nPtAnz-1]==rXP[nPtAnz-2]) { - rXP.Remove(nPtAnz-1,1); + XPolygon& rXP=aPathPolygon[nPolyCount-1]; + sal_uInt16 nPointCount=rXP.GetPointCount(); + if (nPointCount>=2) { + if (!rXP.IsControl(nPointCount-2)) { + if (rXP[nPointCount-1]==rXP[nPointCount-2]) { + rXP.Remove(nPointCount-1,1); } } else { - if (rXP[nPtAnz-3]==rXP[nPtAnz-2]) { - rXP.Remove(nPtAnz-3,3); + if (rXP[nPointCount-3]==rXP[nPointCount-2]) { + rXP.Remove(nPointCount-3,3); } } } } - for (sal_uInt16 nPolyNum=nPolyAnz; nPolyNum>0;) { + for (sal_uInt16 nPolyNum=nPolyCount; nPolyNum>0;) { nPolyNum--; XPolygon& rXP=aPathPolygon[nPolyNum]; - sal_uInt16 nPtAnz=rXP.GetPointCount(); + sal_uInt16 nPointCount=rXP.GetPointCount(); // delete polygons with too few points - if (nPolyNum<nPolyAnz-1 || eCmd==SDRCREATE_FORCEEND) { - if (nPtAnz<2) aPathPolygon.Remove(nPolyNum); + if (nPolyNum<nPolyCount-1 || eCmd==SDRCREATE_FORCEEND) { + if (nPointCount<2) aPathPolygon.Remove(nPolyNum); } } } @@ -1605,7 +1605,7 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::TakeObjectPolyPolygon(const Sdr return aRetval; } -basegfx::B2DPolyPolygon ImpPathForDragAndCreate::TakeDragPolyPolygon(const SdrDragStat& rDrag) const +basegfx::B2DPolyPolygon ImpPathForDragAndCreate::TakeDragPolyPolygon(const SdrDragStat& rDrag) { basegfx::B2DPolyPolygon aRetval; SdrView* pView = rDrag.GetView(); @@ -2308,7 +2308,7 @@ basegfx::B2DPolyPolygon SdrPathObj::TakeCreatePoly(const SdrDragStat& rDrag) con if(mpDAC) { aRetval = mpDAC->TakeObjectPolyPolygon(rDrag); - aRetval.append(mpDAC->TakeDragPolyPolygon(rDrag)); + aRetval.append(ImpPathForDragAndCreate::TakeDragPolyPolygon(rDrag)); } return aRetval; @@ -2333,7 +2333,7 @@ basegfx::B2DPolyPolygon SdrPathObj::getDragPolyPolygon(const SdrDragStat& rDrag) if(mpDAC) { - aRetval = mpDAC->TakeDragPolyPolygon(rDrag); + aRetval = ImpPathForDragAndCreate::TakeDragPolyPolygon(rDrag); } return aRetval; |