From 96a6128b9259e62ae0b2872a3157bb1bb32d2a6d Mon Sep 17 00:00:00 2001 From: László Németh Date: Fri, 24 Apr 2015 13:58:04 +0200 Subject: Initial XTiledRenderable API Cherry-picked from e2ad83e25aa86bc377b664d6d07a0b86abf487c0 Change-Id: I6dc337ec958c1e116fc9763877f331b751b64e6e --- sw/inc/unotxdoc.hxx | 7 ++++++- sw/source/uibase/uno/unotxdoc.cxx | 27 +++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) (limited to 'sw') diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 8a12ff02ea04..7d8033903fdb 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -67,6 +67,7 @@ #include #include #include +#include #include #include @@ -128,7 +129,8 @@ SwXTextDocumentBaseClass; class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass, public SvxFmMSFactory, public SfxBaseModel, - public vcl::ITiledRenderable + public vcl::ITiledRenderable, + public ::com::sun::star::tiledrendering::XTiledRenderable { private: class Impl; @@ -420,6 +422,9 @@ public: /// @see vcl::ITiledRenderable::resetSelection(). virtual void resetSelection() SAL_OVERRIDE; + // ::com::sun::star::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 ) throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE; + void Invalidate(); void Reactivate(SwDocShell* pNewDocShell); SwXDocumentPropertyHelper * GetPropertyHelper (); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index a83bbfca4ce0..01d78fe6b670 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -289,6 +290,12 @@ Any SAL_CALL SwXTextDocument::queryInterface( const uno::Type& rType ) throw(Run Reference xTmp = this; aRet <<= xTmp; } + if ( !aRet.hasValue() && + rType == cppu::UnoType::get()) + { + Reference xTmp = this; + aRet <<= xTmp; + } if ( !aRet.hasValue() && rType != cppu::UnoType::get() @@ -338,8 +345,8 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeExceptio } } long nIndex = aBaseTypes.getLength(); - // don't forget the lang::XMultiServiceFactory - aBaseTypes.realloc(aBaseTypes.getLength() + aTextTypes.getLength() + aNumTypes.getLength() + 1); + // don't forget the lang::XMultiServiceFactory and the XTiledRenderable + aBaseTypes.realloc(aBaseTypes.getLength() + aTextTypes.getLength() + aNumTypes.getLength() + 2); uno::Type* pBaseTypes = aBaseTypes.getArray(); const uno::Type* pTextTypes = aTextTypes.getConstArray(); long nPos; @@ -353,6 +360,7 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeExceptio pBaseTypes[nIndex++] = pNumTypes[nPos]; } pBaseTypes[nIndex++] = cppu::UnoType::get(); + pBaseTypes[nIndex++] = cppu::UnoType::get(); return aBaseTypes; } @@ -3274,6 +3282,21 @@ void SwXTextDocument::resetSelection() pWrtShell->ResetSelect(0, false); } +void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) throw (::css::uno::RuntimeException, ::std::exception) +{ + SystemGraphicsData aData; + aData.nSize = sizeof(SystemGraphicsData); + #if defined WNT + sal_Int64 nWindowHandle; + Parent >>= nWindowHandle; + aData.hDC = (HDC) nWindowHandle; + VirtualDevice aDevice(&aData, Size(1, 1), (sal_uInt16)32); + paintTile( aDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight ); + #else + // TODO: support other platforms + #endif +} + void * SAL_CALL SwXTextDocument::operator new( size_t t) throw() { return SwXTextDocumentBaseClass::operator new(t); -- cgit