summaryrefslogtreecommitdiff
path: root/desktop/source/lib/init.cxx
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-11-29 17:47:10 +0530
committerAndras Timar <andras.timar@collabora.com>2018-03-19 14:55:59 +0100
commit6bd477aed78bd5d6fd191daf26c526a89c4b8e70 (patch)
treea72ea5d6720b42c933fc5649d0a35b41ade7a38b /desktop/source/lib/init.cxx
parente842a38f4bb3bc88f1ebdf9a4f6550b80edbe89b (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 (cherry picked from commit 2f2679a56c0ae5dbcab6a0e6aa523587ecdc84fe)
Diffstat (limited to 'desktop/source/lib/init.cxx')
-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;