tdf#143890: Show preview of diagonal borders / Calc

- in "Properties sidebar > Cell Appearance",
Calc shows preview of the selected cell borders.
(preview is at the bottom of "Background" text)

- this feature doesn't work for diagonal borders.

- diagonal borders preview is now shown with
this patch.

Change-Id: I9d98b045ccef5e8469cc38f08e5f14c3199d027c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120519
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index 188a638..75cb522 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -258,9 +258,9 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
                    mbBottom = true;

                if(!AllSettings::GetLayoutRTL())
                    UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, mbVer, mbHor);
                    UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR);
                else
                    UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, mbVer, mbHor);
                    UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR);

                if(mbLeft || mbRight || mbTop || mbBottom)
                    mbOuterBorder = true;
@@ -301,9 +301,9 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
                    bBottom = true;

                if(!AllSettings::GetLayoutRTL())
                    UpdateCellBorder(bTop, bBottom, bLeft, bRight, mbVer, mbHor);
                    UpdateCellBorder(bTop, bBottom, bLeft, bRight, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR);
                else
                    UpdateCellBorder(bTop, bBottom, bRight, bLeft, mbVer, mbHor);
                    UpdateCellBorder(bTop, bBottom, bRight, bLeft, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR);

                if(mbVer || mbHor || bLeft || bRight || bTop || bBottom)
                    mbInnerBorder = true;
@@ -337,6 +337,7 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
                }
            }
        }
        UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR);
        UpdateControlState();
        break;
    case SID_ATTR_BORDER_DIAG_BLTR:
@@ -363,6 +364,7 @@ void CellAppearancePropertyPanel::NotifyItemUpdate(
                }
            }
        }
        UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, mbVer, mbHor, mbDiagTLBR, mbDiagBLTR);
        UpdateControlState();
        break;
    }
@@ -464,7 +466,8 @@ void CellAppearancePropertyPanel::UpdateControlState()
    }
}

void CellAppearancePropertyPanel::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, bool bVer, bool bHor)
void CellAppearancePropertyPanel::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight,
                                                   bool bVer, bool bHor, bool bTLBR, bool bBLTR)
{
    const Size aBmpSize = maIMGCellBorder.GetBitmapEx().GetSizePixel();

@@ -488,6 +491,10 @@ void CellAppearancePropertyPanel::UpdateCellBorder(bool bTop, bool bBot, bool bL
            pVirDev->DrawLine( aVT,aVB );
        if(bHor)
            pVirDev->DrawLine( aHL,aHR );
        if(bTLBR)
            pVirDev->DrawLine( aTL,aBR );
        if(bBLTR)
            pVirDev->DrawLine( aBL,aTR );
        mxTBCellBorder->set_item_image(SETBORDERSTYLE, pVirDev);
    }
    else
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
index d695df4..412cd37 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
@@ -139,7 +139,7 @@ private:
    void Initialize();
    void SetStyleIcon();
    void UpdateControlState();
    void UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, bool bVer, bool bHor);
    void UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, bool bVer, bool bHor, bool bTLBR, bool bBLTR);
};

} // end of namespace ::sc::sidebar