diff options
author | Joost Wezenbeek <joost.eekhoorn@gmail.com> | 2010-12-12 12:04:34 +0100 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-12-13 23:38:19 -0500 |
commit | 9fe1f169fa9e1a693a1d81a9b422d0d4ce0d6c23 (patch) | |
tree | 31e4c9bb73280dbeab60c85011358f3717c6d576 /sc/source | |
parent | 8d2908194c04ce0129d0d232d9fc6beb5b9d3b4e (diff) |
Change Sheet copy process
Easy Hacks 3.27
Added rename in Move/Copy Sheet in calc
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/mvtabdlg.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/mvtabdlg.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshf.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 4 |
6 files changed, 28 insertions, 8 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 7c428916ba8a..b55aa44f51bd 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -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; diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index cf875b131354..58ad69cbb05f 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -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 diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx index 3d00c94ef385..81da77b8ff85 100644 --- a/sc/source/ui/inc/mvtabdlg.hxx +++ b/sc/source/ui/inc/mvtabdlg.hxx @@ -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; diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx index 8035cc26c26a..e10e4ba1e1d9 100644 --- a/sc/source/ui/miscdlgs/mvtabdlg.cxx +++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx @@ -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; diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 6fb7b5c9656c..e569baf10987 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -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(); diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index a15af65bfac2..e105754e4e2f 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -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++) { |