diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-07-21 23:16:28 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-07-24 07:10:31 +0200 |
commit | 77a192aa016279acc0b0f9df584d1ce31bde41a4 (patch) | |
tree | 97f81b6d3f70a0e95f85226275e81afb447f76f1 /sw | |
parent | cb2827f5f65324f309fa0e3c30d0b19ad237410e (diff) |
sw: define to constexpr, use MM50 from svx and use o3tl::convert
MM50 is a constant representing 0.5cm in twips. Use o3tl::convert
for to init the constant instead. It matches the constant which I
checked with a static_assert.
Change-Id: Ib6c37a44ef5b22258e913fd3809a37ab0d18671b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119396
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/swtypes.hxx | 29 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/conform.cxx | 8 |
2 files changed, 18 insertions, 19 deletions
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx index e76b521b1f8b..dd15ce03bb88 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -27,6 +27,7 @@ #include <o3tl/typed_flags_set.hxx> #include <i18nlangtag/lang.h> #include <vcl/outdev.hxx> +#include <svx/flagsdef.hxx> namespace com::sun::star { namespace linguistic2{ @@ -52,30 +53,28 @@ typedef tools::Long SwTwips; #define INVALID_TWIPS LONG_MAX #define TWIPS_MAX (LONG_MAX - 1) -#define MM50 283 // 1/2 cm in TWIPS. +constexpr sal_Int32 COMPLETE_STRING = SAL_MAX_INT32; -const sal_Int32 COMPLETE_STRING = SAL_MAX_INT32; - -const SwTwips cMinHdFtHeight = 56; +constexpr SwTwips cMinHdFtHeight = 56; #define MINFLY 23 // Minimal size for FlyFrames. #define MINLAY 23 // Minimal size for other Frames. // Default column distance of two text columns corresponds to 0.3 cm. -#define DEF_GUTTER_WIDTH (MM50 / 5 * 3) +constexpr SwTwips DEF_GUTTER_WIDTH = MM50 / 5 * 3; // Minimal distance (distance to text) for border attribute // in order not to crock up aligned lines. // 28 Twips == 0,4mm -#define MIN_BORDER_DIST 28 +constexpr SwTwips MIN_BORDER_DIST = 28; // Minimal document border: 20mm. -const SwTwips lMinBorder = 1134; +constexpr SwTwips lMinBorder = 1134; // Margin left and above document. // Half of it is gap between the pages. //TODO: Replace with SwViewOption::defDocumentBorder -#define DOCUMENTBORDER 284 +constexpr SwTwips DOCUMENTBORDER = 284; // For inserting of captions (what and where to insert). // It's here because it is not big enough to justify its own hxx @@ -88,19 +87,19 @@ enum class SwLabelType Draw // Caption for a draw object. }; -const sal_uInt8 MAXLEVEL = 10; +constexpr sal_uInt8 MAXLEVEL = 10; -const sal_uInt8 NO_NUMLEVEL = 0x20; // "or" with the levels. +constexpr sal_uInt8 NO_NUMLEVEL = 0x20; // "or" with the levels. // Values for indents at numbering and bullet lists. // (For more levels the values have to be multiplied with the levels+1; // levels 0 ..4!) -const short lBulletIndent = 1440/4; -const short lBulletFirstLineOffset = -lBulletIndent; -const sal_uInt16 lNumberIndent = 1440/4; -const short lNumberFirstLineOffset = -lNumberIndent; -const short lOutlineMinTextDistance = 216; // 0.15 inch = 0.38 cm +constexpr short lBulletIndent = 1440 / 4; +constexpr short lBulletFirstLineOffset = -lBulletIndent; +constexpr sal_uInt16 lNumberIndent = 1440 / 4; +constexpr short lNumberFirstLineOffset = -lNumberIndent; +constexpr short lOutlineMinTextDistance = 216; // 0.15 inch = 0.38 cm // Count of SystemField-types of SwDoc. #define INIT_FLDTYPES 33 diff --git a/sw/source/uibase/ribbar/conform.cxx b/sw/source/uibase/ribbar/conform.cxx index 393896e22d27..f51e9123ca40 100644 --- a/sw/source/uibase/ribbar/conform.cxx +++ b/sw/source/uibase/ribbar/conform.cxx @@ -91,10 +91,10 @@ void ConstFormControl::CreateDefaultObject() { Point aStartPos(GetDefaultCenterPos()); Point aEndPos(aStartPos); - aStartPos.AdjustX( -(2 * MM50) ); - aStartPos.AdjustY( -(MM50) ); - aEndPos.AdjustX(2 * MM50 ); - aEndPos.AdjustY(MM50 ); + aStartPos.AdjustX(-(2 * MM50)); + aStartPos.AdjustY(-MM50); + aEndPos.AdjustX(2 * MM50); + aEndPos.AdjustY(MM50); if(!m_pSh->HasDrawView()) m_pSh->MakeDrawView(); |