[Libreoffice-commits] core.git: comphelper/source desktop/source include/comphelper include/LibreOfficeKit sw/source

Pranav Kant pranavk at collabora.co.uk
Mon Jan 23 19:32:42 UTC 2017


 comphelper/source/misc/lok.cxx               |   12 ++++++++++++
 desktop/source/lib/init.cxx                  |    2 ++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |    5 +++++
 include/comphelper/lok.hxx                   |    4 ++++
 sw/source/core/view/viewsh.cxx               |    3 ++-
 sw/source/uibase/uno/unotxdoc.cxx            |    8 ++++++++
 6 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit 75d8b305bbc1c2377f23361ecd64816a350baa4c
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Jan 23 21:53:49 2017 +0530

    lok: New feature flag to turn off tiled annotations
    
    Change-Id: Ie418642242ada98d4a41f30bb6cefcd57f398ef0
    Reviewed-on: https://gerrit.libreoffice.org/33472
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index cf776f0..44487da 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -21,6 +21,8 @@ static bool g_bPartInInvalidation(false);
 
 static bool g_bTiledPainting(false);
 
+static bool g_bTiledAnnotations(true);
+
 void setActive(bool bActive)
 {
     g_bActive = bActive;
@@ -51,6 +53,16 @@ bool isTiledPainting()
     return g_bTiledPainting;
 }
 
+void setTiledAnnotations(bool bTiledAnnotations)
+{
+    g_bTiledAnnotations = bTiledAnnotations;
+}
+
+bool isTiledAnnotations()
+{
+    return g_bTiledAnnotations;
+}
+
 static bool g_bLocalRendering(false);
 
 void setLocalRendering(bool bLocalRendering)
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3aef796..40fd4e5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2798,6 +2798,8 @@ static void lo_setOptionalFeatures(LibreOfficeKit* pThis, uint64_t const feature
     pLib->mOptionalFeatures = features;
     if (features & LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK)
         comphelper::LibreOfficeKit::setPartInInvalidation(true);
+    if (features & LOK_FEATURE_NO_TILED_ANNOTATIONS)
+        comphelper::LibreOfficeKit::setTiledAnnotations(false);
 }
 
 static void lo_setDocumentPassword(LibreOfficeKit* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index d2ccc0f..f3dccd0 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -69,6 +69,11 @@ typedef enum
      * LOK_CALLBACK_INVALIDATE_TILES payload.
      */
     LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK = (1ULL << 2),
+
+    /**
+     * Turn off tile rendering for annotations
+     */
+    LOK_FEATURE_NO_TILED_ANNOTATIONS = (1ULL << 3)
 }
 LibreOfficeKitOptionalFeatures;
 
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index ca9f87f..253541a 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -52,6 +52,10 @@ COMPHELPER_DLLPUBLIC void setPartInInvalidation(bool bPartInInvalidation);
 COMPHELPER_DLLPUBLIC bool isTiledPainting();
 /// Set if we are doing tiled painting.
 COMPHELPER_DLLPUBLIC void setTiledPainting(bool bTiledPainting);
+/// Set if we want no annotations rendering
+COMPHELPER_DLLPUBLIC void setTiledAnnotations(bool bTiledAnnotations);
+/// Check if annotations rendering is turned off
+COMPHELPER_DLLPUBLIC bool isTiledAnnotations();
 
 // Status indicator handling. Even if in theory there could be several status indicators active at
 // the same time, in practice there is only one at a time, so we don't handle any identification of
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index e0ef02b..1762c09 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1908,7 +1908,8 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
     // draw - works in logic coordinates
     Paint(rDevice, aOutRect);
 
-    if (SwPostItMgr* pPostItMgr = GetPostItMgr())
+    SwPostItMgr* pPostItMgr = GetPostItMgr();
+    if (GetViewOptions()->IsPostIts() && pPostItMgr)
         pPostItMgr->PaintTile(rDevice, aOutRect);
 
     // SwViewShell's output device tear down
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index d880e48..2c81a20 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -119,6 +119,7 @@
 #include <drawdoc.hxx>
 #include <SwStyleNameMapper.hxx>
 #include <osl/file.hxx>
+#include <comphelper/lok.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <unotools/saveopt.hxx>
@@ -3284,8 +3285,15 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::
             pDocShell->SetView(pView);
         }
     }
+
+    aViewOption.SetPostIts(comphelper::LibreOfficeKit::isTiledAnnotations());
     pViewShell->ApplyViewOptions(aViewOption);
 
+    // position the pages again after setting view options. Eg: if postit
+    // rendering is false, then there would be no sidebar, so width of the
+    // document needs to be adjusted
+    pViewShell->GetLayout()->CheckViewLayout( pViewShell->GetViewOptions(), nullptr );
+
     // Disable map mode, so that it's possible to send mouse event coordinates
     // directly in twips.
     SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin();


More information about the Libreoffice-commits mailing list