summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-04-28 15:14:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-04-28 19:31:03 +0200
commit6523c7a6436f3a7ea189c4e77898d754bf703e49 (patch)
tree9369a0b99b842f05f3e3399db65845bf7a6bc800 /sw
parent424bdeda9fea09f0b48b5551baf872656845c7c3 (diff)
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.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/doclay.cxx13
1 files changed, 13 insertions, 0 deletions
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;
}