diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-12-22 18:40:05 +0530 |
---|---|---|
committer | pranavk <pranavk@collabora.co.uk> | 2017-12-22 14:21:33 +0100 |
commit | 381398928f1112a9c26ee1dbae55a06feac17cc6 (patch) | |
tree | 0be5a88c0221c0401ee0a2ed287a2a2f5858e547 /sfx2/source/view/lokcharthelper.cxx | |
parent | 5b272bf4b94e1dac427472a07b241e2ae95d8730 (diff) |
lokdocview: android: tiled annotations is the cause of the problem
The earlier workaround only fixes it for android but keep other clients
like gnome-documents broken. The real problem with these clients is that
they ask lokit to render annotations in the tiles.
This patch should keep the problem fixed for android and additionally
make gnome-documents work, or any other lok clients who do not use comments
API but render comments in tiles.
Change-Id: I942f988698a9a43abedef7c998589be7f00a4ac0
Reviewed-on: https://gerrit.libreoffice.org/46975
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'sfx2/source/view/lokcharthelper.cxx')
-rw-r--r-- | sfx2/source/view/lokcharthelper.cxx | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx index 17df4dac3817..dc82d2ffe4db 100644 --- a/sfx2/source/view/lokcharthelper.cxx +++ b/sfx2/source/view/lokcharthelper.cxx @@ -236,42 +236,32 @@ void LokChartHelper::PaintAllChartsOnTile(VirtualDevice& rDevice, int nTilePosX, int nTilePosY, long nTileWidth, long nTileHeight) { - // TODO: Hack to make Android Viewer render at least *something* again, but of - // course it's just a crude hack to just disable this instead of debugging further - // and fixing it for Android case -#if !defined(ANDROID) - // Resizes the virtual device so to contain the entries context - rDevice.SetOutputSizePixel(Size(nOutputWidth, nOutputHeight)); - - rDevice.Push(PushFlags::MAPMODE); - MapMode aMapMode(rDevice.GetMapMode()); - - // Scaling. Must convert from pixels to twips. We know - // that VirtualDevices use a DPI of 96. - Fraction scaleX = Fraction(nOutputWidth, 96) * Fraction(1440) / Fraction(nTileWidth); - Fraction scaleY = Fraction(nOutputHeight, 96) * Fraction(1440) / Fraction(nTileHeight); - aMapMode.SetScaleX(scaleX); - aMapMode.SetScaleY(scaleY); - rDevice.SetMapMode(aMapMode); - - tools::Rectangle aTileRect(Point(nTilePosX, nTilePosY), Size(nTileWidth, nTileHeight)); - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) + if (!comphelper::LibreOfficeKit::isTiledAnnotations()) { - LokChartHelper aChartHelper(pViewShell); - aChartHelper.PaintTile(rDevice, aTileRect); - pViewShell = SfxViewShell::GetNext(*pViewShell); + // Resizes the virtual device so to contain the entries context + rDevice.SetOutputSizePixel(Size(nOutputWidth, nOutputHeight)); + + rDevice.Push(PushFlags::MAPMODE); + MapMode aMapMode(rDevice.GetMapMode()); + + // Scaling. Must convert from pixels to twips. We know + // that VirtualDevices use a DPI of 96. + Fraction scaleX = Fraction(nOutputWidth, 96) * Fraction(1440) / Fraction(nTileWidth); + Fraction scaleY = Fraction(nOutputHeight, 96) * Fraction(1440) / Fraction(nTileHeight); + aMapMode.SetScaleX(scaleX); + aMapMode.SetScaleY(scaleY); + rDevice.SetMapMode(aMapMode); + + tools::Rectangle aTileRect(Point(nTilePosX, nTilePosY), Size(nTileWidth, nTileHeight)); + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) + { + LokChartHelper aChartHelper(pViewShell); + aChartHelper.PaintTile(rDevice, aTileRect); + pViewShell = SfxViewShell::GetNext(*pViewShell); + } + rDevice.Pop(); } - rDevice.Pop(); -#else - (void)rDevice; - (void)nOutputWidth; - (void)nOutputHeight; - (void)nTilePosX; - (void)nTilePosY; - (void)nTileWidth; - (void)nTileHeight; -#endif } bool LokChartHelper::postMouseEvent(int nType, int nX, int nY, |