summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2020-08-20 12:06:03 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-08-21 23:44:01 +0200
commita6c2a87612a10d55fc59fa01e44d67d95505834f (patch)
tree358f3ec47c365e7d645597e2bb1742b9e1a828d3
parent5f23f241704f798164df498e24dbf6b0daf27c44 (diff)
tdf#133490: set name for pasted frame format
In some copy/paste operations resulting frame format name can be empty. This can lead to problems with udo/redo which relies on format names. Change-Id: I3cb542321d37cc00e2dee83d0f667164d83ead78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101042 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--sw/source/core/doc/DocumentLayoutManager.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx
index a582fddaa1cb..7df5d2871f91 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -41,6 +41,7 @@
#include <pam.hxx>
#include <frameformats.hxx>
#include <com/sun/star/embed/EmbedStates.hpp>
+#include <svx/svdobj.hxx>
using namespace ::com::sun::star;
@@ -485,6 +486,14 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat(
pDestTextBox->SetOtherTextBoxFormat(pDest);
}
+ if (pDest->GetName().isEmpty())
+ {
+ // Format name should have unique name. Let's use object name as a fallback
+ SdrObject *pObj = pDest->FindSdrObject();
+ if (pObj)
+ pDest->SetName(pObj->GetName());
+ }
+
return pDest;
}