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

sal_uIntPtr->sal_Int32 in SdrDragStat

also fix the
   X& X()
methods to be normal
void SetX(X const &)
methods

Change-Id: Id2999b09535ce560110eda646d3d5bbbedf87326
Reviewed-on: https://gerrit.libreoffice.org/46309Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 8782ea03
......@@ -76,7 +76,6 @@ class SVX_DLLPUBLIC SdrDragStat final
std::unique_ptr<SdrDragStatUserData> mpUserData; // Userdata
void Clear();
Point& Pnt(sal_uIntPtr nNum) { return mvPnts[nNum]; }
public:
SdrDragStat() { Reset(); }
......@@ -86,21 +85,21 @@ public:
void SetView(SdrView* pV) { pView=pV; }
SdrPageView* GetPageView() const { return pPageView; }
void SetPageView(SdrPageView* pPV) { pPageView=pPV; }
const Point& GetPoint(sal_uIntPtr nNum) const { return mvPnts[nNum]; }
sal_uIntPtr GetPointCount() const { return mvPnts.size(); }
const Point& GetStart() const { return GetPoint(0); }
Point& Start() { return Pnt(0); }
const Point& GetPrev() const { return GetPoint(GetPointCount()-(GetPointCount()>=2 ? 2:1)); }
Point& Prev() { return Pnt(GetPointCount()-(GetPointCount()>=2 ? 2:1)); }
const Point& GetPoint(sal_Int32 nNum) const { return mvPnts[nNum]; }
sal_Int32 GetPointCount() const { return mvPnts.size(); }
const Point& GetStart() const { return mvPnts[0]; }
void SetStart(const Point &pt) { mvPnts[0] = pt; }
const Point& GetPrev() const { return mvPnts[GetPointCount()-(GetPointCount()>=2 ? 2:1)]; }
void SetPrev(const Point &pt) { mvPnts[GetPointCount()-(GetPointCount()>=2 ? 2:1)] = pt; }
const Point& GetPos0() const { return aPos0; }
const Point& GetNow() const { return GetPoint(GetPointCount()-1); }
Point& Now() { return Pnt(GetPointCount()-1); }
const Point& GetNow() const { return mvPnts.back(); }
void SetNow(Point const &pt) { mvPnts.back() = pt; }
const Point& GetRealNow() const { return aRealNow; }
Point& RealNow() { return aRealNow; }
void SetRealNow(Point const &pt) { aRealNow = pt; }
const Point& GetRef1() const { return aRef1; }
Point& Ref1() { return aRef1; }
void SetRef1(const Point &pt) { aRef1 = pt; }
const Point& GetRef2() const { return aRef2; }
Point& Ref2() { return aRef2; }
void SetRef2(const Point &pt) { aRef2 = pt; }
const SdrHdl* GetHdl() const { return pHdl; }
void SetHdl(SdrHdl* pH) { pHdl=pH; }
SdrDragStatUserData* GetUser() const { return mpUserData.get(); }
......
......@@ -179,7 +179,7 @@ bool PathDragResize::EndSdrDrag(bool /*bCopy*/)
SdrPathObj* pPathObj = mxTag->getPathObj();
if( pPathObj )
{
const Point aRef( DragStat().Ref1() );
const Point aRef( DragStat().GetRef1() );
basegfx::B2DHomMatrix aTrans(basegfx::utils::createTranslateB2DHomMatrix(-aRef.X(), -aRef.Y()));
aTrans.scale(double(aXFact), double(aYFact));
aTrans.translate(aRef.X(), aRef.Y());
......
......@@ -112,7 +112,7 @@ AnnotationDragMove::AnnotationDragMove(SdrDragView& rNewView, const rtl::Referen
bool AnnotationDragMove::BeginSdrDrag()
{
DragStat().Ref1()=GetDragHdl()->GetPos();
DragStat().SetRef1(GetDragHdl()->GetPos());
DragStat().SetShown(!DragStat().IsShown());
maOrigin = GetDragHdl()->GetPos();
......
......@@ -114,7 +114,7 @@ bool E3dDragMethod::BeginSdrDrag()
if(E3dDragConstraint::Z == meConstraint)
{
const sal_uInt32 nCnt(maGrp.size());
DragStat().Ref1() = maFullBound.Center();
DragStat().SetRef1( maFullBound.Center() );
for(sal_uInt32 nOb(0); nOb < nCnt; nOb++)
{
......
......@@ -58,30 +58,30 @@ void SdrDragStat::Reset()
void SdrDragStat::Reset(const Point& rPnt)
{
Reset();
Start()=rPnt;
SetStart(rPnt);
aPos0=rPnt;
RealNow()=rPnt;
SetRealNow(rPnt);
}
void SdrDragStat::NextMove(const Point& rPnt)
{
aPos0=GetNow();
RealNow()=rPnt;
Now()=GetRealNow();
SetRealNow(rPnt);
SetNow(GetRealNow());
}
void SdrDragStat::NextPoint()
{
Point aPnt(GetNow());
mvPnts.emplace_back(GetRealNow());
Prev()=aPnt;
SetPrev(aPnt);
}
void SdrDragStat::PrevPoint()
{
if (mvPnts.size()>=2) { // one has to remain at all times
mvPnts.erase(mvPnts.begin()+mvPnts.size()-2);
Now() = GetRealNow();
SetNow( GetRealNow() );
}
}
......
......@@ -949,7 +949,7 @@ bool SdrDragMovHdl::BeginSdrDrag()
if( !GetDragHdl() )
return false;
DragStat().Ref1()=GetDragHdl()->GetPos();
DragStat().SetRef1(GetDragHdl()->GetPos());
DragStat().SetShown(!DragStat().IsShown());
SdrHdlKind eKind=GetDragHdl()->GetKind();
SdrHdl* pH1=GetHdlList().GetHdl(SdrHdlKind::Ref1);
......@@ -1808,7 +1808,7 @@ bool SdrDragResize::BeginSdrDrag()
if (pRefHdl!=nullptr && !getSdrDragView().IsResizeAtCenter())
{
// Calc hack to adjust for calc grid
DragStat().Ref1()=pRefHdl->GetPos() - getSdrDragView().GetGridOffset();
DragStat().SetRef1(pRefHdl->GetPos() - getSdrDragView().GetGridOffset());
}
else
{
......@@ -1817,11 +1817,11 @@ bool SdrDragResize::BeginSdrDrag()
if (pRef1!=nullptr && pRef2!=nullptr)
{
DragStat().Ref1()=tools::Rectangle(pRef1->GetPos(),pRef2->GetPos()).Center();
DragStat().SetRef1(tools::Rectangle(pRef1->GetPos(),pRef2->GetPos()).Center());
}
else
{
DragStat().Ref1()=GetMarkedRect().Center();
DragStat().SetRef1(GetMarkedRect().Center());
}
}
......@@ -1833,9 +1833,9 @@ bool SdrDragResize::BeginSdrDrag()
basegfx::B2DHomMatrix SdrDragResize::getCurrentTransformation()
{
basegfx::B2DHomMatrix aRetval(basegfx::utils::createTranslateB2DHomMatrix(
-DragStat().Ref1().X(), -DragStat().Ref1().Y()));
-DragStat().GetRef1().X(), -DragStat().GetRef1().Y()));
aRetval.scale(double(aXFact), double(aYFact));
aRetval.translate(DragStat().Ref1().X(), DragStat().Ref1().Y());
aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y());
return aRetval;
}
......@@ -2023,7 +2023,7 @@ void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
void SdrDragResize::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
{
rTarget.Resize(DragStat().Ref1(),aXFact,aYFact);
rTarget.Resize(DragStat().GetRef1(),aXFact,aYFact);
}
bool SdrDragResize::EndSdrDrag(bool bCopy)
......@@ -2032,15 +2032,15 @@ bool SdrDragResize::EndSdrDrag(bool bCopy)
if (IsDraggingPoints())
{
getSdrDragView().ResizeMarkedPoints(DragStat().Ref1(),aXFact,aYFact);
getSdrDragView().ResizeMarkedPoints(DragStat().GetRef1(),aXFact,aYFact);
}
else if (IsDraggingGluePoints())
{
getSdrDragView().ResizeMarkedGluePoints(DragStat().Ref1(),aXFact,aYFact,bCopy);
getSdrDragView().ResizeMarkedGluePoints(DragStat().GetRef1(),aXFact,aYFact,bCopy);
}
else
{
getSdrDragView().ResizeMarkedObj(DragStat().Ref1(),aXFact,aYFact,bCopy);
getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aXFact,aYFact,bCopy);
}
return true;
......@@ -2100,7 +2100,7 @@ bool SdrDragRotate::BeginSdrDrag()
if (nullptr != pH)
{
Show();
DragStat().Ref1()=pH->GetPos();
DragStat().SetRef1(pH->GetPos());
nAngle0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
return true;
}
......@@ -2112,7 +2112,7 @@ bool SdrDragRotate::BeginSdrDrag()
if(!aLocalMarkRect.IsEmpty())
{
Show();
DragStat().Ref1() = aLocalMarkRect.Center();
DragStat().SetRef1(aLocalMarkRect.Center());
nAngle0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
return true;
}
......@@ -2255,7 +2255,7 @@ bool SdrDragShear::BeginSdrDrag()
if (pRefHdl!=nullptr)
{
DragStat().Ref1()=pRefHdl->GetPos();
DragStat().SetRef1(pRefHdl->GetPos());
nAngle0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
}
else
......@@ -2528,8 +2528,8 @@ bool SdrDragMirror::BeginSdrDrag()
if (pH1!=nullptr && pH2!=nullptr)
{
DragStat().Ref1()=pH1->GetPos();
DragStat().Ref2()=pH2->GetPos();
DragStat().SetRef1(pH1->GetPos());
DragStat().SetRef2(pH2->GetPos());
Ref1()=pH1->GetPos();
Ref2()=pH2->GetPos();
aDif=pH2->GetPos()-pH1->GetPos();
......@@ -2633,8 +2633,8 @@ bool SdrDragGradient::BeginSdrDrag()
if(pIAOHandle)
{
// save old values
DragStat().Ref1() = pIAOHandle->GetPos();
DragStat().Ref2() = pIAOHandle->Get2ndPos();
DragStat().SetRef1( pIAOHandle->GetPos() );
DragStat().SetRef2( pIAOHandle->Get2ndPos() );
// what was hit?
bool bHit(false);
......@@ -2706,27 +2706,27 @@ void SdrDragGradient::MoveSdrDrag(const Point& rPnt)
{
if(pIAOHandle->IsMoveFirstHandle())
{
pIAOHandle->SetPos(DragStat().Ref1() + aMoveDiff);
pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
if(pIAOHandle->GetColorHdl1())
pIAOHandle->GetColorHdl1()->SetPos(DragStat().Ref1() + aMoveDiff);
pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
}
else
{
pIAOHandle->Set2ndPos(DragStat().Ref2() + aMoveDiff);
pIAOHandle->Set2ndPos(DragStat().GetRef2() + aMoveDiff);
if(pIAOHandle->GetColorHdl2())
pIAOHandle->GetColorHdl2()->SetPos(DragStat().Ref2() + aMoveDiff);
pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2() + aMoveDiff);
}
}
else
{
pIAOHandle->SetPos(DragStat().Ref1() + aMoveDiff);
pIAOHandle->Set2ndPos(DragStat().Ref2() + aMoveDiff);
pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
pIAOHandle->Set2ndPos(DragStat().GetRef2() + aMoveDiff);
if(pIAOHandle->GetColorHdl1())
pIAOHandle->GetColorHdl1()->SetPos(DragStat().Ref1() + aMoveDiff);
pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
if(pIAOHandle->GetColorHdl2())
pIAOHandle->GetColorHdl2()->SetPos(DragStat().Ref2() + aMoveDiff);
pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2() + aMoveDiff);
}
// new state
......@@ -2748,14 +2748,14 @@ bool SdrDragGradient::EndSdrDrag(bool /*bCopy*/)
void SdrDragGradient::CancelSdrDrag()
{
// restore old values
pIAOHandle->SetPos(DragStat().Ref1());
pIAOHandle->Set2ndPos(DragStat().Ref2());
pIAOHandle->SetPos(DragStat().GetRef1());
pIAOHandle->Set2ndPos(DragStat().GetRef2());
if(pIAOHandle->GetColorHdl1())
pIAOHandle->GetColorHdl1()->SetPos(DragStat().Ref1());
pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1());
if(pIAOHandle->GetColorHdl2())
pIAOHandle->GetColorHdl2()->SetPos(DragStat().Ref2());
pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2());
// new state
pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), true, false);
......
......@@ -958,7 +958,7 @@ bool SdrMeasureObj::MovCreate(SdrDragStat& rStat)
aPt2=rStat.GetNow();
if (pView!=nullptr && pView->IsCreate1stPointAsCenter()) {
aPt1+=aPt1;
aPt1-=rStat.Now();
aPt1-=rStat.GetNow();
}
SetTextDirty();
SetBoundRectDirty();
......
......@@ -730,8 +730,8 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
// let the alternative that allows fewer correction win
if (nX1<nX2) bPnt2=false; else bPnt1=false;
}
if (bPnt1) rDrag.Now()=aNeuPos1;
if (bPnt2) rDrag.Now()=aNeuPos2;
if (bPnt1) rDrag.SetNow(aNeuPos1);
if (bPnt2) rDrag.SetNow(aNeuPos2);
}
rDrag.SetActionRect(tools::Rectangle(rDrag.GetNow(),rDrag.GetNow()));
......@@ -752,7 +752,7 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
aPt=mpSdrPathDragData->aXP[nNextPnt];
aPt+=mpSdrPathDragData->aXP[nPrevPnt];
aPt/=2;
rDrag.Now()=aPt;
rDrag.SetNow(aPt);
}
}
......@@ -1326,12 +1326,12 @@ bool ImpPathForDragAndCreate::MovCreate(SdrDragStat& rStat)
bool bFreeHand=IsFreeHand(pU->eAktKind);
rStat.SetNoSnap(bFreeHand);
rStat.SetOrtho8Possible(pU->eAktKind!=OBJ_CARC && pU->eAktKind!=OBJ_RECT && (!pU->bMixedCreate || pU->eAktKind!=OBJ_LINE));
rXPoly[nActPoint]=rStat.Now();
rXPoly[nActPoint]=rStat.GetNow();
if (!pU->bMixedCreate && pU->eStartKind==OBJ_LINE && rXPoly.GetPointCount()>=1) {
Point aPt(rStat.Start());
Point aPt(rStat.GetStart());
if (pView!=nullptr && pView->IsCreate1stPointAsCenter()) {
aPt+=aPt;
aPt-=rStat.Now();
aPt-=rStat.GetNow();
}
rXPoly[0]=aPt;
}
......@@ -1346,7 +1346,7 @@ bool ImpPathForDragAndCreate::MovCreate(SdrDragStat& rStat)
if (nMinDist<1) nMinDist=1;
Point aPt0(rXPoly[nActPoint-1]);
Point aPt1(rStat.Now());
Point aPt1(rStat.GetNow());
long dx=aPt0.X()-aPt1.X(); if (dx<0) dx=-dx;
long dy=aPt0.Y()-aPt1.Y(); if (dy<0) dy=-dy;
if (dx<nMinDist && dy<nMinDist) return false;
......@@ -1364,7 +1364,7 @@ bool ImpPathForDragAndCreate::MovCreate(SdrDragStat& rStat)
rXPoly.SetFlags(nActPoint-3,PolyFlags::Smooth);
}
}
rXPoly[nActPoint+1]=rStat.Now();
rXPoly[nActPoint+1]=rStat.GetNow();
rStat.NextPoint();
} else {
pU->nBezierStartPoint=nActPoint;
......@@ -1400,7 +1400,7 @@ bool ImpPathForDragAndCreate::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
bool bIncomp=pView!=nullptr && pView->IsUseIncompatiblePathCreateInterface();
XPolygon& rXPoly=aPathPolygon[aPathPolygon.Count()-1];
sal_uInt16 nActPoint=rXPoly.GetPointCount()-1;
rXPoly[nActPoint]=rStat.Now();
rXPoly[nActPoint]=rStat.GetNow();
if (!pU->bMixedCreate && pU->eStartKind==OBJ_LINE) {
if (rStat.GetPointCount()>=2) eCmd=SdrCreateCmd::ForceEnd;
bRet = eCmd==SdrCreateCmd::ForceEnd;
......@@ -1422,7 +1422,7 @@ bool ImpPathForDragAndCreate::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
}
if (eCmd==SdrCreateCmd::NextPoint || eCmd==SdrCreateCmd::NextObject) {
// don't allow two consecutive points to occupy the same position
if (nActPoint==0 || rStat.Now()!=rXPoly[nActPoint-1]) {
if (nActPoint==0 || rStat.GetNow()!=rXPoly[nActPoint-1]) {
if (bIncomp) {
if (pU->nBezierStartPoint>nActPoint) pU->nBezierStartPoint=nActPoint;
if (IsBezier(pU->eAktKind) && nActPoint-pU->nBezierStartPoint>=3 && ((nActPoint-pU->nBezierStartPoint)%3)==0) {
......@@ -1536,7 +1536,7 @@ bool ImpPathForDragAndCreate::BckCreate(SdrDragStat& rStat)
sal_uInt16 nLocalActPoint=rLocalXPoly.GetPointCount();
if (nLocalActPoint>0) {
nLocalActPoint--;
rLocalXPoly[nLocalActPoint]=rStat.Now();
rLocalXPoly[nLocalActPoint]=rStat.GetNow();
}
}
}
......
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