summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-02 09:46:30 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-02 10:56:40 +0100
commit9d8b33079494cf7b5e66bd6c9d71f025efd9a653 (patch)
treed589a70ebe9611582881ef1a4d06bbd4ef4a747c /libreofficekit
parent6691d78f1df044877fdfa30dd08f0821569efc92 (diff)
lokdocview: add a set_visible_area()
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 8b7c931dc4d3..45ac17e1f134 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -440,6 +440,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 e6da63017017..dfe14a0c22d6 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -14,6 +14,7 @@
#include <vector>
#include <string>
#include <sstream>
+#include <iostream>
#include <boost/property_tree/json_parser.hpp>
#include <com/sun/star/awt/Key.hpp>
@@ -129,6 +130,9 @@ struct LOKDocViewPrivateImpl
*/
int m_nTileSizeTwips;
+ GdkRectangle m_aVisibleArea;
+ bool m_bVisibleAreaSet;
+
LOKDocViewPrivateImpl()
: m_aLOPath(nullptr),
m_aDocPath(nullptr),
@@ -166,7 +170,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));
@@ -561,6 +567,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 << ")";
@@ -2521,6 +2532,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);