summaryrefslogtreecommitdiff
path: root/sw/source/filter/html/htmlplug.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-07-23 08:44:14 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-08-10 03:02:52 +0200
commit9da7b1592e010928c26c43ee93b91cdd66403985 (patch)
tree213723545904c4c4549b7f635c4ac6182e0af06e /sw/source/filter/html/htmlplug.cxx
parenteeeef98796df322d89912070c8e431c5f6d1283f (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 'sw/source/filter/html/htmlplug.cxx')
-rw-r--r--sw/source/filter/html/htmlplug.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 9ae5abc57095..e3cb057759d5 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -83,11 +83,12 @@
using namespace com::sun::star;
-#define HTML_DFLT_EMBED_WIDTH ((MM50*5)/2)
-#define HTML_DFLT_EMBED_HEIGHT ((MM50*5)/2)
-#define HTML_DFLT_APPLET_WIDTH ((MM50*5)/2)
-#define HTML_DFLT_APPLET_HEIGHT ((MM50*5)/2)
+#define HTML_DFLT_EMBED_WIDTH (o3tl::toTwips(125, o3tl::Length::mm10))
+#define HTML_DFLT_EMBED_HEIGHT (o3tl::toTwips(125, o3tl::Length::mm10))
+
+#define HTML_DFLT_APPLET_WIDTH (o3tl::toTwips(125, o3tl::Length::mm10))
+#define HTML_DFLT_APPLET_HEIGHT (o3tl::toTwips(125, o3tl::Length::mm10))
const HtmlFrmOpts HTML_FRMOPTS_EMBED_ALL =