[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 2 commits - include/LibreOfficeKit libreofficekit/source svx/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Mar 5 03:43:43 PST 2015
include/LibreOfficeKit/LibreOfficeKitEnums.h | 11 +++++++++--
include/LibreOfficeKit/LibreOfficeKitGtk.h | 1 +
libreofficekit/source/gtk/lokdocview.c | 16 ++++++++++++++++
svx/source/svdraw/svdmrkv.cxx | 11 +++++++++++
4 files changed, 37 insertions(+), 2 deletions(-)
New commits:
commit 5a586313f0a7ab928c59260a5ee6922c77e5bd57
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Mar 5 11:57:25 2015 +0100
lokdocview: initial LOK_CALLBACK_GRAPHIC_SELECTION handling
No markers yet, but we're aware of the selection rectangle at least.
Change-Id: I92d3fc62d066e401ad19107fbbd414b1b9b26125
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index c98b612..595f888 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -58,6 +58,7 @@ struct _LOKDocView
GdkRectangle m_aTextSelectionStart;
/// Position and size of the selection end.
GdkRectangle m_aTextSelectionEnd;
+ GdkRectangle m_aGraphicSelection;
/// @name Start/middle/end handle.
///@{
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index d9f0b19..2ab8577 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -253,6 +253,7 @@ static void lok_docview_init( LOKDocView* pDocView )
pDocView->m_pTextSelectionRectangles = NULL;
memset(&pDocView->m_aTextSelectionStart, 0, sizeof(pDocView->m_aTextSelectionStart));
memset(&pDocView->m_aTextSelectionEnd, 0, sizeof(pDocView->m_aTextSelectionEnd));
+ memset(&pDocView->m_aGraphicSelection, 0, sizeof(pDocView->m_aGraphicSelection));
// Start/middle/end handle.
pDocView->m_pHandleStart = NULL;
@@ -420,6 +421,10 @@ static gboolean renderOverlay(GtkWidget* pWidget, GdkEventExpose* pEvent, gpoint
}
}
+ if (!lcl_isEmptyRectangle(&pDocView->m_aGraphicSelection))
+ {
+ }
+
cairo_destroy(pCairo);
#endif
return FALSE;
@@ -606,6 +611,8 @@ static const gchar* lcl_LibreOfficeKitCallbackTypeToString(int nType)
return "LOK_CALLBACK_TEXT_SELECTION_END";
case LOK_CALLBACK_CURSOR_VISIBLE:
return "LOK_CALLBACK_CURSOR_VISIBLE";
+ case LOK_CALLBACK_GRAPHIC_SELECTION:
+ return "LOK_CALLBACK_GRAPHIC_SELECTION";
}
return 0;
}
@@ -672,6 +679,15 @@ static gboolean lok_docview_callback(gpointer pData)
pCallback->m_pDocView->m_bCursorVisible = strcmp(pCallback->m_pPayload, "true") == 0;
}
break;
+ case LOK_CALLBACK_GRAPHIC_SELECTION:
+ {
+ if (strcmp(pCallback->m_pPayload, "EMPTY") != 0)
+ pCallback->m_pDocView->m_aGraphicSelection = lcl_payloadToRectangle(pCallback->m_pPayload);
+ else
+ memset(&pCallback->m_pDocView->m_aGraphicSelection, 0, sizeof(pCallback->m_pDocView->m_aGraphicSelection));
+ gtk_widget_queue_draw(GTK_WIDGET(pCallback->m_pDocView->pEventBox));
+ }
+ break;
default:
break;
}
commit d19e1087a6c2823ebba21b109803ab7080e24169
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Mar 5 11:32:14 2015 +0100
LOK: add LOK_CALLBACK_GRAPHIC_SELECTION API and implement it in svx
Change-Id: I4dbee4048f52f480efef4454d3714862e4ddcf4b
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index aed96d6..1cb3da4 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -43,7 +43,8 @@ typedef enum
* longer valid.
*
* Rectangle format: "width, height, x, y", where all numbers are document
- * coordinates, in twips.
+ * coordinates, in twips. When all tiles are supposed to be dropped, the
+ * format is the "EMPTY" string.
*/
LOK_CALLBACK_INVALIDATE_TILES,
/**
@@ -87,7 +88,13 @@ typedef enum
* LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR once it becomes true. Payload is
* either the "true" or the "false" string.
*/
- LOK_CALLBACK_CURSOR_VISIBLE
+ LOK_CALLBACK_CURSOR_VISIBLE,
+ /**
+ * The size and/or the position of the graphic selection changed.
+ *
+ * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ */
+ LOK_CALLBACK_GRAPHIC_SELECTION
}
LibreOfficeKitCallbackType;
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 954d35a..4485c50 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -51,6 +51,7 @@
#include <svx/svdograf.hxx>
#include <editeng/editdata.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
using namespace com::sun::star;
@@ -702,6 +703,16 @@ void SdrMarkView::SetMarkHandles()
{
Rectangle aRect(GetMarkedObjRect());
+ if (GetModel()->isTiledRendering())
+ {
+ OString sRectangle;
+ if (aRect.IsEmpty())
+ sRectangle = "EMPTY";
+ else
+ sRectangle = aRect.toString();
+ GetModel()->libreOfficeKitCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sRectangle.getStr());
+ }
+
if(!aRect.IsEmpty())
{ // otherwise nothing is found
if( bSingleTextObjMark )
More information about the Libreoffice-commits
mailing list