diff options
author | László Németh <laszlo.nemeth@collabora.com> | 2015-04-24 13:58:04 +0200 |
---|---|---|
committer | László Németh <laszlo.nemeth@collabora.com> | 2015-05-07 17:47:22 +0200 |
commit | 96a6128b9259e62ae0b2872a3157bb1bb32d2a6d (patch) | |
tree | e456c27a9a6e8cbcab698df7957e6eb4a0d087b4 /sw | |
parent | 65376dad896d5dfc1fd6665fc5fdd1833007ce20 (diff) |
Initial XTiledRenderable API
Cherry-picked from e2ad83e25aa86bc377b664d6d07a0b86abf487c0
Change-Id: I6dc337ec958c1e116fc9763877f331b751b64e6e
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unotxdoc.hxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 27 |
2 files changed, 31 insertions, 3 deletions
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 <cppuhelper/weak.hxx> #include <cppuhelper/implbase.hxx> #include <vcl/ITiledRenderable.hxx> +#include <com/sun/star/tiledrendering/XTiledRenderable.hpp> #include <unobaseclass.hxx> #include <viewopt.hxx> @@ -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 <osl/mutex.hxx> #include <vcl/image.hxx> #include <vcl/virdev.hxx> +#include <vcl/sysdata.hxx> #include <vcl/svapp.hxx> #include <vcl/print.hxx> #include <sfx2/viewfrm.hxx> @@ -289,6 +290,12 @@ Any SAL_CALL SwXTextDocument::queryInterface( const uno::Type& rType ) throw(Run Reference<lang::XMultiServiceFactory> xTmp = this; aRet <<= xTmp; } + if ( !aRet.hasValue() && + rType == cppu::UnoType<tiledrendering::XTiledRenderable>::get()) + { + Reference<tiledrendering::XTiledRenderable> xTmp = this; + aRet <<= xTmp; + } if ( !aRet.hasValue() && rType != cppu::UnoType<com::sun::star::document::XDocumentEventBroadcaster>::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<lang::XMultiServiceFactory>::get(); + pBaseTypes[nIndex++] = cppu::UnoType<tiledrendering::XTiledRenderable>::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); |