diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-11-29 17:47:10 +0530 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-12-05 12:11:15 +0100 |
commit | 8ef8ae4695e37483377a1f3450582faddb1ddaed (patch) | |
tree | 96e57cfadd6c149f2b6f0158f3de6473c557b50c /desktop | |
parent | 7cf07104d87b071a8d0f463ef33c60da2072d062 (diff) |
lokdialog: Allow closing a dialog from LOK client
... and rename paintDialog -> paintWindow before it's too late. We not
only render dialogs now but also popups.
Change-Id: I6b1253c4d9be0c79199b683df4413658a461f850
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index f0c970905a39..1ca906185de4 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -633,12 +633,14 @@ static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis, int* pFontHeight); static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart); -static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, unsigned char* pBuffer, +static void doc_paintWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, unsigned char* pBuffer, const int nX, const int nY, const int nWidth, const int nHeight); static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, unsigned char* pBuffer, int* nWidth, int* nHeight); +static void doc_postWindow(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nAction); + LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) : mxComponent(xComponent) { @@ -689,8 +691,9 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->renderFont = doc_renderFont; m_pDocumentClass->getPartHash = doc_getPartHash; - m_pDocumentClass->paintDialog = doc_paintDialog; + m_pDocumentClass->paintWindow = doc_paintWindow; m_pDocumentClass->paintActiveFloatingWindow = doc_paintActiveFloatingWindow; + m_pDocumentClass->postWindow = doc_postWindow; gDocumentClass = m_pDocumentClass; } @@ -3310,7 +3313,7 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/, return nullptr; } -static void doc_paintDialog(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, +static void doc_paintWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, unsigned char* pBuffer, const int nX, const int nY, const int nWidth, const int nHeight) @@ -3361,6 +3364,24 @@ static void doc_paintActiveFloatingWindow(LibreOfficeKitDocument* /*pThis*/, uns comphelper::LibreOfficeKit::setDialogPainting(false); } +static void doc_postWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nAction) +{ + SolarMutexGuard aGuard; + + VclPtr<Window> pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); + if (!pWindow) + { + gImpl->maLastExceptionMsg = "Document doesn't support dialog rendering, or window not found."; + return; + } + + if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get())) + { + if (nAction == LOK_WINDOW_CLOSE) + pDialog->EndDialog( RET_CANCEL ); + } +} + static char* lo_getError (LibreOfficeKit *pThis) { SolarMutexGuard aGuard; |