diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-01 15:04:08 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-01 18:56:23 +0100 |
commit | c84e1e2521fe0794c3bc84a2238df59a8dba93f4 (patch) | |
tree | 356e0b5e5f989d96a29d49c98b2001bdbb41e703 /libreofficekit/source | |
parent | dfe5531ec8eaf9665248eb332f33ddfecd04d588 (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
Diffstat (limited to 'libreofficekit/source')
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index afb347f62e83..e6da63017017 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -123,6 +123,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_aDocPath(nullptr), @@ -159,7 +165,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)); @@ -541,6 +548,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()); @@ -2556,6 +2577,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 |