summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdocapt.cxx34
-rw-r--r--svx/source/svdraw/svdocirc.cxx83
-rw-r--r--svx/source/svdraw/svdoedge.cxx512
-rw-r--r--svx/source/svdraw/svdograf.cxx31
-rw-r--r--svx/source/svdraw/svdogrp.cxx28
-rw-r--r--svx/source/svdraw/svdomeas.cxx88
-rw-r--r--svx/source/svdraw/svdomedia.cxx5
-rw-r--r--svx/source/svdraw/svdoole2.cxx28
-rw-r--r--svx/source/svdraw/svdopage.cxx2
-rw-r--r--svx/source/svdraw/svdopath.cxx343
10 files changed, 597 insertions, 557 deletions
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 5822a0e59e4d..cf261d8136ff 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -39,9 +39,9 @@
#include <svx/svdhdl.hxx>
#include <svx/svddrag.hxx>
#include <svx/svdmodel.hxx>
-#include <svx/svdview.hxx> // fuer RectSnap
+#include <svx/svdview.hxx> // for RectSnap
#include "svx/svdglob.hxx" // StringCache
-#include "svx/svdstr.hrc" // Objektname
+#include "svx/svdstr.hrc" // the object's name
#include <svx/svdogrp.hxx>
#include <svx/svdpage.hxx>
#include <svx/xflhtit.hxx>
@@ -99,7 +99,7 @@ public:
void ImpCaptParams::CalcEscPos(const Point& rTailPt, const Rectangle& rRect, Point& rPt, EscDir& rDir) const
{
- Point aTl(rTailPt); // lokal kopieren wg. Performance
+ Point aTl(rTailPt); // copy locally for performance reasons
long nX,nY;
if (bEscRel) {
nX=rRect.Right()-rRect.Left();
@@ -199,7 +199,7 @@ TYPEINIT1(SdrCaptionObj,SdrRectObj);
SdrCaptionObj::SdrCaptionObj():
SdrRectObj(OBJ_TEXT),
- aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien
+ aTailPoly(3), // default size: 3 points = 2 lines
mbSpecialTextBoxShadow(sal_False),
mbFixedTail(sal_False)
{
@@ -207,7 +207,7 @@ SdrCaptionObj::SdrCaptionObj():
SdrCaptionObj::SdrCaptionObj(const Rectangle& rRect, const Point& rTail):
SdrRectObj(OBJ_TEXT,rRect),
- aTailPoly(3), // Default Groesse: 3 Punkte = 2 Linien
+ aTailPoly(3), // default size: 3 points = 2 lines
mbSpecialTextBoxShadow(sal_False),
mbFixedTail(sal_False)
{
@@ -276,7 +276,7 @@ basegfx::B2DPolyPolygon SdrCaptionObj::TakeXorPoly() const
sal_uInt32 SdrCaptionObj::GetHdlCount() const
{
sal_uInt32 nAnz1(SdrRectObj::GetHdlCount());
- // Derzeit ist nur das Draggen des Schwanzendes implementiert
+ // Currently only dragging the tail's end is implemented.
return nAnz1 + 1L;
}
@@ -453,8 +453,8 @@ void SdrCaptionObj::ImpRecalcTail()
// Changed this method to not do that.
// Also found why this has been done: For interactive dragging of the
// tail end pos for SDRCAPT_TYPE1. This sure was the simplest method
-// to achieve this, for the cost to make a whole group of const methods
-// of this object implicitly chainging the object's position.
+// to achieve this, at the cost of making a whole group of const methods
+// of this object implicitly change the object's position.
void SdrCaptionObj::ImpCalcTail1(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const
{
Polygon aPol(2);
@@ -493,7 +493,7 @@ void SdrCaptionObj::ImpCalcTail2(const ImpCaptParams& rPara, Polygon& rPoly, Rec
aPol[1]=aEscPos;
if (!rPara.bFixedAngle) {
- // fehlende Implementation
+ // TODO: Implementation missing.
}
rPoly=aPol;
}
@@ -526,7 +526,7 @@ void SdrCaptionObj::ImpCalcTail3(const ImpCaptParams& rPara, Polygon& rPoly, Rec
}
}
if (!rPara.bFixedAngle) {
- // fehlende Implementation
+ // TODO: Implementation missing.
}
rPoly=aPol;
}
@@ -548,7 +548,7 @@ void SdrCaptionObj::ImpCalcTail(const ImpCaptParams& rPara, Polygon& rPoly, Rect
bool SdrCaptionObj::BegCreate(SdrDragStat& rStat)
{
- if (aRect.IsEmpty()) return sal_False; // Create z.Zt. nur mit vorgegebenen Rect
+ if (aRect.IsEmpty()) return sal_False; // Create currently only works with the given Rect
ImpCaptParams aPara;
ImpGetCaptParams(aPara);
@@ -625,7 +625,7 @@ void SdrCaptionObj::NbcSetRelativePos(const Point& rPnt)
{
Point aRelPos0(aTailPoly.GetPoint(0)-aAnchor);
Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
- NbcMove(aSiz); // Der ruft auch das SetRectsDirty()
+ NbcMove(aSiz); // This also calls SetRectsDirty()
}
Point SdrCaptionObj::GetRelativePos() const
@@ -636,12 +636,12 @@ Point SdrCaptionObj::GetRelativePos() const
void SdrCaptionObj::NbcSetAnchorPos(const Point& rPnt)
{
SdrRectObj::NbcSetAnchorPos(rPnt);
- // !!!!! fehlende Impl.
+ // TODO: Implementation missing.
}
const Point& SdrCaptionObj::GetAnchorPos() const
{
- // !!!!! fehlende Impl.
+ // TODO: Implementation missing.
return SdrRectObj::GetAnchorPos();
}
@@ -649,7 +649,7 @@ void SdrCaptionObj::RecalcSnapRect()
{
SdrRectObj::RecalcSnapRect();
// #i32599#
- // !!!!! fehlende Impl.
+ // TODO: Implementation missing.
}
const Rectangle& SdrCaptionObj::GetSnapRect() const
@@ -701,13 +701,13 @@ void SdrCaptionObj::NbcSetTailPos(const Point& rPos)
sal_uInt32 SdrCaptionObj::GetSnapPointCount() const
{
- // !!!!! fehlende Impl.
+ // TODO: Implementation missing.
return 0L;
}
Point SdrCaptionObj::GetSnapPoint(sal_uInt32 /*i*/) const
{
- // !!!!! fehlende Impl.
+ // TODO: Implementation missing.
return Point(0,0);
}
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index c67e47ca03ff..746873b2cf65 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -44,10 +44,10 @@
#include <svx/svddrag.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdpage.hxx>
-#include <svx/svdopath.hxx> // fuer die Objektkonvertierung
-#include <svx/svdview.hxx> // Zum Draggen (Ortho)
+#include <svx/svdopath.hxx> // for the object conversion
+#include <svx/svdview.hxx> // for dragging (Ortho)
#include "svx/svdglob.hxx" // StringCache
-#include "svx/svdstr.hrc" // Objektname
+#include "svx/svdstr.hrc" // the object's name
#include <editeng/eeitem.hxx>
#include <svx/sdr/properties/circleproperties.hxx>
#include <svx/sdr/contact/viewcontactofsdrcircobj.hxx>
@@ -74,7 +74,7 @@ Point GetWinkPnt(const Rectangle& rR, long nWink)
if (nWdt!=nHgt) {
if (nWdt>nHgt) {
if (nWdt!=0) {
- // eventuelle Ueberlaeufe bei sehr grossen Objekten abfangen
+ // stop possible overruns for very large objects
if (Abs(nHgt)>32767 || Abs(aRetval.Y())>32767) {
aRetval.Y()=BigMulDiv(aRetval.Y(),nHgt,nWdt);
} else {
@@ -83,7 +83,7 @@ Point GetWinkPnt(const Rectangle& rR, long nWink)
}
} else {
if (nHgt!=0) {
- // eventuelle Ueberlaeufe bei sehr grossen Objekten abfangen
+ // stop possible overruns for very large objects
if (Abs(nWdt)>32767 || Abs(aRetval.X())>32767) {
aRetval.X()=BigMulDiv(aRetval.X(),nWdt,nHgt);
} else {
@@ -139,7 +139,7 @@ SdrCircObj::SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect, long nNewSta
long nWinkDif=nNewEndWink-nNewStartWink;
nStartWink=NormAngle360(nNewStartWink);
nEndWink=NormAngle360(nNewEndWink);
- if (nWinkDif==36000) nEndWink+=nWinkDif; // Vollkreis
+ if (nWinkDif==36000) nEndWink+=nWinkDif; // full circle
meCircleKind=eNewKind;
bClosedObj=eNewKind!=OBJ_CARC;
}
@@ -164,42 +164,42 @@ sal_uInt16 SdrCircObj::GetObjIdentifier() const
bool SdrCircObj::PaintNeedsXPolyCirc() const
{
- // XPoly ist notwendig fuer alle gedrehten Ellipsenobjekte,
- // fuer alle Kreis- und Ellipsenabschnitte
- // und wenn nicht WIN dann (erstmal) auch fuer Kreis-/Ellipsenausschnitte
- // und Kreis-/Ellipsenboegen (wg. Genauigkeit)
+ // XPoly is necessary for all rotated ellipse objects, circle and
+ // ellipse segments.
+ // If not WIN, then (for now) also for circle/ellipse segments and circle/
+ // ellipse arcs (for precision)
bool bNeed=aGeo.nDrehWink!=0 || aGeo.nShearWink!=0 || meCircleKind==OBJ_CCUT;
- // Wenn nicht Win, dann fuer alle ausser Vollkreis (erstmal!!!)
+ // If not WIN, then for everything except full circle (for now!)
if (meCircleKind!=OBJ_CIRC) bNeed = true;
const SfxItemSet& rSet = GetObjectItemSet();
if(!bNeed)
{
- // XPoly ist notwendig fuer alles was nicht LineSolid oder LineNone ist
+ // XPoly is necessary for everything that isn't LineSolid or LineNone
XLineStyle eLine = ((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue();
bNeed = eLine != XLINE_NONE && eLine != XLINE_SOLID;
- // XPoly ist notwendig fuer dicke Linien
+ // XPoly is necessary for thick lines
if(!bNeed && eLine != XLINE_NONE)
bNeed = ((XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue() != 0;
- // XPoly ist notwendig fuer Kreisboegen mit Linienenden
+ // XPoly is necessary for circle arcs with line ends
if(!bNeed && meCircleKind == OBJ_CARC)
{
- // Linienanfang ist da, wenn StartPolygon und StartWidth!=0
+ // start of the line is here if StartPolygon, StartWidth!=0
bNeed=((XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetLineStartValue().count() != 0L &&
((XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue() != 0;
if(!bNeed)
{
- // Linienende ist da, wenn EndPolygon und EndWidth!=0
+ // end of the line is here if EndPolygon, EndWidth!=0
bNeed = ((XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetLineEndValue().count() != 0L &&
((XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue() != 0;
}
}
}
- // XPoly ist notwendig, wenn Fill !=None und !=Solid
+ // XPoly is necessary if Fill !=None and !=Solid
if(!bNeed && meCircleKind != OBJ_CARC)
{
XFillStyle eFill=((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
@@ -207,7 +207,7 @@ bool SdrCircObj::PaintNeedsXPolyCirc() const
}
if(!bNeed && meCircleKind != OBJ_CIRC && nStartWink == nEndWink)
- bNeed = true; // Weil sonst Vollkreis gemalt wird
+ bNeed = true; // otherwise we're drawing a full circle
return bNeed;
}
@@ -370,7 +370,7 @@ struct ImpCircUser : public SdrDragStatUserData
long nStart;
long nEnd;
long nWink;
- bool bRight; // noch nicht implementiert
+ bool bRight; // not yet implemented
public:
ImpCircUser()
@@ -644,7 +644,7 @@ void ImpCircUser::SetCreateParams(SdrDragStat& rStat)
nStart=NormAngle360(GetAngle(aP));
if (rStat.GetView()!=NULL && rStat.GetView()->IsAngleSnapEnabled()) {
long nSA=rStat.GetView()->GetSnapAngle();
- if (nSA!=0) { // Winkelfang
+ if (nSA!=0) { // angle snapping
nStart+=nSA/2;
nStart/=nSA;
nStart*=nSA;
@@ -665,7 +665,7 @@ void ImpCircUser::SetCreateParams(SdrDragStat& rStat)
nEnd=NormAngle360(GetAngle(aP));
if (rStat.GetView()!=NULL && rStat.GetView()->IsAngleSnapEnabled()) {
long nSA=rStat.GetView()->GetSnapAngle();
- if (nSA!=0) { // Winkelfang
+ if (nSA!=0) { // angle snapping
nEnd+=nSA/2;
nEnd/=nSA;
nEnd*=nSA;
@@ -702,7 +702,7 @@ bool SdrCircObj::MovCreate(SdrDragStat& rStat)
ImpSetCreateParams(rStat);
ImpCircUser* pU=(ImpCircUser*)rStat.GetUser();
rStat.SetActionRect(pU->aR);
- aRect=pU->aR; // fuer ObjName
+ aRect=pU->aR; // for ObjName
ImpJustifyRect(aRect);
nStartWink=pU->nStart;
nEndWink=pU->nEnd;
@@ -826,21 +826,20 @@ void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
if (bXMirr || bYMirr) {
- // bei bXMirr!=bYMirr muessten eigentlich noch die beiden
- // Linienende vertauscht werden. Das ist jedoch mal wieder
- // schlecht (wg. zwangslaeufiger harter Formatierung).
- // Alternativ koennte ein bMirrored-Flag eingefuehrt werden
- // (Vielleicht ja mal grundsaetzlich, auch fuer gepiegelten Text, ...).
+ // At bXMirr!=bYMirr we should actually swap both line ends.
+ // That, however, is pretty bad (because of forced "hard" formatting).
+ // Alternatively, we could implement a bMirrored flag (maybe even
+ // a more general one, e. g. for mirrored text, ...).
long nS0=nStartWink;
long nE0=nEndWink;
if (bNoShearRota) {
- // Das RectObj spiegelt bei VMirror bereits durch durch 180deg Drehung.
+ // the RectObj already mirrors at VMirror because of a 180deg rotation
if (! (bXMirr && bYMirr)) {
long nTmp=nS0;
nS0=18000-nE0;
nE0=18000-nTmp;
}
- } else { // Spiegeln fuer verzerrte Ellipsen
+ } else { // mirror contorted ellipses
if (bXMirr!=bYMirr) {
nS0+=nWink0;
nE0+=nWink0;
@@ -861,7 +860,7 @@ void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
long nWinkDif=nE0-nS0;
nStartWink=NormAngle360(nS0);
nEndWink =NormAngle360(nE0);
- if (nWinkDif==36000) nEndWink+=nWinkDif; // Vollkreis
+ if (nWinkDif==36000) nEndWink+=nWinkDif; // full circle
}
}
SetXPolyDirty();
@@ -880,19 +879,19 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
bool bFreeMirr=meCircleKind!=OBJ_CIRC;
Point aTmpPt1;
Point aTmpPt2;
- if (bFreeMirr) { // bei freier Spiegelachse einige Vorbereitungen Treffen
+ if (bFreeMirr) { // some preparations for using an arbitrary axis of reflection
Point aCenter(aRect.Center());
long nWdt=aRect.GetWidth()-1;
long nHgt=aRect.GetHeight()-1;
long nMaxRad=((nWdt>nHgt ? nWdt : nHgt)+1) /2;
double a;
- // Startpunkt
+ // starting point
a=nStartWink*nPi180;
aTmpPt1=Point(Round(cos(a)*nMaxRad),-Round(sin(a)*nMaxRad));
if (nWdt==0) aTmpPt1.X()=0;
if (nHgt==0) aTmpPt1.Y()=0;
aTmpPt1+=aCenter;
- // Endpunkt
+ // finishing point
a=nEndWink*nPi180;
aTmpPt2=Point(Round(cos(a)*nMaxRad),-Round(sin(a)*nMaxRad));
if (nWdt==0) aTmpPt2.X()=0;
@@ -908,29 +907,29 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
}
}
SdrTextObj::NbcMirror(rRef1,rRef2);
- if (meCircleKind!=OBJ_CIRC) { // Anpassung von Start- und Endwinkel
+ if (meCircleKind!=OBJ_CIRC) { // adapt starting and finishing angle
MirrorPoint(aTmpPt1,rRef1,rRef2);
MirrorPoint(aTmpPt2,rRef1,rRef2);
- // Unrotate:
+ // unrotate:
if (aGeo.nDrehWink!=0) {
- RotatePoint(aTmpPt1,aRect.TopLeft(),-aGeo.nSin,aGeo.nCos); // -sin fuer Umkehrung
- RotatePoint(aTmpPt2,aRect.TopLeft(),-aGeo.nSin,aGeo.nCos); // -sin fuer Umkehrung
+ RotatePoint(aTmpPt1,aRect.TopLeft(),-aGeo.nSin,aGeo.nCos); // -sin for reversion
+ RotatePoint(aTmpPt2,aRect.TopLeft(),-aGeo.nSin,aGeo.nCos); // -sin for reversion
}
- // Unshear:
+ // unshear:
if (aGeo.nShearWink!=0) {
- ShearPoint(aTmpPt1,aRect.TopLeft(),-aGeo.nTan); // -tan fuer Umkehrung
- ShearPoint(aTmpPt2,aRect.TopLeft(),-aGeo.nTan); // -tan fuer Umkehrung
+ ShearPoint(aTmpPt1,aRect.TopLeft(),-aGeo.nTan); // -tan for reversion
+ ShearPoint(aTmpPt2,aRect.TopLeft(),-aGeo.nTan); // -tan for reversion
}
Point aCenter(aRect.Center());
aTmpPt1-=aCenter;
aTmpPt2-=aCenter;
- // Weil gespiegelt sind die Winkel nun auch noch vertauscht
+ // because it's mirrored, the angles are swapped, too
nStartWink=GetAngle(aTmpPt2);
nEndWink =GetAngle(aTmpPt1);
long nWinkDif=nEndWink-nStartWink;
nStartWink=NormAngle360(nStartWink);
nEndWink =NormAngle360(nEndWink);
- if (nWinkDif==36000) nEndWink+=nWinkDif; // Vollkreis
+ if (nWinkDif==36000) nEndWink+=nWinkDif; // full circle
}
SetXPolyDirty();
ImpSetCircInfoToAttr();
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 3d0fc70dad0c..1e47375d254c 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -43,7 +43,7 @@
#include <svx/svdtrans.hxx>
#include <svx/svdetc.hxx>
#include "svx/svdglob.hxx" // StringCache
-#include "svx/svdstr.hrc" // Objektname
+#include "svx/svdstr.hrc" // the object's name
#include <svl/style.hxx>
#include <svl/smplhint.hxx>
#include <editeng/eeitem.hxx>
@@ -77,7 +77,7 @@ void SdrObjConnection::ResetVars()
bool SdrObjConnection::TakeGluePoint(SdrGluePoint& rGP, bool bSetAbsPos) const
{
bool bRet = false;
- if (pObj!=NULL) { // Ein Obj muss schon angedockt sein!
+ if (pObj!=NULL) { // one object has to be docked already!
if (bAutoVertex) {
rGP=pObj->GetVertexGluePoint(nConId);
bRet = true;
@@ -450,12 +450,12 @@ SdrGluePoint SdrEdgeObj::GetCornerGluePoint(sal_uInt16 nNum) const
const SdrGluePointList* SdrEdgeObj::GetGluePointList() const
{
- return NULL; // Keine benutzerdefinierten Klebepunkte fuer Verbinder
+ return NULL; // no user defined glue points for connectors
}
SdrGluePointList* SdrEdgeObj::ForceGluePointList()
{
- return NULL; // Keine benutzerdefinierten Klebepunkte fuer Verbinder
+ return NULL; // no user defined glue points for connectors
}
bool SdrEdgeObj::IsEdge() const
@@ -552,7 +552,7 @@ void SdrEdgeObj::ImpRecalcEdgeTrack()
if(IsBoundRectCalculationRunning())
{
- // this object is involved into another ImpRecalcEdgeTrack() call
+ // This object is involved into another ImpRecalcEdgeTrack() call
// from another SdrEdgeObj. Do not calculate again to avoid loop.
// Also, do not change bEdgeTrackDirty so that it gets recalculated
// later at the first non-looping call.
@@ -561,7 +561,7 @@ void SdrEdgeObj::ImpRecalcEdgeTrack()
else if(GetModel() && GetModel()->isLocked())
{
// avoid re-layout during imports/API call sequences
- // #i45294# but calc EdgeTrack and secure properties there
+ // #i45294# but calculate EdgeTrack and secure properties there
((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_True;
*pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo);
ImpSetAttrToEdgeInfo();
@@ -570,14 +570,14 @@ void SdrEdgeObj::ImpRecalcEdgeTrack()
}
else
{
- // To not run in a depth loop, use a coloring algorythm on
+ // To not run in a depth loop, use a coloring algorithm on
// SdrEdgeObj BoundRect calculations
((SdrEdgeObj*)this)->mbBoundRectCalculationRunning = sal_True;
Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
SetRectsDirty();
*pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo);
- ImpSetEdgeInfoToAttr(); // Die Werte aus aEdgeInfo in den Pool kopieren
+ ImpSetEdgeInfoToAttr(); // copy values from aEdgeInfo into the pool
bEdgeTrackDirty=sal_False;
// Only redraw here, no object change
@@ -602,25 +602,25 @@ sal_uInt16 SdrEdgeObj::ImpCalcEscAngle(SdrObject* pObj, const Point& rPt) const
long dx=Min(dxl,dxr);
long dy=Min(dyo,dyu);
bool bDiag=Abs(dx-dy)<2;
- if (bxMitt && byMitt) return SDRESC_ALL; // In der Mitte
- if (bDiag) { // diagonal
+ if (bxMitt && byMitt) return SDRESC_ALL; // in the center
+ if (bDiag) { // diagonally
sal_uInt16 nRet=0;
if (byMitt) nRet|=SDRESC_VERT;
if (bxMitt) nRet|=SDRESC_HORZ;
- if (dxl<dxr) { // Links
+ if (dxl<dxr) { // left
if (dyo<dyu) nRet|=SDRESC_LEFT | SDRESC_TOP;
else nRet|=SDRESC_LEFT | SDRESC_BOTTOM;
- } else { // Rechts
+ } else { // right
if (dyo<dyu) nRet|=SDRESC_RIGHT | SDRESC_TOP;
else nRet|=SDRESC_RIGHT | SDRESC_BOTTOM;
}
return nRet;
}
- if (dx<dy) { // waagerecht
+ if (dx<dy) { // horizontal
if (bxMitt) return SDRESC_HORZ;
if (dxl<dxr) return SDRESC_LEFT;
else return SDRESC_RIGHT;
- } else { // senkrecht
+ } else { // vertical
if (byMitt) return SDRESC_VERT;
if (dyo<dyu) return SDRESC_TOP;
else return SDRESC_BOTTOM;
@@ -636,13 +636,13 @@ XPolygon SdrEdgeObj::ImpCalcObjToCenter(const Point& rStPt, long nEscAngle, cons
bool bLks=nEscAngle==18000;
bool bUnt=nEscAngle==27000;
- Point aP1(rStPt); // erstmal den Pflichtabstand
+ Point aP1(rStPt); // mandatory difference first,...
if (bLks) aP1.X()=rRect.Left();
if (bRts) aP1.X()=rRect.Right();
if (bObn) aP1.Y()=rRect.Top();
if (bUnt) aP1.Y()=rRect.Bottom();
- Point aP2(aP1); // Und nun den Pflichtabstand ggf. bis auf Meetinghoehe erweitern
+ Point aP2(aP1); // ...now increase to Meeting height, if necessary
if (bLks && rMeeting.X()<=aP2.X()) aP2.X()=rMeeting.X();
if (bRts && rMeeting.X()>=aP2.X()) aP2.X()=rMeeting.X();
if (bObn && rMeeting.Y()<=aP2.Y()) aP2.Y()=rMeeting.Y();
@@ -650,7 +650,7 @@ XPolygon SdrEdgeObj::ImpCalcObjToCenter(const Point& rStPt, long nEscAngle, cons
aXP.Insert(XPOLY_APPEND,aP2,XPOLY_NORMAL);
Point aP3(aP2);
- if ((bLks && rMeeting.X()>aP2.X()) || (bRts && rMeeting.X()<aP2.X())) { // Aussenrum
+ if ((bLks && rMeeting.X()>aP2.X()) || (bRts && rMeeting.X()<aP2.X())) { // around
if (rMeeting.Y()<aP2.Y()) {
aP3.Y()=rRect.Top();
if (rMeeting.Y()<aP3.Y()) aP3.Y()=rMeeting.Y();
@@ -664,7 +664,7 @@ XPolygon SdrEdgeObj::ImpCalcObjToCenter(const Point& rStPt, long nEscAngle, cons
aXP.Insert(XPOLY_APPEND,aP3,XPOLY_NORMAL);
}
}
- if ((bObn && rMeeting.Y()>aP2.Y()) || (bUnt && rMeeting.Y()<aP2.Y())) { // Aussenrum
+ if ((bObn && rMeeting.Y()>aP2.Y()) || (bUnt && rMeeting.Y()<aP2.Y())) { // around
if (rMeeting.X()<aP2.X()) {
aP3.X()=rRect.Left();
if (rMeeting.X()<aP3.X()) aP3.X()=rMeeting.X();
@@ -680,7 +680,7 @@ XPolygon SdrEdgeObj::ImpCalcObjToCenter(const Point& rStPt, long nEscAngle, cons
}
#ifdef DBG_UTIL
if (aXP.GetPointCount()>4) {
- OSL_FAIL("SdrEdgeObj::ImpCalcObjToCenter(): Polygon hat mehr als 4 Punkte!");
+ OSL_FAIL("SdrEdgeObj::ImpCalcObjToCenter(): Polygon has more than 4 points!");
}
#endif
return aXP;
@@ -695,7 +695,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
Rectangle aBoundRect2;
Rectangle aBewareRect1;
Rectangle aBewareRect2;
- // Erstmal die alten Endpunkte wiederholen
+ // first, get the old corner points
if (rTrack0.GetPointCount()!=0) {
aPt1=rTrack0[0];
sal_uInt16 nSiz=rTrack0.GetPointCount();
@@ -714,7 +714,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
if (bCon1) {
if (rCon1.pObj==(SdrObject*)this)
{
- // sicherheitshalber Abfragen
+ // check, just in case
aBoundRect1=aOutRect;
}
else
@@ -737,7 +737,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
aBewareRect1=aBoundRect1;
}
if (bCon2) {
- if (rCon2.pObj==(SdrObject*)this) { // sicherheitshalber Abfragen
+ if (rCon2.pObj==(SdrObject*)this) { // check, just in case
aBoundRect2=aOutRect;
}
else
@@ -893,12 +893,12 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
Point aC1(aBewareRect1.Center());
Point aC2(aBewareRect2.Center());
if (aBewareRect1.Left()<=aBewareRect2.Right() && aBewareRect1.Right()>=aBewareRect2.Left()) {
- // Ueberschneidung auf der X-Achse
+ // overlapping on the x axis
long n1=Max(aBewareRect1.Left(),aBewareRect2.Left());
long n2=Min(aBewareRect1.Right(),aBewareRect2.Right());
aMeeting.X()=(n1+n2+1)/2;
} else {
- // Ansonsten den Mittelpunkt des Freiraums
+ // otherwise the center point of the empty space
if (aC1.X()<aC2.X()) {
aMeeting.X()=(aBewareRect1.Right()+aBewareRect2.Left()+1)/2;
} else {
@@ -906,22 +906,22 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
}
}
if (aBewareRect1.Top()<=aBewareRect2.Bottom() && aBewareRect1.Bottom()>=aBewareRect2.Top()) {
- // Ueberschneidung auf der Y-Achse
+ // overlapping on the x axis
long n1=Max(aBewareRect1.Top(),aBewareRect2.Top());
long n2=Min(aBewareRect1.Bottom(),aBewareRect2.Bottom());
aMeeting.Y()=(n1+n2+1)/2;
} else {
- // Ansonsten den Mittelpunkt des Freiraums
+ // otherwise the center point of the empty space
if (aC1.Y()<aC2.Y()) {
aMeeting.Y()=(aBewareRect1.Bottom()+aBewareRect2.Top()+1)/2;
} else {
aMeeting.Y()=(aBewareRect1.Top()+aBewareRect2.Bottom()+1)/2;
}
}
- // Im Prinzip gibt es 3 zu unterscheidene Faelle:
- // 1. Beide in die selbe Richtung
- // 2. Beide in genau entgegengesetzte Richtungen
- // 3. Einer waagerecht und der andere senkrecht
+ // Here, there are three cases:
+ // 1. both go into the same direction
+ // 2. both go into opposite directions
+ // 3. one is vertical, the other is horizontal
long nXMin=Min(aBewareRect1.Left(),aBewareRect2.Left());
long nXMax=Max(aBewareRect1.Right(),aBewareRect2.Right());
long nYMin=Min(aBewareRect1.Top(),aBewareRect2.Top());
@@ -931,10 +931,10 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
unsigned nMainCase=3;
if (nAngle1==nAngle2) nMainCase=1;
else if ((bHor1 && bHor2) || (bVer1 && bVer2)) nMainCase=2;
- if (nMainCase==1) { // Fall 1: Beide in eine Richtung moeglich.
- if (bVer1) aMeeting.X()=(aPt1.X()+aPt2.X()+1)/2; // ist hier besser, als der
- if (bHor1) aMeeting.Y()=(aPt1.Y()+aPt2.Y()+1)/2; // Mittelpunkt des Freiraums
- // bX1Ok bedeutet, dass die Vertikale, die aus Obj1 austritt, keinen Konflikt mit Obj2 bildet, ...
+ if (nMainCase==1) { // case 1 (both go in one direction) is possible
+ if (bVer1) aMeeting.X()=(aPt1.X()+aPt2.X()+1)/2; // Here, this is better than
+ if (bHor1) aMeeting.Y()=(aPt1.Y()+aPt2.Y()+1)/2; // using center point of empty space
+ // bX1Ok means that the vertical exiting Obj1 doesn't conflict with Obj2, ...
bool bX1Ok=aPt1.X()<=aBewareRect2.Left() || aPt1.X()>=aBewareRect2.Right();
bool bX2Ok=aPt2.X()<=aBewareRect1.Left() || aPt2.X()>=aBewareRect1.Right();
bool bY1Ok=aPt1.Y()<=aBewareRect2.Top() || aPt1.Y()>=aBewareRect2.Bottom();
@@ -952,49 +952,69 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
aMeeting.Y()=nYMax;
}
} else if (nMainCase==2) {
- // Fall 2:
- if (bHor1) { // beide waagerecht
- /* 9 Moeglichkeiten: � � � */
- /* 2.1 Gegenueber, Ueberschneidung � � � */
- /* nur auf der Y-Achse � � � */
- /* 2.2, 2.3 Gegenueber, vertikal versetzt. � � � � � � */
- /* Ueberschneidung weder auf der � � � � � � */
- /* X- noch auf der Y-Achse � � � � � � */
- /* 2.4, 2.5 Untereinander, � � � � � � */
- /* Ueberschneidung � � � � � � */
- /* nur auf X-Achse � � � � � � */
- /* 2.6, 2.7 Gegeneinander, vertikal versetzt. � � � � � � */
- /* Ueberschneidung weder auf der � � � � � � */
- /* X- noch auf der Y-Achse. � � � � � � */
- /* 2.8 Gegeneinander. � � � */
- /* Ueberschneidung nur � � � */
- /* auf der Y-Achse. � � � */
- /* 2.9 Die BewareRects der Objekte ueberschneiden */
- /* sich auf X- und Y-Achse. */
- /* Die Faelle gelten entsprechend umgesetzt auch fuer */
- /* senkrechte Linienaustritte. */
- /* Die Faelle 2.1-2.7 werden mit dem Default-Meeting ausreichend*/
- /* gut behandelt. Spezielle MeetingPoints werden hier also nur */
- /* fuer 2.8 und 2.9 bestimmt. */
-
- // Normalisierung. aR1 soll der nach rechts und
- // aR2 der nach links austretende sein.
+ // case 2:
+ if (bHor1) { // both horizontal
+ /* 9 sub-cases:
+ (legend: line exits to the left (-|), right (|-))
+
+ 2.1: Facing; overlap only on y axis
+ * * *
+ |--| *
+ * * *
+
+ 2.2, 2.3: Facing, offset vertically; no overlap on either
+ axis
+ |- * * * * *
+ * -| * * -| *
+ * * * , * * *
+
+ 2.4, 2.5: One below the other; overlap only on y axis
+ * |- * * * *
+ * -| * * -| *
+ * * * , * |- *
+
+ 2.6, 2.7: Not facing, offset vertically; no overlap on either
+ axis
+ * * |- * * *
+ * -| * * -| *
+ * * * , * * |-
+
+ 2.8: Not facing; overlap only on y axis
+ * * *
+ * -| |-
+ * * *
+
+ 2.9: The objects's BewareRects overlap on x and y axis
+
+ These cases, with some modifications are also valid for
+ horizontal line exits.
+ Cases 2.1 through 2.7 are covered well enough with the
+ default meetings. Only for cases 2.8 and 2.9 do we determine
+ special meeting points here.
+ */
+
+ // normalization; be aR1 the one exiting to the right,
+ // be aR2 the one exiting to the left
Rectangle aBewR1(bRts1 ? aBewareRect1 : aBewareRect2);
Rectangle aBewR2(bRts1 ? aBewareRect2 : aBewareRect1);
Rectangle aBndR1(bRts1 ? aBoundRect1 : aBoundRect2);
Rectangle aBndR2(bRts1 ? aBoundRect2 : aBoundRect1);
if (aBewR1.Bottom()>aBewR2.Top() && aBewR1.Top()<aBewR2.Bottom()) {
- // Ueberschneidung auf der Y-Achse. Faelle 2.1, 2.8, 2.9
+ // overlap on y axis; cases 2.1, 2.8, 2.9
if (aBewR1.Right()>aBewR2.Left()) {
- // Faelle 2.8, 2.9
- // Fall 2.8 ist immer Aussenrumlauf (bDirect=sal_False).
- // Fall 2.9 kann auch Direktverbindung sein (bei geringer
- // Ueberschneidung der BewareRects ohne Ueberschneidung der
- // Boundrects wenn die Linienaustritte sonst das BewareRect
- // des jeweils anderen Objekts verletzen wuerden.
+ /* Cases 2.8, 2.9:
+ Case 2.8: always going around on the outside
+ (bDirect=sal_False).
+
+ Case 2.9 could also be a direct connection (in the
+ case that the BewareRects overlap only slightly and
+ the BoundRects don't overlap at all and if the
+ line exits would otherwise violate the respective
+ other object's BewareRect).
+ */
bool bCase29Direct = false;
bool bCase29=aBewR1.Right()>aBewR2.Left();
- if (aBndR1.Right()<=aBndR2.Left()) { // Fall 2.9 und keine Boundrectueberschneidung
+ if (aBndR1.Right()<=aBndR2.Left()) { // case 2.9 without BoundRect overlap
if ((aPt1.Y()>aBewareRect2.Top() && aPt1.Y()<aBewareRect2.Bottom()) ||
(aPt2.Y()>aBewareRect1.Top() && aPt2.Y()<aBewareRect1.Bottom())) {
bCase29Direct = true;
@@ -1008,8 +1028,8 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
aMeeting.Y()=nYMax;
}
if (bCase29) {
- // und nun noch dafuer sorgen, dass das
- // umzingelte Obj nicht durchquert wird
+ // now make sure that the surrounded object
+ // isn't traversed
if ((aBewR1.Center().Y()<aBewR2.Center().Y()) != bObenLang) {
aMeeting.X()=aBewR2.Right();
} else {
@@ -1017,42 +1037,45 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
}
}
} else {
- // Direkte Verbindung (3-Linien Z-Verbindung), da
- // Verletzung der BewareRects unvermeidlich ist.
- // Via Dreisatz werden die BewareRects nun verkleinert.
- long nWant1=aBewR1.Right()-aBndR1.Right(); // Abstand bei Obj1
- long nWant2=aBndR2.Left()-aBewR2.Left(); // Abstand bei Obj2
- long nSpace=aBndR2.Left()-aBndR1.Right(); // verfuegbarer Platz
+ // We need a direct connection (3-line Z connection),
+ // because we have to violate the BewareRects.
+ // Use rule of three to scale down the BewareRects.
+ long nWant1=aBewR1.Right()-aBndR1.Right(); // distance at Obj1
+ long nWant2=aBndR2.Left()-aBewR2.Left(); // distance at Obj2
+ long nSpace=aBndR2.Left()-aBndR1.Right(); // available space
long nGet1=BigMulDiv(nWant1,nSpace,nWant1+nWant2);
long nGet2=nSpace-nGet1;
- if (bRts1) { // Normalisierung zurueckwandeln
+ if (bRts1) { // revert normalization
aBewareRect1.Right()+=nGet1-nWant1;
aBewareRect2.Left()-=nGet2-nWant2;
} else {
aBewareRect2.Right()+=nGet1-nWant1;
aBewareRect1.Left()-=nGet2-nWant2;
}
- nIntersections++; // Qualitaet herabsetzen
+ nIntersections++; // lower quality
}
}
}
- } else if (bVer1) { // beide senkrecht
+ } else if (bVer1) { // both horizontal
Rectangle aBewR1(bUnt1 ? aBewareRect1 : aBewareRect2);
Rectangle aBewR2(bUnt1 ? aBewareRect2 : aBewareRect1);
Rectangle aBndR1(bUnt1 ? aBoundRect1 : aBoundRect2);
Rectangle aBndR2(bUnt1 ? aBoundRect2 : aBoundRect1);
if (aBewR1.Right()>aBewR2.Left() && aBewR1.Left()<aBewR2.Right()) {
- // Ueberschneidung auf der Y-Achse. Faelle 2.1, 2.8, 2.9
+ // overlap on y axis; cases 2.1, 2.8, 2.9
if (aBewR1.Bottom()>aBewR2.Top()) {
- // Faelle 2.8, 2.9
- // Fall 2.8 ist immer Aussenrumlauf (bDirect=sal_False).
- // Fall 2.9 kann auch Direktverbindung sein (bei geringer
- // Ueberschneidung der BewareRects ohne Ueberschneidung der
- // Boundrects wenn die Linienaustritte sonst das BewareRect
- // des jeweils anderen Objekts verletzen wuerden.
+ /* Cases 2.8, 2.9
+ Case 2.8 always going around on the outside (bDirect=sal_False).
+
+ Case 2.9 could also be a direct connection (in the
+ case that the BewareRects overlap only slightly and
+ the BoundRects don't overlap at all and if the
+ line exits would otherwise violate the respective
+ other object's BewareRect).
+ */
bool bCase29Direct = false;
bool bCase29=aBewR1.Bottom()>aBewR2.Top();
- if (aBndR1.Bottom()<=aBndR2.Top()) { // Fall 2.9 und keine Boundrectueberschneidung
+ if (aBndR1.Bottom()<=aBndR2.Top()) { // case 2.9 without BoundRect overlap
if ((aPt1.X()>aBewareRect2.Left() && aPt1.X()<aBewareRect2.Right()) ||
(aPt2.X()>aBewareRect1.Left() && aPt2.X()<aBewareRect1.Right())) {
bCase29Direct = true;
@@ -1066,8 +1089,8 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
aMeeting.X()=nXMax;
}
if (bCase29) {
- // und nun noch dafuer sorgen, dass das
- // umzingelte Obj nicht durchquert wird
+ // now make sure that the surrounded object
+ // isn't traversed
if ((aBewR1.Center().X()<aBewR2.Center().X()) != bLinksLang) {
aMeeting.Y()=aBewR2.Bottom();
} else {
@@ -1075,66 +1098,80 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
}
}
} else {
- // Direkte Verbindung (3-Linien Z-Verbindung), da
- // Verletzung der BewareRects unvermeidlich ist.
- // Via Dreisatz werden die BewareRects nun verkleinert.
- long nWant1=aBewR1.Bottom()-aBndR1.Bottom(); // Abstand bei Obj1
- long nWant2=aBndR2.Top()-aBewR2.Top(); // Abstand bei Obj2
- long nSpace=aBndR2.Top()-aBndR1.Bottom(); // verfuegbarer Platz
+ // We need a direct connection (3-line Z connection),
+ // because we have to violate the BewareRects.
+ // Use rule of three to scale down the BewareRects.
+ long nWant1=aBewR1.Bottom()-aBndR1.Bottom(); // difference at Obj1
+ long nWant2=aBndR2.Top()-aBewR2.Top(); // difference at Obj2
+ long nSpace=aBndR2.Top()-aBndR1.Bottom(); // available space
long nGet1=BigMulDiv(nWant1,nSpace,nWant1+nWant2);
long nGet2=nSpace-nGet1;
- if (bUnt1) { // Normalisierung zurueckwandeln
+ if (bUnt1) { // revert normalization
aBewareRect1.Bottom()+=nGet1-nWant1;
aBewareRect2.Top()-=nGet2-nWant2;
} else {
aBewareRect2.Bottom()+=nGet1-nWant1;
aBewareRect1.Top()-=nGet2-nWant2;
}
- nIntersections++; // Qualitaet herabsetzen
+ nIntersections++; // lower quality
}
}
}
}
- } else if (nMainCase==3) { // Fall 3: Einer waagerecht und der andere senkrecht. Sehr viele Fallunterscheidungen
- /* Kleine Legende: � � � � � -> Ohne Ueberschneidung, maximal Beruehrung. */
- /* � � � � � -> Ueberschneidung */
- /* � � � � � -> Selbe Hoehe */
- /* � � � � � -> Ueberschneidung */
- /* � � � � � -> Ohne Ueberschneidung, maximal Beruehrung. */
- /* Linienaustritte links �, rechts �, oben � und unten �. */
- /* Insgesamt sind 96 Konstellationen moeglich, wobei einige nicht einmal */
- /* eindeutig einem Fall und damit einer Behandlungsmethode zugeordnet werden */
- /* koennen. */
- /* 3.1: Hierzu moegen alle Konstellationen zaehlen, die durch den */
- /* Default-MeetingPoint zufriedenstellend abgedeckt sind (20+12). */
- /* � � � � � � � � � � Diese 12 � � � � � � � � � � � � � � � � � � � � */
- /* � � � � � � � � � � Konstel. � � � � � � � � � � � � � � � � � � � � */
- /* � � � � � � � � � � jedoch � � � � � � � � � � � � � � � � � � � � */
- /* � � � � � � � � � � nur zum � � � � � � � � � � � � � � � � � � � � */
- /* � � � � � � � � � � Teil: � � � � � � � � � � � � � � � � � � � � */
- /* Letztere 16 Faelle scheiden aus, sobald sich die Objekte offen */
- /* gegenueberstehen (siehe Fall 3.2). */
- /* 3.2: Die Objekte stehen sich offen gegenueber und somit ist eine */
- /* Verbindung mit lediglich 2 Linien moeglich (4+20). */
- /* Dieser Fall hat 1. Prioritaet. */
- /* � � � � � � � � � � Diese 20 � � � � � � � � � � � � � � � � � � � � */
- /* � � � � � � � � � � Konstel. � � � � � � � � � � � � � � � � � � � � */
- /* � � � � � � � � � � jedoch � � � � � � � � � � � � � � � � � � � � */
- /* � � � � � � � � � � nur zum � � � � � � � � � � � � � � � � � � � � */
- /* � � � � � � � � � � Teil: � � � � � � � � � � � � � � � � � � � � */
- /* 3.3: Die Linienaustritte zeigen vom anderen Objekt weg bzw. hinter */
- /* dessen Ruecken vorbei (52+4). */
- /* � � � � � � � � � � � � � � � � � � � � Diese 4 � � � � � � � � � � */
- /* � � � � � � � � � � � � � � � � � � � � Konstel. � � � � � � � � � � */
- /* � � � � � � � � � � � � � � � � � � � � jedoch � � � � � � � � � � */
- /* � � � � � � � � � � � � � � � � � � � � nur zum � � � � � � � � � � */
- /* � � � � � � � � � � � � � � � � � � � � Teil: � � � � � � � � � � */
-
- // Fall 3.2
+ } else if (nMainCase==3) { // case 3: one horizontal, the other vertical
+ /* legend:
+ The line exits to the:
+ -| left
+
+ |- right
+
+ _|_ top
+
+ T bottom
+
+ * . * . * -- no overlap, at most might touch
+ . . . . . -- overlap
+ * . |- . * -- same height
+ . . . . . -- overlap
+ * . * . * -- no overlap, at most might touch
+
+ Overall, there are 96 possible constellations, some of these can't even
+ be unambiguously assigned to a certain case/method of handling.
+
+
+ 3.1: All those constellations that are covered reasonably well
+ by the default MeetingPoint (20+12).
+
+ T T T . _|_ _|_ . T T T these 12 * . * T * * . * . * * T * . * * . * . *
+ . . . . _|_ _|_ . . . . constellations . . . . . . . . . T . . . . . T . . . .
+ * . |- . * * . -| . * are covered * . |- . _|_ * . |- . T _|_ . -| . * T . -| . *
+ . . . . T T . . . . only in . . . . _|_ . . . . . _|_ . . . . . . . . .
+ _|__|__|_ . T T . _|__|__|_ part: * . * _|_ * * . * . * * _|_ * . * * . * . *
+
+ The last 16 of these cases can be excluded, if the objects face each other openly.
+
+
+ 3.2: The objects face each other openly, thus a connection using only two lines is possible (4+20);
+ This case is priority #1.
+ * . * . T T . * . * these 20 * . * T * * T * . * * . * . * * . * . *
+ . . . . . . . . . . constellations . . . T T T T . . . . . . . . . . . . .
+ * . |- . * * . -| . * are covered * . |-_|__|_ _|__|_-| . * * . |- T T T T -| . *
+ . . . . . . . . . . only in . . . _|__|_ _|__|_ . . . . . . . . . . . . .
+ * . * . _|_ _|_ . * . * part: * . * _|_ * * _|_ * . * * . * . * * . * . *
+
+ 3.3: The line exits point away from the other object or or miss its back (52+4).
+ _|__|__|__|_ * * _|__|__|__|_ * . . . * * . * . * these 4 * . * . * * . * . *
+ _|__|__|__|_ . . _|__|__|__|_ T T T . . . . T T T constellations . . . T . . T . . .
+ _|__|_ |- . * * . -| _|__|_ T T |- . * * . -| T T are covered * . |- . * * . -| . *
+ _|__|__|_ . . . . _|__|__|_ T T T T . . T T T T only in . . . _|_ . . _|_ . . .
+ * . * . * * . * . * T T T T * * T T T T part: * . * . * * . * . *
+ */
+
+ // case 3.2
Rectangle aTmpR1(aBewareRect1);
Rectangle aTmpR2(aBewareRect2);
if (bBewareOverlap) {
- // Ueberschneidung der BewareRects: BoundRects fuer Check auf Fall 3.2 verwenden.
+ // overlapping BewareRects: use BoundRects for checking for case 3.2
aTmpR1=aBoundRect1;
aTmpR2=aBoundRect2;
}
@@ -1142,7 +1179,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
((bUnt2 && aTmpR2.Bottom()<=aPt1.Y()) || (bObn2 && aTmpR2.Top ()>=aPt1.Y()))) ||
(((bRts2 && aTmpR2.Right ()<=aPt1.X()) || (bLks2 && aTmpR2.Left()>=aPt1.X())) &&
((bUnt1 && aTmpR1.Bottom()<=aPt2.Y()) || (bObn1 && aTmpR1.Top ()>=aPt2.Y())))) {
- // Fall 3.2 trifft zu: Verbindung mit lediglich 2 Linien
+ // case 3.2 applies: connector with only 2 lines
if (bHor1) {
aMeeting.X()=aPt2.X();
aMeeting.Y()=aPt1.Y();
@@ -1150,7 +1187,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
aMeeting.X()=aPt1.X();
aMeeting.Y()=aPt2.Y();
}
- // Falls Ueberschneidung der BewareRects:
+ // in the case of overlapping BewareRects:
aBewareRect1=aTmpR1;
aBewareRect2=aTmpR2;
} else if ((((bRts1 && aBewareRect1.Right ()>aBewareRect2.Left ()) ||
@@ -1161,7 +1198,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
(bLks2 && aBewareRect2.Left ()<aBewareRect1.Right ())) &&
((bUnt1 && aBewareRect1.Bottom()>aBewareRect2.Top ()) ||
(bObn1 && aBewareRect1.Top ()<aBewareRect2.Bottom())))) {
- // Fall 3.3
+ // case 3.3
if (bRts1 || bRts2) { aMeeting.X()=nXMax; }
if (bLks1 || bLks2) { aMeeting.X()=nXMin; }
if (bUnt1 || bUnt2) { aMeeting.Y()=nYMax; }
@@ -1181,18 +1218,18 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
Point aEP1(aXP1[nXP1Anz-1]);
Point aEP2(aXP2[nXP2Anz-1]);
bool bInsMeetingPoint=aEP1.X()!=aEP2.X() && aEP1.Y()!=aEP2.Y();
- bool bHorzE1=aEP1.Y()==aXP1[nXP1Anz-2].Y(); // letzte Linie von XP1 horizontal?
- bool bHorzE2=aEP2.Y()==aXP2[nXP2Anz-2].Y(); // letzte Linie von XP2 horizontal?
+ bool bHorzE1=aEP1.Y()==aXP1[nXP1Anz-2].Y(); // is last line of XP1 horizontal?
+ bool bHorzE2=aEP2.Y()==aXP2[nXP2Anz-2].Y(); // is last line of XP2 horizontal?
if (aEP1==aEP2 && ((bHorzE1 && bHorzE2 && aEP1.Y()==aEP2.Y()) || (!bHorzE1 && !bHorzE2 && aEP1.X()==aEP2.X()))) {
- // Sonderbehandlung fuer 'I'-Verbinder
+ // special casing 'I' connectors
nXP1Anz--; aXP1.Remove(nXP1Anz,1);
nXP2Anz--; aXP2.Remove(nXP2Anz,1);
}
if (bInsMeetingPoint) {
aXP1.Insert(XPOLY_APPEND,aMeeting,XPOLY_NORMAL);
if (bInfo) {
- // Durch einfuegen des MeetingPoints kommen 2 weitere Linie hinzu.
- // Evtl. wird eine von diesen die Mittellinie.
+ // Inserting a MeetingPoint adds 2 new lines,
+ // either might become the center line.
if (pInfo->nObj1Lines==pInfo->nObj2Lines) {
pInfo->nObj1Lines++;
pInfo->nObj2Lines++;
@@ -1207,8 +1244,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
}
}
} else if (bInfo && aEP1!=aEP2 && nXP1Anz+nXP2Anz>=4) {
- // Durch Verbinden der beiden Enden kommt eine weitere Linie hinzu.
- // Dies wird die Mittellinie.
+ // By connecting both ends, another line is added, this becomes the center line.
pInfo->nMiddleLine=nXP1Anz-1;
}
sal_uInt16 nNum=aXP2.GetPointCount();
@@ -1223,27 +1259,27 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
cForm='?';
if (nPntAnz==2) cForm='I';
else if (nPntAnz==3) cForm='L';
- else if (nPntAnz==4) { // Z oder U
+ else if (nPntAnz==4) { // Z or U
if (nAngle1==nAngle2) cForm='U';
else cForm='Z';
- } else if (nPntAnz==6) { // S oder C oder ...
+ } else if (nPntAnz==6) { // S or C or ...
if (nAngle1!=nAngle2) {
- // Fuer Typ S hat Linie2 dieselbe Richtung wie Linie4.
- // Bei Typ C sind die beiden genau entgegengesetzt.
+ // For type S, line 2 has the same direction as line 4.
+ // For type C, the opposite is true.
Point aP1(aXP1[1]);
Point aP2(aXP1[2]);
Point aP3(aXP1[3]);
Point aP4(aXP1[4]);
- if (aP1.Y()==aP2.Y()) { // beide Linien Horz
+ if (aP1.Y()==aP2.Y()) { // else both lines are horizontal
if ((aP1.X()<aP2.X())==(aP3.X()<aP4.X())) cForm='S';
else cForm='C';
- } else { // sonst beide Linien Vert
+ } else { // else both lines are vertical
if ((aP1.Y()<aP2.Y())==(aP3.Y()<aP4.Y())) cForm='S';
else cForm='C';
}
- } else cForm='4'; // sonst der 3. Fall mit 5 Linien
+ } else cForm='4'; // else is case 3 with 5 lines
} else cForm='?'; //
- // Weitere Formen:
+ // more shapes:
if (bInfo) {
pInfo->cOrthoForm=cForm;
if (cForm=='I' || cForm=='L' || cForm=='Z' || cForm=='U') {
@@ -1263,7 +1299,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
}
if (pnQuality!=NULL) {
sal_uIntPtr nQual=0;
- sal_uIntPtr nQual0=nQual; // Ueberlaeufe vorbeugen
+ sal_uIntPtr nQual0=nQual; // prevent overruns
bool bOverflow = false;
Point aPt0(aXP1[0]);
for (sal_uInt16 nPntNum=1; nPntNum<nPntAnz; nPntNum++) {
@@ -1276,18 +1312,18 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
sal_uInt16 nTmp=nPntAnz;
if (cForm=='Z') {
- nTmp=2; // Z-Form hat gute Qualitaet (nTmp=2 statt 4)
+ nTmp=2; // Z shape with good quality (nTmp=2 instead of 4)
sal_uIntPtr n1=Abs(aXP1[1].X()-aXP1[0].X())+Abs(aXP1[1].Y()-aXP1[0].Y());
sal_uIntPtr n2=Abs(aXP1[2].X()-aXP1[1].X())+Abs(aXP1[2].Y()-aXP1[1].Y());
sal_uIntPtr n3=Abs(aXP1[3].X()-aXP1[2].X())+Abs(aXP1[3].Y()-aXP1[2].Y());
- // fuer moeglichst gleichlange Linien sorgen
+ // try to make lines lengths similar
sal_uIntPtr nBesser=0;
n1+=n3;
n3=n2/4;
if (n1>=n2) nBesser=6;
else if (n1>=3*n3) nBesser=4;
else if (n1>=2*n3) nBesser=2;
- if (aXP1[0].Y()!=aXP1[1].Y()) nBesser++; // Senkrechte Startlinie kriegt auch noch einen Pluspunkt (fuer H/V-Prio)
+ if (aXP1[0].Y()!=aXP1[1].Y()) nBesser++; // vertical starting line gets a plus (for H/V-Prio)
if (nQual>nBesser) nQual-=nBesser; else nQual=0;
}
if (nTmp>=3) {
@@ -1295,20 +1331,20 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
nQual+=(sal_uIntPtr)nTmp*0x01000000;
if (nQual<nQual0 || nTmp>15) bOverflow = true;
}
- if (nPntAnz>=2) { // Austrittswinkel nochmal pruefen
+ if (nPntAnz>=2) { // check exit angle again
Point aP1(aXP1[1]); aP1-=aXP1[0];
Point aP2(aXP1[nPntAnz-2]); aP2-=aXP1[nPntAnz-1];
long nAng1=0; if (aP1.X()<0) nAng1=18000; if (aP1.Y()>0) nAng1=27000;
- if (aP1.Y()<0) nAng1=9000; if (aP1.X()!=0 && aP1.Y()!=0) nAng1=1; // Schraeg!?!
+ if (aP1.Y()<0) nAng1=9000; if (aP1.X()!=0 && aP1.Y()!=0) nAng1=1; // slant?!
long nAng2=0; if (aP2.X()<0) nAng2=18000; if (aP2.Y()>0) nAng2=27000;
- if (aP2.Y()<0) nAng2=9000; if (aP2.X()!=0 && aP2.Y()!=0) nAng2=1; // Schraeg!?!
+ if (aP2.Y()<0) nAng2=9000; if (aP2.X()!=0 && aP2.Y()!=0) nAng2=1; // slant?!
if (nAng1!=nAngle1) nIntersections++;
if (nAng2!=nAngle2) nIntersections++;
}
- // Fuer den Qualitaetscheck wieder die Original-Rects verwenden und
- // gleichzeitig checken, ob eins fuer die Edge-Berechnung verkleinert
- // wurde (z.B. Fall 2.9)
+ // For the quality check, use the original Rects and at the same time
+ // check whether one them was scaled down for the calculation of the
+ // Edges (e. g. case 2.9)
aBewareRect1=rBewareRect1;
aBewareRect2=rBewareRect2;
@@ -1325,16 +1361,16 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
if (b1) nIntersections++;
if (b2) nIntersections++;
}
- // und nun noch auf Ueberschneidungen checken
+ // check for overlaps
if (i>0 && nInt0==nIntersections) {
- if (aPt0.Y()==aPt1b.Y()) { // Horizontale Linie
+ if (aPt0.Y()==aPt1b.Y()) { // horizontal line
if (aPt0.Y()>aBewareRect1.Top() && aPt0.Y()<aBewareRect1.Bottom() &&
((aPt0.X()<=aBewareRect1.Left() && aPt1b.X()>=aBewareRect1.Right()) ||
(aPt1b.X()<=aBewareRect1.Left() && aPt0.X()>=aBewareRect1.Right()))) nIntersections++;
if (aPt0.Y()>aBewareRect2.Top() && aPt0.Y()<aBewareRect2.Bottom() &&
((aPt0.X()<=aBewareRect2.Left() && aPt1b.X()>=aBewareRect2.Right()) ||
(aPt1b.X()<=aBewareRect2.Left() && aPt0.X()>=aBewareRect2.Right()))) nIntersections++;
- } else { // Vertikale Linie
+ } else { // vertical line
if (aPt0.X()>aBewareRect1.Left() && aPt0.X()<aBewareRect1.Right() &&
((aPt0.Y()<=aBewareRect1.Top() && aPt1b.Y()>=aBewareRect1.Bottom()) ||
(aPt1b.Y()<=aBewareRect1.Top() && aPt0.Y()>=aBewareRect1.Bottom()))) nIntersections++;
@@ -1353,7 +1389,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
if (bOverflow || nQual==0xFFFFFFFF) nQual=0xFFFFFFFE;
*pnQuality=nQual;
}
- if (bInfo) { // nun die Linienversaetze auf aXP1 anwenden
+ if (bInfo) { // now apply line offsets to aXP1
if (pInfo->nMiddleLine!=0xFFFF) {
sal_uInt16 nIdx=pInfo->ImpGetPolyIdx(MIDDLELINE,aXP1);
if (pInfo->ImpIsHorzLine(MIDDLELINE,aXP1)) {
@@ -1405,7 +1441,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
}
}
}
- // Nun mache ich ggf. aus dem Verbinder eine Bezierkurve
+ // make the connector a bezier curve, if appropriate
if (eKind==SDREDGE_BEZIER && nPntAnz>2) {
Point* pPt1=&aXP1[0];
Point* pPt2=&aXP1[1];
@@ -1428,20 +1464,18 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
pPt2->Y()-=dy1/3;
pPt3->X()-=dx2/3;
pPt3->Y()-=dy2/3;
- } else if (nPntAnz>=4 && nPntAnz<=6) { // Z oder U oder ...
- // fuer Alle Anderen werden die Endpunkte der Ausgangslinien
- // erstmal zu Kontrollpunkten. Bei nPntAnz>4 ist also noch
- // Nacharbeit erforderlich!
+ } else if (nPntAnz>=4 && nPntAnz<=6) { // Z or U or ...
+ // To all others, the end points of the original lines become control
+ // points for now. Thus, we need to do some more work for nPntAnz>4!
aXP1.SetFlags(1,XPOLY_CONTROL);
aXP1.SetFlags(nPntAnz-2,XPOLY_CONTROL);
- // Distanz x1.5
+ // distance x1.5
pPt2->X()+=dx1/2;
pPt2->Y()+=dy1/2;
pPt3->X()+=dx2/2;
pPt3->Y()+=dy2/2;
if (nPntAnz==5) {
- // Vor und hinter dem Mittelpunkt jeweils
- // noch einen Kontrollpunkt einfuegen
+ // add a control point before and after center
Point aCenter(aXP1[2]);
long dx1b=aCenter.X()-aXP1[1].X();
long dy1b=aCenter.Y()-aXP1[1].Y();
@@ -1469,7 +1503,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
aXP1.SetFlags(3,XPOLY_SYMMTR);
//aXP1[4].X()+=dx/2;
//aXP1[4].Y()+=dy/2;
- aXP1.Remove(4,1); // weil identisch mit aXP1[3]
+ aXP1.Remove(4,1); // because it's identical with aXP1[3]
}
}
}
@@ -1477,37 +1511,48 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const Rec
}
/*
-Nach einer einfachen Rechnung koennte es max. 64 unterschiedliche Verlaeufe mit
-5 Linien, 32 mit 4 Linien, 16 mit 3, 8 mit 2 Linien und 4 mit 1 Linie geben=124.
-Normalisiert auf 1. Austrittswinkel nach rechts bleiben dann noch 31.
-Dann noch eine vertikale Spiegelung wegnormalisiert bleiben noch 16
-characteristische Verlaufszuege mit 1-5 Linien:
-Mit 1 Linie (Typ 'I'): --
-Mit 2 Linien (Typ 'L'): -�
-Mit 3 Linien (Typ 'U'): -� (Typ 'Z'): �-
- -� -�
-Mit 4 Linien: 1 ist nicht plausibel, 3 ist=2 (90deg Drehung). Verbleibt 2,4
- �-� ڿ � ڿ ڿ �-�
- -� -� -� -� -� -�
-Mit 5 Linien: nicht plausibel sind 1,2,4,5. 7 ist identisch mit 3 (Richtungsumkehr)
- Bleibt also 3,6 und 8. '4' 'S' 'C'
- � � -� �- �-� �-
- �-� �-� �-� �-� � � -� � �-� �-� � �-�
- -� -� -� � -� �- -� -� --� � � -� � -� � �
-Insgesamt sind also 9 Grundtypen zu unterscheiden die den 400 Konstellationen
-aus Objektposition und Austrittswinkeln zuzuordnen sind.
-4 der 9 Grundtypen haben eine 'Mittellinie'. Die Anzahl der zu Objektabstaende
-je Objekt variiert von 0-3:
- Mi O1 O2 Anmerkung
-'I': n 0 0
-'L': n 0 0
-'U': n 0-1 0-1
-'Z': j 0 0
-4.1: j 0 1 = U+1 bzw. 1+U
-4.2: n 0-2 0-2 = Z+1
-'4': j 0 2 = Z+2
-'S': j 1 1 = 1+Z+1
-'C': n 0-3 0-3 = 1+U+1
+There could be a maximum of 64 different developments with with 5 lines, a
+maximum of 32 developments with 4 lines, a maximum of 16 developments with
+3 lines, a maximum of 8 developments with 2 lines.
+This gives us a total of 124 possibilities.
+Normalized for the 1st exit angle to the right, there remain 31 possibilities.
+Now, normalizing away the vertical mirroring, we get to a total of 16
+characteristic developments with 1 through 5 lines:
+
+1 line (type "I") --
+
+2 lines (type "L") __|
+
+3 lines (type "U") __ (type "Z") _
+ __| _|
+ _ _
+4 lines #1 _| #2 | | #3 |_ #4 | |
+ _| _| _| _|
+ Of these, #1 is implausible, #2 is a rotated version of #3. This leaves
+ #2 (from now on referred to as 4.1) and #4 (from now on referred to as 4.2).
+ _ _
+5 lines #1 _| #2 _| #3 ___ #4 _
+ _| _| _| _| _| |_
+ _ _ _
+ #5 |_ #6 |_ #7 _| | #8 ____
+ _| _| _| |_ _|
+ Of these, 5.1, 5.2, 5.4 and 5.5 are implausible, 5.7 is a reversed version
+ of 5.3. This leaves 5.3 (type "4"), 5.6 (type "S") and 5.8 (type "C").
+
+We now have discerned the 9 basic types to cover all 400 possible constellations
+of object positions and exit angles. 4 of the 9 types have got a center
+line (CL). The number of object margins per object varies between 0 and 3:
+
+ CL O1 O2 Note
+"I": n 0 0
+"L": n 0 0
+"U": n 0-1 0-1
+"Z": y 0 0
+4.2: y 0 1 = U+1, respectively 1+U
+4.4: n 0-2 0-2 = Z+1
+"4": y 0 2 = Z+2
+"S": y 1 1 = 1+Z+1
+"C": n 0-3 0-3 = 1+U+1
*/
void SdrEdgeObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
@@ -1519,33 +1564,33 @@ void SdrEdgeObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
bool bObj1=aCon1.pObj!=NULL && aCon1.pObj->GetBroadcaster()==&rBC;
bool bObj2=aCon2.pObj!=NULL && aCon2.pObj->GetBroadcaster()==&rBC;
if (bDying && (bObj1 || bObj2)) {
- // Dying vorher abfangen, damit AttrObj nicht
- // wg. vermeintlicher Vorlagenaenderung rumbroadcastet
+ // catch Dying, so AttrObj doesn't start broadcasting
+ // about an alleged change of template
if (bObj1) aCon1.pObj=NULL;
if (bObj2) aCon2.pObj=NULL;
- return; // Und mehr braucht hier nicht getan werden.
+ return;
}
if ( bObj1 || bObj2 )
{
bEdgeTrackUserDefined = sal_False;
}
SdrTextObj::Notify(rBC,rHint);
- if (nNotifyingCount==0) { // Hier nun auch ein VerriegelungsFlag
+ if (nNotifyingCount==0) { // a locking flag
((SdrEdgeObj*)this)->nNotifyingCount++;
SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
- if (bDataChg) { // StyleSheet geaendert
- ImpSetAttrToEdgeInfo(); // Werte bei Vorlagenaenderung vom Pool nach aEdgeInfo kopieren
+ if (bDataChg) { // StyleSheet changed
+ ImpSetAttrToEdgeInfo(); // when changing templates, copy values from Pool to aEdgeInfo
}
if (bDataChg ||
(bObj1 && aCon1.pObj->GetPage()==pPage) ||
(bObj2 && aCon2.pObj->GetPage()==pPage) ||
(pSdrHint && pSdrHint->GetKind()==HINT_OBJREMOVED))
{
- // Broadcasting nur, wenn auf der selben Page
+ // broadcasting only, if on the same page
Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
ImpDirtyEdgeTrack();
- // only redraw here, no objectchange
+ // only redraw here, object hasn't actually changed
ActionChanged();
SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
@@ -1555,7 +1600,7 @@ void SdrEdgeObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
}
/** updates edges that are connected to the edges of this object
- as if the connected objects send a repaint broadcast
+ as if the connected objects sent a repaint broadcast
*/
void SdrEdgeObj::Reformat()
{
@@ -1641,7 +1686,7 @@ void SdrEdgeObj::SetEdgeTrackPath( const basegfx::B2DPolyPolygon& rPoly )
bEdgeTrackDirty = sal_False;
bEdgeTrackUserDefined = sal_True;
- // #i110629# also set aRect and maSnapeRect dependent from pEdgeTrack
+ // #i110629# also set aRect and maSnapeRect depending on pEdgeTrack
const Rectangle aPolygonBounds(pEdgeTrack->GetBoundRect());
aRect = aPolygonBounds;
maSnapRect = aPolygonBounds;
@@ -1868,7 +1913,7 @@ bool SdrEdgeObj::applySpecialDrag(SdrDragStat& rDragStat)
aEdgeInfo.ImpSetLineVersatz(eLineCode, *pEdgeTrack, nDist);
}
- // force recalc EdgeTrack
+ // force recalculation of EdgeTrack
*pEdgeTrack = ImpCalcEdgeTrack(*pEdgeTrack, aCon1, aCon2, &aEdgeInfo);
bEdgeTrackDirty=sal_False;
@@ -2007,7 +2052,7 @@ bool SdrEdgeObj::EndCreate(SdrDragStat& rDragStat, SdrCreateCmd eCmd)
if (rDragStat.GetView()!=NULL) {
rDragStat.GetView()->HideConnectMarker();
}
- ImpSetEdgeInfoToAttr(); // Die Werte aus aEdgeInfo in den Pool kopieren
+ ImpSetEdgeInfoToAttr(); // copy values from aEdgeInfo into the pool
}
SetRectsDirty();
return bOk;
@@ -2047,7 +2092,7 @@ bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrO
if (pOut==NULL) return sal_False;
SdrObjList* pOL=rPV.GetObjList();
const SetOfByte& rVisLayer=rPV.GetVisibleLayers();
- // Sensitiver Bereich der Konnektoren ist doppelt so gross wie die Handles:
+ // sensitive area of connectors is twice as large as the one of the handles
sal_uInt16 nMarkHdSiz=rPV.GetView().GetMarkHdlSizePixel();
Size aHalfConSiz(nMarkHdSiz,nMarkHdSiz);
aHalfConSiz=pOut->PixelToLogic(aHalfConSiz);
@@ -2064,20 +2109,20 @@ bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrO
SdrObjConnection aBestCon;
while (no>0 && !bFnd) {
- // Problem: Gruppenobjekt mit verschiedenen Layern liefert LayerID 0 !!!!
+ // issue: group objects on different layers return LayerID=0!
no--;
SdrObject* pObj=pOL->GetObj(no);
if (rVisLayer.IsSet(pObj->GetLayer()) && pObj->IsVisible() && // only visible objects
- (pThis==NULL || pObj!=(SdrObject*)pThis) && // nicht an mich selbst connecten
+ (pThis==NULL || pObj!=(SdrObject*)pThis) && // don't connect it to itself
pObj->IsNode())
{
Rectangle aObjBound(pObj->GetCurrentBoundRect());
if (aObjBound.IsOver(aMouseRect)) {
aTestCon.ResetVars();
- bool bEdge=HAS_BASE(SdrEdgeObj,pObj); // kein BestCon fuer Edge
- // Die Userdefined Konnektoren haben absolute Prioritaet.
- // Danach kommt Vertex, Corner und Mitte(Best) gleich priorisiert.
- // Zum Schluss kommt noch ein HitTest aufs Obj.
+ bool bEdge=HAS_BASE(SdrEdgeObj,pObj); // no BestCon for Edge
+ // User-defined connectors have absolute priority.
+ // After those come Vertex, Corner and center (Best), all prioritized equally.
+ // Finally, a HitTest for the object.
const SdrGluePointList* pGPL=pObj->GetGluePointList();
sal_uInt16 nConAnz=pGPL==NULL ? 0 : pGPL->GetCount();
sal_uInt16 nGesAnz=nConAnz+9;
@@ -2117,7 +2162,7 @@ bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrO
// Suppress default connect at object center
if(!pThis || !pThis->GetSuppressDefaultConnect())
{
- // Edges nicht!
+ // not the edges!
nConNum=0;
aConPos=aObjBound.Center();
bOk = true;
@@ -2138,8 +2183,7 @@ bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrO
}
}
}
- // Falls kein Konnektor getroffen wird nochmal
- // HitTest versucht fuer BestConnector (=bCenter)
+ // if no connector is hit, try HitTest again, for BestConnector (=bCenter)
if(!bFnd &&
!bEdge &&
SdrObjectPrimitiveHit(*pObj, rPt, nBoundHitTol, rPV, &rVisLayer, false))
@@ -2264,7 +2308,7 @@ Point SdrEdgeObj::GetPoint(sal_uInt32 i) const
void SdrEdgeObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
{
- // ToDo: Umconnekten fehlt noch
+ // TODO: Need an implementation to connect differently.
ImpUndirtyEdgeTrack();
sal_uInt16 nAnz=pEdgeTrack->GetPointCount();
if (0L == i)
@@ -2354,9 +2398,9 @@ void SdrEdgeObj::SetTailPoint( sal_Bool bTail, const Point& rPt )
}
/** this method is used by the api to set a glue point for a connection
- nId == -1 : The best default point is automaticly choosen
- 0 <= nId <= 3 : One of the default points is choosen
- nId >= 4 : A user defined glue point is choosen
+ nId == -1 : The best default point is automatically chosen
+ 0 <= nId <= 3 : One of the default points is chosen
+ nId >= 4 : A user defined glue point is chosen
*/
void SdrEdgeObj::setGluePointIndex( sal_Bool bTail, sal_Int32 nIndex /* = -1 */ )
{
@@ -2424,7 +2468,7 @@ sal_Bool SdrEdgeObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::
void SdrEdgeObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon)
{
- // evtl. take care for existing connections. For now, just use the
+ // where appropriate take care for existing connections. For now, just use the
// implementation from SdrObject.
SdrObject::TRSetBaseGeometry(rMatrix, rPolyPolygon);
}
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 151878a1bb27..c82b5fe33f19 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -109,9 +109,9 @@ const Graphic ImpLoadLinkedGraphic( const String aFileName, const String aFilter
String aEmptyStr;
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aFilterData( 1 );
- // Room for improvment:
+ // TODO: Room for improvement:
// As this is a linked graphic the GfxLink is not needed if saving/loading our own format.
- // But this link is required by some filters to access the native graphic (pdf export/ms export),
+ // But this link is required by some filters to access the native graphic (PDF export/MS export),
// there we should create a new service to provide this data if needed
aFilterData[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreateNativeLink" ) );
aFilterData[ 0 ].Value = Any( sal_True );
@@ -258,7 +258,7 @@ void SdrGraphicLink::RemoveGraphicUpdater()
}
else if( SotExchange::GetFormatIdFromMimeType( rMimeType ) != sfx2::LinkManager::RegisterStatusInfoId() )
{
- // broadcasting, to update slidesorter
+ // broadcasting, to update slide sorter
pGrafObj->BroadcastObjectChange();
}
}
@@ -269,7 +269,7 @@ void SdrGraphicLink::RemoveGraphicUpdater()
void SdrGraphicLink::Closed()
{
- // Die Verbindung wird aufgehoben; pLink des Objekts auf NULL setzen, da die Link-Instanz ja gerade destruiert wird.
+ // close connection; set pLink of the object to NULL, as link instance is just about getting destructed.
pGrafObj->ForceSwapIn();
pGrafObj->pGraphicLink=NULL;
pGrafObj->ReleaseGraphicLink();
@@ -614,7 +614,7 @@ void SdrGrafObj::ImpLinkAbmeldung()
if( pLinkManager != NULL && pGraphicLink!=NULL)
{
- // Bei Remove wird *pGraphicLink implizit deleted
+ // When using Remove, the *pGraphicLink is implicitly deleted
pLinkManager->Remove( pGraphicLink );
pGraphicLink=NULL;
}
@@ -960,7 +960,7 @@ void SdrGrafObj::SetPage( SdrPage* pNewPage )
if( bRemove )
{
- // hier kein SwapIn noetig, weil wenn nicht geladen, dann auch nicht animiert.
+ // No SwapIn necessary here, because if something's not loaded, it can't be animated either.
if( pGraphic->IsAnimated())
pGraphic->StopAnimation();
@@ -992,7 +992,7 @@ void SdrGrafObj::SetModel( SdrModel* pNewModel )
ImpLinkAbmeldung();
}
- // Model umsetzen
+ // realize model
SdrRectObj::SetModel(pNewModel);
if( bChg && aFileName.Len() )
@@ -1023,7 +1023,7 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier) const
{
case GRAPHIC_GDIMETAFILE:
{
- // NUR die aus dem MetaFile erzeugbaren Objekte in eine Gruppe packen und zurueckliefern
+ // Sort into group and return ONLY those objects that can be created from the MetaFile.
SdrObjGroup* pGrp = new SdrObjGroup();
ImpSdrGDIMetaFileImport aFilter(*GetModel());
Point aOutPos( aRect.TopLeft() );
@@ -1065,13 +1065,13 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier) const
}
case GRAPHIC_BITMAP:
{
- // Grundobjekt kreieren und Fuellung ergaenzen
+ // create basic object and add fill
pRetval = SdrRectObj::DoConvertToPolyObj(bBezier);
- // Bitmap als Attribut retten
+ // save bitmap as an attribute
if(pRetval)
{
- // Bitmap als Fuellung holen
+ // retrieve bitmap for the fill
SfxItemSet aSet(GetObjectItemSet());
aSet.Put(XFillStyleItem(XFILL_BITMAP));
@@ -1142,8 +1142,7 @@ void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly )
{
Point aPos( rMaxRect.TopLeft() );
- // Falls Grafik zu gross, wird die Grafik
- // in die Seite eingepasst
+ // if the graphic is too large, fit it to page
if ( (!bShrinkOnly ||
( aSize.Height() > aMaxSize.Height() ) ||
( aSize.Width() > aMaxSize.Width() ) )&&
@@ -1154,7 +1153,7 @@ void SdrGrafObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly )
float fWinWH = (float)aMaxSize.Width() /
(float)aMaxSize.Height();
- // Grafik an Pagesize anpassen (skaliert)
+ // Scale graphic to page size
if ( fGrfWH < fWinWH )
{
aSize.Width() = (long)(aMaxSize.Height() * fGrfWH);
@@ -1217,7 +1216,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
}
else if( pO->IsInSwapIn() )
{
- // kann aus dem original Doc-Stream nachgeladen werden...
+ // can be loaded from the original document stream later
if( pModel != NULL )
{
if( pGraphic->HasUserData() )
@@ -1305,7 +1304,7 @@ Reference< XInputStream > SdrGrafObj::getInputStream()
if( pModel )
{
- // kann aus dem original Doc-Stream nachgeladen werden...
+ // can be loaded from the original document stream later
if( pGraphic->HasUserData() )
{
::comphelper::LifecycleProxy proxy;
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index df0fe3f8d674..bc0f7c760f75 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -49,9 +49,9 @@
#include <svx/svdtrans.hxx>
#include <svx/svdetc.hxx>
#include <svx/svdattrx.hxx> // NotPersistItems
-#include <svx/svdoedge.hxx> // Die Verbinder nach Move nochmal anbroadcasten
+#include <svx/svdoedge.hxx> // broadcast connectors to Move
#include "svx/svdglob.hxx" // StringCache
-#include "svx/svdstr.hrc" // Objektname
+#include "svx/svdstr.hrc" // the object's name
#include <svx/svxids.hrc>
#include <svl/whiter.hxx>
@@ -299,7 +299,7 @@ SdrObjGroup& SdrObjGroup::operator=(const SdrObjGroup& rObj)
pSub->SetModel(rSourceSubList.GetModel());
pSub->CopyObjects(*rObj.GetSubList());
- // copy local paremeters
+ // copy local parameters
nDrehWink = rObj.nDrehWink;
nShearWink = rObj.nShearWink;
aRefPoint = rObj.aRefPoint;
@@ -343,7 +343,7 @@ void SdrObjGroup::TakeObjNamePlural(XubString& rName) const
void SdrObjGroup::RecalcSnapRect()
{
- // nicht erforderlich, da die Rects von der SubList verwendet werden.
+ // TODO: unnecessary, because we use the Rects from the SubList
}
basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
@@ -484,7 +484,7 @@ void SdrObjGroup::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
{
SetGlueReallyAbsolute(sal_True);
- MirrorPoint(aRefPoint,rRef1,rRef2); // fehlende Implementation in SvdEtc !!!
+ MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
SdrObjList* pOL=pSub;
sal_uIntPtr nObjAnz=pOL->GetObjCount();
for (sal_uIntPtr i=0; i<nObjAnz; i++) {
@@ -563,7 +563,7 @@ void SdrObjGroup::Move(const Size& rSiz)
Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
MovePoint(aRefPoint,rSiz);
if (pSub->GetObjCount()!=0) {
- // Erst die Verbinder verschieben, dann den Rest
+ // first move the connectors, then everything else
SdrObjList* pOL=pSub;
sal_uIntPtr nObjAnz=pOL->GetObjCount();
sal_uIntPtr i;
@@ -608,7 +608,7 @@ void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fractio
Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
ResizePoint(aRefPoint,rRef,xFact,yFact);
if (pSub->GetObjCount()!=0) {
- // Erst die Verbinder verschieben, dann den Rest
+ // move the connectors first, everything else afterwards
SdrObjList* pOL=pSub;
sal_uIntPtr nObjAnz=pOL->GetObjCount();
sal_uIntPtr i;
@@ -639,7 +639,7 @@ void SdrObjGroup::Rotate(const Point& rRef, long nWink, double sn, double cs)
Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
nDrehWink=NormAngle360(nDrehWink+nWink);
RotatePoint(aRefPoint,rRef,sn,cs);
- // Erst die Verbinder verschieben, dann den Rest
+ // move the connectors first, everything else afterwards
SdrObjList* pOL=pSub;
sal_uIntPtr nObjAnz=pOL->GetObjCount();
sal_uIntPtr i;
@@ -664,8 +664,8 @@ void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
{
SetGlueReallyAbsolute(sal_True);
Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
- MirrorPoint(aRefPoint,rRef1,rRef2); // fehlende Implementation in SvdEtc !!!
- // Erst die Verbinder verschieben, dann den Rest
+ MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
+ // move the connectors first, everything else afterwards
SdrObjList* pOL=pSub;
sal_uIntPtr nObjAnz=pOL->GetObjCount();
sal_uIntPtr i;
@@ -692,7 +692,7 @@ void SdrObjGroup::Shear(const Point& rRef, long nWink, double tn, bool bVShear)
Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
nShearWink+=nWink;
ShearPoint(aRefPoint,rRef,tn);
- // Erst die Verbinder verschieben, dann den Rest
+ // move the connectors first, everything else afterwards
SdrObjList* pOL=pSub;
sal_uIntPtr nObjAnz=pOL->GetObjCount();
sal_uIntPtr i;
@@ -720,7 +720,7 @@ void SdrObjGroup::SetAnchorPos(const Point& rPnt)
aAnchor=rPnt;
Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
MovePoint(aRefPoint,aSiz);
- // Erst die Verbinder verschieben, dann den Rest
+ // move the connectors first, everything else afterwards
SdrObjList* pOL=pSub;
sal_uIntPtr nObjAnz=pOL->GetObjCount();
sal_uIntPtr i;
@@ -745,14 +745,14 @@ void SdrObjGroup::NbcSetRelativePos(const Point& rPnt)
{
Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
- NbcMove(aSiz); // Der ruft auch das SetRectsDirty()
+ NbcMove(aSiz); // this also calls SetRectsDirty()
}
void SdrObjGroup::SetRelativePos(const Point& rPnt)
{
Point aRelPos0(GetSnapRect().TopLeft()-aAnchor);
Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
- if (aSiz.Width()!=0 || aSiz.Height()!=0) Move(aSiz); // Der ruft auch das SetRectsDirty() und Broadcast, ...
+ if (aSiz.Width()!=0 || aSiz.Height()!=0) Move(aSiz); // this also calls SetRectsDirty() and Broadcast, ...
}
void SdrObjGroup::NbcReformatText()
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index f04d79a0062f..83aa8e490bcc 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -40,7 +40,7 @@
#include <svx/svdmodel.hxx>
#include <svx/svdview.hxx>
#include "svx/svdglob.hxx" // StringCache
-#include "svx/svdstr.hrc" // Objektname
+#include "svx/svdstr.hrc" // the object's name
#include <svl/style.hxx>
#include <svl/smplhint.hxx>
#include <editeng/eeitem.hxx>
@@ -105,7 +105,7 @@ void SdrMeasureObj::TakeRepresentation( XubString& rStr, SdrMeasureFieldKind eMe
if(eMeasureUnit != eModUIUnit)
{
- // Zur Umrechnung der Einheiten
+ // for the unit conversion
aFact *= GetMapFactor(eModUIUnit, eMeasureUnit).X();
}
@@ -116,7 +116,7 @@ void SdrMeasureObj::TakeRepresentation( XubString& rStr, SdrMeasureFieldKind eMe
if(aFact.GetNumerator() != aFact.GetDenominator())
{
- // Scaling ueber BigInt, um Ueberlaeufe zu vermeiden
+ // scale via BigInt, to avoid overruns
nLen = BigMulDiv(nLen, aFact.GetNumerator(), aFact.GetDenominator());
}
@@ -152,7 +152,7 @@ void SdrMeasureObj::TakeRepresentation( XubString& rStr, SdrMeasureFieldKind eMe
}
else
{
- // falls kein Model da ... (z.B. Preview im Dialog)
+ // if there's no Model ... (e. g. preview in dialog)
rStr = String();
rStr.AppendAscii("4711");
}
@@ -293,9 +293,9 @@ struct ImpLineRec
struct ImpMeasurePoly
{
- ImpLineRec aMainline1; // die mit dem 1. Pfeil
- ImpLineRec aMainline2; // die mit dem 2. Pfeil
- ImpLineRec aMainline3; // die dazwischen
+ ImpLineRec aMainline1; // those with the 1st arrowhead
+ ImpLineRec aMainline2; // those with the 2nd arrowhead
+ ImpLineRec aMainline3; // those in between
ImpLineRec aHelpline1;
ImpLineRec aHelpline2;
Rectangle aTextRect;
@@ -311,16 +311,16 @@ struct ImpMeasurePoly
sal_uInt16 nMainlineAnz;
SdrMeasureTextHPos eUsedTextHPos;
SdrMeasureTextVPos eUsedTextVPos;
- long nLineWdt2; // Halbe Strichstaerke
- long nArrow1Len; // Laenge des 1. Pfeils. Bei Center nur die Haelfte
- long nArrow2Len; // Laenge des 2. Pfeils. Bei Center nur die Haelfte
- long nArrow1Wdt; // Breite des 1. Pfeils
- long nArrow2Wdt; // Breite des 2. Pfeils
- long nShortLineLen; // Linienlaenge, wenn PfeileAussen
- bool bArrow1Center; // Pfeil 1 zentriert?
- bool bArrow2Center; // Pfeil 2 zentriert?
- bool bAutoUpsideDown; // UpsideDown durch Automatik
- bool bPfeileAussen;
+ long nLineWdt2; // half the line width
+ long nArrow1Len; // length of 1st arrowhead; for Center, use only half
+ long nArrow2Len; // length of 2nd arrowhead; for Center, use only half
+ long nArrow1Wdt; // width of 1st arrow
+ long nArrow2Wdt; // width of 2nd arrow
+ long nShortLineLen; // line length, if PfeileAussen (arrowheads on the outside)
+ bool bArrow1Center; // arrowhead 1 centered?
+ bool bArrow2Center; // arrowhead 2 centered?
+ bool bAutoUpsideDown; // UpsideDown via automation
+ bool bPfeileAussen; // arrowheads on the outside
bool bBreakedLine;
};
@@ -406,8 +406,8 @@ void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly&
nArrow1Len = impGetLineStartEndDistance(aPol1, nArrow1Wdt, bArrow1Center) - 1;
nArrow2Len = impGetLineStartEndDistance(aPol2, nArrow2Wdt, bArrow2Center) - 1;
- // nArrowLen ist bei bCenter bereits halbiert
- // Bei 2 Pfeilen a 4mm ist unter 10mm Schluss.
+ // nArrowLen is already halved at bCenter.
+ // In the case of 2 arrowheads each 4mm long, we can't go below 10mm.
nArrowNeed=nArrow1Len+nArrow2Len+(nArrow1Wdt+nArrow2Wdt)/2;
if (rPol.nLineLen<nArrowNeed) bPfeileAussen = true;
nShortLen=(nArrow1Len+nArrow1Wdt + nArrow2Len+nArrow2Wdt) /2;
@@ -421,19 +421,19 @@ void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly&
OutlinerParaObject* pOutlinerParaObject = SdrTextObj::GetOutlinerParaObject();
if (pOutlinerParaObject!=NULL && pOutlinerParaObject->GetTextObject().GetParagraphCount()==1)
{
- bBrkLine=sal_True; // Unterbrochene Linie, wenn nur 1 Absatz.
+ bBrkLine=sal_True; // dashed line if there's only on paragraph.
}
}
rPol.bBreakedLine=bBrkLine;
- if (rPol.eUsedTextHPos==SDRMEASURE_TEXTHAUTO) { // bei zu breitem Text diesen eventuell nach aussen schieben
+ if (rPol.eUsedTextHPos==SDRMEASURE_TEXTHAUTO) { // if text is too wide, push it outside
bool bOutside = false;
long nNeedSiz=!rRec.bTextRota90 ? rPol.aTextSize.Width() : rPol.aTextSize.Height();
- if (nNeedSiz>rPol.nLineLen) bOutside = true; // Text passt nicht in die Mitte
+ if (nNeedSiz>rPol.nLineLen) bOutside = true; // text doesn't fit in between
if (bBrkLine) {
- if (nNeedSiz+nArrowNeed>rPol.nLineLen) bPfeileAussen = true; // Text passt in die Mitte, wenn die Pfeile nach aussen kommen
+ if (nNeedSiz+nArrowNeed>rPol.nLineLen) bPfeileAussen = true; // text fits in between, if arrowheads are on the outside
} else {
long nSmallNeed=nArrow1Len+nArrow2Len+(nArrow1Wdt+nArrow2Wdt)/2/4;
- if (nNeedSiz+nSmallNeed>rPol.nLineLen) bPfeileAussen = true; // Text passt in die Mitte, wenn die Pfeile nach aussen kommen
+ if (nNeedSiz+nSmallNeed>rPol.nLineLen) bPfeileAussen = true; // text fits in between, if arrowheads are on the outside
}
rPol.eUsedTextHPos=bOutside ? SDRMEASURE_TEXTLEFTOUTSIDE : SDRMEASURE_TEXTINSIDE;
}
@@ -493,15 +493,15 @@ void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly&
long dxh2= Round((nLineDist+nOverhang)*nHlpCos);
long dyh2=-Round((nLineDist+nOverhang)*nHlpSin);
- // Masshilfslinie 1
+ // extension line 1
rPol.aHelpline1.aP1=Point(aP1.X()+dxh1a,aP1.Y()+dyh1a);
rPol.aHelpline1.aP2=Point(aP1.X()+dxh2,aP1.Y()+dyh2);
- // Masshilfslinie 2
+ // extension line 2
rPol.aHelpline2.aP1=Point(aP2.X()+dxh1b,aP2.Y()+dyh1b);
rPol.aHelpline2.aP2=Point(aP2.X()+dxh2,aP2.Y()+dyh2);
- // Masslinie(n)
+ // dimension line
Point aMainlinePt1(aP1.X()+dx,aP1.Y()+dy);
Point aMainlinePt2(aP2.X()+dx,aP2.Y()+dy);
if (!bPfeileAussen) {
@@ -522,7 +522,7 @@ void SdrMeasureObj::ImpCalcGeometrics(const ImpMeasureRec& rRec, ImpMeasurePoly&
RotatePoint(rPol.aMainline2.aP1,rPol.aMainline2.aP2,nLineSin,nLineCos);
}
} else {
- long nLen1=nShortLen; // Pfeilbreite als Linienlaenge ausserhalb des Pfeils
+ long nLen1=nShortLen; // arrowhead's width as line length outside of the arrowhead
long nLen2=nShortLen;
long nTextWdt=rRec.bTextRota90 ? rPol.aTextSize.Height() : rPol.aTextSize.Width();
if (!bBrkLine) {
@@ -616,7 +616,7 @@ void SdrMeasureObj::UndirtyText() const
rOutliner.SetParaAttribs(0, GetObjectItemSet());
- // casting auf nonconst
+ // cast to nonconst
const_cast<SdrMeasureObj*>(this)->NbcSetOutlinerParaObject( rOutliner.CreateParaObject() );
}
else
@@ -628,7 +628,7 @@ void SdrMeasureObj::UndirtyText() const
rOutliner.UpdateFields();
Size aSiz(rOutliner.CalcTextSize());
rOutliner.Clear();
- // 3x casting auf nonconst
+ // cast to nonconst three times
((SdrMeasureObj*)this)->aTextSize=aSiz;
((SdrMeasureObj*)this)->bTextSizeDirty=sal_False;
((SdrMeasureObj*)this)->bTextDirty=sal_False;
@@ -643,7 +643,7 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
ImpTakeAttr(aRec);
ImpCalcGeometrics(aRec,aMPol);
- // TextSize ermitteln inkl. Textrahmenabstaende
+ // determine TextSize including text frame margins
Size aTextSize2(aMPol.aTextSize);
if (aTextSize2.Width()<1) aTextSize2.Width()=1;
if (aTextSize2.Height()<1) aTextSize2.Height()=1;
@@ -656,8 +656,9 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
long nArr1Len=aMPol.nArrow1Len;
long nArr2Len=aMPol.nArrow2Len;
if (aMPol.bBreakedLine) {
- // Bei Unterbrochener Linie und Outside muss der Text nicht neben den
- // Pfeil sondern neben die Linie an dem Pfeil plaziert werden
+ // In the case of a dashed line and Outside, the text shouldn't be
+ // placed next to the line at the arrowhead insetead of directly at the
+ // arrowhead.
nArr1Len=aMPol.nShortLineLen+aMPol.nArrow1Wdt/4;
nArr2Len=aMPol.nShortLineLen+aMPol.nArrow2Wdt/4;
}
@@ -690,7 +691,7 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
aTextPos.X()+=aTextSize2.Width();
aTextPos.Y()+=aTextSize2.Height();
}
- } else { // also wenn bTextRota90==TRUE
+ } else { // also if bTextRota90==TRUE
switch (eMH) {
case SDRMEASURE_TEXTLEFTOUTSIDE: aTextPos.X()=aPt1b.X()-aTextSize2.Height()-nArr1Len; break;
case SDRMEASURE_TEXTRIGHTOUTSIDE: aTextPos.X()=aPt1b.X()+nLen+nArr2Len; break;
@@ -718,7 +719,7 @@ void SdrMeasureObj::TakeUnrotatedSnapRect(Rectangle& rRect) const
((SdrMeasureObj*)this)->aGeo.RecalcSinCos();
}
RotatePoint(aTextPos,aPt1b,aMPol.nLineSin,aMPol.nLineCos);
- aTextSize2.Width()++; aTextSize2.Height()++; // wg. des komischen Verhaltens beim Rect-Ctor
+ aTextSize2.Width()++; aTextSize2.Height()++; // because of the Rect-Ctor's odd behavior
rRect=Rectangle(aTextPos,aTextSize2);
rRect.Justify();
((SdrMeasureObj*)this)->aRect=rRect;
@@ -931,7 +932,7 @@ void SdrMeasureObj::ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) c
long ndy0=aMov.Y()-aFix.Y();
bool bHLin=ndy0==0;
bool bVLin=ndx0==0;
- if (!bHLin || !bVLin) { // sonst ist aPt1==aPt2
+ if (!bHLin || !bVLin) { // else aPt1==aPt2
long ndx=aPt.X()-aFix.X();
long ndy=aPt.Y()-aFix.Y();
double nXFact=0; if (!bVLin) nXFact=(double)ndx/(double)ndx0;
@@ -1042,7 +1043,7 @@ void SdrMeasureObj::NbcRotate(const Point& rRef, long nWink, double sn, double c
RotatePoint(aPt1,rRef,sn,cs);
RotatePoint(aPt2,rRef,sn,cs);
long nLen1=GetLen(aPt2-aPt1);
- if (nLen1!=nLen0) { // Aha, Rundungsfehler
+ if (nLen1!=nLen0) { // rounding error!
long dx=aPt2.X()-aPt1.X();
long dy=aPt2.Y()-aPt1.Y();
dx=BigMulDiv(dx,nLen0,nLen1);
@@ -1082,7 +1083,6 @@ long SdrMeasureObj::GetRotateAngle() const
void SdrMeasureObj::RecalcSnapRect()
{
- // Added correct implementation here.
ImpMeasureRec aRec;
ImpMeasurePoly aMPol;
XPolyPolygon aXPP;
@@ -1286,7 +1286,7 @@ void SdrMeasureObj::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject)
{
SdrTextObj::NbcSetOutlinerParaObject(pTextObject);
if(SdrTextObj::GetOutlinerParaObject())
- SetTextDirty(); // Text neu berechnen!
+ SetTextDirty(); // recalculate text
}
void SdrMeasureObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, bool bNoEditText,
@@ -1323,18 +1323,18 @@ sal_uInt16 SdrMeasureObj::GetOutlinerViewAnchorMode() const
bool bTextRota90=aRec.bTextRota90;
bool bBelowRefEdge=aRec.bBelowRefEdge;
- // bTextUpsideDown muss hier noch ausgewertet werden!!!!
+ // TODO: bTextUpsideDown should be interpreted here!
if (!bTextRota90) {
if (eMH==SDRMEASURE_TEXTLEFTOUTSIDE) eTH=SDRTEXTHORZADJUST_RIGHT;
if (eMH==SDRMEASURE_TEXTRIGHTOUTSIDE) eTH=SDRTEXTHORZADJUST_LEFT;
- // bei eMH==SDRMEASURE_TEXTINSIDE kann horizontal geankert werden.
+ // at eMH==SDRMEASURE_TEXTINSIDE we can anchor horizontally
if (eMV==SDRMEASURE_ABOVE) eTV=SDRTEXTVERTADJUST_BOTTOM;
if (eMV==SDRMEASURE_BELOW) eTV=SDRTEXTVERTADJUST_TOP;
if (eMV==SDRMEASURETEXT_BREAKEDLINE || eMV==SDRMEASURETEXT_VERTICALCENTERED) eTV=SDRTEXTVERTADJUST_CENTER;
} else {
if (eMH==SDRMEASURE_TEXTLEFTOUTSIDE) eTV=SDRTEXTVERTADJUST_BOTTOM;
if (eMH==SDRMEASURE_TEXTRIGHTOUTSIDE) eTV=SDRTEXTVERTADJUST_TOP;
- // bei eMH==SDRMEASURE_TEXTINSIDE kann vertikal geankert werden.
+ // at eMH==SDRMEASURE_TEXTINSIDE we can anchor vertically
if (!bBelowRefEdge) {
if (eMV==SDRMEASURE_ABOVE) eTH=SDRTEXTHORZADJUST_LEFT;
if (eMV==SDRMEASURE_BELOW) eTH=SDRTEXTHORZADJUST_RIGHT;
@@ -1379,7 +1379,7 @@ sal_Bool SdrMeasureObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf
basegfx::B2DTuple aScale(aRange.getRange());
basegfx::B2DTuple aTranslate(aRange.getMinimum());
- // position maybe relative to anchorpos, convert
+ // position maybe relative to anchor position, convert
if( pModel->IsWriter() )
{
if(GetAnchorPos().X() || GetAnchorPos().Y())
@@ -1396,7 +1396,7 @@ sal_Bool SdrMeasureObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf
{
case SFX_MAPUNIT_TWIP :
{
- // postion
+ // position
aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index f75fb3e68672..875d263e033f 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -200,8 +200,7 @@ void SdrMediaObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly /
{
Point aPos( rMaxRect.TopLeft() );
- // Falls Grafik zu gross, wird die Grafik
- // in die Seite eingepasst
+ // if graphic is too large, fit it to the page
if ( (!bShrinkOnly ||
( aSize.Height() > aMaxSize.Height() ) ||
( aSize.Width() > aMaxSize.Width() ) )&&
@@ -212,7 +211,7 @@ void SdrMediaObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly /
float fWinWH = (float)aMaxSize.Width() /
(float)aMaxSize.Height();
- // Grafik an Pagesize anpassen (skaliert)
+ // scale graphic to page size
if ( fGrfWH < fWinWH )
{
aSize.Width() = (long)(aMaxSize.Height() * fGrfWH);
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 13871ee698b2..b9df1162dad1 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -77,7 +77,7 @@
#include <svx/svdpagv.hxx>
#include <svx/svdmodel.hxx>
#include "svx/svdglob.hxx" // Stringcache
-#include "svx/svdstr.hrc" // Objektname
+#include "svx/svdstr.hrc" // the object's name
#include <svx/svdetc.hxx>
#include <svx/svdview.hxx>
#include "unomlstr.hxx"
@@ -234,7 +234,7 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::notifyEvent( const document::EventObj
SolarMutexGuard aGuard;
- // the code currently makes sence only in case there is no other client
+ // the code currently makes sense only in case there is no other client
if ( mpObj && mpObj->GetAspect() != embed::Aspects::MSOLE_ICON && aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnVisAreaChanged"))
&& mpObj->GetObjRef().is() && mpObj->GetObjRef()->getClientSite() == uno::Reference< embed::XEmbeddedClient >( this ) )
{
@@ -309,7 +309,7 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::saveObject()
if ( !mpObj )
throw embed::ObjectSaveVetoException();
- // the common persistance is supported by objects and links
+ // the common persistence is supported by objects and links
xPersist = uno::Reference< embed::XCommonEmbedPersist >( mpObj->GetObjRef(), uno::UNO_QUERY_THROW );
xModifiable = uno::Reference< util::XModifiable >( mpObj->GetParentXModel(), uno::UNO_QUERY );
}
@@ -1211,8 +1211,8 @@ void SdrOle2Obj::Disconnect_Impl()
// TODO/LATER: here we must assume that the destruction of the model is enough to make clear that we will not
// remove the object from the container, even if the DrawingObject itself is not destroyed (unfortunately this
// There is no real need to do the following removing of the object from the container
- // in case the model has correct persistance, but in case of problems such a removing
- // would make the behaviour of the office more stable
+ // in case the model has correct persistence, but in case of problems such a removing
+ // would make the behavior of the office more stable
comphelper::EmbeddedObjectContainer* pContainer = xObjRef.GetContainer();
if ( pContainer )
@@ -1250,7 +1250,7 @@ void SdrOle2Obj::Disconnect_Impl()
{
pContainer->RemoveEmbeddedObject( xObjRef.GetObject(), sal_False);
- // TODO/LATER: mpImpl->aPersistName contains outdated information, to have it uptodate
+ // TODO/LATER: mpImpl->aPersistName contains outdated information, to keep it updated
// it should be returned from RemoveEmbeddedObject call. Currently it is no problem,
// since no container is adjusted, actually the empty string could be provided as a name here
xObjRef.AssignToContainer( NULL, mpImpl->aPersistName );
@@ -1293,7 +1293,7 @@ void SdrOle2Obj::SetModel(SdrModel* pNewModel)
if ( pNewModel == pModel )
{
- // don't know if this is necessary or if it will ever happen, but who know?!
+ // don't know if this is necessary or if it will ever happen, but who knows?!
SdrRectObj::SetModel( pNewModel );
return;
}
@@ -1315,7 +1315,7 @@ void SdrOle2Obj::SetModel(SdrModel* pNewModel)
{
try
{
- // move the objects' storage; ObjectRef remains the same, but PersistName may change
+ // move the object's storage; ObjectRef remains the same, but PersistName may change
::rtl::OUString aTmp;
comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer();
uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName );
@@ -1343,7 +1343,7 @@ void SdrOle2Obj::SetModel(SdrModel* pNewModel)
SdrRectObj::SetModel( pNewModel );
// #i43086#
- // #i85304 redo the change for charts for the above bugfix, as #i43086# does not ocur anymore
+ // #i85304 redo the change for charts for the above bugfix, as #i43086# does not occur anymore
//so maybe the ImpSetVisAreaSize call can be removed here completely
//Nevertheless I leave it in for other objects as I am not sure about the side effects when removing now
if( pModel && !pModel->isLocked() && !IsChart() )
@@ -1352,7 +1352,7 @@ void SdrOle2Obj::SetModel(SdrModel* pNewModel)
if( pDestPers && !IsEmptyPresObj() )
{
if ( !pSrcPers || IsEmptyPresObj() )
- // object wasn't connected, now it should
+ // object wasn't connected, now it should be
Connect_Impl();
else
Reconnect_Impl();
@@ -1386,7 +1386,7 @@ void SdrOle2Obj::SetObjRef( const com::sun::star::uno::Reference < com::sun::sta
return;
// the caller of the method is responsible to control the old object, it will not be closed here
- // Otherwise WW8 import crashes because it tranfers control to OLENode by this method
+ // Otherwise WW8 import crashes because it transfers control to OLENode by this method
if ( xObjRef.GetObject().is() )
xObjRef.Lock( sal_False );
@@ -1636,7 +1636,7 @@ void SdrOle2Obj::ImpSetVisAreaSize()
if ( pClient || bHasOwnClient )
{
- // TODO/LATER: IMHO we need to do similar things when object is UIActive or OutplaceActive?! (MBA)
+ // TODO: IMHO we need to do similar things when object is UIActive or OutplaceActive?!
if ( ((nMiscStatus & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) &&
svt::EmbeddedObjectRef::TryRunningState( xObjRef.GetObject() ))
|| xObjRef->getCurrentState() == embed::EmbedStates::INPLACE_ACTIVE
@@ -1760,7 +1760,7 @@ void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
}
SdrRectObj::NbcResize(rRef,xFact,yFact);
- if (aGeo.nShearWink!=0 || aGeo.nDrehWink!=0) { // kleine Korrekturen
+ if (aGeo.nShearWink!=0 || aGeo.nDrehWink!=0) { // little correctures
if (aGeo.nDrehWink>=9000 && aGeo.nDrehWink<27000) {
aRect.Move(aRect.Left()-aRect.Right(),aRect.Top()-aRect.Bottom());
}
@@ -1911,7 +1911,7 @@ sal_Bool SdrOle2Obj::Unload()
{
//TODO/LATER: no refcounting tricks anymore!
//"customers" must register as state change listeners
- //Nicht notwendig im Doc DTor (MM)
+ // Not necessary in Doc DTor (MM)
//sal_uIntPtr nRefCount = (*ppObjRef)->GetRefCount();
// prevent Unload if there are external references
//if( nRefCount > 2 )
diff --git a/svx/source/svdraw/svdopage.cxx b/svx/source/svdraw/svdopage.cxx
index c9dafba15088..2c9e34e17256 100644
--- a/svx/source/svdraw/svdopage.cxx
+++ b/svx/source/svdraw/svdopage.cxx
@@ -29,7 +29,7 @@
#include <svx/svdopage.hxx>
#include "svx/svdglob.hxx" // Stringcache
-#include "svx/svdstr.hrc" // Objektname
+#include "svx/svdstr.hrc" // the object's name
#include <svx/svdtrans.hxx>
#include <svx/svdetc.hxx>
#include <svx/svdmodel.hxx>
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 4a9dc0cbeaa5..2b827cba0b48 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -39,9 +39,9 @@
#include <svx/svdmodel.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdhdl.hxx>
-#include <svx/svdview.hxx> // fuer MovCreate bei Freihandlinien
+#include <svx/svdview.hxx> // for MovCreate when using curves
#include "svx/svdglob.hxx" // Stringcache
-#include "svx/svdstr.hrc" // Objektname
+#include "svx/svdstr.hrc" // the object's name
#ifdef _MSC_VER
#pragma optimize ("",off)
@@ -98,32 +98,32 @@ inline sal_uInt16 GetNextPnt(sal_uInt16 nPnt, sal_uInt16 nPntMax, bool bClosed)
struct ImpSdrPathDragData : public SdrDragStatUserData
{
- XPolygon aXP; // Ausschnitt aud dem Originalpolygon
- bool bValid; // FALSE = zu wenig Punkte
- bool bClosed; // geschlossenes Objekt?
- sal_uInt16 nPoly; // Nummer des Polygons im PolyPolygon
- sal_uInt16 nPnt; // Punktnummer innerhalb des obigen Polygons
- sal_uInt16 nPntAnz; // Punktanzahl des Polygons
- sal_uInt16 nPntMax; // Maximaler Index
- bool bBegPnt; // Gedraggter Punkt ist der Anfangspunkt einer Polyline
- bool bEndPnt; // Gedraggter Punkt ist der Endpunkt einer Polyline
- sal_uInt16 nPrevPnt; // Index des vorherigen Punkts
- sal_uInt16 nNextPnt; // Index des naechsten Punkts
- bool bPrevIsBegPnt; // Vorheriger Punkt ist Anfangspunkt einer Polyline
- bool bNextIsEndPnt; // Folgepunkt ist Endpunkt einer Polyline
- sal_uInt16 nPrevPrevPnt; // Index des vorvorherigen Punkts
- sal_uInt16 nNextNextPnt; // Index des uebernaechsten Punkts
- bool bControl; // Punkt ist ein Kontrollpunkt
- bool bIsPrevControl; // Punkt ist Kontrollpunkt vor einem Stuetzpunkt
- bool bIsNextControl; // Punkt ist Kontrollpunkt hinter einem Stuetzpunkt
- bool bPrevIsControl; // Falls nPnt ein StPnt: Davor ist ein Kontrollpunkt
- bool bNextIsControl; // Falls nPnt ein StPnt: Dahinter ist ein Kontrollpunkt
+ XPolygon aXP; // section of the original polygon
+ bool bValid; // FALSE = too few points
+ bool bClosed; // closed object?
+ sal_uInt16 nPoly; // number of the polygon in the PolyPolygon
+ sal_uInt16 nPnt; // number of point in the upper polygon
+ sal_uInt16 nPntAnz; // 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
+ sal_uInt16 nPrevPnt; // index of previous point
+ sal_uInt16 nNextPnt; // index of next point
+ bool bPrevIsBegPnt; // previous point is first point of a Polyline
+ bool bNextIsEndPnt; // next point is first point of a Polyline
+ sal_uInt16 nPrevPrevPnt; // index of point before previous point
+ sal_uInt16 nNextNextPnt; // index of point after next point
+ bool bControl; // point is a control point
+ bool bIsPrevControl; // point is a control point before a support point
+ bool bIsNextControl; // point is a control point after a support point
+ bool bPrevIsControl; // if nPnt is a support point: a control point comes before
+ bool bNextIsControl; // if nPnt is a support point: a control point comes after
sal_uInt16 nPrevPrevPnt0;
sal_uInt16 nPrevPnt0;
sal_uInt16 nPnt0;
sal_uInt16 nNextPnt0;
sal_uInt16 nNextNextPnt0;
- bool bEliminate; // Punkt loeschen? (wird von MovDrag gesetzt)
+ bool bEliminate; // delete point? (is set by MovDrag)
sal_Bool mbMultiPointDrag;
const XPolyPolygon maOrig;
@@ -165,34 +165,34 @@ ImpSdrPathDragData::ImpSdrPathDragData(const SdrPathObj& rPO, const SdrHdl& rHdl
else
{
bValid=sal_False;
- bClosed=rPO.IsClosed(); // geschlossenes Objekt?
- nPoly=(sal_uInt16)rHdl.GetPolyNum(); // Nummer des Polygons im PolyPolygon
- nPnt=(sal_uInt16)rHdl.GetPointNum(); // Punktnummer innerhalb des obigen Polygons
+ bClosed=rPO.IsClosed(); // closed object?
+ nPoly=(sal_uInt16)rHdl.GetPolyNum(); // number of the polygon in the PolyPolygon
+ nPnt=(sal_uInt16)rHdl.GetPointNum(); // number of points in the upper polygon
const XPolygon aTmpXP(rPO.GetPathPoly().getB2DPolygon(nPoly));
- nPntAnz=aTmpXP.GetPointCount(); // Punktanzahl des Polygons
- if (nPntAnz==0 || (bClosed && nPntAnz==1)) return; // min. 1Pt bei Line, min. 2 bei Polygon
- nPntMax=nPntAnz-1; // Maximaler Index
- bBegPnt=!bClosed && nPnt==0; // Gedraggter Punkt ist der Anfangspunkt einer Polyline
- bEndPnt=!bClosed && nPnt==nPntMax; // Gedraggter Punkt ist der Endpunkt einer Polyline
- if (bClosed && nPntAnz<=3) { // Falls Polygon auch nur eine Linie ist
+ 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
+ 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;
}
- nPrevPnt=nPnt; // Index des vorherigen Punkts
- nNextPnt=nPnt; // Index des naechsten Punkts
+ nPrevPnt=nPnt; // index of previous point
+ nNextPnt=nPnt; // index of next point
if (!bBegPnt) nPrevPnt=GetPrevPnt(nPnt,nPntMax,bClosed);
if (!bEndPnt) nNextPnt=GetNextPnt(nPnt,nPntMax,bClosed);
bPrevIsBegPnt=bBegPnt || (!bClosed && nPrevPnt==0);
bNextIsEndPnt=bEndPnt || (!bClosed && nNextPnt==nPntMax);
- nPrevPrevPnt=nPnt; // Index des vorvorherigen Punkts
- nNextNextPnt=nPnt; // Index des uebernaechsten Punkts
+ nPrevPrevPnt=nPnt; // index of point before previous point
+ nNextNextPnt=nPnt; // index of point after next point
if (!bPrevIsBegPnt) nPrevPrevPnt=GetPrevPnt(nPrevPnt,nPntMax,bClosed);
if (!bNextIsEndPnt) nNextNextPnt=GetNextPnt(nNextPnt,nPntMax,bClosed);
- bControl=rHdl.IsPlusHdl(); // Punkt ist ein Kontrollpunkt
- bIsPrevControl=sal_False; // Punkt ist Kontrollpunkt vor einem Stuetzpunkt
- bIsNextControl=sal_False; // Punkt ist Kontrollpunkt hinter einem Stuetzpunkt
- bPrevIsControl=sal_False; // Falls nPnt ein StPnt: Davor ist ein Kontrollpunkt
- bNextIsControl=sal_False; // Falls nPnt ein StPnt: Dahinter ist ein Kontrollpunkt
+ bControl=rHdl.IsPlusHdl(); // point is a control point
+ bIsPrevControl=sal_False; // point is a control point before a support point
+ bIsNextControl=sal_False; // point is a control point after a support point
+ bPrevIsControl=sal_False; // if nPnt is a support point: a control point comes before
+ bNextIsControl=sal_False; // if nPnt is a support point: a control point comes after
if (bControl) {
bIsPrevControl=aTmpXP.IsControl(nPrevPnt);
bIsNextControl=!bIsPrevControl;
@@ -346,7 +346,7 @@ bool ImpPathCreateUser::CalcCircle(const Point& rP1, const Point& rP2, const Poi
bAngleSnap=pView!=NULL && pView->IsAngleSnapEnabled();
if (bAngleSnap) {
long nSA=pView->GetSnapAngle();
- if (nSA!=0) { // Winkelfang
+ if (nSA!=0) { // angle snapping
bool bNeg=nCircRelWink<0;
if (bNeg) nCircRelWink=-nCircRelWink;
nCircRelWink+=nSA/2;
@@ -375,7 +375,7 @@ XPolygon ImpPathCreateUser::GetCirclePoly() const
sal_uInt16(NormAngle360(nCircStWink+nCircRelWink+5)/10),sal_uInt16((nCircStWink+5)/10),sal_False);
sal_uInt16 nAnz=aXP.GetPointCount();
for (sal_uInt16 nNum=nAnz/2; nNum>0;) {
- nNum--; // XPoly Punktreihenfolge umkehren
+ nNum--; // reverse XPoly's order of points
sal_uInt16 n2=nAnz-nNum-1;
Point aPt(aXP[nNum]);
aXP[nNum]=aXP[n2];
@@ -420,11 +420,11 @@ bool ImpPathCreateUser::CalcLine(const Point& rP1, const Point& rP2, const Point
long nDirY=rDir.Y();
Point aP1(CalcLine(aTmpPt, nDirX, nDirY,pView)); aP1-=aTmpPt; long nQ1=Abs(aP1.X())+Abs(aP1.Y());
Point aP2(CalcLine(aTmpPt, nDirY,-nDirX,pView)); aP2-=aTmpPt; long nQ2=Abs(aP2.X())+Abs(aP2.Y());
- if (pView!=NULL && pView->IsOrtho()) nQ1=0; // Ortho schaltet rechtwinklig aus
+ if (pView!=NULL && pView->IsOrtho()) nQ1=0; // Ortho turns off at right angle
bLine90=nQ1>2*nQ2;
- if (!bLine90) { // glatter Uebergang
+ if (!bLine90) { // smooth transition
aLineEnd+=aP1;
- } else { // rechtwinkliger Uebergang
+ } else { // rectangular transition
aLineEnd+=aP2;
}
bLine=sal_True;
@@ -597,7 +597,7 @@ bool ImpPathForDragAndCreate::beginPathDrag( SdrDragStat& rDrag ) const
if(!mpSdrPathDragData || !mpSdrPathDragData->bValid)
{
- OSL_FAIL("ImpPathForDragAndCreate::BegDrag(): ImpSdrPathDragData ist ungueltig");
+ OSL_FAIL("ImpPathForDragAndCreate::BegDrag(): ImpSdrPathDragData is invalid.");
delete mpSdrPathDragData;
((ImpPathForDragAndCreate*)this)->mpSdrPathDragData = 0;
return false;
@@ -610,7 +610,7 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
{
if(!mpSdrPathDragData || !mpSdrPathDragData->bValid)
{
- OSL_FAIL("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData ist ungueltig");
+ OSL_FAIL("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData is invalid.");
return false;
}
@@ -664,35 +664,35 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
{
mpSdrPathDragData->ResetPoly(mrSdrPathObject);
- // Div. Daten lokal Kopieren fuer weniger Code und schnelleren Zugriff
- bool bClosed =mpSdrPathDragData->bClosed ; // geschlossenes Objekt?
- sal_uInt16 nPnt =mpSdrPathDragData->nPnt ; // Punktnummer innerhalb des obigen Polygons
- bool bBegPnt =mpSdrPathDragData->bBegPnt ; // Gedraggter Punkt ist der Anfangspunkt einer Polyline
- bool bEndPnt =mpSdrPathDragData->bEndPnt ; // Gedraggter Punkt ist der Endpunkt einer Polyline
- sal_uInt16 nPrevPnt =mpSdrPathDragData->nPrevPnt ; // Index des vorherigen Punkts
- sal_uInt16 nNextPnt =mpSdrPathDragData->nNextPnt ; // Index des naechsten Punkts
- bool bPrevIsBegPnt =mpSdrPathDragData->bPrevIsBegPnt ; // Vorheriger Punkt ist Anfangspunkt einer Polyline
- bool bNextIsEndPnt =mpSdrPathDragData->bNextIsEndPnt ; // Folgepunkt ist Endpunkt einer Polyline
- sal_uInt16 nPrevPrevPnt =mpSdrPathDragData->nPrevPrevPnt ; // Index des vorvorherigen Punkts
- sal_uInt16 nNextNextPnt =mpSdrPathDragData->nNextNextPnt ; // Index des uebernaechsten Punkts
- bool bControl =mpSdrPathDragData->bControl ; // Punkt ist ein Kontrollpunkt
- bool bIsNextControl =mpSdrPathDragData->bIsNextControl; // Punkt ist Kontrollpunkt hinter einem Stuetzpunkt
- bool bPrevIsControl =mpSdrPathDragData->bPrevIsControl; // Falls nPnt ein StPnt: Davor ist ein Kontrollpunkt
- bool bNextIsControl =mpSdrPathDragData->bNextIsControl; // Falls nPnt ein StPnt: Dahinter ist ein Kontrollpunkt
-
- // Ortho bei Linien/Polygonen = Winkel beibehalten
+ // copy certain data locally to use less code and have faster access times
+ bool bClosed =mpSdrPathDragData->bClosed ; // closed object?
+ sal_uInt16 nPnt =mpSdrPathDragData->nPnt ; // number of point in the upper polygon
+ bool bBegPnt =mpSdrPathDragData->bBegPnt ; // dragged point is first point of a Polyline
+ bool bEndPnt =mpSdrPathDragData->bEndPnt ; // dragged point is last point of a Polyline
+ sal_uInt16 nPrevPnt =mpSdrPathDragData->nPrevPnt ; // index of previous point
+ sal_uInt16 nNextPnt =mpSdrPathDragData->nNextPnt ; // index of next point
+ bool bPrevIsBegPnt =mpSdrPathDragData->bPrevIsBegPnt ; // previous point is first point of a Polyline
+ bool bNextIsEndPnt =mpSdrPathDragData->bNextIsEndPnt ; // next point is last point of a Polyline
+ sal_uInt16 nPrevPrevPnt =mpSdrPathDragData->nPrevPrevPnt ; // index of the point before the previous point
+ sal_uInt16 nNextNextPnt =mpSdrPathDragData->nNextNextPnt ; // index if the point after the next point
+ bool bControl =mpSdrPathDragData->bControl ; // point is a control point
+ bool bIsNextControl =mpSdrPathDragData->bIsNextControl; // point is a control point after a support point
+ bool bPrevIsControl =mpSdrPathDragData->bPrevIsControl; // if nPnt is a support point: there's a control point before
+ bool bNextIsControl =mpSdrPathDragData->bNextIsControl; // if nPnt is a support point: there's a control point after
+
+ // Ortho for lines/polygons: keep angle
if (!bControl && rDrag.GetView()!=NULL && rDrag.GetView()->IsOrtho()) {
bool bBigOrtho=rDrag.GetView()->IsBigOrtho();
- Point aPos(rDrag.GetNow()); // die aktuelle Position
- Point aPnt(mpSdrPathDragData->aXP[nPnt]); // der gedraggte Punkt
- sal_uInt16 nPnt1=0xFFFF,nPnt2=0xFFFF; // seine Nachbarpunkte
- Point aNeuPos1,aNeuPos2; // die neuen Alternativen fuer aPos
- bool bPnt1 = false, bPnt2 = false; // die neuen Alternativen gueltig?
- if (!bClosed && mpSdrPathDragData->nPntAnz>=2) { // Mind. 2 Pt bei Linien
+ Point aPos(rDrag.GetNow()); // current position
+ Point aPnt(mpSdrPathDragData->aXP[nPnt]); // the dragged point
+ 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 (!bBegPnt) nPnt1=nPrevPnt;
if (!bEndPnt) nPnt2=nNextPnt;
}
- if (bClosed && mpSdrPathDragData->nPntAnz>=3) { // Mind. 3 Pt bei Polygon
+ if (bClosed && mpSdrPathDragData->nPntAnz>=3) { // minimum of 3 points for polygon
nPnt1=nPrevPnt;
nPnt2=nNextPnt;
}
@@ -738,14 +738,14 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
aNeuPos2.Y()+=ndy;
}
}
- if (bPnt1 && bPnt2) { // beide Alternativen vorhanden (Konkurenz)
+ if (bPnt1 && bPnt2) { // both alternatives exist (and compete)
BigInt nX1(aNeuPos1.X()-aPos.X()); nX1*=nX1;
BigInt nY1(aNeuPos1.Y()-aPos.Y()); nY1*=nY1;
BigInt nX2(aNeuPos2.X()-aPos.X()); nX2*=nX2;
BigInt nY2(aNeuPos2.Y()-aPos.Y()); nY2*=nY2;
- nX1+=nY1; // Korrekturabstand zum Quadrat
- nX2+=nY2; // Korrekturabstand zum Quadrat
- // Die Alternative mit dem geringeren Korrekturbedarf gewinnt
+ nX1+=nY1; // correction distance to square
+ nX2+=nY2; // correction distance to square
+ // let the alternative that allows fewer correction win
if (nX1<nX2) bPnt2=sal_False; else bPnt1=sal_False;
}
if (bPnt1) rDrag.Now()=aNeuPos1;
@@ -753,8 +753,7 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
}
rDrag.SetActionRect(Rectangle(rDrag.GetNow(),rDrag.GetNow()));
- // IBM Special: Punkte eliminieren, wenn die beiden angrenzenden
- // Linien eh' fast 180 deg sind.
+ // spacially for IBM: Eliminate points, if both adjoining lines form near 180 degrees angle anyway
if (!bControl && rDrag.GetView()!=NULL && rDrag.GetView()->IsEliminatePolyPoints() &&
!bBegPnt && !bEndPnt && !bPrevIsControl && !bNextIsControl)
{
@@ -767,7 +766,7 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
long nDiff=nWink1-nWink2;
nDiff=Abs(nDiff);
mpSdrPathDragData->bEliminate=nDiff<=rDrag.GetView()->GetEliminatePolyPointLimitAngle();
- if (mpSdrPathDragData->bEliminate) { // Position anpassen, damit Smooth an den Enden stimmt
+ if (mpSdrPathDragData->bEliminate) { // adapt position, Smooth is true for the ends
aPt=mpSdrPathDragData->aXP[nNextPnt];
aPt+=mpSdrPathDragData->aXP[nPrevPnt];
aPt/=2;
@@ -775,29 +774,29 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
}
}
- // Um diese Entfernung wurde insgesamt gedraggd
+ // we dragged by this distance
Point aDiff(rDrag.GetNow()); aDiff-=mpSdrPathDragData->aXP[nPnt];
- // Insgesamt sind 8 Faelle moeglich:
- // X 1. Weder rechts noch links Ctrl.
- // o--X--o 2. Rechts und links Ctrl, gedraggd wird St.
- // o--X 3. Nur links Ctrl, gedraggd wird St.
- // X--o 4. Nur rechts Ctrl, gedraggd wird St.
- // x--O--o 5. Rechts und links Ctrl, gedraggd wird links.
- // x--O 6. Nur links Ctrl, gedraggd wird links.
- // o--O--x 7. Rechts und links Ctrl, gedraggd wird rechts.
- // O--x 8. Nur rechts Ctrl, gedraggd wird rechts.
- // Zusaetzlich ist zu beachten, dass das Veraendern einer Linie (keine Kurve)
- // eine evtl. Kurve am anderen Ende der Linie bewirkt, falls dort Smooth
- // gesetzt ist (Kontrollpunktausrichtung an Gerade).
+ /* There are 8 possible cases:
+ X 1. A control point neither on the left nor on the right.
+ o--X--o 2. There are control points on the left and the right, we are dragging a support point.
+ o--X 3. There is a control point on the left, we are dragging a support point.
+ X--o 4. There is a control point on the right, we are dragging a support point.
+ x--O--o 5. There are control points on the left and the right, we are dragging the left one.
+ x--O 6. There is a control point on the left, we are dragging it.
+ o--O--x 7. There are control points on the left and the right, we are dragging the right one.
+ O--x 8. There is a control point on the right, we are dragging it.
+ Note: modifying a line (not a curve!) might create a curve on the other end of the line
+ if Smooth is set there (with control points aligned to line).
+ */
mpSdrPathDragData->aXP[nPnt]+=aDiff;
- // Nun symmetrische PlusHandles etc. checken
- if (bControl) { // Faelle 5,6,7,8
- sal_uInt16 nSt=nPnt; // der zugehoerige Stuetzpunkt
- sal_uInt16 nFix=nPnt; // der gegenueberliegende Kontrollpunkt
- if (bIsNextControl) { // Wenn der naechste ein Kontrollpunkt ist, muss der vorh. der Stuetzpunkt sein
+ // now check symmetric plus handles
+ if (bControl) { // cases 5,6,7,8
+ sal_uInt16 nSt=nPnt; // the associated support point
+ sal_uInt16 nFix=nPnt; // the opposing control point
+ if (bIsNextControl) { // if the next one is a control point, the on before has to be a support point
nSt=nPrevPnt;
nFix=nPrevPrevPnt;
} else {
@@ -809,22 +808,22 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const
}
}
- if (!bControl) { // Faelle 1,2,3,4 wobei bei 1 nix passiert und bei 3+4 unten noch mehr folgt
- // die beiden Kontrollpunkte mit verschieben
+ if (!bControl) { // Cases 1,2,3,4. In case 1, nothing happens; in cases 3 and 4, there is more following below.
+ // move both control points
if (bPrevIsControl) mpSdrPathDragData->aXP[nPrevPnt]+=aDiff;
if (bNextIsControl) mpSdrPathDragData->aXP[nNextPnt]+=aDiff;
- // Kontrollpunkt ggf. an Gerade ausrichten
+ // align control point to line, if appropriate
if (mpSdrPathDragData->aXP.IsSmooth(nPnt)) {
- if (bPrevIsControl && !bNextIsControl && !bEndPnt) { // Fall 3
+ if (bPrevIsControl && !bNextIsControl && !bEndPnt) { // case 3
mpSdrPathDragData->aXP.CalcSmoothJoin(nPnt,nNextPnt,nPrevPnt);
}
- if (bNextIsControl && !bPrevIsControl && !bBegPnt) { // Fall 4
+ if (bNextIsControl && !bPrevIsControl && !bBegPnt) { // case 4
mpSdrPathDragData->aXP.CalcSmoothJoin(nPnt,nPrevPnt,nNextPnt);
}
}
- // Und nun noch die anderen Enden der Strecken ueberpruefen (nPnt+-1).
- // Ist dort eine Kurve (IsControl(nPnt+-2)) mit SmoothJoin (nPnt+-1),
- // so muss der entsprechende Kontrollpunkt (nPnt+-2) angepasst werden.
+ // Now check the other ends of the line (nPnt+-1). If there is a
+ // curve (IsControl(nPnt+-2)) with SmoothJoin (nPnt+-1), the
+ // associated control point (nPnt+-2) has to be adapted.
if (!bBegPnt && !bPrevIsControl && !bPrevIsBegPnt && mpSdrPathDragData->aXP.IsSmooth(nPrevPnt)) {
if (mpSdrPathDragData->aXP.IsControl(nPrevPrevPnt)) {
mpSdrPathDragData->aXP.CalcSmoothJoin(nPrevPnt,nPnt,nPrevPrevPnt);
@@ -846,7 +845,7 @@ bool ImpPathForDragAndCreate::endPathDrag(SdrDragStat& rDrag)
Point aLinePt1;
Point aLinePt2;
bool bLineGlueMirror(OBJ_LINE == meObjectKind);
- if (bLineGlueMirror) { // #40549#
+ if (bLineGlueMirror) {
XPolygon& rXP=aPathPolygon[0];
aLinePt1=rXP[0];
aLinePt2=rXP[1];
@@ -854,7 +853,7 @@ bool ImpPathForDragAndCreate::endPathDrag(SdrDragStat& rDrag)
if(!mpSdrPathDragData || !mpSdrPathDragData->bValid)
{
- OSL_FAIL("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData ist ungueltig");
+ OSL_FAIL("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData is invalid.");
return false;
}
@@ -866,17 +865,17 @@ bool ImpPathForDragAndCreate::endPathDrag(SdrDragStat& rDrag)
{
const SdrHdl* pHdl=rDrag.GetHdl();
- // Referenz auf das Polygon
+ // reference the polygon
XPolygon& rXP=aPathPolygon[(sal_uInt16)pHdl->GetPolyNum()];
- // Die 5 Punkte die sich evtl. geaendert haben
+ // the 5 points that might have changed
if (!mpSdrPathDragData->bPrevIsBegPnt) rXP[mpSdrPathDragData->nPrevPrevPnt0]=mpSdrPathDragData->aXP[mpSdrPathDragData->nPrevPrevPnt];
if (!mpSdrPathDragData->bNextIsEndPnt) rXP[mpSdrPathDragData->nNextNextPnt0]=mpSdrPathDragData->aXP[mpSdrPathDragData->nNextNextPnt];
if (!mpSdrPathDragData->bBegPnt) rXP[mpSdrPathDragData->nPrevPnt0] =mpSdrPathDragData->aXP[mpSdrPathDragData->nPrevPnt];
if (!mpSdrPathDragData->bEndPnt) rXP[mpSdrPathDragData->nNextPnt0] =mpSdrPathDragData->aXP[mpSdrPathDragData->nNextPnt];
rXP[mpSdrPathDragData->nPnt0] =mpSdrPathDragData->aXP[mpSdrPathDragData->nPnt];
- // Letzter Punkt muss beim Geschlossenen immer gleich dem Ersten sein
+ // for closed objects: last point has to be equal to first point
if (mpSdrPathDragData->bClosed) rXP[rXP.GetPointCount()-1]=rXP[0];
if (mpSdrPathDragData->bEliminate)
@@ -902,7 +901,7 @@ bool ImpPathForDragAndCreate::endPathDrag(SdrDragStat& rDrag)
aPathPolygon = XPolyPolygon(aTempPolyPolygon);
}
- // Winkel anpassen fuer Text an einfacher Linie
+ // adapt angle for text beneath a simple line
if (bLineGlueMirror)
{
Point aLinePt1_(aPathPolygon[0][0]);
@@ -1010,27 +1009,27 @@ String ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag)
if(!pDragData)
{
- OSL_FAIL("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData ist ungueltig");
+ OSL_FAIL("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData is invalid.");
return String();
}
if(!pDragData->IsMultiPointDrag() && pDragData->bEliminate)
{
- // Punkt von ...
+ // point of ...
mrSdrPathObject.ImpTakeDescriptionStr(STR_ViewMarkedPoint, aStr);
- // %O loeschen
+ // delete %O
XubString aStr2(ImpGetResStr(STR_EditDelete));
- // UNICODE: Punkt von ... loeschen
+ // UNICODE: delete point of ...
aStr2.SearchAndReplaceAscii("%1", aStr);
return aStr2;
}
- // dx=0.00 dy=0.00 // Beide Seiten Bezier
- // dx=0.00 dy=0.00 l=0.00 0.00� // Anfang oder Ende oder eine Seite Bezier bzw. Hebel
- // dx=0.00 dy=0.00 l=0.00 0.00� / l=0.00 0.00� // Mittendrin
+ // dx=0.00 dy=0.00 -- both sides bezier
+ // dx=0.00 dy=0.00 l=0.00 0.00° -- one bezier/lever on one side, a start, or an ending
+ // dx=0.00 dy=0.00 l=0.00 0.00° / l=0.00 0.00° -- in between
XubString aMetr;
Point aBeg(rDrag.GetStart());
Point aNow(rDrag.GetNow());
@@ -1056,7 +1055,7 @@ String ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag)
if(pHdl->IsPlusHdl())
{
- // Hebel
+ // lever
sal_uInt16 nRef(nPntNum);
if(rXPoly.IsControl(nPntNum + 1))
@@ -1103,10 +1102,10 @@ String ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag)
nPt2 = 0;
if(bPt1 && rXPoly.IsControl(nPt1))
- bPt1 = sal_False; // Keine Anzeige
+ bPt1 = sal_False; // don't display
if(bPt2 && rXPoly.IsControl(nPt2))
- bPt2 = sal_False; // von Bezierdaten
+ bPt2 = sal_False; // of bezier data
if(bPt1)
{
@@ -1155,7 +1154,7 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::getSpecialDragPoly(const SdrDra
{
if(!mpSdrPathDragData || !mpSdrPathDragData->bValid)
{
- OSL_FAIL("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData ist ungueltig");
+ OSL_FAIL("ImpPathForDragAndCreate::MovDrag(): ImpSdrPathDragData is invalid.");
return basegfx::B2DPolyPolygon();
}
@@ -1174,22 +1173,22 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::getSpecialDragPoly(const SdrDra
aRetval.Insert(aXPoly);
return aRetval.getB2DPolyPolygon();
}
- // Div. Daten lokal Kopieren fuer weniger Code und schnelleren Zugriff
- bool bClosed =mpSdrPathDragData->bClosed ; // geschlossenes Objekt?
- sal_uInt16 nPntAnz =mpSdrPathDragData->nPntAnz ; // Punktanzahl
- sal_uInt16 nPnt =mpSdrPathDragData->nPnt ; // Punktnummer innerhalb des Polygons
- bool bBegPnt =mpSdrPathDragData->bBegPnt ; // Gedraggter Punkt ist der Anfangspunkt einer Polyline
- bool bEndPnt =mpSdrPathDragData->bEndPnt ; // Gedraggter Punkt ist der Endpunkt einer Polyline
- sal_uInt16 nPrevPnt =mpSdrPathDragData->nPrevPnt ; // Index des vorherigen Punkts
- sal_uInt16 nNextPnt =mpSdrPathDragData->nNextPnt ; // Index des naechsten Punkts
- bool bPrevIsBegPnt =mpSdrPathDragData->bPrevIsBegPnt ; // Vorheriger Punkt ist Anfangspunkt einer Polyline
- bool bNextIsEndPnt =mpSdrPathDragData->bNextIsEndPnt ; // Folgepunkt ist Endpunkt einer Polyline
- sal_uInt16 nPrevPrevPnt =mpSdrPathDragData->nPrevPrevPnt ; // Index des vorvorherigen Punkts
- sal_uInt16 nNextNextPnt =mpSdrPathDragData->nNextNextPnt ; // Index des uebernaechsten Punkts
- bool bControl =mpSdrPathDragData->bControl ; // Punkt ist ein Kontrollpunkt
- bool bIsNextControl =mpSdrPathDragData->bIsNextControl; // Punkt ist Kontrollpunkt hinter einem Stuetzpunkt
- bool bPrevIsControl =mpSdrPathDragData->bPrevIsControl; // Falls nPnt ein StPnt: Davor ist ein Kontrollpunkt
- bool bNextIsControl =mpSdrPathDragData->bNextIsControl; // Falls nPnt ein StPnt: Dahinter ist ein Kontrollpunkt
+ // 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 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
+ sal_uInt16 nPrevPnt =mpSdrPathDragData->nPrevPnt ; // index of the previous point
+ sal_uInt16 nNextPnt =mpSdrPathDragData->nNextPnt ; // index of the next point
+ bool bPrevIsBegPnt =mpSdrPathDragData->bPrevIsBegPnt ; // previous point is first point of a Polyline
+ bool bNextIsEndPnt =mpSdrPathDragData->bNextIsEndPnt ; // next point is last point of a Polyline
+ sal_uInt16 nPrevPrevPnt =mpSdrPathDragData->nPrevPrevPnt ; // index of the point before the previous point
+ sal_uInt16 nNextNextPnt =mpSdrPathDragData->nNextNextPnt ; // index of the point after the last point
+ bool bControl =mpSdrPathDragData->bControl ; // point is a control point
+ bool bIsNextControl =mpSdrPathDragData->bIsNextControl; //point is a control point after a support point
+ bool bPrevIsControl =mpSdrPathDragData->bPrevIsControl; // if nPnt is a support point: there's a control point before
+ bool bNextIsControl =mpSdrPathDragData->bNextIsControl; // if nPnt is a support point: there's a control point after
XPolygon aXPoly(mpSdrPathDragData->aXP);
XPolygon aLine1(2);
XPolygon aLine2(2);
@@ -1197,14 +1196,14 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::getSpecialDragPoly(const SdrDra
XPolygon aLine4(2);
if (bControl) {
aLine1[1]=mpSdrPathDragData->aXP[nPnt];
- if (bIsNextControl) { // bin ich Kontrollpunkt hinter der Stuetzstelle?
+ if (bIsNextControl) { // is this a control point after the support point?
aLine1[0]=mpSdrPathDragData->aXP[nPrevPnt];
aLine2[0]=mpSdrPathDragData->aXP[nNextNextPnt];
aLine2[1]=mpSdrPathDragData->aXP[nNextPnt];
if (mpSdrPathDragData->aXP.IsSmooth(nPrevPnt) && !bPrevIsBegPnt && mpSdrPathDragData->aXP.IsControl(nPrevPrevPnt)) {
aXPoly.Insert(0,rXP[mpSdrPathDragData->nPrevPrevPnt0-1],XPOLY_CONTROL);
aXPoly.Insert(0,rXP[mpSdrPathDragData->nPrevPrevPnt0-2],XPOLY_NORMAL);
- // Hebellienien fuer das gegenueberliegende Kurvensegment
+ // leverage lines for the opposing curve segment
aLine3[0]=mpSdrPathDragData->aXP[nPrevPnt];
aLine3[1]=mpSdrPathDragData->aXP[nPrevPrevPnt];
aLine4[0]=rXP[mpSdrPathDragData->nPrevPrevPnt0-2];
@@ -1212,14 +1211,14 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::getSpecialDragPoly(const SdrDra
} else {
aXPoly.Remove(0,1);
}
- } else { // ansonsten bin ich Kontrollpunkt vor der Stuetzstelle
+ } else { // else this is a control point before a support point
aLine1[0]=mpSdrPathDragData->aXP[nNextPnt];
aLine2[0]=mpSdrPathDragData->aXP[nPrevPrevPnt];
aLine2[1]=mpSdrPathDragData->aXP[nPrevPnt];
if (mpSdrPathDragData->aXP.IsSmooth(nNextPnt) && !bNextIsEndPnt && mpSdrPathDragData->aXP.IsControl(nNextNextPnt)) {
aXPoly.Insert(XPOLY_APPEND,rXP[mpSdrPathDragData->nNextNextPnt0+1],XPOLY_CONTROL);
aXPoly.Insert(XPOLY_APPEND,rXP[mpSdrPathDragData->nNextNextPnt0+2],XPOLY_NORMAL);
- // Hebellinien fuer das gegenueberliegende Kurvensegment
+ // leverage lines for the opposing curve segment
aLine3[0]=mpSdrPathDragData->aXP[nNextPnt];
aLine3[1]=mpSdrPathDragData->aXP[nNextNextPnt];
aLine4[0]=rXP[mpSdrPathDragData->nNextNextPnt0+2];
@@ -1228,7 +1227,7 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::getSpecialDragPoly(const SdrDra
aXPoly.Remove(aXPoly.GetPointCount()-1,1);
}
}
- } else { // ansonsten kein Kontrollpunkt
+ } else { // else is not a control point
if (mpSdrPathDragData->bEliminate) {
aXPoly.Remove(2,1);
}
@@ -1248,7 +1247,7 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::getSpecialDragPoly(const SdrDra
aXPoly.Remove(aXPoly.GetPointCount()-1,1);
if (bEndPnt) aXPoly.Remove(aXPoly.GetPointCount()-1,1);
}
- if (bClosed) { // "Birnenproblem": 2 Linien, 1 Kurve, alles Smooth, Punkt zw. beiden Linien wird gedraggt
+ if (bClosed) { // "pear problem": 2 lines, 1 curve, everything smoothed, a point between both lines is dragged
if (aXPoly.GetPointCount()>nPntAnz && aXPoly.IsControl(1)) {
sal_uInt16 a=aXPoly.GetPointCount();
aXPoly[a-2]=aXPoly[2]; aXPoly.SetFlags(a-2,aXPoly.GetFlags(2));
@@ -1298,7 +1297,7 @@ bool ImpPathForDragAndCreate::MovCreate(SdrDragStat& rStat)
SdrView* pView=rStat.GetView();
XPolygon& rXPoly=aPathPolygon[aPathPolygon.Count()-1];
if (pView!=NULL && pView->IsCreateMode()) {
- // ggf. auf anderes CreateTool umschalten
+ // switch to different CreateTool, if appropriate
sal_uInt16 nIdent;
sal_uInt32 nInvent;
pView->TakeCurrentObj(nIdent,nInvent);
@@ -1346,7 +1345,7 @@ bool ImpPathForDragAndCreate::MovCreate(SdrDragStat& rStat)
if (bFreeHand) {
if (pU->nBezierStartPoint>nActPoint) pU->nBezierStartPoint=nActPoint;
if (rStat.IsMouseDown() && nActPoint>0) {
- // keine aufeinanderfolgenden Punkte an zu Nahe gelegenen Positionen zulassen
+ // don't allow two consecutive points to occupy too similar positions
long nMinDist=1;
if (pView!=NULL) nMinDist=pView->GetFreeHandMinDistPix();
if (pOut!=NULL) nMinDist=pOut->PixelToLogic(Size(nMinDist,0)).Width();
@@ -1358,8 +1357,8 @@ bool ImpPathForDragAndCreate::MovCreate(SdrDragStat& rStat)
long dy=aPt0.Y()-aPt1.Y(); if (dy<0) dy=-dy;
if (dx<nMinDist && dy<nMinDist) return sal_False;
- // folgendes ist aus EndCreate kopiert (nur kleine Modifikationen)
- // und sollte dann mal in eine Methode zusammengefasst werden:
+ // TODO: the following is copied from EndCreate (with a few smaller modifications)
+ // and should be combined into a method with the code there.
if (nActPoint-pU->nBezierStartPoint>=3 && ((nActPoint-pU->nBezierStartPoint)%3)==0) {
rXPoly.PointsToBezier(nActPoint-3);
@@ -1431,7 +1430,7 @@ bool ImpPathForDragAndCreate::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
return bRet;
}
if (eCmd==SDRCREATE_NEXTPOINT || eCmd==SDRCREATE_NEXTOBJECT) {
- // keine aufeinanderfolgenden Punkte an identischer Position zulassen
+ // don't allow two consecutive points to occupy the same position
if (nActPoint==0 || rStat.Now()!=rXPoly[nActPoint-1]) {
if (bIncomp) {
if (pU->nBezierStartPoint>nActPoint) pU->nBezierStartPoint=nActPoint;
@@ -1453,10 +1452,10 @@ bool ImpPathForDragAndCreate::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
}
if (pU->IsFormFlag()) {
sal_uInt16 nPtAnz0=rXPoly.GetPointCount();
- rXPoly.Remove(nActPoint-1,2); // die letzten beiden Punkte entfernen und durch die Form ersetzen
+ 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++) { // Damit BckAction richtig funktioniert
+ for (sal_uInt16 i=nPtAnz0+1; i<nPtAnz1-1; i++) { // to make BckAction work
if (!rXPoly.IsControl(i)) rStat.NextPoint();
}
nActPoint=rXPoly.GetPointCount()-1;
@@ -1468,7 +1467,7 @@ bool ImpPathForDragAndCreate::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
if (eCmd==SDRCREATE_NEXTOBJECT) {
if (rXPoly.GetPointCount()>=2) {
pU->bBezHasCtrl0=sal_False;
- // nur einzelnes Polygon kann offen sein, deshalb schliessen
+ // only a singular polygon may be opened, so close this
rXPoly[nActPoint]=rXPoly[0];
XPolygon aXP;
aXP[0]=rStat.GetNow();
@@ -1479,7 +1478,7 @@ bool ImpPathForDragAndCreate::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
sal_uInt16 nPolyAnz=aPathPolygon.Count();
if (nPolyAnz!=0) {
- // den letzten Punkt ggf. wieder loeschen
+ // delete last point, if necessary
if (eCmd==SDRCREATE_FORCEEND) {
XPolygon& rXP=aPathPolygon[nPolyAnz-1];
sal_uInt16 nPtAnz=rXP.GetPointCount();
@@ -1499,7 +1498,7 @@ bool ImpPathForDragAndCreate::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
nPolyNum--;
XPolygon& rXP=aPathPolygon[nPolyNum];
sal_uInt16 nPtAnz=rXP.GetPointCount();
- // Polygone mit zu wenig Punkten werden geloescht
+ // delete polygons with too few points
if (nPolyNum<nPolyAnz-1 || eCmd==SDRCREATE_FORCEEND) {
if (nPtAnz<2) aPathPolygon.Remove(nPolyNum);
}
@@ -1523,16 +1522,16 @@ bool ImpPathForDragAndCreate::BckCreate(SdrDragStat& rStat)
sal_uInt16 nActPoint=rXPoly.GetPointCount();
if (nActPoint>0) {
nActPoint--;
- // Das letzte Stueck einer Bezierkurve wird erstmal zu 'ner Linie
+ // make the last part of a bezier curve a line
rXPoly.Remove(nActPoint,1);
if (nActPoint>=3 && rXPoly.IsControl(nActPoint-1)) {
- // Beziersegment am Ende sollte zwar nicht vorkommen, aber falls doch ...
+ // there should never be a bezier segment at the end, so this is just in case...
rXPoly.Remove(nActPoint-1,1);
if (rXPoly.IsControl(nActPoint-2)) rXPoly.Remove(nActPoint-2,1);
}
}
nActPoint=rXPoly.GetPointCount();
- if (nActPoint>=4) { // Kein Beziersegment am Ende
+ if (nActPoint>=4) { // no bezier segment at the end
nActPoint--;
if (rXPoly.IsControl(nActPoint-1)) {
rXPoly.Remove(nActPoint-1,1);
@@ -1588,7 +1587,7 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::TakeObjectPolyPolygon(const Sdr
if(nChangeIndex < aNewPolygon.count())
{
- // if really something was added, set the saved prev control point at the
+ // if really something was added, set the saved previous control point to the
// point where it belongs
aNewPolygon.setPrevControlPoint(nChangeIndex, aSavedPrevCtrlPoint);
}
@@ -1768,9 +1767,9 @@ void SdrPathObj::ImpForceKind()
//
// Here i again need to fix something, because when Path-Polys are Copy-Pasted
// between Apps with different measurements (e.g. 100TH_MM and TWIPS) there is
- // a scaling loop started from SdrExchangeView::Paste. This is principally nothing
+ // a scaling loop started from SdrExchangeView::Paste. In itself, this is not
// wrong, but aRect is wrong here and not even updated by RecalcSnapRect(). If
- // this is the case, some size needs to be set here in aRect to avoid that the cyclus
+ // this is the case, some size needs to be set here in aRect to avoid that the cycle
// through Rect2Poly - Poly2Rect does something badly wrong since that cycle is
// BASED on aRect. That cycle is triggered in SdrTextObj::NbcResize() which is called
// from the local Resize() implementation.
@@ -2472,7 +2471,7 @@ Point SdrPathObj::GetSnapPoint(sal_uInt32 nSnapPnt) const
sal_uInt32 nPoly,nPnt;
if(!PolyPolygonEditor::GetRelativePolyPoint(GetPathPoly(), nSnapPnt, nPoly, nPnt))
{
- DBG_ASSERT(sal_False,"SdrPathObj::GetSnapPoint: Punkt nSnapPnt nicht vorhanden!");
+ DBG_ASSERT(sal_False,"SdrPathObj::GetSnapPoint: Point nSnapPnt does not exist.");
}
const basegfx::B2DPoint aB2DPoint(GetPathPoly().getB2DPolygon(nPoly).getB2DPoint(nPnt));
@@ -2531,7 +2530,7 @@ void SdrPathObj::NbcSetPoint(const Point& rPnt, sal_uInt32 nHdlNum)
if(GetPathPoly().count())
{
// #i10659# for SdrTextObj, keep aRect up to date
- aRect = ImpGetBoundRect(GetPathPoly()); // fuer SdrTextObj#
+ aRect = ImpGetBoundRect(GetPathPoly());
}
}
@@ -2790,7 +2789,7 @@ void SdrPathObj::RestGeoData(const SdrObjGeoData& rGeo)
SdrPathObjGeoData& rPGeo=(SdrPathObjGeoData&)rGeo;
maPathPolygon=rPGeo.maPathPolygon;
meKind=rPGeo.meKind;
- ImpForceKind(); // damit u.a. bClosed gesetzt wird
+ ImpForceKind(); // to set bClosed (among other things)
}
void SdrPathObj::NbcSetPathPoly(const basegfx::B2DPolyPolygon& rPathPoly)
@@ -2820,15 +2819,15 @@ void SdrPathObj::ToggleClosed()
Rectangle aBoundRect0;
if(pUserCall != NULL)
aBoundRect0 = GetLastBoundRect();
- ImpSetClosed(!IsClosed()); // neuen ObjKind setzen
- ImpForceKind(); // wg. Line->Poly->PolyLine statt Line->Poly->Line
+ ImpSetClosed(!IsClosed()); // set new ObjKind
+ ImpForceKind(); // because we want Line -> Poly -> PolyLine instead of Line -> Poly -> Line
SetRectsDirty();
SetChanged();
BroadcastObjectChange();
SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
}
-// fuer friend class SdrPolyEditView auf einigen Compilern:
+// for friend class SdrPolyEditView in some compilers:
void SdrPathObj::SetRectsDirty(sal_Bool bNotMyself)
{
SdrTextObj::SetRectsDirty(bNotMyself);
@@ -2856,7 +2855,7 @@ void SdrPathObj::impDeleteDAC() const
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// transformation interface for StarOfficeAPI. This implements support for
-// homogen 3x3 matrices containing the transformation of the SdrObject. At the
+// homogeneous 3x3 matrices containing the transformation of the SdrObject. At the
// moment it contains a shearX, rotation and translation, but for setting all linear
// transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
//
@@ -2879,7 +2878,7 @@ sal_Bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::
if(OBJ_LINE == meKind)
{
// ignore shear and rotate, just use scale and translate
- OSL_ENSURE(GetPathPoly().count() > 0L && GetPathPoly().getB2DPolygon(0L).count() > 1L, "OBJ_LINE with too less polygons (!)");
+ OSL_ENSURE(GetPathPoly().count() > 0L && GetPathPoly().getB2DPolygon(0L).count() > 1L, "OBJ_LINE with too few polygons (!)");
// #i72287# use polygon without control points for range calculation. Do not change rPolyPolygon
// itself, else this method will no longer return the full polygon information (curve will
// be lost)
@@ -2959,7 +2958,7 @@ sal_Bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::
{
case SFX_MAPUNIT_TWIP :
{
- // postion
+ // position
aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
@@ -2992,7 +2991,7 @@ sal_Bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::
return sal_True;
}
-// sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
+// Sets the base geometry of the object using infos contained in the homogeneous 3x3 matrix.
// If it's an SdrPathObj it will use the provided geometry information. The Polygon has
// to use (0,0) as upper left and will be scaled to the given size in the matrix.
void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon)
@@ -3084,12 +3083,12 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b
if(!basegfx::fTools::equalZero(fRotate))
{
// #i78696#
- // fRotate is matematically correct for linear transformations, so it's
+ // fRotate is mathematically correct for linear transformations, so it's
// the one to use for the geometry change
aTransform.rotate(fRotate);
// #i78696#
- // fRotate is matematically correct, but aGeoStat.nDrehWink is
+ // fRotate is mathematically correct, but aGeoStat.nDrehWink is
// mirrored -> mirror value here
aGeo.nDrehWink = NormAngle360(FRound(-fRotate / F_PI18000));
aGeo.RecalcSinCos();