summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-11-29 17:47:10 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-12-04 17:14:00 +0530
commit2f2679a56c0ae5dbcab6a0e6aa523587ecdc84fe (patch)
tree3463803764fd9df80da1c9deaf099969d35c6fa4 /desktop
parentcc05f8d9d27a8b28421a91cbfb059898d9619974 (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.cxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1c4922eacacf..02790af6b2f4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -613,12 +613,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)
{
@@ -669,8 +671,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;
}
@@ -3283,7 +3286,7 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh
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)
@@ -3334,6 +3337,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;