21#include <svx/strings.hrc>
22#include <osl/diagnose.h>
120 if ((nIdx & 1)==1) bHorz=!bHorz;
128 else rPt.
setX(nVal );
145 return std::make_unique<sdr::properties::ConnectorProperties>(*
this);
153 return std::make_unique<sdr::contact::ViewContactOfSdrEdgeObj>(*
this);
160 bEdgeTrackDirty(false),
161 bEdgeTrackUserDefined(false),
163 mbSuppressDefaultConnect(false),
164 mbBoundRectCalculationRunning(false),
175 bEdgeTrackDirty(false),
176 bEdgeTrackUserDefined(false),
178 mbSuppressDefaultConnect(false),
179 mbBoundRectCalculationRunning(false),
223 sal_Int32 nVals[3] = { nVal1, nVal2, nVal3 };
291 sal_Int32 nVals[3] = { nVal1, nVal2, nVal3 };
336 if(!(
n != nValCnt || nVals[0] != nVal1 || nVals[1] != nVal2 || nVals[2] != nVal3))
345 if(nVals[0] != nVal1)
350 if(nVals[1] != nVal2)
355 if(nVals[2] != nVal3)
431 sal_uInt16 nPointCount=
pEdgeTrack->GetPointCount();
436 else if (nNum==3 &&
GetConnectedNode(
false)==
nullptr) aPt=(*pEdgeTrack)[nPointCount-1];
438 if ((nPointCount & 1) ==1) {
439 aPt=(*pEdgeTrack)[nPointCount/2];
444 aPt1.
setX( aPt1.
X() / 2 );
445 aPt1.
setY( aPt1.
Y() / 2 );
489 if (rCon.
pObj!=
nullptr) {
512 sal_uInt16 nPointCount=
pEdgeTrack->GetPointCount();
517 sal_uInt16 nGluePointCnt=pGPL==
nullptr ? 0 : pGPL->
GetCount();
518 sal_uInt16 nGesAnz=nGluePointCnt+8;
520 for (sal_uInt16
i=0;
i<nGesAnz && !bRet;
i++) {
521 if (
i<nGluePointCnt) {
522 bRet=aTail==(*pGPL)[
i].GetAbsolutePos(*rCon.
pObj);
523 }
else if (
i<nGluePointCnt+4) {
537 sal_uInt16 nPointCount=
pEdgeTrack->GetPointCount();
538 if (nPointCount==0) {
539 (*pEdgeTrack)[0]=rPt;
540 (*pEdgeTrack)[1]=rPt;
541 }
else if (nPointCount==1) {
542 if (!bTail1) (*pEdgeTrack)[1]=rPt;
543 else { (*pEdgeTrack)[1]=(*pEdgeTrack)[0]; (*pEdgeTrack)[0]=rPt; }
545 if (!bTail1) (*pEdgeTrack)[sal_uInt16(nPointCount-1)]=rPt;
629 bool bxMitt=std::abs(dxl-dxr)<2;
630 bool byMitt=std::abs(dyo-dyu)<2;
633 bool bDiag=std::abs(dx-dy)<2;
663 bool bRts=nEscAngle==0;
664 bool bObn=nEscAngle==9000;
665 bool bLks=nEscAngle==18000;
666 bool bUnt=nEscAngle==27000;
671 if (bObn) aP1.
setY(rRect.
Top() );
675 if (bLks && rMeeting.
X()<=aP2.
X()) aP2.
setX(rMeeting.
X() );
676 if (bRts && rMeeting.
X()>=aP2.
X()) aP2.
setX(rMeeting.
X() );
677 if (bObn && rMeeting.
Y()<=aP2.
Y()) aP2.
setY(rMeeting.
Y() );
678 if (bUnt && rMeeting.
Y()>=aP2.
Y()) aP2.
setY(rMeeting.
Y() );
682 if ((bLks && rMeeting.
X()>aP2.
X()) || (bRts && rMeeting.
X()<aP2.
X())) {
683 if (rMeeting.
Y()<aP2.
Y()) {
685 if (rMeeting.
Y()<aP3.
Y()) aP3.
setY(rMeeting.
Y() );
688 if (rMeeting.
Y()>aP3.
Y()) aP3.
setY(rMeeting.
Y() );
691 if (aP3.
Y()!=rMeeting.
Y()) {
692 aP3.
setX(rMeeting.
X() );
696 if ((bObn && rMeeting.
Y()>aP2.
Y()) || (bUnt && rMeeting.
Y()<aP2.
Y())) {
697 if (rMeeting.
X()<aP2.
X()) {
699 if (rMeeting.
X()<aP3.
X()) aP3.
setX(rMeeting.
X() );
702 if (rMeeting.
X()>aP3.
X()) aP3.
setX(rMeeting.
X() );
705 if (aP3.
X()!=rMeeting.
X()) {
706 aP3.
setY(rMeeting.
Y() );
712 OSL_FAIL(
"SdrEdgeObj::ImpCalcObjToCenter(): Polygon has more than 4 points!");
737 if (!aRectangle.IsEmpty()) {
738 aPt1 = aRectangle.TopLeft();
739 aPt2 = aRectangle.BottomRight();
764 aBewareRect1=aBoundRect1;
776 aBewareRect1=aBoundRect1;
794 aBewareRect2=aBoundRect2;
806 aBewareRect2=aBoundRect2;
810 sal_uIntPtr nBestQual=0xFFFFFFFF;
816 sal_uInt16 nBestAuto1=0;
817 sal_uInt16 nBestAuto2=0;
818 sal_uInt16 nCount1=bAuto1 ? 4 : 1;
819 sal_uInt16 nCount2=bAuto2 ? 4 : 1;
821 for (sal_uInt16 nNum1=0; nNum1<nCount1; nNum1++)
823 if (bAuto1) rCon1.
nConId=nNum1;
830 for (sal_uInt16 nNum2=0; nNum2<nCount2; nNum2++)
832 if (bAuto2) rCon2.
nConId=nNum2;
845 if ((nEsc1&nE1) && (nEsc2&nE2))
849 if (pInfo!=
nullptr) aInfo=*pInfo;
853 aBestXP=std::move(aXP);
864 if (bAuto1) rCon1.
nConId=nBestAuto1;
865 if (bAuto2) rCon2.
nConId=nBestAuto2;
866 if (pInfo!=
nullptr) *pInfo=aBestInfo;
875 bool bRts1=nAngle1==0;
876 bool bObn1=nAngle1==9000;
877 bool bLks1=nAngle1==18000;
878 bool bUnt1=nAngle1==27000;
879 bool bHor1=bLks1 || bRts1;
880 bool bVer1=bObn1 || bUnt1;
881 bool bRts2=nAngle2==0;
882 bool bObn2=nAngle2==9000;
883 bool bLks2=nAngle2==18000;
884 bool bUnt2=nAngle2==27000;
885 bool bHor2=bLks2 || bRts2;
886 bool bVer2=bObn2 || bUnt2;
887 bool bInfo=pInfo!=
nullptr;
901 Point aMeeting((aPt1.
X()+aPt2.
X()+1)/2,(aPt1.
Y()+aPt2.
Y()+1)/2);
906 if (pnQuality!=
nullptr) {
907 *pnQuality=std::abs(rPt1.
X()-rPt2.
X())+std::abs(rPt1.
Y()-rPt2.
Y());
916 if (bRts1) aXP[1].setX(aBewareRect1.
Right() );
917 if (bObn1) aXP[1].setY(aBewareRect1.
Top() );
918 if (bLks1) aXP[1].setX(aBewareRect1.
Left() );
919 if (bUnt1) aXP[1].setY(aBewareRect1.
Bottom() );
920 if (bRts2) aXP[2].setX(aBewareRect2.
Right() );
921 if (bObn2) aXP[2].setY(aBewareRect2.
Top() );
922 if (bLks2) aXP[2].setX(aBewareRect2.
Left() );
923 if (bUnt2) aXP[2].setY(aBewareRect2.
Bottom() );
924 if (pnQuality!=
nullptr) {
925 tools::Long nQ=std::abs(aXP[1].
X()-aXP[0].
X())+std::abs(aXP[1].
Y()-aXP[0].
Y());
926 nQ+=std::abs(aXP[2].
X()-aXP[1].
X())+std::abs(aXP[2].
Y()-aXP[1].
Y());
927 nQ+=std::abs(aXP[3].
X()-aXP[2].
X())+std::abs(aXP[3].
Y()-aXP[2].
Y());
946 sal_uInt16 nIntersections=0;
950 if (aBewareRect1.
Left()<=aBewareRect2.
Right() && aBewareRect1.
Right()>=aBewareRect2.
Left()) {
957 if (aC1.
X()<aC2.
X()) {
958 aMeeting.
setX((aBewareRect1.
Right()+aBewareRect2.
Left()+1)/2 );
960 aMeeting.
setX((aBewareRect1.
Left()+aBewareRect2.
Right()+1)/2 );
963 if (aBewareRect1.
Top()<=aBewareRect2.
Bottom() && aBewareRect1.
Bottom()>=aBewareRect2.
Top()) {
970 if (aC1.
Y()<aC2.
Y()) {
971 aMeeting.
setY((aBewareRect1.
Bottom()+aBewareRect2.
Top()+1)/2 );
973 aMeeting.
setY((aBewareRect1.
Top()+aBewareRect2.
Bottom()+1)/2 );
984 bool bBewareOverlap=aBewareRect1.
Right()>aBewareRect2.
Left() && aBewareRect1.
Left()<aBewareRect2.
Right() &&
986 unsigned nMainCase=3;
987 if (nAngle1==nAngle2) nMainCase=1;
988 else if ((bHor1 && bHor2) || (bVer1 && bVer2)) nMainCase=2;
990 if (bVer1) aMeeting.
setX((aPt1.
X()+aPt2.
X()+1)/2 );
991 if (bHor1) aMeeting.
setY((aPt1.
Y()+aPt2.
Y()+1)/2 );
993 bool bX1Ok=aPt1.
X()<=aBewareRect2.
Left() || aPt1.
X()>=aBewareRect2.
Right();
994 bool bX2Ok=aPt2.
X()<=aBewareRect1.
Left() || aPt2.
X()>=aBewareRect1.
Right();
995 bool bY1Ok=aPt1.
Y()<=aBewareRect2.
Top() || aPt1.
Y()>=aBewareRect2.
Bottom();
996 bool bY2Ok=aPt2.
Y()<=aBewareRect1.
Top() || aPt2.
Y()>=aBewareRect1.
Bottom();
997 if (bLks1 && (bY1Ok || aBewareRect1.
Left()<aBewareRect2.
Right()) && (bY2Ok || aBewareRect2.
Left()<aBewareRect1.
Right())) {
998 aMeeting.
setX(nXMin );
1000 if (bRts1 && (bY1Ok || aBewareRect1.
Right()>aBewareRect2.
Left()) && (bY2Ok || aBewareRect2.
Right()>aBewareRect1.
Left())) {
1001 aMeeting.
setX(nXMax );
1003 if (bObn1 && (bX1Ok || aBewareRect1.
Top()<aBewareRect2.
Bottom()) && (bX2Ok || aBewareRect2.
Top()<aBewareRect1.
Bottom())) {
1004 aMeeting.
setY(nYMin );
1006 if (bUnt1 && (bX1Ok || aBewareRect1.
Bottom()>aBewareRect2.
Top()) && (bX2Ok || aBewareRect2.
Bottom()>aBewareRect1.
Top())) {
1007 aMeeting.
setY(nYMax );
1009 }
else if (nMainCase==2) {
1070 bool bCase29Direct =
false;
1071 bool bCase29=aBewR1.
Right()>aBewR2.
Left();
1073 if ((aPt1.
Y()>aBewareRect2.Top() && aPt1.
Y()<aBewareRect2.Bottom()) ||
1074 (aPt2.
Y()>aBewareRect1.Top() && aPt2.
Y()<aBewareRect1.Bottom())) {
1075 bCase29Direct =
true;
1078 if (!bCase29Direct) {
1079 bool bObenLang=std::abs(nYMin-aMeeting.
Y())<=std::abs(nYMax-aMeeting.
Y());
1081 aMeeting.
setY(nYMin );
1083 aMeeting.
setY(nYMax );
1104 aBewareRect1.AdjustRight(nGet1-nWant1 );
1105 aBewareRect2.AdjustLeft( -(nGet2-nWant2) );
1107 aBewareRect2.AdjustRight(nGet1-nWant1 );
1108 aBewareRect1.AdjustLeft( -(nGet2-nWant2) );
1131 bool bCase29Direct =
false;
1132 bool bCase29=aBewR1.
Bottom()>aBewR2.
Top();
1134 if ((aPt1.
X()>aBewareRect2.Left() && aPt1.
X()<aBewareRect2.Right()) ||
1135 (aPt2.
X()>aBewareRect1.Left() && aPt2.
X()<aBewareRect1.Right())) {
1136 bCase29Direct =
true;
1139 if (!bCase29Direct) {
1140 bool bLinksLang=std::abs(nXMin-aMeeting.
X())<=std::abs(nXMax-aMeeting.
X());
1142 aMeeting.
setX(nXMin );
1144 aMeeting.
setX(nXMax );
1165 aBewareRect1.AdjustBottom(nGet1-nWant1 );
1166 aBewareRect2.AdjustTop( -(nGet2-nWant2) );
1168 aBewareRect2.AdjustBottom(nGet1-nWant1 );
1169 aBewareRect1.AdjustTop( -(nGet2-nWant2) );
1176 }
else if (nMainCase==3) {
1228 if (bBewareOverlap) {
1233 if ((((bRts1 && aTmpR1.
Right ()<=aPt2.
X()) || (bLks1 && aTmpR1.
Left()>=aPt2.
X())) &&
1234 ((bUnt2 && aTmpR2.
Bottom()<=aPt1.
Y()) || (bObn2 && aTmpR2.
Top ()>=aPt1.
Y()))) ||
1235 (((bRts2 && aTmpR2.
Right ()<=aPt1.
X()) || (bLks2 && aTmpR2.
Left()>=aPt1.
X())) &&
1236 ((bUnt1 && aTmpR1.
Bottom()<=aPt2.
Y()) || (bObn1 && aTmpR1.
Top ()>=aPt2.
Y())))) {
1239 aMeeting.
setX(aPt2.
X() );
1240 aMeeting.
setY(aPt1.
Y() );
1242 aMeeting.
setX(aPt1.
X() );
1243 aMeeting.
setY(aPt2.
Y() );
1246 aBewareRect1=aTmpR1;
1247 aBewareRect2=aTmpR2;
1248 }
else if ((((bRts1 && aBewareRect1.
Right ()>aBewareRect2.
Left ()) ||
1249 (bLks1 && aBewareRect1.
Left ()<aBewareRect2.
Right ())) &&
1250 ((bUnt2 && aBewareRect2.
Bottom()>aBewareRect1.
Top ()) ||
1251 (bObn2 && aBewareRect2.
Top ()<aBewareRect1.
Bottom()))) ||
1252 (((bRts2 && aBewareRect2.
Right ()>aBewareRect1.
Left ()) ||
1253 (bLks2 && aBewareRect2.
Left ()<aBewareRect1.
Right ())) &&
1254 ((bUnt1 && aBewareRect1.
Bottom()>aBewareRect2.
Top ()) ||
1255 (bObn1 && aBewareRect1.
Top ()<aBewareRect2.
Bottom())))) {
1257 if (bRts1 || bRts2) { aMeeting.
setX(nXMax ); }
1258 if (bLks1 || bLks2) { aMeeting.
setX(nXMin ); }
1259 if (bUnt1 || bUnt2) { aMeeting.
setY(nYMax ); }
1260 if (bObn1 || bObn2) { aMeeting.
setY(nYMin ); }
1273 Point aEP1(aXP1[nXP1Cnt-1]);
1274 Point aEP2(aXP2[nXP2Cnt-1]);
1275 bool bInsMeetingPoint=aEP1.
X()!=aEP2.
X() && aEP1.
Y()!=aEP2.
Y();
1276 bool bHorzE1=aEP1.
Y()==aXP1[nXP1Cnt-2].Y();
1277 bool bHorzE2=aEP2.
Y()==aXP2[nXP2Cnt-2].Y();
1278 if (aEP1==aEP2 && ((bHorzE1 && bHorzE2 && aEP1.
Y()==aEP2.
Y()) || (!bHorzE1 && !bHorzE2 && aEP1.
X()==aEP2.
X()))) {
1280 nXP1Cnt--; aXP1.
Remove(nXP1Cnt,1);
1281 nXP2Cnt--; aXP2.
Remove(nXP2Cnt,1);
1283 if (bInsMeetingPoint) {
1301 }
else if (bInfo && aEP1!=aEP2 && nXP1Cnt+nXP2Cnt>=4) {
1306 if (aXP1[nXP1Cnt-1]==aXP2[nXP2Cnt-1] && nXP1Cnt>1 && nXP2Cnt>1) nNum--;
1313 if (bInfo || pnQuality!=
nullptr) {
1314 if (nPointCount==2) cForm=
'I';
1315 else if (nPointCount==3) cForm=
'L';
1316 else if (nPointCount==4) {
1317 if (nAngle1==nAngle2) cForm=
'U';
1319 }
else if (nPointCount==6) {
1320 if (nAngle1!=nAngle2) {
1327 if (aP1.
Y()==aP2.
Y()) {
1328 if ((aP1.
X()<aP2.
X())==(aP3.
X()<aP4.
X())) cForm=
'S';
1331 if ((aP1.
Y()<aP2.
Y())==(aP3.
Y()<aP4.
Y())) cForm=
'S';
1338 if (cForm==
'I' || cForm==
'L' || cForm==
'Z' || cForm==
'U') {
1341 if (cForm==
'Z' || cForm==
'U') {
1346 }
else if (cForm==
'S' || cForm==
'C') {
1357 if (pnQuality!=
nullptr) {
1358 sal_uIntPtr nQual=0;
1359 sal_uIntPtr nQual0=nQual;
1360 bool bOverflow =
false;
1361 Point aPt0(aXP1[0]);
1362 for (sal_uInt16 nPntNum=1; nPntNum<nPointCount; nPntNum++) {
1363 Point aPt1b(aXP1[nPntNum]);
1364 nQual+=std::abs(aPt1b.
X()-aPt0.
X())+std::abs(aPt1b.
Y()-aPt0.
Y());
1365 if (nQual<nQual0) bOverflow =
true;
1370 sal_uInt16 nTmp=nPointCount;
1373 sal_uIntPtr
n1=std::abs(aXP1[1].
X()-aXP1[0].
X())+std::abs(aXP1[1].
Y()-aXP1[0].
Y());
1374 sal_uIntPtr
n2=std::abs(aXP1[2].
X()-aXP1[1].
X())+std::abs(aXP1[2].
Y()-aXP1[1].
Y());
1375 sal_uIntPtr
n3=std::abs(aXP1[3].
X()-aXP1[2].
X())+std::abs(aXP1[3].
Y()-aXP1[2].
Y());
1377 sal_uIntPtr nBesser=0;
1380 if (
n1>=
n2) nBesser=6;
1381 else if (
n1>=3*
n3) nBesser=4;
1382 else if (
n1>=2*
n3) nBesser=2;
1383 if (aXP1[0].
Y()!=aXP1[1].
Y()) nBesser++;
1384 if (nQual>nBesser) nQual-=nBesser;
else nQual=0;
1388 nQual+=
static_cast<sal_uIntPtr
>(nTmp)*0x01000000;
1389 if (nQual<nQual0 || nTmp>15) bOverflow =
true;
1391 if (nPointCount>=2) {
1392 Point aP1(aXP1[1]); aP1-=aXP1[0];
1393 Point aP2(aXP1[nPointCount-2]); aP2-=aXP1[nPointCount-1];
1394 tools::Long nAng1=0;
if (aP1.
X()<0) nAng1=18000;
if (aP1.
Y()>0) nAng1=27000;
1395 if (aP1.
Y()<0) nAng1=9000;
1396 if (aP1.
X()!=0 && aP1.
Y()!=0) nAng1=1;
1397 tools::Long nAng2=0;
if (aP2.
X()<0) nAng2=18000;
if (aP2.
Y()>0) nAng2=27000;
1398 if (aP2.
Y()<0) nAng2=9000;
1399 if (aP2.
X()!=0 && aP2.
Y()!=0) nAng2=1;
1400 if (nAng1!=nAngle1) nIntersections++;
1401 if (nAng2!=nAngle2) nIntersections++;
1407 aBewareRect1=rBewareRect1;
1408 aBewareRect2=rBewareRect2;
1410 for (sal_uInt16
i=0;
i<nPointCount;
i++) {
1412 bool b1=aPt1b.
X()>aBewareRect1.
Left() && aPt1b.
X()<aBewareRect1.
Right() &&
1413 aPt1b.
Y()>aBewareRect1.
Top() && aPt1b.
Y()<aBewareRect1.
Bottom();
1414 bool b2=aPt1b.
X()>aBewareRect2.
Left() && aPt1b.
X()<aBewareRect2.
Right() &&
1415 aPt1b.
Y()>aBewareRect2.
Top() && aPt1b.
Y()<aBewareRect2.
Bottom();
1416 sal_uInt16 nInt0=nIntersections;
1417 if (
i==0 ||
i==nPointCount-1) {
1418 if (b1 && b2) nIntersections++;
1420 if (b1) nIntersections++;
1421 if (b2) nIntersections++;
1424 if (
i>0 && nInt0==nIntersections) {
1425 if (aPt0.
Y()==aPt1b.
Y()) {
1426 if (aPt0.
Y()>aBewareRect1.
Top() && aPt0.
Y()<aBewareRect1.
Bottom() &&
1427 ((aPt0.
X()<=aBewareRect1.
Left() && aPt1b.
X()>=aBewareRect1.
Right()) ||
1428 (aPt1b.
X()<=aBewareRect1.
Left() && aPt0.
X()>=aBewareRect1.
Right()))) nIntersections++;
1429 if (aPt0.
Y()>aBewareRect2.
Top() && aPt0.
Y()<aBewareRect2.
Bottom() &&
1430 ((aPt0.
X()<=aBewareRect2.
Left() && aPt1b.
X()>=aBewareRect2.
Right()) ||
1431 (aPt1b.
X()<=aBewareRect2.
Left() && aPt0.
X()>=aBewareRect2.
Right()))) nIntersections++;
1433 if (aPt0.
X()>aBewareRect1.
Left() && aPt0.
X()<aBewareRect1.
Right() &&
1434 ((aPt0.
Y()<=aBewareRect1.
Top() && aPt1b.
Y()>=aBewareRect1.
Bottom()) ||
1435 (aPt1b.
Y()<=aBewareRect1.
Top() && aPt0.
Y()>=aBewareRect1.
Bottom()))) nIntersections++;
1436 if (aPt0.
X()>aBewareRect2.
Left() && aPt0.
X()<aBewareRect2.
Right() &&
1437 ((aPt0.
Y()<=aBewareRect2.
Top() && aPt1b.
Y()>=aBewareRect2.
Bottom()) ||
1438 (aPt1b.
Y()<=aBewareRect2.
Top() && aPt0.
Y()>=aBewareRect2.
Bottom()))) nIntersections++;
1443 if (nPointCount<=1) nIntersections++;
1445 nQual+=
static_cast<sal_uIntPtr
>(nIntersections)*0x10000000;
1446 if (nQual<nQual0 || nIntersections>15) bOverflow =
true;
1448 if (bOverflow || nQual==0xFFFFFFFF) nQual=0xFFFFFFFE;
1505 Point* pPt1=&aXP1[0];
1506 Point* pPt2=&aXP1[1];
1507 Point* pPt3=&aXP1[nPointCount-2];
1508 Point* pPt4=&aXP1[nPointCount-1];
1514 aXP1.
SetFlags(1,PolyFlags::Control);
1516 aXP1.
Insert(2,aPt3,PolyFlags::Control);
1519 pPt3=&aXP1[nPointCount-2];
1524 }
else if (nPointCount>=4 && nPointCount<=6) {
1527 aXP1.
SetFlags(1,PolyFlags::Control);
1528 aXP1.
SetFlags(nPointCount-2,PolyFlags::Control);
1534 if (nPointCount==5) {
1536 Point aCenter(aXP1[2]);
1541 aXP1.
Insert(2,aCenter,PolyFlags::Control);
1542 aXP1.
SetFlags(3,PolyFlags::Symmetric);
1543 aXP1.
Insert(4,aCenter,PolyFlags::Control);
1544 aXP1[2].AdjustX( -(dx1b/2) );
1545 aXP1[2].AdjustY( -(dy1b/2) );
1546 aXP1[3].AdjustX( -((dx1b+dx2b)/4) );
1547 aXP1[3].AdjustY( -((dy1b+dy2b)/4) );
1548 aXP1[4].AdjustX( -(dx2b/2) );
1549 aXP1[4].AdjustY( -(dy2b/2) );
1551 if (nPointCount==6) {
1552 Point aPt1b(aXP1[2]);
1553 Point aPt2b(aXP1[3]);
1554 aXP1.
Insert(2,aPt1b,PolyFlags::Control);
1555 aXP1.
Insert(5,aPt2b,PolyFlags::Control);
1558 aXP1[3].AdjustX( -(dx/2) );
1559 aXP1[3].AdjustY( -(dy/2) );
1560 aXP1.
SetFlags(3,PolyFlags::Symmetric);
1616 bool bDataChg=
nId==SfxHintId::DataChanged;
1617 bool bDying=
nId==SfxHintId::Dying;
1620 if (bDying && (bObj1 || bObj2)) {
1627 if ( bObj1 || bObj2 )
1636 const SdrHint* pSdrHint = ( rHint.
GetId() == SfxHintId::ThisIsAnSdrHint ?
static_cast<const SdrHint*
>(&rHint) :
nullptr );
1665 SfxHint aHint( SfxHintId::DataChanged );
1671 SfxHint aHint( SfxHintId::DataChanged );
1686 if (!
aName.isEmpty())
1693 return SvxResId(STR_ObjNamePluralEDGE);
1710 return aPolyPolygon;
1715 if ( !rPoly.
count() )
1742 return aPolyPolygon;
1748 sal_uInt32 nHdlCnt(0);
1749 sal_uInt32 nPointCount(
pEdgeTrack->GetPointCount());
1759 nHdlCnt += nO1 + nO2 + nM;
1776 sal_uInt32 nPointCount(
pEdgeTrack->GetPointCount());
1783 pHdl->SetPointNum(0);
1784 rHdlList.
AddHdl(std::move(pHdl));
1789 pHdl->SetPointNum(1);
1790 rHdlList.
AddHdl(std::move(pHdl));
1799 for(sal_uInt32
i = 0;
i < (nO1 + nO2 + nM); ++
i)
1802 sal_uInt32 nNum =
i;
1811 nPt=nPointCount-3-nNum;
1824 aPos+=(*pEdgeTrack)[
static_cast<sal_uInt16
>(nPt)+1];
1825 aPos.
setX( aPos.
X() / 2 );
1826 aPos.
setY( aPos.
Y() / 2 );
1828 pHdl->SetPointNum(
i + 2);
1829 rHdlList.
AddHdl(std::move(pHdl));
1840 pHdl->SetPointNum(2);
1841 rHdlList.
AddHdl(std::move(pHdl));
1848 pHdl->SetPointNum(3);
1849 rHdlList.
AddHdl(std::move(pHdl));
1890 const bool bOriginalEdgeModified(pOriginalEdge ==
this);
1892 if(!bOriginalEdgeModified && pOriginalEdge)
1920 if(pDraggedOne->
pObj)
1925 pDraggedOne->
pObj =
nullptr;
1929 if(rDragStat.
GetView() && !bOriginalEdgeModified)
1942 (*pEdgeTrack)[0] = aPointNow;
1946 (*pEdgeTrack)[sal_uInt16(
pEdgeTrack->GetPointCount()-1)] = aPointNow;
1963 sal_Int32 nDist(pEdgeHdl->
IsHorzDrag() ? aDist.
X() : aDist.
Y());
1979 if(bOriginalEdgeModified && rDragStat.
GetView())
2071 (*pEdgeTrack)[0]=rDragStat.
GetStart();
2072 (*pEdgeTrack)[1]=rDragStat.
GetNow();
2084 (*pEdgeTrack)[nMax-1]=rDragStat.
GetNow();
2103 if (rDragStat.
GetView()!=
nullptr) {
2114 if (rDragStat.
GetView()!=
nullptr) {
2122 if (rDragStat.
GetView()!=
nullptr) {
2136 return PointerStyle::DrawConnect;
2143 if (
pOut==
nullptr)
return false;
2148 Size aHalfConSiz(nMarkHdSiz,nMarkHdSiz);
2150 aHalfConSiz=
pOut->PixelToLogic(aHalfConSiz,
MapMode(MapUnit::Map100thMM));
2152 aHalfConSiz=
pOut->PixelToLogic(aHalfConSiz);
2158 double fBoundHitTol=
static_cast<double>(aHalfConSiz.
Width())/2;
if (fBoundHitTol==0.0) fBoundHitTol=1.0;
2163 bool bHasRequestedOrdNum =
false;
2164 sal_Int32 requestedOrdNum = -1;
2166 if (bTiledRendering && pDragStat)
2169 if (glueOptions.objectOrdNum != -1)
2171 requestedOrdNum = glueOptions.objectOrdNum;
2172 bHasRequestedOrdNum =
true;
2176 while (no>0 && !bFnd) {
2180 if (bHasRequestedOrdNum)
2182 if (pObj->
GetOrdNumDirect() !=
static_cast<sal_uInt32
>(requestedOrdNum))
2186 (pThis==
nullptr || pObj!=
static_cast<SdrObject const *
>(pThis)))
2189 if (aObjBound.
Overlaps(aMouseRect)) {
2191 bool bEdge=
dynamic_cast<const SdrEdgeObj *
>(pObj) !=
nullptr;
2196 sal_uInt16 nGluePointCnt=pGPL==
nullptr ? 0 : pGPL->
GetCount();
2197 sal_uInt16 nGesAnz=nGluePointCnt+9;
2198 bool bUserFnd =
false;
2199 sal_uIntPtr nBestDist=0xFFFFFFFF;
2200 for (sal_uInt16
i=0;
i<nGesAnz;
i++)
2202 bool bUser=
i<nGluePointCnt;
2203 bool bVertex=
i>=nGluePointCnt+0 &&
i<nGluePointCnt+4;
2204 bool bCorner=
i>=nGluePointCnt+4 &&
i<nGluePointCnt+8;
2205 bool bCenter=
i==nGluePointCnt+8;
2208 sal_uInt16 nConNum=
i;
2212 nConNum=rGP.
GetId();
2214 }
else if (bVertex && !bUserFnd) {
2215 nConNum=nConNum-nGluePointCnt;
2219 }
else if (bCorner && !bUserFnd) {
2220 nConNum-=nGluePointCnt+4;
2223 else if (bCenter && !bUserFnd && !bEdge)
2230 aConPos=aObjBound.
Center();
2234 if (bOk && aMouseRect.
Contains(aConPos)) {
2235 if (bUser) bUserFnd =
true;
2237 sal_uIntPtr nDist=
static_cast<sal_uIntPtr
>(std::abs(aConPos.
X()-rPt.
X()))+
static_cast<sal_uIntPtr
>(std::abs(aConPos.
Y()-rPt.
Y()));
2238 if (nDist<nBestDist) {
2296 if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; }
2297 if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; }
2351 sal_uInt16 nPointCount =
pEdgeTrack->GetPointCount();
2382 sal_uInt16 nPointCount =
pEdgeTrack->GetPointCount();
2413 sal_uInt16 nPointCount =
pEdgeTrack->GetPointCount();
2473 (*pEdgeTrack)[0]=rPnt;
2475 (*pEdgeTrack)[
nCount-1]=rPnt;
2481 : pEdgeTrack(
std::in_place)
2482 , bEdgeTrackDirty(false)
2483 , bEdgeTrackUserDefined(false)
2493 return std::make_unique<SdrEdgeObjGeoData>();
2546 return rTrack0[nSiz];
2653 return ::basegfx::B2DPolygon();
SdrEdgeLineCode GetLineCode() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
virtual const tools::Rectangle & GetSnapRect() const override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
tools::Rectangle maSnapRect
SdrObject * GetCreateObj() const
void SetConnectMarker(const SdrObjConnection &rCon)
virtual basegfx::B2DHomMatrix getCurrentTransformation() const
sal_Int32 GetPointCount() const
const Point & GetStart() const
SdrView * GetView() const
void SetEndDragChangesGeoAndAttributes(bool bOn)
const SdrHdl * GetHdl() const
const Point & GetNow() const
void SetNoSnap(bool bOn=true)
SdrPageView * GetPageView() const
void SetEndDragChangesAttributes(bool bOn)
Utility class SdrEdgeInfoRec.
void ImpSetLineOffset(SdrEdgeLineCode eLineCode, const XPolygon &rXP, tools::Long nVal)
bool ImpIsHorzLine(SdrEdgeLineCode eLineCode, const XPolygon &rXP) const
Point & ImpGetLineOffsetPoint(SdrEdgeLineCode eLineCode)
sal_uInt16 ImpGetPolyIdx(SdrEdgeLineCode eLineCode, const XPolygon &rXP) const
tools::Long ImpGetLineOffset(SdrEdgeLineCode eLineCode, const XPolygon &rXP) const
Utility class SdrEdgeObjGeoData.
bool bEdgeTrackUserDefined
virtual ~SdrEdgeObjGeoData() override
std::optional< XPolygon > pEdgeTrack
Utility class SdrEdgeObj.
virtual SdrGluePointList * ForceGluePointList() override
static XPolygon ImpCalcObjToCenter(const Point &rStPt, tools::Long nEscAngle, const tools::Rectangle &rRect, const Point &rCenter)
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
void ConnectToNode(bool bTail1, SdrObject *pObj) override
virtual void NbcResize(const Point &rRefPnt, const Fraction &aXFact, const Fraction &aYFact) override
void ImpRecalcEdgeTrack()
virtual bool IsPolyObj() const override
virtual sal_uInt32 GetPointCount() const override
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
virtual const tools::Rectangle & GetSnapRect() const override
virtual ~SdrEdgeObj() override
virtual void BrkCreate(SdrDragStat &rStat) override
static SdrEscapeDirection ImpCalcEscAngle(SdrObject const *pObj, const Point &aPt2)
virtual SdrObjKind GetObjIdentifier() const override
virtual bool BckCreate(SdrDragStat &rStat) override
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
void DisconnectFromNode(bool bTail1) override
virtual bool MovCreate(SdrDragStat &rStat) override
virtual rtl::Reference< SdrObject > getFullDragClone() const override
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
virtual void NbcSetAnchorPos(const Point &rPnt) override
void ImpUndirtyEdgeTrack()
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
sal_Int32 getGluePointIndex(bool bTail)
this method is used by the api to return a gluepoint id for a connection.
virtual void NbcMove(const Size &aSize) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
::basegfx::B2DPolygon getEdgeTrack() const
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
virtual OUString TakeObjNamePlural() const override
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
XPolygon ImpCalcEdgeTrack(const XPolygon &rTrack0, SdrObjConnection &rCon1, SdrObjConnection &rCon2, SdrEdgeInfoRec *pInfo) const
virtual void NbcSetPoint(const Point &rPnt, sal_uInt32 i) override
void SetEdgeTrackPath(const basegfx::B2DPolyPolygon &rPoly)
virtual const SdrGluePointList * GetGluePointList() const override
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
virtual Point GetSnapPoint(sal_uInt32 i) const override
static bool ImpFindConnector(const Point &rPt, const SdrPageView &rPV, SdrObjConnection &rCon, const SdrEdgeObj *pThis, OutputDevice *pOut=nullptr, SdrDragStat *pDragStat=nullptr)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
basegfx::B2DPolygon ImplAddConnectorOverlay(const SdrDragMethod &rDragMethod, bool bTail1, bool bTail2, bool bDetail) const
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const override
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const override
SdrObjConnection & GetConnection(bool bTail1)
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
void SetTailPoint(bool bTail, const Point &rPt)
virtual Point GetPoint(sal_uInt32 i) const override
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
void setGluePointIndex(bool bTail, sal_Int32 nId=-1)
this method is used by the api to set a gluepoint for a connection nId == -1 : The best default point...
bool bEdgeTrackUserDefined
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear) override
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
bool mbBoundRectCalculationRunning
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
virtual const tools::Rectangle & GetCurrentBoundRect() const override
SdrObject * GetConnectedNode(bool bTail1) const override
virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const override
virtual OUString TakeObjNameSingul() const override
bool CheckNodeConnection(bool bTail1) const
sal_uInt16 nNotifyingCount
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
basegfx::B2DPolyPolygon GetEdgeTrackPath() const
bool GetSuppressDefaultConnect() const
void Reformat()
updates edges that are connected to the edges of this object as if the connected objects send a repai...
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
void ImpSetTailPoint(bool bTail1, const Point &rPt)
void ImpSetAttrToEdgeInfo()
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Point GetTailPoint(bool bTail) const
std::optional< XPolygon > pEdgeTrack
void ImpSetEdgeInfoToAttr()
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
SdrEdgeObj(SdrModel &rSdrModel)
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const override
virtual rtl::Reference< SdrObject > DoConvertToPolyObj(bool bBezier, bool bAddText) const override
sal_uInt16 FindGluePoint(sal_uInt16 nId) const
sal_uInt16 GetCount() const
void SetPercent(bool bOn)
Point GetAbsolutePos(const SdrObject &rObj) const
void SetPos(const Point &rNewPos)
SdrEscapeDirection GetEscDir() const
const Point & GetPos() const
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
SdrObject * GetObj() const
sal_uInt32 GetPointNum() const
SdrHintKind GetKind() const
bool IsSet(SdrLayerID a) const
sal_uInt16 GetMarkHdlSizePixel() const
Utility class SdrObjConnection.
bool TakeGluePoint(SdrGluePoint &rGP) const
sal_uInt16 GetConnectorId() const
void SetBestConnection(bool rB)
void SetBestVertex(bool rB)
void SetAutoVertex(bool rB)
bool IsAutoVertex() const
bool IsBestConnection() const
SdrObject * GetObject() const
void SetConnectorId(sal_uInt16 nId)
All geometrical data of an arbitrary object for use in undo/redo.
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
sal_uInt32 GetOrdNumDirect() const
virtual void NbcSetAnchorPos(const Point &rPnt)
void ActionChanged() const
const tools::Rectangle & getOutRectangle() const
virtual sdr::properties::BaseProperties & GetProperties() const
const SfxBroadcaster * GetBroadcaster() const
bool LineGeometryUsageIsNecessary() const
void RemoveListener(SfxListener &rListener)
const SfxPoolItem & GetObjectItem(const sal_uInt16 nWhich) const
static rtl::Reference< T > Clone(T const &rObj, SdrModel &rTargetModel)
virtual const tools::Rectangle & GetCurrentBoundRect() const
SdrModel & getSdrModelFromSdrObject() const
virtual const tools::Rectangle & GetSnapRect() const
SdrObjUserCall * m_pUserCall
virtual const OUString & GetName() const
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon)
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
virtual void SetChanged()
void AddListener(SfxListener &rListener)
SdrPage * getSdrPageFromSdrObject() const
virtual const SdrGluePointList * GetGluePointList() const
OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const
virtual SdrLayerID GetLayer() const
virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const
virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const
virtual void SetBoundRectDirty()
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
const SfxItemSet & GetObjectItemSet() const
const SdrLayerIDSet & GetVisibleLayers() const
SdrObjList * GetObjList() const
Return current List.
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
OutputDevice * GetFirstOutputDevice() const
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
tools::Rectangle const & getRectangle() const
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear) override
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
rtl::Reference< SdrPathObj > ImpConvertMakeObj(const basegfx::B2DPolyPolygon &rPolyPolygon, bool bClosed, bool bBezier) const
bool ImpCanConvTextToCurve() const
virtual bool HasText() const override
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
rtl::Reference< SdrObject > ImpConvertAddText(rtl::Reference< SdrObject > pObj, bool bBezier) const
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
void setRectangle(tools::Rectangle const &rRectangle)
virtual void NbcRotate(const Point &rRef, Degree100 nAngle, double sn, double cs) override
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void Remove(sal_uInt16 nPos, sal_uInt16 nCount)
sal_uInt16 GetPointCount() const
void Insert(sal_uInt16 nPos, const Point &rPt, PolyFlags eFlags)
void SetFlags(sal_uInt16 nPos, PolyFlags eFlags)
set the flags for the point at the given position
basegfx::B2DPolygon getB2DPolygon() const
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
virtual void ClearObjectItemDirect(const sal_uInt16 nWhich)=0
virtual void SetObjectItemDirect(const SfxPoolItem &rItem)=0
@ ConnectorUseSnapRect
for tdf#149756
OUString SvxResId(TranslateId aId)
virtual css::uno::Reference< css::embed::XEmbeddedObject > GetObject() override
B2IRange fround(const B2DRange &rRange)
SdrObject * SdrObjectPrimitiveHit(const SdrObject &rObject, const Point &rPnt, const basegfx::B2DVector &rHitTolerance, const SdrPageView &rSdrPageView, const SdrLayerIDSet *pVisiLayer, bool bTextOnly, drawinglayer::primitive2d::Primitive2DContainer *pHitContainer)
constexpr TypedWhichId< SdrEdgeNode1HorzDistItem > SDRATTR_EDGENODE1HORZDIST(SDRATTR_EDGE_FIRST+1)
constexpr TypedWhichId< SdrEdgeLineDeltaCountItem > SDRATTR_EDGELINEDELTACOUNT(SDRATTR_EDGE_FIRST+7)
constexpr TypedWhichId< SdrEdgeKindItem > SDRATTR_EDGEKIND(SDRATTR_EDGE_FIRST+0)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_EDGELINE2DELTA(SDRATTR_EDGE_FIRST+9)
constexpr TypedWhichId< SdrEdgeNode1VertDistItem > SDRATTR_EDGENODE1VERTDIST(SDRATTR_EDGE_FIRST+2)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_EDGELINE3DELTA(SDRATTR_EDGE_FIRST+10)
constexpr TypedWhichId< SdrEdgeNode2HorzDistItem > SDRATTR_EDGENODE2HORZDIST(SDRATTR_EDGE_FIRST+3)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_EDGELINE1DELTA(SDRATTR_EDGE_FIRST+8)
constexpr TypedWhichId< SdrEdgeNode2VertDistItem > SDRATTR_EDGENODE2VERTDIST(SDRATTR_EDGE_FIRST+4)
#define SDRGLUEPOINT_NOTFOUND
void ResizeXPoly(XPolygon &rPoly, const Point &rRef, const Fraction &xFact, const Fraction &yFact)
void ShearXPoly(XPolygon &rPoly, const Point &rRef, double tn, bool bVShear)
void RotateXPoly(XPolygon &rPoly, const Point &rRef, double sn, double cs)
void MirrorPoint(Point &rPnt, const Point &rRef1, const Point &rRef2)
tools::Long BigMulDiv(tools::Long nVal, tools::Long nMul, tools::Long nDiv)
void MoveXPoly(XPolygon &rPoly, const Size &S)
void MirrorXPoly(XPolygon &rPoly, const Point &rRef1, const Point &rRef2)
void ShearPoint(Point &rPnt, const Point &rRef, double tn, bool bVShear=false)
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
SdrMetricItem makeSdrEdgeLine2DeltaItem(tools::Long nVal)
SdrMetricItem makeSdrEdgeLine1DeltaItem(tools::Long nVal)
SdrMetricItem makeSdrEdgeLine3DeltaItem(tools::Long nVal)