diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/scabstdlg.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/mvtabdlg.hxx | 10 | ||||
-rw-r--r-- | sc/source/ui/inc/viewfunc.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/mvtabdlg.cxx | 42 | ||||
-rw-r--r-- | sc/source/ui/src/miscdlgs.src | 22 | ||||
-rw-r--r-- | sc/source/ui/view/tabcont.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshf.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 20 |
10 files changed, 119 insertions, 7 deletions
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 57d0fd43f179..41cce4123b3e 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -213,6 +213,8 @@ public: virtual USHORT GetSelectedDocument () const = 0; virtual USHORT GetSelectedTable () const = 0; virtual BOOL GetCopyTable () const = 0; + virtual BOOL GetRenameTable () const = 0; + virtual void GetTabNameString( String& rString ) const = 0; virtual void SetCopyTable (BOOL bFlag=TRUE) = 0; virtual void EnableCopyTable (BOOL bFlag=TRUE) = 0; }; diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index b4035b187197..8d57ccfcd5c0 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -502,6 +502,14 @@ BOOL AbstractScMoveTableDlg_Impl::GetCopyTable() const { return pDlg->GetCopyTable(); } +BOOL AbstractScMoveTableDlg_Impl::GetRenameTable() const +{ + return pDlg->GetRenameTable(); +} +void AbstractScMoveTableDlg_Impl::GetTabNameString( String& rString ) const +{ + pDlg->GetTabNameString( rString ); +} void AbstractScMoveTableDlg_Impl::SetCopyTable(BOOL bFla) { return pDlg->SetCopyTable( bFla ); diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 9815fd22d51e..6b669a231f66 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -263,6 +263,8 @@ class AbstractScMoveTableDlg_Impl : public AbstractScMoveTableDlg //add for ScM virtual USHORT GetSelectedDocument () const; virtual USHORT GetSelectedTable () const; virtual BOOL GetCopyTable () const; + virtual BOOL GetRenameTable () const; + virtual void GetTabNameString( String& rString ) const; virtual void SetCopyTable (BOOL bFlag=TRUE); virtual void EnableCopyTable (BOOL bFlag=TRUE); }; diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx index 27963f335bcb..a4991ca821fb 100644 --- a/sc/source/ui/inc/mvtabdlg.hxx +++ b/sc/source/ui/inc/mvtabdlg.hxx @@ -35,6 +35,7 @@ #include <vcl/imagebtn.hxx> #include <vcl/lstbox.hxx> #include <vcl/fixed.hxx> +#include <vcl/edit.hxx> #include <layout/layout.hxx> #include <layout/layout-pre.hxx> @@ -50,8 +51,12 @@ public: USHORT GetSelectedDocument () const; SCTAB GetSelectedTable () const; BOOL GetCopyTable () const; + BOOL GetRenameTable () const; + void GetTabNameString( String& rString ) const; void SetCopyTable (BOOL bFlag=TRUE); void EnableCopyTable (BOOL bFlag=TRUE); + void SetRenameTable (BOOL bFlag=TRUE); + void SetTabNameVisible (BOOL bFlag=TRUE); private: FixedText aFtDoc; @@ -59,6 +64,9 @@ private: FixedText aFtTable; ListBox aLbTable; CheckBox aBtnCopy; + CheckBox aBtnRename; + FixedText aFtTabName; + Edit aEdTabName; OKButton aBtnOk; CancelButton aBtnCancel; HelpButton aBtnHelp; @@ -66,11 +74,13 @@ private: USHORT nDocument; SCTAB nTable; BOOL bCopyTable; + BOOL bRenameTable; //-------------------------------------- void Init (); void InitDocListBox (); DECL_LINK( OkHdl, void * ); DECL_LINK( SelHdl, ListBox * ); + DECL_LINK( RenameHdl, void * ); }; #include <layout/layout-post.hxx> diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index f231e91d3dd6..a5f3e70ff8a9 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -272,7 +272,7 @@ public: BOOL DeleteTables(const SvShorts &TheTabs, BOOL bRecord = TRUE ); BOOL RenameTable( const String& rName, SCTAB nTabNr ); - void MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy ); + void MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy, const String& rName ); void ImportTables( ScDocShell* pSrcShell, SCTAB nCount, const SCTAB* pSrcTabs, BOOL bLink,SCTAB nTab); diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx index 2dfaa510959a..b92d66a230c7 100644 --- a/sc/source/ui/miscdlgs/mvtabdlg.cxx +++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx @@ -65,13 +65,17 @@ ScMoveTableDlg::ScMoveTableDlg( Window* pParent ) aFtTable ( this, ScResId( FT_INSERT ) ), aLbTable ( this, ScResId( LB_INSERT ) ), aBtnCopy ( this, ScResId( BTN_COPY ) ), + aBtnRename ( this, ScResId( BTN_RENAME ) ), + aFtTabName ( this, ScResId( FT_LABEL ) ), + aEdTabName ( this, ScResId( ED_INPUT ) ), aBtnOk ( this, ScResId( BTN_OK ) ), aBtnCancel ( this, ScResId( BTN_CANCEL ) ), aBtnHelp ( this, ScResId( BTN_HELP ) ), // nDocument ( 0 ), nTable ( 0 ), - bCopyTable ( FALSE ) + bCopyTable ( FALSE ), + bRenameTable( FALSE ) { #if ENABLE_LAYOUT #undef ScResId @@ -95,6 +99,13 @@ SCTAB ScMoveTableDlg::GetSelectedTable () const { return nTable; } BOOL ScMoveTableDlg::GetCopyTable () const { return bCopyTable; } +BOOL ScMoveTableDlg::GetRenameTable () const { return bRenameTable; } + +void ScMoveTableDlg::GetTabNameString( String& rString ) const +{ + rString = aEdTabName.GetText(); +} + void ScMoveTableDlg::SetCopyTable(BOOL bFlag) { aBtnCopy.Check(bFlag); @@ -107,6 +118,24 @@ void ScMoveTableDlg::EnableCopyTable(BOOL bFlag) aBtnCopy.Disable(); } +void ScMoveTableDlg::SetRenameTable(BOOL bFlag) +{ + aBtnRename.Check(bFlag); + SetTabNameVisible(bFlag); +} + +void ScMoveTableDlg::SetTabNameVisible(BOOL bFlag) +{ + if(bFlag) + { + aFtTabName.Show(); + aEdTabName.Show(); + } else + { + aFtTabName.Hide(); + aEdTabName.Hide(); + } +} //------------------------------------------------------------------------ @@ -114,7 +143,10 @@ void ScMoveTableDlg::Init() { aBtnOk.SetClickHdl ( LINK( this, ScMoveTableDlg, OkHdl ) ); aLbDoc.SetSelectHdl ( LINK( this, ScMoveTableDlg, SelHdl ) ); + aBtnRename.SetToggleHdl( LINK( this, ScMoveTableDlg, RenameHdl ) ); aBtnCopy.Check( FALSE ); + aBtnRename.Check( FALSE ); + SetTabNameVisible( FALSE ); InitDocListBox(); SelHdl( &aLbDoc ); } @@ -157,6 +189,13 @@ void ScMoveTableDlg::InitDocListBox() //------------------------------------------------------------------------ // Handler: +IMPL_LINK( ScMoveTableDlg, RenameHdl, void *, EMPTYARG ) +{ + SetTabNameVisible( aBtnRename.IsChecked() ); + + return 0; +} + IMPL_LINK( ScMoveTableDlg, OkHdl, void *, EMPTYARG ) { USHORT nDocSel = aLbDoc.GetSelectEntryPos(); @@ -167,6 +206,7 @@ IMPL_LINK( ScMoveTableDlg, OkHdl, void *, EMPTYARG ) nDocument = (nDocSel != nDocLast) ? nDocSel : SC_DOC_NEW; nTable = (nTabSel != nTabLast) ? static_cast<SCTAB>(nTabSel) : SC_TAB_APPEND; bCopyTable = aBtnCopy.IsChecked(); + bRenameTable= aBtnRename.IsChecked(); EndDialog( RET_OK ); return 0; diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src index 5793d4237790..308318262db7 100644 --- a/sc/source/ui/src/miscdlgs.src +++ b/sc/source/ui/src/miscdlgs.src @@ -439,7 +439,7 @@ ModalDialog RID_SCDLG_MOVETAB OutputSize = TRUE ; HelpId = FID_TAB_MOVE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 168 , 130 ) ; + Size = MAP_APPFONT ( 168 , 180 ) ; Text [ en-US ] = "Move/Copy Sheet" ; Moveable = TRUE ; Closeable = FALSE ; @@ -496,6 +496,26 @@ ModalDialog RID_SCDLG_MOVETAB Text [ en-US ] = "~Copy" ; TabStop = TRUE ; }; + CheckBox BTN_RENAME + { + Pos = MAP_APPFONT ( 6 , 124 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "~Rename" ; + TabStop = TRUE ; + }; + FixedText FT_LABEL + { + Pos = MAP_APPFONT ( 6 , 137 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; + Text [ en-US ] = "New ~name" ; + }; + Edit ED_INPUT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 149 ) ; + Size = MAP_APPFONT ( 110 , 12 ) ; + TabStop = TRUE ; + }; String STR_NEWDOC { Text [ en-US ] = "- new document -" ; diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index daea22b78027..3a09a53abd52 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -552,7 +552,7 @@ sal_Int8 ScTabControl::ExecuteDrop( const ExecuteDropEvent& rEvt ) if ( !pDoc->GetChangeTrack() && pDoc->IsDocEditable() ) { //! use table selection from the tab control where dragging was started? - pViewData->GetView()->MoveTable( lcl_DocShellNr(pDoc), nPos, rEvt.mnAction != DND_ACTION_MOVE ); + pViewData->GetView()->MoveTable( lcl_DocShellNr(pDoc), nPos, rEvt.mnAction != DND_ACTION_MOVE, String() ); rData.pCellTransfer->SetDragWasInternal(); // don't delete return TRUE; diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 3baa549f2932..b4950e38963d 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -478,7 +478,9 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) USHORT nDoc = 0; SCTAB nTab = pViewData->GetTabNo(); BOOL bCpy = FALSE; + BOOL bRna = FALSE; String aDocName; + String aTabName; if( pReqArgs != NULL ) { @@ -497,6 +499,12 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) if( IS_AVAILABLE( FN_PARAM_2, &pItem ) ) bCpy = ((const SfxBoolItem*)pItem)->GetValue(); +#if 0 +// This must be checked: + if( IS_AVAILABLE( FN_PARAM_3, &pItem ) ) + aTabName = ((const SfxStringItem*)pItem)->GetValue(); +#endif + if( aDocName.Len() ) { SfxObjectShell* pSh = SfxObjectShell::GetFirst(); @@ -557,6 +565,12 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) nDoc = pDlg->GetSelectedDocument(); nTab = pDlg->GetSelectedTable(); bCpy = pDlg->GetCopyTable(); + bRna = pDlg->GetRenameTable(); + // Leave aTabName string empty, when Rename is FALSE. + if( bRna ) + { + pDlg->GetTabNameString( aTabName ); + } bDoIt = TRUE; String aFoundDocName; @@ -586,7 +600,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) { rReq.Done(); // aufzeichnen, solange das Dokument noch aktiv ist - MoveTable( nDoc, nTab, bCpy ); + MoveTable( nDoc, nTab, bCpy, aTabName ); } } break; 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) |