summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/Library_sofficeapp.mk1
-rw-r--r--desktop/source/lib/init.cxx64
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";
}
}