tdf#122444 Use fontwork name for object name
Change-Id: Icdbde958f2e89e669a9399479e0059095a6d8a3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92333
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index b39ccea..de4ebc3 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -427,6 +427,7 @@
// It may also have a Title and a Description for accessibility purposes.
void SetName(const OUString& rStr);
OUString GetName() const;
void MakeNameUnique();
void MakeNameUnique(std::unordered_set<OUString>& rNameSet);
void SetTitle(const OUString& rStr);
OUString GetTitle() const;
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index b1e4a44..8081df8 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -2990,6 +2990,12 @@
return false;
}
void SdrObject::MakeNameUnique()
{
std::unordered_set<OUString> aNameSet;
MakeNameUnique(aNameSet);
}
void SdrObject::MakeNameUnique(std::unordered_set<OUString>& rNameSet)
{
if (GetName().isEmpty())
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index d7dea7f..4268cec 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -192,6 +192,8 @@
pPage->GetObj(0)->CloneSdrObject(
bUseSpecialCalcMode ? *mpDestModel : mrSdrView.getSdrModelFromSdrView()));
pNewObject->MakeNameUnique();
// tdf#117629
// Since the 'old' ::CloneSdrObject also copies the SdrPage* the
// SdrObject::getUnoShape() *will* create the wrong UNO API object
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 856ad95..8cec500 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -953,8 +953,6 @@
}
// insert drawing object into the document creating a new <SwDrawFrameFormat> instance
SwDrawFrameFormat* pFormat = GetDoc()->getIDocumentContentOperations().InsertDrawObj( aPam, rDrawObj, rFlyAttrSet );
OUString sShapeName = GetDoc()->GetUniqueShapeName();
rDrawObj.SetName(sShapeName);
// move object to visible layer
SwContact* pContact = static_cast<SwContact*>(rDrawObj.GetUserCall());
@@ -965,7 +963,7 @@
if (pFormat)
{
pFormat->SetName(sShapeName);
pFormat->SetName(rDrawObj.GetName());
// select drawing object
Imp()->GetDrawView()->MarkObj( &rDrawObj, Imp()->GetPageView() );
}