diff options
author | VaibhavMalik4187 <vaibhavmalik2018@gmail.com> | 2022-01-18 19:26:35 +0530 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2022-01-19 06:55:12 +0100 |
commit | 40bab1e31c7865f8c45883b8e4b684c0134b9191 (patch) | |
tree | a27945adbb2c40538a882dd38845251c019fcb33 /UnoControls | |
parent | 4a388f5e01ebb5a512931d11e48c4380382239c8 (diff) |
tdf#145614 Convert #define to enum or constexpr
Change-Id: Ib6694ec77c275c9a604abfa7d87df6ab262449b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128250
Tested-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'UnoControls')
-rw-r--r-- | UnoControls/source/base/basecontrol.cxx | 14 | ||||
-rw-r--r-- | UnoControls/source/inc/progressbar.hxx | 24 | ||||
-rw-r--r-- | UnoControls/source/inc/statusindicator.hxx | 14 |
3 files changed, 27 insertions, 25 deletions
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 |