diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-06-13 17:32:44 +0100 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-06-25 13:04:32 +0100 |
commit | cd96b0498d9147422ecb25a38aa2b04a480cdfa9 (patch) | |
tree | 7058b9a4dd607c9e19dab48a23f1981adfc2277b /desktop | |
parent | f35b010a95ad877988bb5eaa4f689644b00f702c (diff) |
Use ITiledRenderable for LIBLOK.
Means that no changes should be required here once calc/impress/draw
support tiled rendering.
Change-Id: I0987d94303f39ba37e29b9ae7b2276e82dc0ccbf
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/Library_sofficeapp.mk | 1 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 64 |
2 files changed, 24 insertions, 41 deletions
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk index 671ff12ae893..8a592ccea00b 100644 --- a/desktop/Library_sofficeapp.mk +++ b/desktop/Library_sofficeapp.mk @@ -14,7 +14,6 @@ $(eval $(call gb_Library_set_include,sofficeapp,\ -I$(SRCDIR)/desktop/inc \ -I$(SRCDIR)/desktop/source/inc \ -I$(SRCDIR)/desktop/source/deployment/inc \ - -I$(SRCDIR)/sw/inc \ -I$(SRCDIR)/vcl/inc \ )) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 605f1097751e..c3792ad06cea 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -42,17 +42,11 @@ #include <vcl/graphicfilter.hxx> #include <vcl/sysdata.hxx> #include <vcl/virdev.hxx> +#include <vcl/ITiledRenderable.hxx> #include <unotools/syslocaleoptions.hxx> #include <unotools/mediadescriptor.hxx> #include <osl/module.hxx> -// Dirty hack -- we go directly into sw -- ideally we need some sort of -// layer to get the writer shell for tiled rendering -#include <doc.hxx> -#include <docsh.hxx> -#include <unotxdoc.hxx> -#include <viewsh.hxx> - #include <salinst.hxx> // And let's also grab the SvpSalInstance and SvpSalVirtualDevice @@ -445,38 +439,32 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, { LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); + ::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() ); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; + } Application::AcquireSolarMutex(1); - switch (doc_getDocumentType(pThis)) { - case LOK_DOCTYPE_TEXT: - { - SwXTextDocument* pTxtDoc = dynamic_cast< SwXTextDocument* >( pDocument->mxComponent.get() ); - SwDocShell* pDocShell = pTxtDoc->GetDocShell(); - SwDoc* pDoc = pDocShell->GetDoc(); - SwViewShell* pViewShell = pDoc->GetCurrentViewShell(); - - ImplSVData* pSVData = ImplGetSVData(); - SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst); - pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA ); + ImplSVData* pSVData = ImplGetSVData(); + SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst); + pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA ); - VirtualDevice aDevice(0, (sal_uInt16)32); - boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); - aDevice.SetOutputSizePixelScaleOffsetAndBuffer( - Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), - aBuffer, true ); + VirtualDevice aDevice(0, (sal_uInt16)32); + boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); + aDevice.SetOutputSizePixelScaleOffsetAndBuffer( + Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), + aBuffer, true ); - pViewShell->PaintTile(aDevice, nCanvasWidth, nCanvasHeight, - nTilePosX, nTilePosY, nTileWidth, nTileHeight); + pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight, + nTilePosX, nTilePosY, nTileWidth, nTileHeight); - SvpSalVirtualDevice* pSalDev = static_cast< SvpSalVirtualDevice* >(aDevice.getSalVirtualDevice()); - basebmp::BitmapDeviceSharedPtr pBmpDev = pSalDev->getBitmapDevice(); + SvpSalVirtualDevice* pSalDev = static_cast< SvpSalVirtualDevice* >(aDevice.getSalVirtualDevice()); + basebmp::BitmapDeviceSharedPtr pBmpDev = pSalDev->getBitmapDevice(); - *pRowStride = pBmpDev->getScanlineStride(); - } - break; - default: - break; + *pRowStride = pBmpDev->getScanlineStride(); } Application::ReleaseSolarMutex(); } @@ -487,20 +475,16 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis, { LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); - if (doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT) + ::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() ); + if (pDoc) { - SwXTextDocument* pTxtDoc = dynamic_cast< SwXTextDocument* >( pDocument->mxComponent.get() ); - SwDocShell* pDocShell = pTxtDoc->GetDocShell(); - SwDoc* pDoc = pDocShell->GetDoc(); - SwViewShell* pViewShell = pDoc->GetCurrentViewShell(); - Size aDocumentSize = pViewShell->GetDocSize(); + Size aDocumentSize = pDoc->getDocumentSize(); *pWidth = aDocumentSize.Width(); *pHeight = aDocumentSize.Height(); } else { - pWidth = 0; - pHeight = 0; + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; } } |