diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-05-26 22:55:31 +0200 |
---|---|---|
committer | Pranav Kant <pranavk@collabora.co.uk> | 2017-10-02 10:54:05 +0530 |
commit | e81338c4e66a3f1193ed338ebab8c436a830db6b (patch) | |
tree | 3c2e613de983441385f95abe86434b7e68854d2e /desktop | |
parent | d663eabbebad69dd64e5d9b05c60375304b28573 (diff) |
Add IDialogRenderable interface for rendering of dialogs
Change-Id: I1d85729a1ac1a99d33ea2bde1b50ccf4c05ca9a9
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 4566a01dac37..476b283c9104 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -84,6 +84,7 @@ #include <vcl/sysdata.hxx> #include <vcl/virdev.hxx> #include <vcl/ITiledRenderable.hxx> +#include <vcl/IDialogRenderable.hxx> #include <unicode/uchar.h> #include <unotools/configmgr.hxx> #include <unotools/syslocaleoptions.hxx> @@ -590,6 +591,8 @@ static unsigned char* doc_renderFont(LibreOfficeKitDocument* pThis, int* pFontHeight); static char* doc_getPartHash(LibreOfficeKitDocument* pThis, int nPart); +static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight); + LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XComponent> &xComponent) : mxComponent(xComponent) { @@ -636,6 +639,8 @@ 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; + gDocumentClass = m_pDocumentClass; } pClass = m_pDocumentClass.get(); @@ -1153,6 +1158,12 @@ ITiledRenderable* getTiledRenderable(LibreOfficeKitDocument* pThis) return dynamic_cast<ITiledRenderable*>(pDocument->mxComponent.get()); } +IDialogRenderable* getDialogRenderable(LibreOfficeKitDocument* pThis) +{ + LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); + return dynamic_cast<IDialogRenderable*>(pDocument->mxComponent.get()); +} + } // anonymous namespace // Wonder global state ... @@ -3001,6 +3012,22 @@ unsigned char* doc_renderFont(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pTh return nullptr; } +static void doc_paintDialog(LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight) +{ + SolarMutexGuard aGuard; + + IDialogRenderable* pDialogRenderable = getDialogRenderable(pThis); + + ScopedVclPtrInstance<VirtualDevice> pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT); + pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); + + pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(nWidth, nHeight), Fraction(1.0), Point(), pBuffer); + + vcl::DialogID aDialogID(pDialogRenderable->findDialog()); + + pDialogRenderable->paintDialog(aDialogID, *pDevice.get(), nWidth, nHeight); +} + static char* lo_getError (LibreOfficeKit *pThis) { SolarMutexGuard aGuard; |