tdf#154817 sw UI: no hatch/gradient name if not selected

This fixes a LO 7.2.0 regression caused by
commit 3f6797c29e9672eba354400f24a669244fd746c0.

A unique name was being created for gradients and hatches
every time the paragraph dialog box was OK'd,
even if the Area tab was not selected or natigated to.

Only create the name if the gradient or hatch is actually
selected as the fill type.

Change-Id: I088954db07d025570b0f5ecd5785020052c6f1f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150669
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Reviewed-by: Justin Luth <jluth@mail.com>
(cherry picked from commit 06c61d3581d95354d627c7de1a7d97b62c8f61c6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150715
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 589af9e..dc4625e 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -51,6 +51,7 @@
#include <svx/SmartTagItem.hxx>
#include <svx/xflgrit.hxx>
#include <svx/xflhtit.hxx>
#include <svx/xfillit0.hxx>
#include <fmtinfmt.hxx>
#include <wrtsh.hxx>
#include <wview.hxx>
@@ -1164,7 +1165,10 @@ void SwTextShell::Execute(SfxRequest &rReq)
                            pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName));
                        }

                        const XFillGradientItem* pTempGradItem = pSet->GetItem<XFillGradientItem>(XATTR_FILLGRADIENT);
                        const XFillStyleItem* pFS = pSet->GetItem<XFillStyleItem>(XATTR_FILLSTYLE);
                        bool bSet = pFS && pFS->GetValue() == drawing::FillStyle_GRADIENT;
                        const XFillGradientItem* pTempGradItem
                            = bSet ? pSet->GetItem<XFillGradientItem>(XATTR_FILLGRADIENT) : nullptr;
                        if (pTempGradItem && pTempGradItem->GetName().isEmpty())
                        {
                            // MigrateItemSet guarantees unique gradient names
@@ -1173,7 +1177,9 @@ void SwTextShell::Execute(SfxRequest &rReq)
                            SdrModel::MigrateItemSet(&aMigrateSet, pSet, pDrawModel);
                        }

                        const XFillHatchItem* pTempHatchItem = pSet->GetItem<XFillHatchItem>(XATTR_FILLHATCH);
                        bSet = pFS && pFS->GetValue() == drawing::FillStyle_HATCH;
                        const XFillHatchItem* pTempHatchItem
                            = bSet ? pSet->GetItem<XFillHatchItem>(XATTR_FILLHATCH) : nullptr;
                        if (pTempHatchItem && pTempHatchItem->GetName().isEmpty())
                        {
                            SfxItemSetFixed<XATTR_FILLHATCH, XATTR_FILLHATCH> aMigrateSet(rWrtSh.GetView().GetPool());