Kaydet (Commit) 38139892 authored tarafından Pranav Kant's avatar Pranav Kant Kaydeden (comit) pranavk

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/46975Reviewed-by: 's avatarpranavk <pranavk@collabora.co.uk>
Tested-by: 's avatarpranavk <pranavk@collabora.co.uk>
üst 5b272bf4
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment