include/vcl/outdev.hxx         |    2 ++
 include/vcl/print.hxx          |    1 +
 vcl/source/gdi/print.cxx       |   13 +++++++++++++
 vcl/source/window/decoview.cxx |   10 +---------
 4 files changed, 17 insertions(+), 9 deletions(-)

New commits:
commit bb0039ca67f84d8c46e78f4209c17d2923790140
Author:     Chris Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Sun May 24 00:40:57 2020 +1000
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue Jun 2 10:54:19 2020 +0200

    tdf#74702 vcl: extract GetButtonBorderSize()
    
    Change-Id: Ibc1818453425cbe5dac3e16bfde9dbe93beb1311
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94725
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index fb58781479c4..18c47547d44a 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -535,6 +535,8 @@ public:
 
     ///@}
 
+public:
+    virtual Size GetButtonBorderSize() { return Size(1, 1); };
 
     /** @name Direct OutputDevice drawing functions
      */
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 2a27e4c2469f..6e0fd0d15c76 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -240,6 +240,7 @@ public:
     void                        DrawGradientEx( OutputDevice* pOut, const 
tools::Rectangle& rRect,
                                     const Gradient& rGradient );
     virtual Bitmap              GetBitmap( const Point& rSrcPt, const Size& 
rSize ) const override;
+    virtual Size                GetButtonBorderSize() override;
 
     bool                        IsScreenComp() const override { return false; }
 
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index c825d25f3501..66ae9022faa8 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -946,6 +946,19 @@ void Printer::dispose()
     OutputDevice::dispose();
 }
 
+Size Printer::GetButtonBorderSize()
+{
+    Size aBrdSize(LogicToPixel(Size(20, 20), MapMode(MapUnit::Map100thMM)));
+
+    if (!aBrdSize.Width())
+        aBrdSize.setWidth(1);
+
+    if (!aBrdSize.Height())
+        aBrdSize.setHeight(1);
+
+    return aBrdSize;
+}
+
 sal_uInt32 Printer::GetCapabilities( PrinterCapType nType ) const
 {
     if ( IsDisplayPrinter() )
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 9111f74027f6..2d418a0ad486 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -480,15 +480,7 @@ void ImplDrawButton( OutputDevice *const pDev, 
tools::Rectangle aFillRect,
 
         ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
 
-        Size aBrdSize( 1, 1 );
-        if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
-        {
-            aBrdSize = pDev->LogicToPixel( Size( 20, 20 ), 
MapMode(MapUnit::Map100thMM) );
-            if ( !aBrdSize.Width() )
-                aBrdSize.setWidth( 1 );
-            if ( !aBrdSize.Height() )
-                aBrdSize.setHeight( 1 );
-        }
+        Size aBrdSize(pDev->GetButtonBorderSize());
 
         pDev->SetLineColor();
         pDev->SetFillColor( aBlackColor );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to