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>
This commit is contained in:
VaibhavMalik4187
2022-01-18 19:26:35 +05:30
committed by Hossein
parent 4a388f5e01
commit 40bab1e31c
6 changed files with 32 additions and 31 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 );

View File

@@ -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

View File

@@ -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; }