From 176356a3c802151967c26dc78f58244fcab9693a Mon Sep 17 00:00:00 2001 From: Gabor Kelemen Date: Wed, 28 Feb 2018 00:34:00 +0100 Subject: 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 Reviewed-by: Miklos Vajna (cherry picked from commit c77e01d63b4bd4805c4a499e4e0cab917d0eb403) Reviewed-on: https://gerrit.libreoffice.org/50803 --- sw/source/core/view/vprint.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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(); -- cgit v1.2.3