sw/source/uibase/shells/textsh1.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit e915155353b72ed2401ffc99ed11b003d5990f17
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Wed Apr 19 20:06:28 2023 -0400
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Apr 21 09:33:46 2023 +0200

    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 <rayk...@gmail.com>
    Reviewed-by: Justin Luth <jl...@mail.com>
    (cherry picked from commit 06c61d3581d95354d627c7de1a7d97b62c8f61c6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150715
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 589af9e5beeb..dc4625eb91d1 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());

Reply via email to