UnoControls/source/base/basecontrol.cxx    |   14 +++++++-------
 UnoControls/source/inc/progressbar.hxx     |   24 +++++++++++++-----------
 UnoControls/source/inc/statusindicator.hxx |   14 +++++++-------
 basctl/source/inc/bastypes.hxx             |    4 ++--
 basctl/source/inc/dlged.hxx                |    5 ++---
 basegfx/source/workbench/bezierclip.hxx    |    2 +-
 6 files changed, 32 insertions(+), 31 deletions(-)

New commits:
commit 40bab1e31c7865f8c45883b8e4b684c0134b9191
Author:     VaibhavMalik4187 <vaibhavmalik2...@gmail.com>
AuthorDate: Tue Jan 18 19:26:35 2022 +0530
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Wed Jan 19 06:55:12 2022 +0100

    tdf#145614 Convert #define to enum or constexpr
    
    Change-Id: Ib6694ec77c275c9a604abfa7d87df6ab262449b6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128250
    Tested-by: Hossein <hoss...@libreoffice.org>
    Reviewed-by: Hossein <hoss...@libreoffice.org>

diff --git a/UnoControls/source/base/basecontrol.cxx 
b/UnoControls/source/base/basecontrol.cxx
index da80678307b7..c2e2f23b12b0 100644
--- a/UnoControls/source/base/basecontrol.cxx
+++ b/UnoControls/source/base/basecontrol.cxx
@@ -38,13 +38,13 @@ using namespace ::com::sun::star::awt;
 
 namespace unocontrols {
 
-#define DEFAULT_X                           0
-#define DEFAULT_Y                           0
-#define DEFAULT_WIDTH                       100
-#define DEFAULT_HEIGHT                      100
-#define DEFAULT_VISIBLE                     false
-#define DEFAULT_INDESIGNMODE                false
-#define DEFAULT_ENABLE                      true
+constexpr sal_Int32 DEFAULT_X = 0;
+constexpr sal_Int32 DEFAULT_Y = 0;
+constexpr sal_Int32 DEFAULT_WIDTH = 100;
+constexpr sal_Int32 DEFAULT_HEIGHT = 100;
+constexpr bool DEFAULT_VISIBLE = false;
+constexpr bool DEFAULT_INDESIGNMODE = false;
+constexpr bool DEFAULT_ENABLE = true;
 
 //  construct/destruct
 
diff --git a/UnoControls/source/inc/progressbar.hxx 
b/UnoControls/source/inc/progressbar.hxx
index dca88b90c4b4..d31758b1cff9 100644
--- a/UnoControls/source/inc/progressbar.hxx
+++ b/UnoControls/source/inc/progressbar.hxx
@@ -21,23 +21,25 @@
 
 #include <com/sun/star/awt/XProgressBar.hpp>
 
+#include <climits>
+
 #include <tools/color.hxx>
 
 #include <basecontrol.hxx>
 
 namespace unocontrols {
 
-#define PROGRESSBAR_FREESPACE               4
-#define PROGRESSBAR_DEFAULT_HORIZONTAL      true
-#define PROGRESSBAR_DEFAULT_BLOCKDIMENSION  Size(1,1)
-#define PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR Color( 0xC0, 0xC0, 0xC0 ) // 
lightgray
-#define PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR Color( 0x00, 0x00, 0x80 ) // blue
-#define PROGRESSBAR_DEFAULT_MINRANGE        INT_MIN
-#define PROGRESSBAR_DEFAULT_MAXRANGE        INT_MAX
-#define PROGRESSBAR_DEFAULT_BLOCKVALUE      1
-#define PROGRESSBAR_DEFAULT_VALUE           PROGRESSBAR_DEFAULT_MINRANGE
-#define PROGRESSBAR_LINECOLOR_BRIGHT        sal_Int32(Color( 0xFF, 0xFF, 0xFF 
)) // white
-#define PROGRESSBAR_LINECOLOR_SHADOW        sal_Int32(Color( 0x00, 0x00, 0x00 
)) // black
+#define PROGRESSBAR_DEFAULT_BLOCKDIMENSION Size(1,1)
+constexpr Color PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR = COL_BLUE;
+constexpr Color PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR = COL_LIGHTGRAY;
+constexpr bool PROGRESSBAR_DEFAULT_HORIZONTAL = true;
+constexpr auto PROGRESSBAR_FREESPACE = 4;
+constexpr auto PROGRESSBAR_DEFAULT_MINRANGE = INT_MIN;
+constexpr auto PROGRESSBAR_DEFAULT_MAXRANGE = INT_MAX;
+constexpr auto PROGRESSBAR_DEFAULT_VALUE = INT_MIN;
+constexpr auto PROGRESSBAR_DEFAULT_BLOCKVALUE = 1;
+constexpr sal_Int32 PROGRESSBAR_LINECOLOR_BRIGHT = sal_Int32(COL_WHITE);
+constexpr sal_Int32 PROGRESSBAR_LINECOLOR_SHADOW = sal_Int32(COL_BLACK);
 
 class ProgressBar final : public css::awt::XControlModel
                     , public css::awt::XProgressBar
diff --git a/UnoControls/source/inc/statusindicator.hxx 
b/UnoControls/source/inc/statusindicator.hxx
index e1930e9da808..34bce92bee85 100644
--- a/UnoControls/source/inc/statusindicator.hxx
+++ b/UnoControls/source/inc/statusindicator.hxx
@@ -22,7 +22,7 @@
 #include <com/sun/star/awt/XLayoutConstrains.hpp>
 #include <com/sun/star/task/XStatusIndicator.hpp>
 #include <rtl/ref.hxx>
-
+#include <tools/color.hxx>
 #include <basecontainercontrol.hxx>
 
 namespace com::sun::star::awt { class XControlModel; }
@@ -35,12 +35,12 @@ namespace unocontrols {
 
 class ProgressBar;
 
-#define STATUSINDICATOR_FREEBORDER              5                              
                         // border around and between the controls
-#define STATUSINDICATOR_BACKGROUNDCOLOR         sal_Int32(Color( 0xC0, 0xC0, 
0xC0 ))              // lightgray
-#define STATUSINDICATOR_LINECOLOR_BRIGHT        sal_Int32(Color( 0xFF, 0xFF, 
0xFF ))              // white
-#define STATUSINDICATOR_LINECOLOR_SHADOW        sal_Int32(Color( 0x00, 0x00, 
0x00 ))              // black
-#define STATUSINDICATOR_DEFAULT_WIDTH           300
-#define STATUSINDICATOR_DEFAULT_HEIGHT          25
+constexpr auto  STATUSINDICATOR_FREEBORDER = 5; // border around and between 
the controls
+constexpr auto STATUSINDICATOR_DEFAULT_WIDTH = 300;
+constexpr auto STATUSINDICATOR_DEFAULT_HEIGHT = 25;
+constexpr sal_Int32 STATUSINDICATOR_BACKGROUNDCOLOR = sal_Int32(COL_LIGHTGRAY);
+constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_BRIGHT = sal_Int32(COL_WHITE);
+constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_SHADOW = sal_Int32(COL_BLACK);
 
 class StatusIndicator final : public css::awt::XLayoutConstrains
                         , public css::task::XStatusIndicator
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index e150635befb7..f2e989aeb145 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -49,8 +49,8 @@ class Layout;
 class ModulWindow;
 class DialogWindow;
 
-#define LINE_SEP_CR     0x0D
-#define LINE_SEP        0x0A
+constexpr auto LINE_SEP_CR = 0x0D;
+constexpr auto LINE_SEP = 0x0A;
 
 // Implementation: baside2b.cxx
 sal_Int32 searchEOL( const OUString& rStr, sal_Int32 fromIndex );
diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx
index 82d3a14f605d..9e5147dfcfc2 100644
--- a/basctl/source/inc/dlged.hxx
+++ b/basctl/source/inc/dlged.hxx
@@ -48,9 +48,8 @@ namespace basctl
 
 class DialogWindowLayout;
 
-#define DLGED_PAGE_WIDTH_MIN    1280
-#define DLGED_PAGE_HEIGHT_MIN   1024
-
+constexpr auto DLGED_PAGE_WIDTH_MIN = 1280;
+constexpr auto DLGED_PAGE_HEIGHT_MIN = 1024;
 
 // DlgEdHint
 
diff --git a/basegfx/source/workbench/bezierclip.hxx 
b/basegfx/source/workbench/bezierclip.hxx
index 36d2f89a893f..54cceb414f33 100644
--- a/basegfx/source/workbench/bezierclip.hxx
+++ b/basegfx/source/workbench/bezierclip.hxx
@@ -73,7 +73,7 @@ template <typename NumType> NumType absval( NumType x )
 Polygon2D convexHull( const Polygon2D& rPoly );
 
 // TODO: find proper epsilon here (try 
std::numeric_limits<NumType>::epsilon()?)!
-#define DBL_EPSILON 1.0e-100
+constexpr auto DBL_EPSILON = 1.0e-100;
 
 /* little approximate comparisons */
 template <typename NumType> bool tolZero( NumType n ) { return fabs(n) < 
DBL_EPSILON; }

Reply via email to