[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sd/source

Katarina Behrens Katarina.Behrens at cib.de
Thu Feb 23 19:24:52 UTC 2017


 sd/source/ui/sidebar/SlideBackground.cxx |    4 +++-
 sd/source/ui/view/drviews7.cxx           |   17 ++++++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit e28fd26d69553733778a86c84cd74e284a079e15
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Sun Feb 12 21:56:18 2017 +0100

    tdf#99908: Ensure non-empty unique gradient names
    
    for user-defined (!preset) gradients. ODF doesn't cope with nameless
    gradients so well ...
    
    Change-Id: I7a4ca32ccf58b22fc55ceeac8778029cd6d5cea3
    Reviewed-on: https://gerrit.libreoffice.org/34001
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    (cherry picked from commit 529162307e9d6191fe43d50597504474b2c1a5ba)
    Reviewed-on: https://gerrit.libreoffice.org/34335
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index 07e43ed..854929f 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -816,7 +816,9 @@ IMPL_LINK_NOARG(SlideBackground, FillColorHdl, SvxColorListBox&, void)
             aGradient.SetStartColor(mpFillLB->GetSelectEntryColor());
             aGradient.SetEndColor(mpFillGrad->GetSelectEntryColor());
 
-            XFillGradientItem aItem(aGradient);
+            // the name doesn't really matter, it'll be converted to unique one eventually,
+            // but it has to be non-empty
+            XFillGradientItem aItem("gradient", aGradient);
             GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_GRADIENT, SfxCallMode::RECORD, { &aItem });
         }
         break;
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index f8570a4..6539152 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1675,8 +1675,8 @@ void DrawViewShell::GetPageProperties( SfxItemSet &rSet )
 
             case (drawing::FillStyle_GRADIENT):
             {
-                const XGradient& xGradient =  static_cast<const XFillGradientItem*>( rPageAttr.GetItem( XATTR_FILLGRADIENT ) )->GetGradientValue();
-                XFillGradientItem aFillGradientItem( OUString(), xGradient, SID_ATTR_PAGE_GRADIENT  );
+                const XFillGradientItem *pGradient =  static_cast<const XFillGradientItem*>( rPageAttr.GetItem( XATTR_FILLGRADIENT ) );
+                XFillGradientItem aFillGradientItem( pGradient->GetName(), pGradient->GetGradientValue(), SID_ATTR_PAGE_GRADIENT );
                 rSet.Put( aFillGradientItem );
             }
             break;
@@ -1716,6 +1716,9 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
         if ( ( nSlotId >= SID_ATTR_PAGE_COLOR ) && ( nSlotId <= SID_ATTR_PAGE_FILLSTYLE ) )
         {
             SdrPageProperties& rPageProperties = pPage->getSdrPageProperties();
+            const SfxItemSet &aPageItemSet = rPageProperties.GetItemSet();
+            SfxItemSet *pTempSet = aPageItemSet.Clone(false, &mpDrawView->GetModel()->GetItemPool());
+
             rPageProperties.ClearItem(XATTR_FILLSTYLE);
             rPageProperties.ClearItem(XATTR_FILLGRADIENT);
             rPageProperties.ClearItem(XATTR_FILLHATCH);
@@ -1744,8 +1747,14 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
                 case(SID_ATTR_PAGE_GRADIENT):
                 {
                     XFillGradientItem aGradientItem( static_cast<const XFillGradientItem&>(pArgs->Get( XATTR_FILLGRADIENT )) );
+
+                    // MigrateItemSet guarantees unique gradient names
+                    SfxItemSet aMigrateSet( mpDrawView->GetModel()->GetItemPool(), XATTR_FILLGRADIENT, XATTR_FILLGRADIENT );
+                    aMigrateSet.Put( aGradientItem );
+                    SdrModel::MigrateItemSet( &aMigrateSet, pTempSet, mpDrawView->GetModel() );
+
+                    rPageProperties.PutItemSet( *pTempSet );
                     rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
-                    rPageProperties.PutItem( XFillGradientItem( aGradientItem ) );
                 }
                 break;
 
@@ -1769,6 +1778,8 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
                 break;
             }
 
+            delete pTempSet;
+
             rReq.Done();
         }
     }


More information about the Libreoffice-commits mailing list