[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 5 08:08:09 UTC 2021


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

New commits:
commit 357e52fd878225d5b7a23eda53514e076b2cd61a
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Mon Jun 21 16:56:04 2021 +0200
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Mon Jul 5 10:07:37 2021 +0200

    tdf#132776 sw UI: make unique names for custom hatch and gradient
    
    This has already been done in sd, so just copy the idea
    and adapt it to fit in the sw environment.
    
    This fixes LO 6.3.4 regression from 7.0
    commit 53c474633c4e658f096669fb0225d751a5701aaf.
    
    This reason for this is noted in one of those commits:
    > However tdf#99908 shows that ODF import doesn't like anonymous
    > gradients. This is a bug in xmloff style import and should eventually
    > be fixed there. Here we implement the same band-aid solution
    > tdf#99908 implements for Impress sidebar
    
    Change-Id: I4437ac97b6aa97f2cd27a10c3d593dc97d24e9c1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117594
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    (cherry picked from commit 3f6797c29e9672eba354400f24a669244fd746c0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118311

diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 0c11a9395a40..c800a1683250 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -48,6 +48,8 @@
 #include <IDocumentSettingAccess.hxx>
 #include <charfmt.hxx>
 #include <svx/SmartTagItem.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
 #include <fmtinfmt.hxx>
 #include <wrtsh.hxx>
 #include <wview.hxx>
@@ -999,7 +1001,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
             // create needed items for XPropertyList entries from the DrawModel so that
             // the Area TabPage can access them
             // Do this after GetCurAttr, this resets the ItemSet content again
-            const SwDrawModel* pDrawModel = GetView().GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
+            SwDrawModel* pDrawModel = GetView().GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
 
             aCoreSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
             aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
@@ -1074,7 +1076,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
                 rReq.Ignore(); // the 'old' request is not relevant any more
 
                 auto vCursors = CopyPaMRing(*pPaM); // tdf#134439 make a copy to use at later apply
-                pDlg->StartExecuteAsync([pDlg, &rWrtSh, pRequest, nDefDist, vCursors](sal_Int32 nResult){
+                pDlg->StartExecuteAsync([pDlg, &rWrtSh, pDrawModel, pRequest, nDefDist, vCursors](sal_Int32 nResult){
                     if (nResult == RET_OK)
                     {
                         // Apply defaults if necessary.
@@ -1104,6 +1106,23 @@ void SwTextShell::Execute(SfxRequest &rReq)
                             pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName));
                         }
 
+                        const XFillGradientItem* pTempGradItem = pSet->GetItem<XFillGradientItem>(XATTR_FILLGRADIENT);
+                        if (pTempGradItem && pTempGradItem->GetName().isEmpty())
+                        {
+                            // MigrateItemSet guarantees unique gradient names
+                            SfxItemSet aMigrateSet(rWrtSh.GetView().GetPool(), svl::Items<XATTR_FILLGRADIENT, XATTR_FILLGRADIENT>{});
+                            aMigrateSet.Put(XFillGradientItem("gradient", pTempGradItem->GetGradientValue()));
+                            SdrModel::MigrateItemSet(&aMigrateSet, pSet, pDrawModel);
+                        }
+
+                        const XFillHatchItem* pTempHatchItem = pSet->GetItem<XFillHatchItem>(XATTR_FILLHATCH);
+                        if (pTempHatchItem && pTempHatchItem->GetName().isEmpty())
+                        {
+                            SfxItemSet aMigrateSet(rWrtSh.GetView().GetPool(), svl::Items<XATTR_FILLHATCH, XATTR_FILLHATCH>{});
+                            aMigrateSet.Put(XFillHatchItem("hatch", pTempHatchItem->GetHatchValue()));
+                            SdrModel::MigrateItemSet(&aMigrateSet, pSet, pDrawModel);
+                        }
+
                         sw_ParagraphDialogResult(pSet, rWrtSh, *pRequest, vCursors->front().get());
                     }
                     pDlg->disposeOnce();


More information about the Libreoffice-commits mailing list