diff options
author | Jim Raykowski <raykowj@gmail.com> | 2022-11-19 17:57:43 -0900 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2022-11-21 18:54:30 +0100 |
commit | fd0f6a4e83cb4a99839c73d7f545b4b80ef4657a (patch) | |
tree | 935558bbc67be766e45e7448fd4e8929c238c6de /svx | |
parent | fe21365c5a9083ae1f086ea48614263b3a75ab3e (diff) |
tdf#151828 related: Make cut shape have the same name after paste
when possible
Fixes shape names without a number at the end of the name, having the
number 1 appended to the end of the name after cut and paste in the
same document.
When possible - because it might happen that a shape is inserted
after the cut operation and is given the same name as the cut shape
name. If so, when the shape is pasted into the same document it will
not have the same name as before it was cut.
Change-Id: I1d1ebc76d07d81da0286d1f0bb7d34ad973a43b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142983
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 877744f4e273..34688e501eae 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -3094,6 +3094,7 @@ void SdrObject::MakeNameUnique() { if (GetName().isEmpty()) { + OUString aName; if (const E3dScene* pE3dObj = DynCastE3dScene(this)) { SdrObjList* pObjList = pE3dObj->GetSubList(); @@ -3101,11 +3102,12 @@ void SdrObject::MakeNameUnique() { SdrObject* pObj0 = pObjList->GetObj(0); if (pObj0) - SetName(pObj0->TakeObjNameSingul()); + aName = pObj0->TakeObjNameSingul(); } } else - SetName(TakeObjNameSingul()); + aName = TakeObjNameSingul(); + SetName(aName + " 1"); } std::unordered_set<OUString> aNameSet; @@ -3143,8 +3145,6 @@ void SdrObject::MakeNameUnique(std::unordered_set<OUString>& rNameSet) while (nPos > 0 && rtl::isAsciiDigit(sName[--nPos])); sRootName = o3tl::trim(sName.subView(0, nPos + 1)); } - else - sName += " 1"; for (sal_uInt32 n = 1; rNameSet.find(sName) != rNameSet.end(); n++) sName = sRootName + " " + OUString::number(n); |