summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2020-02-05 10:57:21 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-02-05 17:17:30 +0100
commitb2d9603bc02db3a6711948274c5fa2b5cf148d48 (patch)
treeb9f22dda2f9275f14151e10509c56af298357f76
parentfe5033036937ab655df997577909527ffb85f5af (diff)
sw: set uniqe name and style to grouped shapes
Unique name is required to dsiplay object in Navigator, style is used by undo/redo code. Change-Id: Id2417cbee3f92c0ee555eb093e1e9bbbc0a83e0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87996 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--sw/inc/doc.hxx1
-rw-r--r--sw/source/core/doc/docdraw.cxx5
-rw-r--r--sw/source/core/doc/doclay.cxx5
3 files changed, 9 insertions, 2 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 20954f7ed608..14d98f6d5fee 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -680,6 +680,7 @@ public:
OUString GetUniqueOLEName() const;
OUString GetUniqueFrameName() const;
OUString GetUniqueShapeName() const;
+ OUString GetUniqueDrawObjectName() const;
o3tl::sorted_vector<SwRootFrame*> GetAllLayouts();
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index 47a217269d45..6a9b4d290096 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -239,7 +239,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
pObj->NbcMove( Size( aAnchorPos.getX(), aAnchorPos.getY() ) );
}
- pFormat = MakeDrawFrameFormat( "DrawObject",
+ pFormat = MakeDrawFrameFormat( GetUniqueDrawObjectName(),
GetDfltFrameFormat() );
pFormat->SetFormatAttr( aAnch );
// #i36010# - set layout direction of the position
@@ -250,6 +250,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
OSL_ENSURE( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." );
SdrObject* pNewGroupObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
+ pNewGroupObj->SetName(pFormat->GetName());
pNewContact = new SwDrawContact( pFormat, pNewGroupObj );
// #i35635#
pNewContact->MoveObjToVisibleLayer( pNewGroupObj );
@@ -322,7 +323,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView )
for ( size_t i2 = 0; i2 < pLst->GetObjCount(); ++i2 )
{
SdrObject* pSubObj = pLst->GetObj( i2 );
- SwDrawFrameFormat *pFormat = MakeDrawFrameFormat( "DrawObject",
+ SwDrawFrameFormat *pFormat = MakeDrawFrameFormat( GetUniqueShapeName(),
GetDfltFrameFormat() );
pFormat->SetFormatAttr( aAnch );
// #i36010# - set layout direction of the position
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index d741c14ba068..c62a91c56a33 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1381,6 +1381,11 @@ OUString SwDoc::GetUniqueShapeName() const
return lcl_GetUniqueFlyName(this, STR_SHAPE_DEFNAME, RES_DRAWFRMFMT);
}
+OUString SwDoc::GetUniqueDrawObjectName() const
+{
+ return lcl_GetUniqueFlyName(this, "DrawObject", RES_DRAWFRMFMT);
+}
+
const SwFlyFrameFormat* SwDoc::FindFlyByName( const OUString& rName, SwNodeType nNdTyp ) const
{
auto range = GetSpzFrameFormats()->rangeFind( RES_FLYFRMFMT, rName );