From 489597d339af14a6403ee079bea35908112720ec Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Fri, 19 May 2017 00:18:15 +0200 Subject: Watermark: extended configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * it is possible to set font family, color, angle and transparency Change-Id: Idea2fb9ee748394bb3d706fa790e109238584cdb Reviewed-on: https://gerrit.libreoffice.org/37793 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- sw/source/uibase/app/docsh2.cxx | 16 ++++++++++++++-- sw/source/uibase/app/docst.cxx | 5 ++--- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'sw/source/uibase/app') diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 7268c502230e..55db8a619643 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -1167,8 +1168,19 @@ void SwDocShell::Execute(SfxRequest& rReq) { if (pArgs && pArgs->GetItemState( SID_WATERMARK, false, &pItem ) == SfxItemState::SET) { - OUString aText = static_cast( pItem )->GetValue(); - pSh->SetWatermark( aText ); + SfxWatermarkItem aItem; + aItem.SetText( static_cast( pItem )->GetValue() ); + + if ( pArgs->GetItemState( SID_WATERMARK_FONT, false, &pItem ) == SfxItemState::SET ) + aItem.SetFont( static_cast( pItem )->GetValue() ); + if ( pArgs->GetItemState( SID_WATERMARK_ANGLE, false, &pItem ) == SfxItemState::SET ) + aItem.SetAngle( static_cast( pItem )->GetValue() ); + if ( pArgs->GetItemState( SID_WATERMARK_TRANSPARENCY, false, &pItem ) == SfxItemState::SET ) + aItem.SetTransparency( static_cast( pItem )->GetValue() ); + if ( pArgs->GetItemState( SID_WATERMARK_COLOR, false, &pItem ) == SfxItemState::SET ) + aItem.SetColor( static_cast( pItem )->GetValue() ); + + pSh->SetWatermark( aItem ); } else { diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index cffd2eca88ca..6eff974face6 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -276,10 +276,9 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh) break; case SID_WATERMARK: { + SfxWatermarkItem aItem = pSh->GetWatermark(); if( pSh ) - rSet.Put(pSh->GetWatermark()); - - rSet.InvalidateItem(nWhich); + rSet.Put(aItem); } break; default: -- cgit