summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-02 09:46:30 +0100
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-07-12 22:06:34 -0400
commitea4c1000b788c352f055c8a63dbab1a036d85715 (patch)
treeb0b0bb465b50431a4a3b6a637baf95cc48f22a6f /libreofficekit
parentd9783c485a8ac2e1996b7195824ae860778b79d5 (diff)
lokdocview: add a set_visible_area()
(cherry picked from commit 9d8b33079494cf7b5e66bd6c9d71f025efd9a653) Change-Id: Ib63959ad64fe52b648e0c0d3fe6d49fb282d57ee
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx3
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx24
2 files changed, 26 insertions, 1 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 0ba201ad33c9..aa84c0a81b60 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -422,6 +422,9 @@ static void changeZoom( GtkWidget* pButton, gpointer /* pItem */ )
if ( pDocView )
{
lok_doc_view_set_zoom( LOK_DOC_VIEW(pDocView), fZoom );
+ GdkRectangle aVisibleArea;
+ getVisibleAreaTwips(pDocView, &aVisibleArea);
+ lok_doc_view_set_visible_area(LOK_DOC_VIEW(pDocView), &aVisibleArea);
}
}
std::string aZoom = std::to_string(int(fZoom * 100)) + std::string("%");
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index c4277b462f57..f31c5b8de18a 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -13,6 +13,7 @@
#include <memory>
#include <vector>
#include <string>
+#include <sstream>
#include <iostream>
#include <boost/property_tree/json_parser.hpp>
@@ -134,6 +135,9 @@ struct LOKDocViewPrivateImpl
*/
int m_nTileSizeTwips;
+ GdkRectangle m_aVisibleArea;
+ bool m_bVisibleAreaSet;
+
LOKDocViewPrivateImpl()
: m_aLOPath(nullptr),
m_pUserProfileURL(nullptr),
@@ -173,7 +177,9 @@ struct LOKDocViewPrivateImpl
m_bInDragEndHandle(false),
m_pGraphicHandle(nullptr),
m_nViewId(0),
- m_nTileSizeTwips(0)
+ m_nTileSizeTwips(0),
+ m_aVisibleArea({0, 0, 0, 0}),
+ m_bVisibleAreaSet(false)
{
memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects));
memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles));
@@ -578,6 +584,11 @@ postKeyEventInThread(gpointer data)
priv->m_nTileSizeTwips);
priv->m_nTileSizeTwips = 0;
}
+ if (priv->m_bVisibleAreaSet)
+ {
+ // TODO invoke lok::Document::setVisibleArea() here.
+ priv->m_bVisibleAreaSet = false;
+ }
std::stringstream ss;
ss << "lok::Document::postKeyEvent(" << pLOEvent->m_nKeyEvent << ", " << pLOEvent->m_nCharCode << ", " << pLOEvent->m_nKeyCode << ")";
@@ -2689,6 +2700,17 @@ lok_doc_view_get_document (LOKDocView* pDocView)
}
SAL_DLLPUBLIC_EXPORT void
+lok_doc_view_set_visible_area (LOKDocView* pDocView, GdkRectangle* pVisibleArea)
+{
+ if (!pVisibleArea)
+ return;
+
+ LOKDocViewPrivate& priv = getPrivate(pDocView);
+ priv->m_aVisibleArea = *pVisibleArea;
+ priv->m_bVisibleAreaSet = true;
+}
+
+SAL_DLLPUBLIC_EXPORT void
lok_doc_view_set_zoom (LOKDocView* pDocView, float fZoom)
{
LOKDocViewPrivate& priv = getPrivate(pDocView);