fdo#45562: paint borders in SwFlyFrm::Paint:

Painting borders of Flys in the heaven layer cannot be done correctly in
SwRootFrm::Paint, because delaying until then paints over other drawing
objects that are on top of the frame, so do it in SwFlyFrm::Paint,
like the old border painting code used to.
(regression from 804d0a896731629397c5328c13c04a45bc55f459)
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index bac034e..80ec5a1 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3025,8 +3025,6 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
                if ( bExtraData )
                    pPage->RefreshExtraData( aPaintRect );

                // have to paint frame borders added in heaven layer here...
                ProcessPrimitives(g_pBorderLines->GetBorderLines_Clear());
                DELETEZ(g_pBorderLines);
                pVout->Leave();

@@ -3741,12 +3739,28 @@ void SwCellFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
void MA_FASTCALL lcl_PaintLowerBorders( const SwLayoutFrm *pLay,
                               const SwRect &rRect, const SwPageFrm *pPage );

struct BorderLinesGuard
{
    explicit BorderLinesGuard() : m_pBorderLines(g_pBorderLines)
    {
        g_pBorderLines = new BorderLines;
    }
    ~BorderLinesGuard()
    {
        delete g_pBorderLines;
        g_pBorderLines = m_pBorderLines;
    }
private:
    BorderLines *const m_pBorderLines;
};

void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
{
    //because of the overlapping of frames and drawing objects the flys have to
    //paint their borders (and those of the internal ones) directly.
    //e.g. #33066#
    pLines->LockLines(sal_True);
    BorderLinesGuard blg; // this should not paint borders added from PaintBaBo

    SwRect aRect( rRect );
    aRect._Intersection( Frm() );
@@ -3957,6 +3971,8 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
    // and then unlock other lines.
    pLines->PaintLines( pOut );
    pLines->LockLines( sal_False );
    // have to paint frame borders added in heaven layer here...
    ProcessPrimitives(g_pBorderLines->GetBorderLines_Clear());

    pOut->Pop();