diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-07-23 08:44:14 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-08-10 03:02:52 +0200 |
commit | 9da7b1592e010928c26c43ee93b91cdd66403985 (patch) | |
tree | 213723545904c4c4549b7f635c4ac6182e0af06e /connectivity/source/inc/java | |
parent | eeeef98796df322d89912070c8e431c5f6d1283f (diff) |
sw: remove all uses of MM50 with (added) o3tl::toTwip
MM50 constant is the number of twips for 5mm. This is (ab)used as
a "shortcut" to set or compare various variables through the code
and also to set a multiplied value (like 1cm, 2cm, 4cm) or divided
value (2.5mm, 1.25mm). The problem with this is that converting the
5mm to twip doesn't round up exactly and multiplied and divided
values increase the error even more.
Instead of basing it from MM50 constant, it is just better to use
our o3tl::convert (or the added variant o3tl::toTwip), which can
actually calculate the conversion at compile time, so there is no
added complexity at runtime and we get a more readable code with
more exact result.
i.e.
o3tl::toTwip(4, o3tl::Length::cm)
instead of the more cryptic
MM50 * 8
In addition also sanitize and comment the values of the constants
in sw/inc/swtypes.hxx.
Change-Id: I85c306c36207d47ac3dc207094b68d0fb1ca5b70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119397
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'connectivity/source/inc/java')
0 files changed, 0 insertions, 0 deletions