summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2015-11-02 11:43:05 +0100
committerAndrzej Hunt <andrzej@ahunt.org>2015-11-05 12:54:21 +0100
commit799406068d34bb69a077fcc0548bfed002f05641 (patch)
tree277e6aecdbf8d56aeff2846256043a61795b73fa /libreofficekit
parenteda52500c72c56149c10f2ef73474b4ac1ae0552 (diff)
sc lok: Cell Cursor callback
This only works correctly for the default zoom level - since the updateLibreOfficeKitCellCursor call happens during the internal / hidden rendering, it uses the internal zoom values, which can differ from the tiled-rendering zoom values. Conflicts: include/LibreOfficeKit/LibreOfficeKitEnums.h Change-Id: Ie4f344fe771078fca10ad9d6f7a93e88fb93880a
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index dcf6d5ff77cd..9aaa5eff1b79 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -79,6 +79,7 @@ struct LOKDocViewPrivateImpl
/// Position and size of the selection end.
GdkRectangle m_aTextSelectionEnd;
GdkRectangle m_aGraphicSelection;
+ GdkRectangle m_aCellCursor;
gboolean m_bInDragGraphicSelection;
/// @name Start/middle/end handle.
@@ -140,6 +141,7 @@ struct LOKDocViewPrivateImpl
m_aTextSelectionStart({0, 0, 0, 0}),
m_aTextSelectionEnd({0, 0, 0, 0}),
m_aGraphicSelection({0, 0, 0, 0}),
+ m_aCellCursor({0, 0, 0, 0}),
m_bInDragGraphicSelection(false),
m_pHandleStart(0),
m_aHandleStartRect({0, 0, 0, 0}),
@@ -275,6 +277,8 @@ callbackTypeToString (int nType)
return "LOK_CALLBACK_CURSOR_VISIBLE";
case LOK_CALLBACK_GRAPHIC_SELECTION:
return "LOK_CALLBACK_GRAPHIC_SELECTION";
+ case LOK_CALLBACK_CELL_CURSOR:
+ return "LOK_CALLBACK_CELL_CURSOR";
case LOK_CALLBACK_HYPERLINK_CLICKED:
return "LOK_CALLBACK_HYPERLINK_CLICKED";
case LOK_CALLBACK_STATE_CHANGED:
@@ -719,6 +723,15 @@ callback (gpointer pData)
gtk_widget_queue_draw(GTK_WIDGET(pDocView));
}
break;
+ case LOK_CALLBACK_CELL_CURSOR:
+ {
+ if (pCallback->m_aPayload != "EMPTY")
+ priv->m_aCellCursor = payloadToRectangle(pDocView, pCallback->m_aPayload.c_str());
+ else
+ memset(&priv->m_aCellCursor, 0, sizeof(priv->m_aCellCursor));
+ gtk_widget_queue_draw(GTK_WIDGET(pDocView));
+ }
+ break;
case LOK_CALLBACK_HYPERLINK_CLICKED:
{
hyperlinkClicked(pDocView, pCallback->m_aPayload);
@@ -1074,6 +1087,22 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
g_free (handleGraphicPath);
}
+ if (!isEmptyRectangle(priv->m_aCellCursor))
+ {
+ cairo_set_source_rgb(pCairo, 0, 0, 0);
+ cairo_rectangle(pCairo,
+ twipToPixel(priv->m_aCellCursor.x, priv->m_fZoom),
+ twipToPixel(priv->m_aCellCursor.y, priv->m_fZoom),
+ twipToPixel(priv->m_aCellCursor.width, priv->m_fZoom),
+ twipToPixel(priv->m_aCellCursor.height, priv->m_fZoom));
+ // priv->m_aCellCursor.x - 1,
+ // priv->m_aCellCursor.y - 1,
+ // priv->m_aCellCursor.width + 2,
+ // priv->m_aCellCursor.height + 2);
+ cairo_set_line_width(pCairo, 2.0);
+ cairo_stroke(pCairo);
+ }
+
return FALSE;
}
@@ -2331,6 +2360,7 @@ lok_doc_view_reset_view(LOKDocView* pDocView)
memset(&priv->m_aTextSelectionEnd, 0, sizeof(priv->m_aTextSelectionEnd));
memset(&priv->m_aGraphicSelection, 0, sizeof(priv->m_aGraphicSelection));
priv->m_bInDragGraphicSelection = false;
+ memset(&priv->m_aCellCursor, 0, sizeof(priv->m_aCellCursor));
cairo_surface_destroy(priv->m_pHandleStart);
priv->m_pHandleStart = 0;