tdf#74702 vcl: extract DrawBorder()

Change-Id: Iba9cc10daa1b6b0ab7097145a3f40832d2165435
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94721
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 86c18f0..8c258a4 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -699,6 +699,9 @@
    SAL_DLLPRIVATE void         SetDeviceClipRegion( const vcl::Region* pRegion );
    ///@}

public:
    virtual void                DrawBorder(tools::Rectangle aBorderRect);


    /** @name Pixel functions
     */
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index e17e5e1..8c91df7 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -237,6 +237,12 @@

    bool                        IsScreenComp() const override { return false; }

    void DrawBorder(tools::Rectangle aBorderRect) override
    {
        SetLineColor(COL_BLACK);
        DrawRect(aBorderRect);
    }

protected:
    virtual void                DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
                                    const Point& rDestPt, const Size& rDestSize,
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 4c635b4..05ad965 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -50,24 +50,7 @@
    pOutDev->SetFillColor();

    // On the printer a black rectangle and on the screen one with 3D effect
    if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
        pOutDev->SetLineColor( COL_BLACK );
    else
    {
        aBorderRect.AdjustLeft(nPixel );
        aBorderRect.AdjustTop(nPixel );

        pOutDev->SetLineColor( COL_LIGHTGRAY );
        pOutDev->DrawRect( aBorderRect );

        aBorderRect.AdjustLeft( -nPixel );
        aBorderRect.AdjustTop( -nPixel );
        aBorderRect.AdjustRight( -nPixel );
        aBorderRect.AdjustBottom( -nPixel );
        pOutDev->SetLineColor( COL_GRAY );
    }

    pOutDev->DrawRect( aBorderRect );
    pOutDev->DrawBorder(aBorderRect);

    aPoint.AdjustX(nPixelWidth + 2*nPixel );
    aPoint.AdjustY(nPixelWidth + 2*nPixel );
diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx
index ecbeb12..2d8fe452 100644
--- a/vcl/source/outdev/rect.cxx
+++ b/vcl/source/outdev/rect.cxx
@@ -29,6 +29,25 @@

#include <salgdi.hxx>

void OutputDevice::DrawBorder(tools::Rectangle aBorderRect)
{
    sal_uInt16 nPixel = static_cast<sal_uInt16>(PixelToLogic(Size(1, 1)).Width());

    aBorderRect.AdjustLeft(nPixel);
    aBorderRect.AdjustTop(nPixel);

    SetLineColor(COL_LIGHTGRAY);
    DrawRect(aBorderRect);

    aBorderRect.AdjustLeft(-nPixel);
    aBorderRect.AdjustTop(-nPixel);
    aBorderRect.AdjustRight(-nPixel);
    aBorderRect.AdjustBottom(-nPixel);
    SetLineColor(COL_GRAY);

    DrawRect(aBorderRect);
}

void OutputDevice::DrawRect( const tools::Rectangle& rRect )
{
    assert(!is_double_buffered_window());