diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-05-26 22:55:31 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-11-15 17:07:04 +0100 |
commit | 388858efc64359875e7592013bee000f5e8b4710 (patch) | |
tree | 226f966612e8e1f73c437ca1ab2c8606e473a688 /desktop | |
parent | 32f7e56c68e2ed6853714dfaefd60f097440f5e5 (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 11cffe2a67f1..e8ca8ff999c2 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -83,6 +83,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> @@ -609,6 +610,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) { @@ -655,6 +658,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(); @@ -1172,6 +1177,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 ... @@ -3029,6 +3040,22 @@ unsigned char* doc_renderFont(LibreOfficeKitDocument* /*pThis*/, 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; |