From 027e592758421287463b1a3bf64cb32d3ef96601 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 18 Dec 2018 09:19:06 +0300 Subject: tdf#116496: don't add header when setting empty watermark MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression from commit 22e94ab1860b1bdea8d107d4e8824f63c6b1c8c5 Change-Id: I66a6e0b5069fe459b887a52f1ea26904dfc2d37b Reviewed-on: https://gerrit.libreoffice.org/65303 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski (cherry picked from commit c4f3bd7c94cacb52f7a791a0d364818cee6080b6) Reviewed-on: https://gerrit.libreoffice.org/65416 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/core/edit/edfcol.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sw/source') diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 6486de18a102..ee76998aac75 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -1600,6 +1600,7 @@ void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark) SwDocShell* pDocShell = GetDoc()->GetDocShell(); if (!pDocShell) return; + const bool bNoWatermark = rWatermark.GetText().isEmpty(); uno::Reference xModel = pDocShell->GetBaseModel(); uno::Reference xStyleFamiliesSupplier(xModel, uno::UNO_QUERY); @@ -1615,7 +1616,12 @@ void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark) bool bHeaderIsOn = false; xPageStyle->getPropertyValue(UNO_NAME_HEADER_IS_ON) >>= bHeaderIsOn; if (!bHeaderIsOn) + { + if (bNoWatermark) + continue; // the style doesn't have any watermark - no need to do anything + xPageStyle->setPropertyValue(UNO_NAME_HEADER_IS_ON, uno::makeAny(true)); + } // backup header height bool bDynamicHeight = true; -- cgit v1.2.3