summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-06-21 16:56:04 +0200
committerJustin Luth <justin_luth@sil.org>2021-07-05 08:33:42 +0200
commit3f6797c29e9672eba354400f24a669244fd746c0 (patch)
treee614ab449206abc8040388d704272807f8711e7a /sw/source
parent17bc5794d6acd38304653dc78b95f9f772893ca7 (diff)
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@sil.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/shells/textsh1.cxx23
1 files changed, 21 insertions, 2 deletions
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index f500f618c48a..8ea51fd6de1a 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();