diff options
-rw-r--r-- | desktop/source/lib/init.cxx | 69 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitEnums.h | 9 | ||||
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 3 | ||||
-rw-r--r-- | sc/inc/docuno.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 15 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 14 | ||||
-rw-r--r-- | sw/inc/unotxdoc.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 11 |
9 files changed, 127 insertions, 1 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) diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index bf6267585a0a..37837ea49b86 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -202,7 +202,14 @@ typedef enum * * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES. */ - LOK_CALLBACK_CELL_CURSOR + LOK_CALLBACK_CELL_CURSOR, + + /** + * The current mouse pointer style. + * + * Payload is a css mouse pointer style. + */ + LOK_CALLBACK_MOUSE_POINTER } LibreOfficeKitCallbackType; diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index 05f4e329cf22..99c31b8da9a7 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -14,6 +14,7 @@ #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKitTypes.h> #include <tools/gen.hxx> +#include <vcl/pointr.hxx> #include <vcl/virdev.hxx> #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp> @@ -172,6 +173,8 @@ public: return OString(); } + virtual Pointer getPointer() = 0; + /// Sets the clipboard of the component. virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) = 0; diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 49059f0b99c6..c208db36ec34 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -413,6 +413,9 @@ public: int nOutputHeight, long nTileWidth, long nTileHeight ) override; + + /// @see vcl::ITiledRenderable::getPointer(). + virtual Pointer getPointer() override; }; class ScDrawPagesObj : public cppu::WeakImplHelper< diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 36ba321ce0e7..b3f80b28f2d2 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -902,6 +902,21 @@ OString ScModelObj::getCellCursor( int nOutputWidth, int nOutputHeight, return "{ \"commandName\": \".uno:CellCursor\", \"commandValues\": \"" + pGridWindow->getCellCursor( nOutputWidth, nOutputHeight, nTileWidth, nTileHeight ) + "\" }"; } +Pointer ScModelObj::getPointer() +{ + SolarMutexGuard aGuard; + + ScViewData* pViewData = ScDocShell::GetViewData(); + if (!pViewData) + return Pointer(); + + ScGridWindow* pGridWindow = pViewData->GetActiveWin(); + if (!pGridWindow) + return Pointer(); + + return pGridWindow->GetPointer(); +} + void ScModelObj::initializeForTiledRendering() { SolarMutexGuard aGuard; diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 11076cafcb4a..bb0220f2aca7 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -263,6 +263,8 @@ public: virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) override; /// @see vcl::ITiledRenderable::isMimeTypeSupported(). virtual bool isMimeTypeSupported() override; + /// @see vcl::ITiledRenderable::getPointer(). + virtual Pointer getPointer() override; // XComponent diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index f064a38d3a45..9c37007c5186 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2558,6 +2558,20 @@ bool SdXImpressDocument::isMimeTypeSupported() return EditEngine::HasValidData(aDataHelper.GetTransferable()); } +Pointer SdXImpressDocument::getPointer() +{ + SolarMutexGuard aGuard; + DrawViewShell* pViewShell = GetViewShell(); + if (!pViewShell) + return Pointer(); + + Window* pWindow = pViewShell->GetActiveWindow(); + if (!pWindow) + return Pointer(); + + return pWindow->GetPointer(); +} + uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable() { uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters); diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index f8be80a8dd09..3aec1633a42a 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -435,6 +435,8 @@ public: virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) override; /// @see vcl::ITiledRenderable::isMimeTypeSupported(). virtual bool isMimeTypeSupported() override; + /// @see vcl::ITiledRenderable::getPointer(). + virtual Pointer getPointer() override; // css::tiledrendering::XTiledRenderable virtual void SAL_CALL paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) throw (::css::uno::RuntimeException, ::std::exception) override; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 2ab018bc95d8..104a5d227d12 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3165,6 +3165,17 @@ bool SwXTextDocument::isMimeTypeSupported() return aDataHelper.GetXTransferable().is() && SwTransferable::IsPaste(*pWrtShell, aDataHelper); } +Pointer SwXTextDocument::getPointer() +{ + SolarMutexGuard aGuard; + + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + if (!pWrtShell) + return Pointer(); + + return pWrtShell->GetView().GetEditWin().GetPointer(); +} + int SwXTextDocument::getPart() { SolarMutexGuard aGuard; |