borderline: abstractions of primitive creations

Abstracted and adapted CreateBorderPrimitives further,
added CreateDiagFrameBorderPrimitives for diagonal
geometry.

Change-Id: Ia2b20d197e1fd29ad9e9eb40a5194efdeac9872e
diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
index d5a962a..b907958 100644
--- a/include/svx/framelink.hxx
+++ b/include/svx/framelink.hxx
@@ -429,7 +429,8 @@ SVX_DLLPUBLIC bool CheckFrameBorderConnectable(
                    |       \                       /       |
                 rLFromB      \                   /      rRFromB
 */
SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DReference CreateBorderPrimitives(
SVX_DLLPUBLIC void CreateBorderPrimitives(
    drawinglayer::primitive2d::Primitive2DContainer&    rTarget,        /// target for created primitives
    const Point&        rLPos,          /// Reference point for left end of the processed frame border.
    const Point&        rRPos,          /// Reference point for right end of the processed frame border.
    const Style&        rBorder,        /// Style of the processed frame border.
@@ -451,7 +452,8 @@ SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DReference CreateBorderPrimit
    const long          rRotationB = 9000  /// Angle of the bottom slanted frames in 100th of degree
);

SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DReference CreateBorderPrimitives(
SVX_DLLPUBLIC void CreateBorderPrimitives(
    drawinglayer::primitive2d::Primitive2DContainer&    rTarget,        /// target for created primitives
    const Point&        rLPos,          /// Reference point for left end of the processed frame border.
    const Point&        rRPos,          /// Reference point for right end of the processed frame border.
    const Style&        rBorder,        /// Style of the processed frame border.
@@ -469,6 +471,34 @@ SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DReference CreateBorderPrimit
    const long          rRotationB = 9000  /// Angle of the bottom slanted frame in 100th of degrees
);

/** Draws both diagonal frame borders, regards all connected frame styles.

One or both passed diagonal frame styles may be invisible.

The function preserves all settings of the passed output device.
*/
SVX_DLLPUBLIC void CreateDiagFrameBorderPrimitives(
    drawinglayer::primitive2d::Primitive2DContainer&    rTarget,        /// target for created primitives
    const basegfx::B2DRange&                            rRange,         /// geometrical definition for both diagonal frame borders.

    const Style&        rTLBR,          /// Style of the processed top-left to bottom-right diagonal frame border.
    const Style&        rBLTR,          /// Style of the processed bottom-left to top-right diagonal frame border.

    const Style&        rTLFromB,       /// Vertical frame border from bottom to top-left end of rTLBR.
    const Style&        rTLFromR,       /// Horizontal frame border from right to top-left end of rTLBR.
    const Style&        rBRFromT,       /// Vertical frame border from top to bottom-right end of rTLBR.
    const Style&        rBRFromL,       /// Horizontal frame border from left to bottom-right end of rTLBR.

    const Style&        rBLFromT,       /// Vertical frame border from top to bottom-left end of rBLTR.
    const Style&        rBLFromR,       /// Horizontal frame border from right to bottom-left end of rBLTR.
    const Style&        rTRFromB,       /// Vertical frame border from bottom to top-right end of rBLTR.
    const Style&        rTRFromL,       /// Horizontal frame border from left to top-right end of rBLTR.

    const Color*        pForceColor,        /// If specified, overrides frame border color.
    const long          nRotationT = 9000,  /// Angle of the top slanted frame in 100th of degrees
    const long          nRotationB = 9000   /// Angle of the bottom slanted frame in 100th of degrees
);

/** Draws a horizontal frame border, regards all connected frame styles.

    The frame style to draw is passed as parameter rBorder. The function
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index d4059c8..b6d7363 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1760,16 +1760,16 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Co
                        {
                            long nUpperRotate = lcl_getRotate( mpDoc, nTab, nX, nY - 1 );
                            drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
                            aSequence.append(
                                svx::frame::CreateBorderPrimitives(
                                    aPoints[bLayoutRTL?1:0], aPoints[bLayoutRTL?0:1], aTopLine,
                                    svx::frame::Style(),
                                    svx::frame::Style(),
                                    aLeftLine,
                                    svx::frame::Style(),
                                    svx::frame::Style(),
                                    aRightLine,
                                    pForceColor, nUpperRotate, nAttrRotate ) );
                            svx::frame::CreateBorderPrimitives(
                                aSequence,
                                aPoints[bLayoutRTL?1:0], aPoints[bLayoutRTL?0:1], aTopLine,
                                svx::frame::Style(),
                                svx::frame::Style(),
                                aLeftLine,
                                svx::frame::Style(),
                                svx::frame::Style(),
                                aRightLine,
                                pForceColor, nUpperRotate, nAttrRotate );
                            pProcessor->process(aSequence);
                        }

@@ -1777,16 +1777,16 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Co
                        {
                            long nLowerRotate = lcl_getRotate( mpDoc, nTab, nX, nY + 1 );
                            drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
                            aSequence.append(
                                svx::frame::CreateBorderPrimitives(
                                    aPoints[bLayoutRTL?2:3], aPoints[bLayoutRTL?3:2], aBottomLine,
                                    aLeftLine,
                                    svx::frame::Style(),
                                    svx::frame::Style(),
                                    aRightLine,
                                    svx::frame::Style(),
                                    svx::frame::Style(),
                                    pForceColor, 18000 - nAttrRotate, 18000 - nLowerRotate ) );
                            svx::frame::CreateBorderPrimitives(
                                aSequence,
                                aPoints[bLayoutRTL?2:3], aPoints[bLayoutRTL?3:2], aBottomLine,
                                aLeftLine,
                                svx::frame::Style(),
                                svx::frame::Style(),
                                aRightLine,
                                svx::frame::Style(),
                                svx::frame::Style(),
                                pForceColor, 18000 - nAttrRotate, 18000 - nLowerRotate );
                            pProcessor->process(aSequence);
                        }

@@ -1795,16 +1795,16 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Co
                        {
                            long nLeftRotate = lcl_getRotate( mpDoc, nTab, nX - 1, nY );
                            drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
                            aSequence.append(
                                svx::frame::CreateBorderPrimitives(
                                    aPoints[0], aPoints[3], aLeftLine,
                                    aTopLine,
                                    svx::frame::Style(),
                                    svx::frame::Style(),
                                    aBottomLine,
                                    svx::frame::Style(),
                                    svx::frame::Style(),
                                    pForceColor, nAttrRotate, nLeftRotate ) );
                            svx::frame::CreateBorderPrimitives(
                                aSequence,
                                aPoints[0], aPoints[3], aLeftLine,
                                aTopLine,
                                svx::frame::Style(),
                                svx::frame::Style(),
                                aBottomLine,
                                svx::frame::Style(),
                                svx::frame::Style(),
                                pForceColor, nAttrRotate, nLeftRotate );
                            pProcessor->process(aSequence);
                        }

@@ -1812,16 +1812,16 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Co
                        {
                            long nRightRotate = lcl_getRotate( mpDoc, nTab, nX + 1, nY );
                            drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
                            aSequence.append(
                                svx::frame::CreateBorderPrimitives(
                                    aPoints[1], aPoints[2], aRightLine,
                                    svx::frame::Style(),
                                    svx::frame::Style(),
                                    aTopLine,
                                    svx::frame::Style(),
                                    svx::frame::Style(),
                                    aBottomLine,
                                    pForceColor, 18000 - nRightRotate, 18000 - nAttrRotate ) );
                            svx::frame::CreateBorderPrimitives(
                                aSequence,
                                aPoints[1], aPoints[2], aRightLine,
                                svx::frame::Style(),
                                svx::frame::Style(),
                                aTopLine,
                                svx::frame::Style(),
                                svx::frame::Style(),
                                aBottomLine,
                                pForceColor, 18000 - nRightRotate, 18000 - nAttrRotate );
                            pProcessor->process(aSequence);
                        }
                    }
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index a22c7be..3dd1b5f 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -1415,41 +1415,138 @@ double lcl_GetExtent(
    return nCut;
}

drawinglayer::primitive2d::Primitive2DReference CreateBorderPrimitives(
        const Point& rLPos, const Point& rRPos, const Style& rBorder,
        const DiagStyle& /*rLFromTR*/, const Style& rLFromT, const Style& /*rLFromL*/, const Style& rLFromB, const DiagStyle& /*rLFromBR*/,
        const DiagStyle& /*rRFromTL*/, const Style& rRFromT, const Style& /*rRFromR*/, const Style& rRFromB, const DiagStyle& /*rRFromBL*/,
        const Color* /*pForceColor*/, long nRotateT, long nRotateB )
void CreateBorderPrimitives(
    drawinglayer::primitive2d::Primitive2DContainer& rTarget,
    const Point& rLPos,
    const Point& rRPos,
    const Style& rBorder,
    const DiagStyle& /*rLFromTR*/,
    const Style& rLFromT,
    const Style& /*rLFromL*/,
    const Style& rLFromB,
    const DiagStyle& /*rLFromBR*/,
    const DiagStyle& /*rRFromTL*/,
    const Style& rRFromT,
    const Style& /*rRFromR*/,
    const Style& rRFromB,
    const DiagStyle& /*rRFromBL*/,
    const Color* /*pForceColor*/,
    const long nRotateT,
    const long nRotateB)
{
    basegfx::B2DPoint aStart( rLPos.getX(), rLPos.getY() );
    basegfx::B2DPoint aEnd( rRPos.getX(), rRPos.getY() );
    if (rBorder.Prim() || rBorder.Secn())
    {
        basegfx::B2DPoint aStart(rLPos.getX(), rLPos.getY());
        basegfx::B2DPoint aEnd(rRPos.getX(), rRPos.getY());

    return drawinglayer::primitive2d::Primitive2DReference(
        new drawinglayer::primitive2d::BorderLinePrimitive2D(
            aStart, aEnd,
            rBorder.Prim(),
            rBorder.Dist(),
            rBorder.Secn(),
            lcl_GetExtent( rBorder, rLFromT, rLFromB, nRotateT, - nRotateB, true, false ),                  // top-left, so left for rBorder and right for left outer
            lcl_GetExtent( rBorder, rRFromT, rRFromB, 18000 - nRotateT, nRotateB - 18000, true, true ),     // top-right
            lcl_GetExtent( rBorder, rLFromB, rLFromT, nRotateB, - nRotateT, false, false ),                 // bottom-left
            lcl_GetExtent( rBorder, rRFromB, rRFromT, 18000 - nRotateB, nRotateT - 18000, false, true ),    // bottom-right
            rBorder.GetColorSecn().getBColor(),
            rBorder.GetColorPrim().getBColor(),
            rBorder.GetColorGap().getBColor(),
            rBorder.UseGapColor(), rBorder.Type(), rBorder.PatternScale()));
        rTarget.append(
            drawinglayer::primitive2d::Primitive2DReference(
                new drawinglayer::primitive2d::BorderLinePrimitive2D(
                    aStart, aEnd,
                    rBorder.Prim(),
                    rBorder.Dist(),
                    rBorder.Secn(),
                    lcl_GetExtent(rBorder, rLFromT, rLFromB, nRotateT, -nRotateB, true, false),                  // top-left, so left for rBorder and right for left outer
                    lcl_GetExtent(rBorder, rRFromT, rRFromB, 18000 - nRotateT, nRotateB - 18000, true, true),     // top-right
                    lcl_GetExtent(rBorder, rLFromB, rLFromT, nRotateB, -nRotateT, false, false),                 // bottom-left
                    lcl_GetExtent(rBorder, rRFromB, rRFromT, 18000 - nRotateB, nRotateT - 18000, false, true),    // bottom-right
                    rBorder.GetColorSecn().getBColor(),
                    rBorder.GetColorPrim().getBColor(),
                    rBorder.GetColorGap().getBColor(),
                    rBorder.UseGapColor(), rBorder.Type(), rBorder.PatternScale())));
    }
}

drawinglayer::primitive2d::Primitive2DReference CreateBorderPrimitives(
        const Point& rLPos, const Point& rRPos, const Style& rBorder,
        const Style& rLFromT, const Style& rLFromL, const Style& rLFromB,
        const Style& rRFromT, const Style& rRFromR, const Style& rRFromB,
        const Color* pForceColor, long nRotateT, long nRotateB )
void CreateBorderPrimitives(
    drawinglayer::primitive2d::Primitive2DContainer& rTarget,
    const Point& rLPos,
    const Point& rRPos,
    const Style& rBorder,
    const Style& rLFromT,
    const Style& rLFromL,
    const Style& rLFromB,
    const Style& rRFromT,
    const Style& rRFromR,
    const Style& rRFromB,
    const Color* pForceColor,
    const long nRotateT,
    const long nRotateB)
{
    return CreateBorderPrimitives( rLPos, rRPos, rBorder,
            DiagStyle(), rLFromT, rLFromL, rLFromB, DiagStyle(),
            DiagStyle(), rRFromT, rRFromR, rRFromB, DiagStyle(),
            pForceColor, nRotateT, nRotateB );
    if (rBorder.Prim() || rBorder.Secn())
    {
        CreateBorderPrimitives(
            rTarget,
            rLPos,
            rRPos,
            rBorder,
            DiagStyle(),
            rLFromT,
            rLFromL,
            rLFromB,
            DiagStyle(),
            DiagStyle(),
            rRFromT,
            rRFromR,
            rRFromB,
            DiagStyle(),
            pForceColor,
            nRotateT,
            nRotateB);
    }
}

void CreateDiagFrameBorderPrimitives(
    drawinglayer::primitive2d::Primitive2DContainer& rTarget,
    const basegfx::B2DRange& rRange,
    const Style& rTLBR,
    const Style& rBLTR,
    const Style& rTLFromB,
    const Style& rTLFromR,
    const Style& rBRFromT,
    const Style& rBRFromL,
    const Style& rBLFromT,
    const Style& rBLFromR,
    const Style& rTRFromB,
    const Style& rTRFromL,
    const Color* /*pForceColor*/,
    const long /*nRotationT*/,
    const long /*nRotationB*/)
{
    if (rTLBR.Prim())
    {
        rTarget.append(
            new drawinglayer::primitive2d::BorderLinePrimitive2D(
                rRange.getMinimum(),
                rRange.getMaximum(),
                rTLBR.Prim(),
                rTLBR.Dist(),
                rTLBR.Secn(),
                0.0, 0.0, 0.0, 0.0,
                rTLBR.GetColorSecn().getBColor(),
                rTLBR.GetColorPrim().getBColor(),
                rTLBR.GetColorGap().getBColor(),
                rTLBR.UseGapColor(),
                rTLBR.Type(),
                rTLBR.PatternScale()));
    }

    if (rBLTR.Prim())
    {
        rTarget.append(
            new drawinglayer::primitive2d::BorderLinePrimitive2D(
                basegfx::B2DPoint(rRange.getMinX(), rRange.getMaxY()),
                basegfx::B2DPoint(rRange.getMaxX(), rRange.getMinY()),
                rBLTR.Prim(),
                rBLTR.Dist(),
                rBLTR.Secn(),
                0.0, 0.0, 0.0, 0.0,
                rBLTR.GetColorSecn().getBColor(),
                rBLTR.GetColorPrim().getBColor(),
                rBLTR.GetColorGap().getBColor(),
                rBLTR.UseGapColor(),
                rBLTR.Type(),
                rBLTR.PatternScale()));
    }
}

void DrawHorFrameBorder( OutputDevice& rDev,
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
index 24f432e..09f4e3a 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -889,63 +889,48 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
    size_t nCol, nRow;

    // *** diagonal frame borders ***
    for( nRow = nFirstRow; nRow <= nLastRow; ++nRow )
    for (nRow = nFirstRow; nRow <= nLastRow; ++nRow)
    {
        for( nCol = nFirstCol; nCol <= nLastCol; ++nCol )
        for (nCol = nFirstCol; nCol <= nLastCol; ++nCol)
        {
            const Cell& rCell = CELL( nCol, nRow );
            const Cell& rCell = CELL(nCol, nRow);
            bool bOverlapX = rCell.mbOverlapX;
            bool bOverlapY = rCell.mbOverlapY;
            bool bFirstCol = nCol == nFirstCol;
            bool bFirstRow = nRow == nFirstRow;
            if( (!bOverlapX && !bOverlapY) || (bFirstCol && bFirstRow) ||
                (!bOverlapY && bFirstCol) || (!bOverlapX && bFirstRow) )
            if ((!bOverlapX && !bOverlapY) || (bFirstCol && bFirstRow) ||
                (!bOverlapY && bFirstCol) || (!bOverlapX && bFirstRow))
            {
                tools::Rectangle aRect( GetCellRect( nCol, nRow ) );
                if( (aRect.GetWidth() > 1) && (aRect.GetHeight() > 1) )
                const tools::Rectangle aRect(GetCellRect(nCol, nRow));
                if ((aRect.GetWidth() > 1) && (aRect.GetHeight() > 1))
                {
                    size_t _nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
                    size_t _nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
                    size_t _nFirstCol = mxImpl->GetMergedFirstCol(nCol, nRow);
                    size_t _nFirstRow = mxImpl->GetMergedFirstRow(nCol, nRow);
                    size_t _nLastCol = mxImpl->GetMergedLastCol(nCol, nRow);
                    size_t _nLastRow = mxImpl->GetMergedLastRow(nCol, nRow);
                    const Style& rTLBR = GetCellStyleTLBR(_nFirstCol, _nFirstRow);
                    const Style& rBLTR = GetCellStyleBLTR(_nFirstCol, _nFirstRow);

                    const Style aTlbrStyle = GetCellStyleTLBR( _nFirstCol, _nFirstRow );
                    if (aTlbrStyle.GetWidth())
                    if (rTLBR.GetWidth() || rBLTR.GetWidth())
                    {
                        drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
                        aSequence.append(
                            new drawinglayer::primitive2d::BorderLinePrimitive2D(
                                basegfx::B2DPoint(aRect.Left(), aRect.Top()),
                                basegfx::B2DPoint(aRect.Right(), aRect.Bottom()),
                                aTlbrStyle.Prim(),
                                aTlbrStyle.Dist(),
                                aTlbrStyle.Secn(),
                                0.0, 0.0, 0.0, 0.0,
                                aTlbrStyle.GetColorSecn().getBColor(),
                                aTlbrStyle.GetColorPrim().getBColor(),
                                aTlbrStyle.GetColorGap().getBColor(),
                                aTlbrStyle.UseGapColor(),
                                aTlbrStyle.Type(),
                                aTlbrStyle.PatternScale()));
                        rProcessor.process(aSequence);
                    }
                        drawinglayer::primitive2d::Primitive2DContainer aSequence;
                        const basegfx::B2DRange aRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());

                    const Style aBltrStyle = GetCellStyleBLTR( _nFirstCol, _nFirstRow );
                    if (aBltrStyle.GetWidth())
                    {
                        drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
                        aSequence.append(
                            new drawinglayer::primitive2d::BorderLinePrimitive2D(
                                basegfx::B2DPoint(aRect.Left(), aRect.Bottom()),
                                basegfx::B2DPoint(aRect.Right(), aRect.Top()),
                                aBltrStyle.Prim(),
                                aBltrStyle.Dist(),
                                aBltrStyle.Secn(),
                                0.0, 0.0, 0.0, 0.0,
                                aBltrStyle.GetColorSecn().getBColor(),
                                aBltrStyle.GetColorPrim().getBColor(),
                                aBltrStyle.GetColorGap().getBColor(),
                                aBltrStyle.UseGapColor(),
                                aBltrStyle.Type(),
                                aBltrStyle.PatternScale()));
                        CreateDiagFrameBorderPrimitives(
                            aSequence,
                            aRange,
                            rTLBR,
                            rBLTR,
                            GetCellStyleLeft(_nFirstCol, _nFirstRow),
                            GetCellStyleTop(_nFirstCol, _nFirstRow),
                            GetCellStyleRight(_nLastCol, _nLastRow),
                            GetCellStyleBottom(_nLastCol, _nLastRow),
                            GetCellStyleLeft(_nFirstCol, _nLastRow),
                            GetCellStyleBottom(_nFirstCol, _nLastRow),
                            GetCellStyleRight(_nLastCol, _nFirstRow),
                            GetCellStyleTop(_nLastCol, _nFirstRow),
                            nullptr);

                        rProcessor.process(aSequence);
                    }
                }
@@ -1000,25 +985,25 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
            {
                // draw previous frame border
                Point aEndPos( mxImpl->GetColPosition( nCol ), aStartPos.Y() );
                if (pStart->Prim() && (aStartPos.X() <= aEndPos.X()))
                if ((pStart->Prim() || pStart->Secn()) && (aStartPos.X() <= aEndPos.X()))
                {
                    drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
                    aSequence.append(
                        CreateBorderPrimitives(
                            aStartPos,
                            aEndPos,
                            *pStart,
                            aStartLFromTR,
                            *pStartLFromT,
                            *pStartLFromL,
                            *pStartLFromB,
                            aStartLFromBR,
                            aEndRFromTL,
                            *pEndRFromT,
                            *pEndRFromR,
                            *pEndRFromB,
                            aEndRFromBL,
                            pForceColor));
                    CreateBorderPrimitives(
                        aSequence,
                        aStartPos,
                        aEndPos,
                        *pStart,
                        aStartLFromTR,
                        *pStartLFromT,
                        *pStartLFromL,
                        *pStartLFromB,
                        aStartLFromBR,
                        aEndRFromTL,
                        *pEndRFromT,
                        *pEndRFromR,
                        *pEndRFromB,
                        aEndRFromBL,
                        pForceColor);
                    rProcessor.process(aSequence);
                }

@@ -1042,25 +1027,25 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,

        // draw last frame border
        Point aEndPos( mxImpl->GetColPosition( nCol ), aStartPos.Y() );
        if (pStart->Prim() && (aStartPos.X() <= aEndPos.X()))
        if ((pStart->Prim() || pStart->Secn()) && (aStartPos.X() <= aEndPos.X()))
        {
            drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
            aSequence.append(
                CreateBorderPrimitives(
                    aStartPos,
                    aEndPos,
                    *pStart,
                    aStartLFromTR,
                    *pStartLFromT,
                    *pStartLFromL,
                    *pStartLFromB,
                    aStartLFromBR,
                    aEndRFromTL,
                    *pEndRFromT,
                    *pEndRFromR,
                    *pEndRFromB,
                    aEndRFromBL,
                    pForceColor));
            CreateBorderPrimitives(
                aSequence,
                aStartPos,
                aEndPos,
                *pStart,
                aStartLFromTR,
                *pStartLFromT,
                *pStartLFromL,
                *pStartLFromB,
                aStartLFromBR,
                aEndRFromTL,
                *pEndRFromT,
                *pEndRFromR,
                *pEndRFromB,
                aEndRFromBL,
                pForceColor);
            rProcessor.process(aSequence);
        }
    }
@@ -1112,33 +1097,33 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,
            {
                // draw previous frame border
                Point aEndPos( aStartPos.X(), mxImpl->GetRowPosition( nRow ) );
                if (pStart->Prim() && (aStartPos.Y() <= aEndPos.Y()))
                if ((pStart->Prim() || pStart->Secn()) && (aStartPos.Y() <= aEndPos.Y()))
                {
                    drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
                    aSequence.append(
                        CreateBorderPrimitives(
                            // This replaces DrawVerFrameBorder which went from top to bottom. To be able to use
                            // the same method as for horizontal (CreateBorderPrimitives), the given borders
                            // have to be rearranged. Best is to look at the explanations of parameters in
                            // framelink.hxx and the former calls to DrawVerFrameBorder and it's parameters.
                            // In principle, the order of the five TFrom and BFrom has to be
                            // inverted to get the same orientation. Before, EndPos and StartPos were changed
                            // which avoids the reordering, but also leads to inverted line patters for vertical
                            // lines
                            aStartPos,
                            aEndPos,
                            *pStart,
                            aStartTFromBR,
                            *pStartTFromR,
                            *pStartTFromT,
                            *pStartTFromL,
                            aStartTFromBL,
                            aEndBFromTR,
                            *pEndBFromR,
                            *pEndBFromB,
                            *pEndBFromL,
                            aEndBFromTL,
                            pForceColor));
                    CreateBorderPrimitives(
                        // This replaces DrawVerFrameBorder which went from top to bottom. To be able to use
                        // the same method as for horizontal (CreateBorderPrimitives), the given borders
                        // have to be rearranged. Best is to look at the explanations of parameters in
                        // framelink.hxx and the former calls to DrawVerFrameBorder and it's parameters.
                        // In principle, the order of the five TFrom and BFrom has to be
                        // inverted to get the same orientation. Before, EndPos and StartPos were changed
                        // which avoids the reordering, but also leads to inverted line patters for vertical
                        // lines
                        aSequence,
                        aStartPos,
                        aEndPos,
                        *pStart,
                        aStartTFromBR,
                        *pStartTFromR,
                        *pStartTFromT,
                        *pStartTFromL,
                        aStartTFromBL,
                        aEndBFromTR,
                        *pEndBFromR,
                        *pEndBFromB,
                        *pEndBFromL,
                        aEndBFromTL,
                        pForceColor);
                    rProcessor.process(aSequence);
                }

@@ -1162,26 +1147,26 @@ void Array::DrawRange( drawinglayer::processor2d::BaseProcessor2D& rProcessor,

        // draw last frame border
        Point aEndPos( aStartPos.X(), mxImpl->GetRowPosition( nRow ) );
        if (pStart->Prim() && (aStartPos.Y() <= aEndPos.Y()))
        if ((pStart->Prim() || pStart->Secn()) && (aStartPos.Y() <= aEndPos.Y()))
        {
            drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
            aSequence.append(
                CreateBorderPrimitives(
                    // also reordered, see call to CreateBorderPrimitives above
                    aStartPos,
                    aEndPos,
                    *pStart,
                    aStartTFromBR,
                    *pStartTFromR,
                    *pStartTFromT,
                    *pStartTFromL,
                    aStartTFromBL,
                    aEndBFromTR,
                    *pEndBFromR,
                    *pEndBFromB,
                    *pEndBFromL,
                    aEndBFromTL,
                    pForceColor));
            CreateBorderPrimitives(
                // also reordered, see call to CreateBorderPrimitives above
                aSequence,
                aStartPos,
                aEndPos,
                *pStart,
                aStartTFromBR,
                *pStartTFromR,
                *pStartTFromT,
                *pStartTFromL,
                aStartTFromBL,
                aEndBFromTR,
                *pEndBFromR,
                *pEndBFromB,
                *pEndBFromL,
                aEndBFromTL,
                pForceColor);
            rProcessor.process(aSequence);
        }
    }
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index a18a473..d136f6f 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2747,35 +2747,35 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons
            if (bHori)
            {
                drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
                aSequence.append(
                    svx::frame::CreateBorderPrimitives(
                        aPaintStart,
                        aPaintEnd,
                        aStyles[ 0 ],   // current style
                        aStyles[ 1 ],   // aLFromT
                        aStyles[ 2 ],   // aLFromL
                        aStyles[ 3 ],   // aLFromB
                        aStyles[ 4 ],   // aRFromT
                        aStyles[ 5 ],   // aRFromR
                        aStyles[ 6 ],   // aRFromB
                        pTmpColor));
                svx::frame::CreateBorderPrimitives(
                    aSequence,
                    aPaintStart,
                    aPaintEnd,
                    aStyles[ 0 ],   // current style
                    aStyles[ 1 ],   // aLFromT
                    aStyles[ 2 ],   // aLFromL
                    aStyles[ 3 ],   // aLFromB
                    aStyles[ 4 ],   // aRFromT
                    aStyles[ 5 ],   // aRFromR
                    aStyles[ 6 ],   // aRFromB
                    pTmpColor);
                mrTabFrame.ProcessPrimitives(aSequence);
            }
            else
            {
                drawinglayer::primitive2d::Primitive2DContainer aSequence(1);
                aSequence.append(
                    svx::frame::CreateBorderPrimitives(
                        aPaintEnd,
                        aPaintStart,
                        aStyles[ 0 ],   // current style
                        aStyles[ 4 ],   // aBFromL
                        aStyles[ 5 ],   // aBFromB
                        aStyles[ 6 ],   // aBFromR
                        aStyles[ 1 ],   // aTFromL
                        aStyles[ 2 ],   // aTFromT
                        aStyles[ 3 ],   // aTFromR
                        pTmpColor));
                svx::frame::CreateBorderPrimitives(
                    aSequence,
                    aPaintEnd,
                    aPaintStart,
                    aStyles[ 0 ],   // current style
                    aStyles[ 4 ],   // aBFromL
                    aStyles[ 5 ],   // aBFromB
                    aStyles[ 6 ],   // aBFromR
                    aStyles[ 1 ],   // aTFromL
                    aStyles[ 2 ],   // aTFromT
                    aStyles[ 3 ],   // aTFromR
                    pTmpColor);
                mrTabFrame.ProcessPrimitives(aSequence);
            }
        }