summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Kelemen <kelemeng@ubuntu.com>2018-02-28 00:34:00 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-03-07 13:21:06 +0100
commit176356a3c802151967c26dc78f58244fcab9693a (patch)
treef8fbd8f1350a965c362d79c0a87c8aec63e35295
parent80dafc57786b6e342468cea227e25fd17ac6dd10 (diff)
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 <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit c77e01d63b4bd4805c4a499e4e0cab917d0eb403) Reviewed-on: https://gerrit.libreoffice.org/50803
-rw-r--r--sw/source/core/view/vprint.cxx11
1 files 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();