summaryrefslogtreecommitdiff
path: root/libreofficekit/qa
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-11-14 00:09:43 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-11-13 23:38:37 +0100
commit7b8f630db30ee0066a9f4b6e540368d2fcad7fa8 (patch)
treee40626d45db8a228defeca6e66aba9055974d0a6 /libreofficekit/qa
parent44f20abf66ce3f9806ad95522d7d9ae698350499 (diff)
Use o3tl::convert
Change-Id: I78db3001d602ec1a0847785b3c127b9d345f5af7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125173 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'libreofficekit/qa')
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx28
1 files changed, 8 insertions, 20 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index a67d3427eae5..4d889645b2fc 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -20,6 +20,8 @@
#include "gtv-lok-dialog.hxx"
#include <com/sun/star/awt/Key.hpp>
+
+#include <o3tl/unit_conversion.hxx>
#include <vcl/event.hxx>
namespace {
@@ -83,20 +85,6 @@ getPrivate(GtvLokDialog* dialog)
return static_cast<GtvLokDialogPrivate*>(gtv_lok_dialog_get_instance_private(dialog));
}
-static float
-pixelToTwip(float fInput)
-{
- return (fInput / 96 / 1.0 /* zoom */) * 1440.0f;
-}
-
-#if 0
-static float
-twipToPixel(float fInput)
-{
- return fInput / 1440.0f * 96 * 1.0 /* zoom */;
-}
-#endif
-
static void
gtv_lok_dialog_draw(GtkWidget* pDialogDrawingArea, cairo_t* pCairo, gpointer)
{
@@ -235,8 +223,8 @@ gtv_lok_dialog_signal_motion(GtkWidget* pDialogDrawingArea, GdkEventButton* pEve
g_info("lok_dialog_signal_motion: %d, %d (in twips: %d, %d)",
static_cast<int>(pEvent->x), static_cast<int>(pEvent->y),
- static_cast<int>(pixelToTwip(pEvent->x)),
- static_cast<int>(pixelToTwip(pEvent->y)));
+ static_cast<int>(o3tl::toTwips(pEvent->x, o3tl::Length::px)),
+ static_cast<int>(o3tl::toTwips(pEvent->y, o3tl::Length::px)));
pDocument->pClass->postWindowMouseEvent(pDocument,
priv->dialogid,
@@ -531,8 +519,8 @@ gtv_lok_dialog_floating_win_signal_button(GtkWidget* /*pDialogChildDrawingArea*/
g_info("lok_dialog_floating_win_signal_button (type: %s): %d, %d (in twips: %d, %d)",
aEventType.c_str(),
static_cast<int>(pEvent->x), static_cast<int>(pEvent->y),
- static_cast<int>(pixelToTwip(pEvent->x)),
- static_cast<int>(pixelToTwip(pEvent->y)));
+ static_cast<int>(o3tl::toTwips(pEvent->x, o3tl::Length::px)),
+ static_cast<int>(o3tl::toTwips(pEvent->y, o3tl::Length::px)));
switch (pEvent->type)
{
@@ -614,8 +602,8 @@ gtv_lok_dialog_floating_win_signal_motion(GtkWidget* /*pDialogDrawingArea*/, Gdk
g_info("lok_dialog_floating_win_signal_motion: %d, %d (in twips: %d, %d)",
static_cast<int>(pEvent->x), static_cast<int>(pEvent->y),
- static_cast<int>(pixelToTwip(pEvent->x)),
- static_cast<int>(pixelToTwip(pEvent->y)));
+ static_cast<int>(o3tl::toTwips(pEvent->x, o3tl::Length::px)),
+ static_cast<int>(o3tl::toTwips(pEvent->y, o3tl::Length::px)));
pDocument->pClass->postWindowMouseEvent(pDocument,
priv->m_nChildId,