diff options
Diffstat (limited to 'sc/source/ui/view/viewfun2.cxx')
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 55dfb6ab30d2..52488e05f422 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2543,7 +2543,7 @@ void ScViewFunc::ImportTables( ScDocShell* pSrcShell, //---------------------------------------------------------------------------- // Tabelle in anderes Dokument verschieben / kopieren -void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy ) +void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const String& rName ) { ScDocument* pDoc = GetViewData()->GetDocument(); ScDocShell* pDocShell = GetViewData()->GetDocShell(); @@ -2645,7 +2645,11 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy ) for( USHORT j=0; j<TheTabs.Count(); j++, nDestTab1++ ) { // #63304# insert sheets first and update all references String aName; - pDoc->GetName( TheTabs[j], aName ); + if( rName.Len() ) + aName = rName; + else + pDoc->GetName( TheTabs[j], aName ); + pDestDoc->CreateValidTabName( aName ); if ( !pDestDoc->InsertTab( nDestTab1, aName ) ) { @@ -2825,6 +2829,18 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy ) delete pString; } + // Rename must be done after that all sheets have been moved. + if( rName.Len() ) + { + for(int j=0;j<TheDestTabs.Count();j++) + { + SCTAB nRenameTab = static_cast<SCTAB>(TheDestTabs[j]); + String aTabName( rName); + pDoc->CreateValidTabName( aTabName ); + pDocShell->GetDocFunc().RenameTable( nRenameTab, aTabName, TRUE, FALSE ); + } + } + nTab = GetViewData()->GetTabNo(); if (bUndo) |