summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2015-11-11 10:05:25 +0100
committerAndrzej Hunt <andrzej@ahunt.org>2015-11-11 09:30:42 +0000
commit81b8ca683d44ba9c37f2dc8c74470a86ce70513f (patch)
treec190ce76fcd6dc459b16a608b794b2f53190e85d /desktop
parentee74decafeb524a014ec186a13015a8d539a763c (diff)
Implement LOK_CALLBACK_MOUSE_POINTER
Change-Id: I8d1f63208baf277b0a9d15908f3ea7ff3b56bf10 Reviewed-on: https://gerrit.libreoffice.org/19883 Reviewed-by: Andrzej Hunt <andrzej@ahunt.org> Tested-by: Andrzej Hunt <andrzej@ahunt.org>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx69
1 files changed, 69 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4523675ca4bd..6d7d079c3c37 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -66,6 +66,7 @@
#include <tools/fract.hxx>
#include <svtools/ctrltool.hxx>
#include <vcl/graphicfilter.hxx>
+#include <vcl/ptrstyle.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/virdev.hxx>
#include <vcl/ITiledRenderable.hxx>
@@ -174,6 +175,58 @@ static const ExtensionMap aDrawExtensionMap[] =
{ nullptr, nullptr }
};
+/*
+ * Map directly to css cursor styles to avoid further mapping in the client.
+ * Gtk (via gdk_cursor_new_from_name) also supports the same css cursor styles.
+ *
+ * This was created partially with help of the mappings in gtkdata.cxx.
+ * The list is incomplete as some cursor style simply aren't supported
+ * by css, it might turn out to be worth mapping some of these missing cursors
+ * to available cursors?
+ */
+static const std::map <PointerStyle, OString> aPointerMap {
+ { PointerStyle::Arrow, "default" },
+ // PointerStyle::Null ?
+ { PointerStyle::Wait, "wait" },
+ { PointerStyle::Text, "text" },
+ { PointerStyle::Help, "help" },
+ { PointerStyle::Cross, "crosshair" },
+ { PointerStyle::Move, "move" },
+ { PointerStyle::NSize, "n-resize" },
+ { PointerStyle::SSize, "s-resize" },
+ { PointerStyle::WSize, "w-resize" },
+ { PointerStyle::ESize, "e-resize" },
+ { PointerStyle::NWSize, "ne-resize" },
+ { PointerStyle::NESize, "ne-resize" },
+ { PointerStyle::SWSize, "sw-resize" },
+ { PointerStyle::SESize, "se-resize" },
+ // WindowNSize through WindowSESize
+ { PointerStyle::HSplit, "col-resize" },
+ { PointerStyle::VSplit, "row-resize" },
+ { PointerStyle::HSizeBar, "col-resize" },
+ { PointerStyle::VSizeBar, "row-resize" },
+ { PointerStyle::Hand, "grab" },
+ { PointerStyle::RefHand, "grabbing" },
+ // Pen, Magnify, Fill, Rotate
+ // HShear, VShear
+ // Mirror, Crook, Crop, MovePoint, MoveBezierWeight
+ // MoveData
+ { PointerStyle::CopyData, "copy" },
+ { PointerStyle::LinkData, "alias" },
+ // MoveDataLink, CopyDataLink
+ //MoveFile, CopyFile, LinkFile
+ // MoveFileLink, CopyFileLink, MoveFiless, CopyFiles
+ { PointerStyle::NotAllowed, "not-allowed" },
+ // DrawLine through DrawCaption
+ // Chart, Detective, PivotCol, PivotRow, PivotField, Chain, ChainNotAllowed
+ // TimeEventMove, TimeEventSize
+ // AutoScrollN through AutoScrollNSWE
+ // Airbrush
+ { PointerStyle::TextVertical, "vertical-text" }
+ // Pivot Delete, TabSelectS through TabSelectSW
+ // PaintBrush, HideWhiteSpace, ShowWhiteSpace
+};
+
static OUString getUString(const char* pString)
{
if (pString == nullptr)
@@ -1040,6 +1093,22 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX,
}
pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier);
+
+ Pointer aPointer = pDoc->getPointer();
+
+ // We don't map all possible pointers hence we need a default
+ OString aPointerString = "default";
+ auto aIt = aPointerMap.find(aPointer.GetStyle());
+ if (aIt != aPointerMap.end())
+ {
+ aPointerString = aIt->second;
+ }
+
+ LibLODocument_Impl* pLib = static_cast<LibLODocument_Impl*>(pThis);
+ if (pLib->mpCallback && pLib->mpCallbackData)
+ {
+ pLib->mpCallback(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr(), pLib->mpCallbackData);
+ }
}
static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY)