summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-12-18 09:19:06 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-12-18 09:43:18 +0100
commitc4f3bd7c94cacb52f7a791a0d364818cee6080b6 (patch)
tree716337156a1af075e2ce2ee521022b4de270272d /sw
parent14b95f66719269e94a717283cf5f6e9cfbd4aad5 (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>
Diffstat (limited to 'sw')
-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 3164e00dd0f0..a3ca45f5ad5a 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1606,6 +1606,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);
@@ -1621,7 +1622,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;