summaryrefslogtreecommitdiff
path: root/sc/source/ui/miscdlgs
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-12-13 20:13:33 -0500
committerKohei Yoshida <kyoshida@novell.com>2010-12-13 23:38:19 -0500
commit7f7552fc48b705f433d3e24a15d681d6006f4b1a (patch)
treec83b10b0d5ced6d85b80ddc1f7ab00ee0269c233 /sc/source/ui/miscdlgs
parent821c6b40070c59530d4413705e5e6154e1d15bca (diff)
Update new sheet name when control states change.
Diffstat (limited to 'sc/source/ui/miscdlgs')
-rw-r--r--sc/source/ui/miscdlgs/mvtabdlg.cxx53
1 files changed, 35 insertions, 18 deletions
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 4568742b7980..5a13865979d4 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -123,28 +123,42 @@ void ScMoveTableDlg::EnableCopyTable(BOOL bFlag)
void ScMoveTableDlg::SetRenameTable(BOOL bFlag)
{
aBtnRename.Check(bFlag);
- EnableTabName(bFlag);
+ aEdTabName.Enable(bFlag);
}
void ScMoveTableDlg::EnableRenameTable(BOOL bFlag)
-{ if( bFlag )
+{
+ if( bFlag )
aBtnRename.Enable();
else
aBtnRename.Disable();
}
-void ScMoveTableDlg::EnableTabName(BOOL bFlag)
+void ScMoveTableDlg::ResetRenameInput()
{
- if(bFlag)
+ bool bVal = aBtnCopy.IsChecked();
+ if (bVal)
{
- aEdTabName.Enable();
- aEdTabName.SetText( mrDefaultName );
+ // copy
+ ScDocument* pDoc = GetSelectedDoc();
+ if (pDoc)
+ {
+ String aStr = mrDefaultName;
+ pDoc->CreateValidTabName(aStr);
+ aEdTabName.SetText(aStr);
+ }
+ else
+ aEdTabName.SetText(mrDefaultName);
}
else
- {
- aEdTabName.Disable();
- aEdTabName.SetText( String() );
- }
+ // move
+ aEdTabName.SetText(mrDefaultName);
+}
+
+ScDocument* ScMoveTableDlg::GetSelectedDoc()
+{
+ USHORT nPos = aLbDoc.GetSelectEntryPos();
+ return static_cast<ScDocument*>(aLbDoc.GetEntryData(nPos));
}
//------------------------------------------------------------------------
@@ -153,12 +167,14 @@ void ScMoveTableDlg::Init()
{
aBtnOk.SetClickHdl ( LINK( this, ScMoveTableDlg, OkHdl ) );
aLbDoc.SetSelectHdl ( LINK( this, ScMoveTableDlg, SelHdl ) );
- aBtnRename.SetToggleHdl( LINK( this, ScMoveTableDlg, RenameHdl ) );
+ aBtnCopy.SetToggleHdl( LINK( this, ScMoveTableDlg, CheckBtnHdl ) );
+ aBtnRename.SetToggleHdl( LINK( this, ScMoveTableDlg, CheckBtnHdl ) );
aBtnCopy.Check( FALSE );
aBtnRename.Check( FALSE );
- EnableTabName( FALSE );
+ aEdTabName.Enable(false);
InitDocListBox();
SelHdl( &aLbDoc );
+ ResetRenameInput();
}
//------------------------------------------------------------------------
@@ -198,9 +214,12 @@ void ScMoveTableDlg::InitDocListBox()
//------------------------------------------------------------------------
// Handler:
-IMPL_LINK( ScMoveTableDlg, RenameHdl, void *, EMPTYARG )
+IMPL_LINK( ScMoveTableDlg, CheckBtnHdl, void *, pBtn )
{
- EnableTabName( aBtnRename.IsChecked() );
+ if (pBtn == &aBtnRename)
+ aEdTabName.Enable( aBtnRename.IsChecked() );
+ else if (pBtn == &aBtnCopy)
+ ResetRenameInput();
return 0;
}
@@ -226,14 +245,11 @@ IMPL_LINK( ScMoveTableDlg, OkHdl, void *, EMPTYARG )
return 0;
}
-//------------------------------------------------------------------------
-
IMPL_LINK( ScMoveTableDlg, SelHdl, ListBox *, pLb )
{
if ( pLb == &aLbDoc )
{
- ScDocument* pDoc = (ScDocument*)
- aLbDoc.GetEntryData( aLbDoc.GetSelectEntryPos() );
+ ScDocument* pDoc = GetSelectedDoc();
SCTAB nLast = 0;
String aName;
@@ -251,6 +267,7 @@ IMPL_LINK( ScMoveTableDlg, SelHdl, ListBox *, pLb )
aLbTable.InsertEntry( ScGlobal::GetRscString(STR_MOVE_TO_END) );
aLbTable.SetUpdateMode( TRUE );
aLbTable.SelectEntryPos( 0 );
+ ResetRenameInput();
}
return 0;