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 | |
parent | d663eabbebad69dd64e5d9b05c60375304b28573 (diff) |
Add IDialogRenderable interface for rendering of dialogs
Change-Id: I1d85729a1ac1a99d33ea2bde1b50ccf4c05ca9a9
-rw-r--r-- | desktop/source/lib/init.cxx | 27 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 3 | ||||
-rw-r--r-- | include/vcl/IDialogRenderable.hxx | 44 | ||||
-rw-r--r-- | sw/inc/unotxdoc.hxx | 11 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 22 | ||||
-rw-r--r-- | vcl/Library_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/source/app/IDialogRenderable.cxx | 22 |
7 files changed, 130 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; diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index 0633f46f97e2..2f0702c67ca8 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -266,6 +266,9 @@ struct _LibreOfficeKitDocumentClass int* pArray, size_t nSize); + /// WIP + void (*paintDialog) (LibreOfficeKitDocument* pThis, unsigned char* pBuffer, int nWidth, int nHeight); + #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx new file mode 100644 index 000000000000..18694092c2fa --- /dev/null +++ b/include/vcl/IDialogRenderable.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef INCLUDED_VCL_IDIALOGRENDERABLE_HXX +#define INCLUDED_VCL_IDIALOGRENDERABLE_HXX + +#include <tools/gen.hxx> +#include <vcl/pointr.hxx> +#include <vcl/virdev.hxx> + +namespace vcl +{ + +typedef sal_Int32 DialogID; + +class VCL_DLLPUBLIC IDialogRenderable +{ +public: + virtual ~IDialogRenderable(); + + virtual DialogID findDialog() = 0; + + virtual void paintDialog(DialogID rDialogID, VirtualDevice &rDevice, + int nOutputWidth, int nOutputHeight) = 0; + + virtual void postDialogMouseEvent(DialogID rDialogID, int nType, + int nCharCode, int nKeyCode) = 0; + + virtual void postDialogKeyEvent(DialogID rDialogID, int nType, int nX, int nY, + int nCount, int nButtons, int nModifier) = 0; +}; + +} // namespace vcl + +#endif // INCLUDED_VCL_IDIALOGRENDERABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 797aec9512fa..0d782213ce61 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -70,6 +70,7 @@ #include <cppuhelper/implbase.hxx> #include <vcl/event.hxx> #include <vcl/ITiledRenderable.hxx> +#include <vcl/IDialogRenderable.hxx> #include <com/sun/star/tiledrendering/XTiledRenderable.hpp> #include <unobaseclass.hxx> @@ -131,6 +132,7 @@ class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass, public SvxFmMSFactory, public SfxBaseModel, public vcl::ITiledRenderable, + public vcl::IDialogRenderable, public css::tiledrendering::XTiledRenderable { private: @@ -428,6 +430,15 @@ public: OUString getRulerState() override; /// @see vcl::ITiledRenderable::getPostIts(). OUString getPostIts() override; + + vcl::DialogID findDialog() override; + void paintDialog(vcl::DialogID rDialogID, VirtualDevice &rDevice, int nWidth, int nHeight) override; + void postDialogMouseEvent(vcl::DialogID rDialogID, int nType, + int nCharCode, int nKeyCode) override; + + void postDialogKeyEvent(vcl::DialogID rDialogID, int nType, int nX, int nY, + int nCount, int nButtons, int nModifier) override; + // css::tiledrendering::XTiledRenderable virtual void SAL_CALL paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) override; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index c1e25aadb2a7..dfc75a7f824d 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3635,6 +3635,28 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I #endif } +vcl::DialogID SwXTextDocument::findDialog() +{ + return vcl::DialogID(0); +} + +void SwXTextDocument::paintDialog(vcl::DialogID /*rDialogID*/, VirtualDevice& /*rDevice*/, int /*nWidth*/, int /*nHeight*/) +{ + //SwViewShell* pViewShell = pDocShell->GetWrtShell(); + + //SwSpellDialogChildWindow::CreateImpl(nullptr, SwSpellDialogChildWindow::GetChildWindowId(), + // pViewShell->GetBindings(), ); +} + +void SwXTextDocument::postDialogMouseEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/) +{ +} + +void SwXTextDocument::postDialogKeyEvent(vcl::DialogID /*rDialogID*/, int /*nType*/, int /*nX*/, int /*nY*/, + int /*nCount*/, int /*nButtons*/, int /*nModifier*/) +{ +} + void * SAL_CALL SwXTextDocument::operator new( size_t t) throw() { return SwXTextDocumentBaseClass::operator new(t); diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 4c636accce92..bc48ea8b0338 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -330,6 +330,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/app/IconThemeScanner \ vcl/source/app/IconThemeSelector \ vcl/source/app/ITiledRenderable \ + vcl/source/app/IDialogRenderable \ vcl/source/app/sound \ vcl/source/app/stdtext \ vcl/source/app/svapp \ diff --git a/vcl/source/app/IDialogRenderable.cxx b/vcl/source/app/IDialogRenderable.cxx new file mode 100644 index 000000000000..58ec05265101 --- /dev/null +++ b/vcl/source/app/IDialogRenderable.cxx @@ -0,0 +1,22 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#include <vcl/IDialogRenderable.hxx> + +namespace vcl +{ + +IDialogRenderable::~IDialogRenderable() +{ +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |