Change Sheet copy process
Easy Hacks 3.27 Added rename in Move/Copy Sheet in calc
This commit is contained in:
parent
8d2908194c
commit
9fe1f169fa
7 changed files with 31 additions and 9 deletions
|
@ -410,7 +410,9 @@ public:
|
|||
long nFirst = 1,
|
||||
long nLast = 100 ) = 0;
|
||||
|
||||
virtual AbstractScMoveTableDlg * CreateScMoveTableDlg( Window* pParent, int nId ) = 0; //add for ScMoveTableDlg
|
||||
virtual AbstractScMoveTableDlg * CreateScMoveTableDlg( Window* pParent, //add for ScMoveTableDlg
|
||||
const String& rDefault,
|
||||
int nId ) = 0;
|
||||
|
||||
virtual AbstractScNameCreateDlg * CreateScNameCreateDlg ( Window * pParent, USHORT nFlags, int nId ) = 0; //add for ScNameCreateDlg
|
||||
|
||||
|
|
|
@ -1125,13 +1125,15 @@ AbstractScMetricInputDlg * ScAbstractDialogFactory_Impl::CreateScMetricInputDlg
|
|||
|
||||
|
||||
//add for ScMoveTableDlg begin
|
||||
AbstractScMoveTableDlg * ScAbstractDialogFactory_Impl::CreateScMoveTableDlg( Window* pParent, int nId )
|
||||
AbstractScMoveTableDlg * ScAbstractDialogFactory_Impl::CreateScMoveTableDlg( Window* pParent,
|
||||
const String& rDefault,
|
||||
int nId )
|
||||
{
|
||||
ScMoveTableDlg * pDlg=NULL;
|
||||
switch ( nId )
|
||||
{
|
||||
case RID_SCDLG_MOVETAB :
|
||||
pDlg = new ScMoveTableDlg( pParent );
|
||||
pDlg = new ScMoveTableDlg( pParent, rDefault );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -492,7 +492,10 @@ public:
|
|||
long nFirst = 1,
|
||||
long nLast = 100 );
|
||||
|
||||
virtual AbstractScMoveTableDlg * CreateScMoveTableDlg( Window* pParent, int nId ); //add for ScMoveTableDlg
|
||||
virtual AbstractScMoveTableDlg * CreateScMoveTableDlg( Window* pParent, //add for ScMoveTableDlg
|
||||
const String& rDefault,
|
||||
int nId );
|
||||
|
||||
virtual AbstractScNameCreateDlg * CreateScNameCreateDlg ( Window * pParent, USHORT nFlags, int nId ); //add for ScNameCreateDlg
|
||||
|
||||
virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, const ScRangeName* pList, //add for ScNamePasteDlg
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
class ScMoveTableDlg : public ModalDialog
|
||||
{
|
||||
public:
|
||||
ScMoveTableDlg( Window* pParent );
|
||||
ScMoveTableDlg( Window* pParent, const String& rDefault );
|
||||
~ScMoveTableDlg();
|
||||
|
||||
USHORT GetSelectedDocument () const;
|
||||
|
@ -71,6 +71,8 @@ private:
|
|||
CancelButton aBtnCancel;
|
||||
HelpButton aBtnHelp;
|
||||
|
||||
const String& mrDefaultName;
|
||||
|
||||
USHORT nDocument;
|
||||
SCTAB nTable;
|
||||
BOOL bCopyTable;
|
||||
|
|
|
@ -56,7 +56,8 @@
|
|||
|
||||
//==================================================================
|
||||
|
||||
ScMoveTableDlg::ScMoveTableDlg( Window* pParent )
|
||||
ScMoveTableDlg::ScMoveTableDlg( Window* pParent,
|
||||
const String& rDefault )
|
||||
|
||||
: ModalDialog ( pParent, ScResId( RID_SCDLG_MOVETAB ) ),
|
||||
//
|
||||
|
@ -71,6 +72,7 @@ ScMoveTableDlg::ScMoveTableDlg( Window* pParent )
|
|||
aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
|
||||
aBtnHelp ( this, ScResId( BTN_HELP ) ),
|
||||
//
|
||||
mrDefaultName( rDefault ),
|
||||
nDocument ( 0 ),
|
||||
nTable ( 0 ),
|
||||
bCopyTable ( FALSE ),
|
||||
|
@ -136,6 +138,7 @@ void ScMoveTableDlg::EnableTabName(BOOL bFlag)
|
|||
if(bFlag)
|
||||
{
|
||||
aEdTabName.Enable();
|
||||
aEdTabName.SetText( mrDefaultName );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -213,6 +216,11 @@ IMPL_LINK( ScMoveTableDlg, OkHdl, void *, EMPTYARG )
|
|||
nTable = (nTabSel != nTabLast) ? static_cast<SCTAB>(nTabSel) : SC_TAB_APPEND;
|
||||
bCopyTable = aBtnCopy.IsChecked();
|
||||
bRenameTable= aBtnRename.IsChecked();
|
||||
|
||||
// Return an empty string, when the new name is the same as the original name.
|
||||
if( mrDefaultName == aEdTabName.GetText() )
|
||||
aEdTabName.SetText( String() );
|
||||
|
||||
EndDialog( RET_OK );
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -544,10 +544,15 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
|
|||
}
|
||||
else
|
||||
{
|
||||
String aDefaultName;
|
||||
pDoc->GetName( pViewData->GetTabNo(), aDefaultName );
|
||||
|
||||
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
|
||||
DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
|
||||
|
||||
AbstractScMoveTableDlg* pDlg = pFact->CreateScMoveTableDlg( GetDialogParent(), RID_SCDLG_MOVETAB );
|
||||
AbstractScMoveTableDlg* pDlg = pFact->CreateScMoveTableDlg( GetDialogParent(),
|
||||
aDefaultName,
|
||||
RID_SCDLG_MOVETAB );
|
||||
DBG_ASSERT(pDlg, "Dialog create fail!");
|
||||
|
||||
SCTAB nTableCount = pDoc->GetTableCount();
|
||||
|
|
|
@ -2645,7 +2645,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const
|
|||
for( USHORT j=0; j<TheTabs.Count(); j++, nDestTab1++ )
|
||||
{ // #63304# insert sheets first and update all references
|
||||
String aName;
|
||||
if( pName->Len() )
|
||||
if( (pName != NULL ) && ( pName->Len() ) )
|
||||
aName = *pName;
|
||||
else
|
||||
pDoc->GetName( TheTabs[j], aName );
|
||||
|
@ -2830,7 +2830,7 @@ void ScViewFunc::MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const
|
|||
}
|
||||
|
||||
// Rename must be done after that all sheets have been moved.
|
||||
if( pName->Len() )
|
||||
if( (pName != NULL) && ( pName->Len() ) )
|
||||
{
|
||||
for(int j=0;j<TheDestTabs.Count();j++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue