summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-07-08 15:13:13 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-08 13:46:10 +0000
commitaf8419fa1d3cea57481e0e53518237eea2d9cdad (patch)
tree42458217ef0137430b058950d5f99e80d0b4ba21 /libreofficekit
parent5d1865293a66eb902237e70877226b7cec31105c (diff)
sw lok: add LOK_CALLBACK_VIEW_CURSOR_VISIBLE
With this, in case a text cursor is turned into a graphic selection in view#0, then view#1 can also hide the text cursor of view#0. Change-Id: I7de89b8537ef8b0985336793b719d93733604bff Reviewed-on: https://gerrit.libreoffice.org/27044 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 8bf889ff9f79..667b4d4feb98 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -83,6 +83,9 @@ struct LOKDocViewPrivateImpl
gboolean m_bCursorOverlayVisible;
/// Cursor is visible or hidden (e.g. for graphic selection).
gboolean m_bCursorVisible;
+ /// Visibility of view selections. The current view can only see / them,
+ /// can't modify them. Key is the view id.
+ std::map<int, bool> m_aViewCursorVisibilities;
/// Time of the last button press.
guint32 m_nLastButtonPressTime;
/// Time of the last button release.
@@ -324,6 +327,8 @@ callbackTypeToString (int nType)
return "LOK_CALLBACK_TEXT_SELECTION_END";
case LOK_CALLBACK_CURSOR_VISIBLE:
return "LOK_CALLBACK_CURSOR_VISIBLE";
+ case LOK_CALLBACK_VIEW_CURSOR_VISIBLE:
+ return "LOK_CALLBACK_VIEW_CURSOR_VISIBLE";
case LOK_CALLBACK_GRAPHIC_SELECTION:
return "LOK_CALLBACK_GRAPHIC_SELECTION";
case LOK_CALLBACK_GRAPHIC_VIEW_SELECTION:
@@ -1222,6 +1227,18 @@ callback (gpointer pData)
gtk_widget_queue_draw(GTK_WIDGET(pDocView));
break;
}
+ case LOK_CALLBACK_VIEW_CURSOR_VISIBLE:
+ {
+ std::stringstream aStream(pCallback->m_aPayload);
+ boost::property_tree::ptree aTree;
+ boost::property_tree::read_json(aStream, aTree);
+ int nViewId = aTree.get<int>("viewId");
+ const std::string& rVisible = aTree.get<std::string>("visible");
+ priv->m_aViewCursorVisibilities[nViewId] = rVisible == "true";
+ gtk_widget_queue_draw(GTK_WIDGET(pDocView));
+ break;
+ }
+ break;
case LOK_CALLBACK_CELL_VIEW_CURSOR:
{
std::stringstream aStream(pCallback->m_aPayload);
@@ -1523,6 +1540,10 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
{
for (auto& rPair : priv->m_aViewCursors)
{
+ auto itVisibility = priv->m_aViewCursorVisibilities.find(rPair.first);
+ if (itVisibility != priv->m_aViewCursorVisibilities.end() && !itVisibility->second)
+ continue;
+
GdkRectangle& rCursor = rPair.second;
if (rCursor.width < 30)
// Set a minimal width if it would be 0.