diff options
Diffstat (limited to 'desktop/source/lib/init.cxx')
-rw-r--r-- | desktop/source/lib/init.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 656d7d32a40f..35964dae4447 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -988,6 +988,11 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments, bool bNotifyWhenFinished); +static void doc_setWindowTextSelection(LibreOfficeKitDocument* pThis, + unsigned nLOKWindowId, + bool swap, + int nX, + int nY); static void doc_setTextSelection (LibreOfficeKitDocument* pThis, int nType, int nX, @@ -1203,6 +1208,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->sendDialogEvent = doc_sendDialogEvent; m_pDocumentClass->postUnoCommand = doc_postUnoCommand; m_pDocumentClass->setTextSelection = doc_setTextSelection; + m_pDocumentClass->setWindowTextSelection = doc_setWindowTextSelection; m_pDocumentClass->getTextSelection = doc_getTextSelection; m_pDocumentClass->getSelectionType = doc_getSelectionType; m_pDocumentClass->getClipboard = doc_getClipboard; @@ -3885,6 +3891,31 @@ static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int n pDoc->setTextSelection(nType, nX, nY); } +static void doc_setWindowTextSelection(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, bool swap, int nX, int nY) +{ + comphelper::ProfileZone aZone("doc_setWindowTextSelection"); + + SolarMutexGuard aGuard; + SetLastExceptionMsg(); + + VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); + if (!pWindow) + { + SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found."); + return; + } + + + Size aOffset(pWindow->GetOutOffXPixel(), pWindow->GetOutOffYPixel()); + Point aCursorPos(nX, nY); + aCursorPos.Move(aOffset); + sal_uInt16 nModifier = swap ? KEY_MOD1 + KEY_MOD2 : KEY_SHIFT; + + MouseEvent aCursorEvent(aCursorPos, 1, MouseEventModifiers::SIMPLECLICK, 0, nModifier); + Application::PostMouseEvent(VclEventId::WindowMouseButtonDown, pWindow, &aCursorEvent); + Application::PostMouseEvent(VclEventId::WindowMouseButtonUp, pWindow, &aCursorEvent); +} + static bool getFromTransferrable( const css::uno::Reference<css::datatransfer::XTransferable> &xTransferable, const OString &aInMimeType, OString &aRet); |