summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-12-18 09:19:06 +0300
committerCaolán McNamara <caolanm@redhat.com>2018-12-21 09:59:53 +0100
commit027e592758421287463b1a3bf64cb32d3ef96601 (patch)
tree1cce61044a418bbe9462c998eb1b10f1d6a63b80
parent72f2fbc75dc254ea8e13527b592bd0b4fb946bab (diff)
tdf#116496: don't add header when setting empty watermark
Regression from commit 22e94ab1860b1bdea8d107d4e8824f63c6b1c8c5 Change-Id: I66a6e0b5069fe459b887a52f1ea26904dfc2d37b Reviewed-on: https://gerrit.libreoffice.org/65303 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit c4f3bd7c94cacb52f7a791a0d364818cee6080b6) Reviewed-on: https://gerrit.libreoffice.org/65416 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/core/edit/edfcol.cxx6
1 files changed, 6 insertions, 0 deletions
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<frame::XModel> xModel = pDocShell->GetBaseModel();
uno::Reference<style::XStyleFamiliesSupplier> 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;