summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-01 15:04:08 +0100
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-07-12 22:06:34 -0400
commitd9783c485a8ac2e1996b7195824ae860778b79d5 (patch)
tree528efce3c781c6baa24289e867b3e5488080dcff /libreofficekit
parent26792ee188827aede0b2cc9cd50156d9ec162d15 (diff)
lokdocview: call lok::Document::setClientZoom() after zoom change
This is similar to what is implemented in online.git's leaflet. If the zoom factor changes, then inform LOK about it on the first keyboard hit. Change-Id: I2db4ffed3897db5c852f4b8aea8f4e2d3500a25a (cherry picked from commit c84e1e2521fe0794c3bc84a2238df59a8dba93f4)
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx25
1 files changed, 24 insertions, 1 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 3e60ee6e55ca..c4277b462f57 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -128,6 +128,12 @@ struct LOKDocViewPrivateImpl
/// View ID, returned by createView() or 0 by default.
int m_nViewId;
+ /**
+ * Contains a freshly set zoom level: logic size of a tile.
+ * It gets reset back to 0 when LOK was informed about this zoom change.
+ */
+ int m_nTileSizeTwips;
+
LOKDocViewPrivateImpl()
: m_aLOPath(nullptr),
m_pUserProfileURL(nullptr),
@@ -166,7 +172,8 @@ struct LOKDocViewPrivateImpl
m_aHandleEndRect({0, 0, 0, 0}),
m_bInDragEndHandle(false),
m_pGraphicHandle(nullptr),
- m_nViewId(0)
+ m_nViewId(0),
+ m_nTileSizeTwips(0)
{
memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects));
memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles));
@@ -558,6 +565,20 @@ postKeyEventInThread(gpointer data)
LOEvent* pLOEvent = static_cast<LOEvent*>(g_task_get_task_data(task));
priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
+
+ if (priv->m_nTileSizeTwips)
+ {
+ std::stringstream ss;
+ ss << "lok::Document::setClientZoom(" << nTileSizePixels << ", " << nTileSizePixels << ", " << priv->m_nTileSizeTwips << ", " << priv->m_nTileSizeTwips << ")";
+ g_info("%s", ss.str().c_str());
+ priv->m_pDocument->pClass->setClientZoom(priv->m_pDocument,
+ nTileSizePixels,
+ nTileSizePixels,
+ priv->m_nTileSizeTwips,
+ priv->m_nTileSizeTwips);
+ priv->m_nTileSizeTwips = 0;
+ }
+
std::stringstream ss;
ss << "lok::Document::postKeyEvent(" << pLOEvent->m_nKeyEvent << ", " << pLOEvent->m_nCharCode << ", " << pLOEvent->m_nKeyCode << ")";
g_info("%s", ss.str().c_str());
@@ -2724,6 +2745,8 @@ lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom)
g_clear_error(&error);
}
g_object_unref(task);
+
+ priv->m_nTileSizeTwips = pixelToTwip(nTileSizePixels, priv->m_fZoom);
}
SAL_DLLPUBLIC_EXPORT gfloat