diff options
-rw-r--r-- | desktop/source/lib/init.cxx | 70 | ||||
-rw-r--r-- | include/vcl/IDialogRenderable.hxx | 2 | ||||
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 61 | ||||
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/mouse.cxx | 17 |
6 files changed, 85 insertions, 73 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d102d91d23f6..143ec46fdc63 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -194,57 +194,6 @@ 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::Fill, "fill" }, - { 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 - // AutoScrollN through AutoScrollNSWE - { PointerStyle::TextVertical, "vertical-text" } - // Pivot Delete, TabSelectS through TabSelectSW - // PaintBrush, HideWhiteSpace, ShowWhiteSpace -}; - static OUString getUString(const char* pString) { if (pString == nullptr) @@ -2503,25 +2452,6 @@ 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); - int nView = SfxLokHelper::getView(); - if (nView < 0) - return; - - if (pLib->mpCallbackFlushHandlers[nView]) - { - pLib->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr()); - } } static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nX, int nY, int nCount, int nButtons, int nModifier) diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx index ef8d42a4a46c..a2c9b8416ccd 100644 --- a/include/vcl/IDialogRenderable.hxx +++ b/include/vcl/IDialogRenderable.hxx @@ -34,6 +34,8 @@ public: virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const std::vector<LOKPayloadItem>& rPayload = std::vector<LOKPayloadItem>()) const = 0; + + virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const = 0; }; } // namespace vcl diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index 5a7034d476d0..ab7b4f027a45 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -15,11 +15,72 @@ #include <tools/gen.hxx> #include <svx/ruler.hxx> #include <vcl/pointr.hxx> +#include <vcl/ptrstyle.hxx> #include <vcl/virdev.hxx> #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp> namespace vcl { + /* + * 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? + */ +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning( disable : 4592) +#endif + static const std::map <PointerStyle, OString> gaLOKPointerMap { + { PointerStyle::Arrow, "default" }, + // PointerStyle::Null ? + { PointerStyle::Wait, "wait" }, + { PointerStyle::Text, "text" }, + { PointerStyle::Help, "help" }, + { PointerStyle::Cross, "crosshair" }, + { PointerStyle::Fill, "fill" }, + { 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 + }; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + class VCL_DLLPUBLIC ITiledRenderable { diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 7ac4f6121d89..2eba19977076 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -316,6 +316,7 @@ void ScTiledRenderingTest::testSortAscendingDescending() pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, 551, 129, 1, MOUSE_LEFT, 0); pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, 820, 1336, 1, MOUSE_LEFT, 0); pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, 820, 1359, 1, MOUSE_LEFT, 0); + Scheduler::ProcessEventsToIdle(); // sort ascending uno::Sequence<beans::PropertyValue> aArgs; @@ -865,6 +866,7 @@ void ScTiledRenderingTest::testGraphicInvalidate() aView.m_bGraphicSelection = false; pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, /*x=*/ 1,/*y=*/ 1,/*count=*/ 1, /*buttons=*/ 1, /*modifier=*/0); pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, /*x=*/ 1, /*y=*/ 1, /*count=*/ 1, /*buttons=*/ 1, /*modifier=*/0); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bGraphicSelection); // Drag Drop graphic diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 5fb2b88cad65..b427331fbbd7 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -667,7 +667,7 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt switch (nType) { case LOK_MOUSEEVENT_MOUSEBUTTONDOWN: - pGridWindow->MouseButtonDown(aEvent); + Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pGridWindow, &aEvent); // Invoke the context menu if (nButtons & MOUSE_RIGHT) @@ -677,7 +677,7 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt } break; case LOK_MOUSEEVENT_MOUSEBUTTONUP: - pGridWindow->MouseButtonUp(aEvent); + Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEBUTTONUP, pGridWindow, &aEvent); // sometimes MouseButtonDown captures mouse and starts tracking, and VCL // will not take care of releasing that with tiled rendering @@ -686,7 +686,7 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt break; case LOK_MOUSEEVENT_MOUSEMOVE: - pGridWindow->MouseMove(aEvent); + Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEMOVE, pGridWindow, &aEvent); break; default: assert(false); diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index ccf463a49c36..f073c9739a65 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -22,6 +22,9 @@ #include <tools/time.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> + +#include <vcl/ITiledRenderable.hxx> #include <vcl/svapp.hxx> #include <vcl/salgtype.hxx> #include <vcl/window.hxx> @@ -481,6 +484,20 @@ void Window::SetPointer( const Pointer& rPointer ) // possibly immediately move pointer if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() ) mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() ); + + if (VclPtr<vcl::Window> pWin = GetParentWithLOKNotifier()) + { + Pointer aPointer = GetPointer(); + // We don't map all possible pointers hence we need a default + OString aPointerString = "default"; + auto aIt = vcl::gaLOKPointerMap.find(aPointer.GetStyle()); + if (aIt != vcl::gaLOKPointerMap.end()) + { + aPointerString = aIt->second; + } + + pWin->GetLOKNotifier()->libreOfficeKitViewCallback(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr()); + } } void Window::EnableChildPointerOverwrite( bool bOverwrite ) |