tdf#121258 Use correct kind of handles for legacy rectangle

Text box and rectangle have the same kind and number of handles in
'Edit Point' mode. Only that a text box has an additional handle for
its blinking frame. The error was, that this special one was not
skipped for a rectangle.

Change-Id: Iae7af3eb196e61e32ecd5a39ba0ec553bbdaaa48
Reviewed-on: https://gerrit.libreoffice.org/63070
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index e182c7e..d9b74ea 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -312,26 +312,26 @@ sal_uInt32 SdrRectObj::GetHdlCount() const

void SdrRectObj::AddToHdlList(SdrHdlList& rHdlList) const
{
    sal_Int32 nCount = IsTextFrame() ? 10 : 9;
    for(sal_Int32 nHdlNum = 0; nHdlNum < nCount; ++nHdlNum)
    // A text box has an additional (pseudo-)handle for the blinking frame.
    if(IsTextFrame())
    {
        std::unique_ptr<SdrHdl> pH;
        OSL_ENSURE(!IsTextEditActive(), "Do not use a ImpTextframeHdl for highlighting text in active text edit, this will collide with EditEngine paints (!)");
        // hack for calc grid sync to ensure the hatched area
        // for a textbox is displayed at correct position
        std::unique_ptr<SdrHdl> pH(new ImpTextframeHdl(maRect + GetGridOffset()));
        pH->SetObj(const_cast<SdrRectObj*>(this));
        pH->SetRotationAngle(aGeo.nRotationAngle);
        rHdlList.AddHdl(std::move(pH));
    }

    for(sal_Int32 nHdlNum = 1; nHdlNum <= 9; ++nHdlNum)
    {
        Point aPnt;
        SdrHdlKind eKind = SdrHdlKind::Move;

        switch(nHdlNum)
        {
            case 0:
            {
                OSL_ENSURE(!IsTextEditActive(), "Do not use a ImpTextframeHdl for highlighting text in active text edit, this will collide with EditEngine paints (!)");
                // hack for calc grid sync to ensure the hatched area
                // for a textbox is displayed at correct position
                pH.reset(new ImpTextframeHdl(maRect + GetGridOffset() ));
                pH->SetObj(const_cast<SdrRectObj*>(this));
                pH->SetRotationAngle(aGeo.nRotationAngle);
                break;
            }
            case 1:
            case 1: // Handle for changing the corner radius
            {
                long a = GetEckenradius();
                long b = std::max(maRect.GetWidth(),maRect.GetHeight())/2; // rounded up, because GetWidth() adds 1
@@ -352,22 +352,18 @@ void SdrRectObj::AddToHdlList(SdrHdlList& rHdlList) const
            case 9: aPnt=maRect.BottomRight();  eKind = SdrHdlKind::LowerRight; break;
        }

        if(!pH)
        if(aGeo.nShearAngle)
        {
            if(aGeo.nShearAngle)
            {
                ShearPoint(aPnt,maRect.TopLeft(),aGeo.nTan);
            }

            if(aGeo.nRotationAngle)
            {
                RotatePoint(aPnt,maRect.TopLeft(),aGeo.nSin,aGeo.nCos);
            }

            pH.reset(new SdrHdl(aPnt,eKind));
            pH->SetObj(const_cast<SdrRectObj*>(this));
            pH->SetRotationAngle(aGeo.nRotationAngle);
            ShearPoint(aPnt,maRect.TopLeft(),aGeo.nTan);
        }
        if(aGeo.nRotationAngle)
        {
            RotatePoint(aPnt,maRect.TopLeft(),aGeo.nSin,aGeo.nCos);
        }

        std::unique_ptr<SdrHdl> pH(new SdrHdl(aPnt,eKind));
        pH->SetObj(const_cast<SdrRectObj*>(this));
        pH->SetRotationAngle(aGeo.nRotationAngle);
        rHdlList.AddHdl(std::move(pH));
    }
}