sw/source/core/doc/doclay.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+)
New commits: commit 6523c7a6436f3a7ea189c4e77898d754bf703e49 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Apr 28 15:14:39 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Apr 28 19:31:03 2023 +0200 Revert "remove dead code in SwDoc::CloneSdrObj" This reverts commit 23046111d01ab0ec5feb570d428aea5ed4ece5fc. Reason for revert: I misunderstood how sw::isType is working here Change-Id: Ib5eac520f4ed79dbe1d6088a44e17b2b2a129877 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151123 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index eab0204fd605..d316ba264b82 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -137,6 +137,19 @@ rtl::Reference<SdrObject> SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveW else if( bInsInPage ) pPg->InsertObjectThenMakeNameUnique( pObj.get() ); + // For drawing objects: set layer of cloned object to invisible layer + SdrLayerID nLayerIdForClone = rObj.GetLayer(); + if ( dynamic_cast<const SwFlyDrawObj*>( pObj.get() ) == nullptr && + dynamic_cast<const SwVirtFlyDrawObj*>( pObj.get() ) == nullptr && + !isType<SdrObject>(pObj.get()) ) + { + if ( getIDocumentDrawModelAccess().IsVisibleLayerId( nLayerIdForClone ) ) + { + nLayerIdForClone = getIDocumentDrawModelAccess().GetInvisibleLayerIdByVisibleOne( nLayerIdForClone ); + } + } + pObj->SetLayer( nLayerIdForClone ); + return pObj; }