Related: #i123048# Corrected connector layout after reload

(cherry picked from commit c7d96eed93415894c5ca4522bd32ca06acd88233)

Conflicts:
	svx/inc/svx/svdoedge.hxx
	svx/source/svdraw/svdoedge.cxx

Change-Id: Id388fa7396751a2e8b5908373ca57eceee1a1af1
diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx
index a7469be..580cf1e 100644
--- a/include/svx/svdoedge.hxx
+++ b/include/svx/svdoedge.hxx
@@ -182,6 +182,10 @@ protected:
    // is running, the flag is set, else it is always sal_False.
    unsigned                    mbBoundRectCalculationRunning : 1;

    // #i123048# need to remember if layouting was suppressed before to get
    // to a correct state for first real layouting
    unsigned                    mbSuppressed : 1;

public:
    // #109007#
    // Interface to default connect suppression
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 9cd1071..afb70f3 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -174,7 +174,8 @@ SdrEdgeObj::SdrEdgeObj()
    bEdgeTrackUserDefined(sal_False),
    // Default is to allow default connects
    mbSuppressDefaultConnect(sal_False),
    mbBoundRectCalculationRunning(sal_False)
    mbBoundRectCalculationRunning(sal_False),
    mbSuppressed(false)
{
    bClosedObj=sal_False;
    bIsEdge=sal_True;
@@ -546,12 +547,20 @@ void SdrEdgeObj::ImpUndirtyEdgeTrack()

void SdrEdgeObj::ImpRecalcEdgeTrack()
{
    // #i120437# if bEdgeTrackUserDefined, do not recalculate. Also not when model locked
    if(bEdgeTrackUserDefined || !GetModel() || GetModel()->isLocked())
    // #i120437# if bEdgeTrackUserDefined, do not recalculate
    if(bEdgeTrackUserDefined)
    {
        return;
    }

    // #i120437# also not when model locked during import, but remember
    if(!GetModel() || GetModel()->isLocked())
    {
        mbSuppressed = true;
        return;
    }

    // #i110649#
    if(IsBoundRectCalculationRunning())
    {
        // This object is involved into another ImpRecalcEdgeTrack() call
@@ -559,20 +568,20 @@ void SdrEdgeObj::ImpRecalcEdgeTrack()
        // Also, do not change bEdgeTrackDirty so that it gets recalculated
        // later at the first non-looping call.
    }
    // #i43068#
    else if(GetModel() && GetModel()->isLocked())
    {
        // avoid re-layout during imports/API call sequences
        // #i45294# but calculate EdgeTrack and secure properties there
        mbBoundRectCalculationRunning = sal_True;
        *pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo);
        ImpSetAttrToEdgeInfo();
        bEdgeTrackDirty=sal_False;
        mbBoundRectCalculationRunning = sal_False;
    }
    else
    {
        // To not run in a depth loop, use a coloring algorithm on
        if(mbSuppressed)
        {
            // #i123048# If layouting was ever suppressed, it needs to be done once
            // and the attr need to be set at EdgeInfo, else these attr *will be lost*
            // in the following call to ImpSetEdgeInfoToAttr() sice they were never
            // set before (!)
            *pEdgeTrack=ImpCalcEdgeTrack(*pEdgeTrack,aCon1,aCon2,&aEdgeInfo);
            ImpSetAttrToEdgeInfo();
            mbSuppressed = false;
        }

        // To not run in a depth loop, use a coloring algorythm on
        // SdrEdgeObj BoundRect calculations
        mbBoundRectCalculationRunning = sal_True;