sw/source/core/view/vprint.cxx |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 176356a3c802151967c26dc78f58244fcab9693a
Author: Gabor Kelemen <kelem...@ubuntu.com>
Date:   Wed Feb 28 00:34:00 2018 +0100

    tdf#91680 Reserve space in margin for comments only if there are comments
    
    Change-Id: Ida08737cf537d85a94a72572e8cbc7e2bfad9333
    Reviewed-on: https://gerrit.libreoffice.org/50505
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    (cherry picked from commit c77e01d63b4bd4805c4a499e4e0cab917d0eb403)
    Reviewed-on: https://gerrit.libreoffice.org/50803

diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index f88e26532356..dbd320ab718e 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -463,7 +463,12 @@ bool SwViewShell::PrintOrPDFExport(
     GDIMetaFile *pOrigRecorder(nullptr);
     GDIMetaFile *pMetaFile(nullptr);
     SwPostItMode nPostItMode = rPrintData.GetPrintPostIts();
-    if (nPostItMode == SwPostItMode::InMargins)
+
+    // tdf#91680 Reserve space in margin for comments only if there are 
comments
+    const bool bHasPostItsToPrintInMargins = ( nPostItMode == 
SwPostItMode::InMargins ) &&
+                                sw_GetPostIts( 
&GetDoc()->getIDocumentFieldsAccess(), nullptr );
+
+    if ( bHasPostItsToPrintInMargins )
     {
         //get and disable the existing recorder
         pOrigRecorder = pOutDev->GetConnectMetaFile();
@@ -534,8 +539,8 @@ bool SwViewShell::PrintOrPDFExport(
 
         SwPaintQueue::Repaint();
 
-        SwPostItMgr *pPostItManager = (nPostItMode == SwPostItMode::InMargins) 
?
-            pShell->GetPostItMgr() : nullptr;
+        SwPostItMgr *pPostItManager = bHasPostItsToPrintInMargins ? 
pShell->GetPostItMgr() : nullptr;
+
         if (pPostItManager)
         {
             pPostItManager->CalcRects();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to