From 23a3727dc6bdb1a3266f71a58cca0bea8f70ac04 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Tue, 21 Apr 2020 18:19:44 +0530 Subject: Added parameter to FillPageGradient command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ife435fc25e8e3114e66461af22ac9e0ef8c9d011 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92235 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- sd/source/ui/view/drviews7.cxx | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'sd/source/ui/view') diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 3b65b9a62108..a0841616946f 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1804,15 +1804,25 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq) case SID_ATTR_PAGE_GRADIENT: { - XFillGradientItem aGradientItem( pArgs->Get( XATTR_FILLGRADIENT ) ); + if (SfxItemState::SET == pArgs->GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem)) + { + const SfxStringItem* pJSON = static_cast(pItem); + XFillGradientItem aGradient( XGradient::fromJSON(pJSON->GetValue()) ); + rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT ) ); + rPageProperties.PutItem( aGradient ); + } + else + { + XFillGradientItem aGradientItem( pArgs->Get( XATTR_FILLGRADIENT ) ); - // MigrateItemSet guarantees unique gradient names - SfxItemSet aMigrateSet( mpDrawView->GetModel()->GetItemPool(), svl::Items{} ); - aMigrateSet.Put( aGradientItem ); - SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDrawView->GetModel() ); + // MigrateItemSet guarantees unique gradient names + SfxItemSet aMigrateSet( mpDrawView->GetModel()->GetItemPool(), svl::Items{} ); + aMigrateSet.Put( aGradientItem ); + SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDrawView->GetModel() ); - rPageProperties.PutItemSet( *pTempSet ); - rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT ) ); + rPageProperties.PutItemSet( *pTempSet ); + rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT ) ); + } } break; -- cgit