[Libreoffice-commits] core.git: sfx2/source

Pranav Kant pranavk at collabora.co.uk
Fri Dec 22 13:21:55 UTC 2017


 sfx2/source/view/lokcharthelper.cxx |   58 ++++++++++++++----------------------
 1 file changed, 24 insertions(+), 34 deletions(-)

New commits:
commit 381398928f1112a9c26ee1dbae55a06feac17cc6
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Dec 22 18:40:05 2017 +0530

    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 at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

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,


More information about the Libreoffice-commits mailing list