summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorJoost Wezenbeek <joost.eekhoorn@gmail.com>2010-12-28 16:07:11 +0100
committerKohei Yoshida <kyoshida@novell.com>2011-01-03 14:06:42 -0500
commit04eabcee2ee1e5ac03219877ad28c447d8e9a52b (patch)
tree6b53098603568fcd5535dcae19ccd4692d7af7e2 /sc/source
parent5ec9ab59a833d568f0e819cd4c4b3647fb1af932 (diff)
New layout Move/Copy sheet in calc
OK, Cancel and Help buttons placed at bottom of the dialog Copy checkbox changed to Copy/Move option buttons Sections: Action, Location and Name Warning: This name is already used.
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx4
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx1
-rw-r--r--sc/source/ui/inc/miscdlgs.hrc7
-rw-r--r--sc/source/ui/inc/mvtabdlg.hxx13
-rw-r--r--sc/source/ui/miscdlgs/mvtabdlg.cxx76
-rw-r--r--sc/source/ui/src/miscdlgs.src88
6 files changed, 143 insertions, 46 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 7332b08fffac..bcc5c4d16098 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -518,10 +518,6 @@ void AbstractScMoveTableDlg_Impl::EnableCopyTable(BOOL bFlag)
{
return pDlg->EnableCopyTable( bFlag);
}
-void AbstractScMoveTableDlg_Impl::SetRenameTable(BOOL bFla)
-{
- return pDlg->SetRenameTable( bFla );
-}
void AbstractScMoveTableDlg_Impl::EnableRenameTable(BOOL bFlag)
{
return pDlg->EnableRenameTable( bFlag);
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index ffe101a02af5..7927960a6490 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -267,7 +267,6 @@ class AbstractScMoveTableDlg_Impl : public AbstractScMoveTableDlg //add for ScM
virtual void GetTabNameString( String& rString ) const;
virtual void SetCopyTable (BOOL bFlag=TRUE);
virtual void EnableCopyTable (BOOL bFlag=TRUE);
- virtual void SetRenameTable (BOOL bFlag=TRUE);
virtual void EnableRenameTable (BOOL bFlag=TRUE);
};
diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc
index 2873dffbb844..fd6463bacf7c 100644
--- a/sc/source/ui/inc/miscdlgs.hrc
+++ b/sc/source/ui/inc/miscdlgs.hrc
@@ -98,6 +98,13 @@
#define LB_INSERT 4
#define BTN_COPY 5
#define STR_NEWDOC 6
+#define BTN_MOVE 7
+#define FL_ACTION 8
+#define FL_LOCATION 9
+#define FL_NAME 11
+#define FT_TABNAME 12
+#define FT_WARN 13
+#define STR_CURRENTDOC 14
// Eingabe eines Strings
#define ED_INPUT 10
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 93b38a39ca01..54aeacde7622 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -55,21 +55,27 @@ public:
void GetTabNameString( String& rString ) const;
void SetCopyTable (BOOL bFlag=TRUE);
void EnableCopyTable (BOOL bFlag=TRUE);
- void SetRenameTable (BOOL bFlag=TRUE);
void EnableRenameTable (BOOL bFlag=TRUE);
private:
void ResetRenameInput();
+ void CheckNewNameExists();
ScDocument* GetSelectedDoc();
private:
+ FixedLine aFlAction;
+ RadioButton aBtnMove;
+ RadioButton aBtnCopy;
+ FixedLine aFlLocation;
FixedText aFtDoc;
ListBox aLbDoc;
FixedText aFtTable;
ListBox aLbTable;
- CheckBox aBtnCopy;
- CheckBox aBtnRename;
+ FixedLine aFlName;
+ FixedText aFtTabName;
Edit aEdTabName;
+ FixedText aFtWarn;
+ FixedLine aFixedLine;
OKButton aBtnOk;
CancelButton aBtnCancel;
HelpButton aBtnHelp;
@@ -87,6 +93,7 @@ private:
DECL_LINK( OkHdl, void * );
DECL_LINK( SelHdl, ListBox * );
DECL_LINK( CheckBtnHdl, void * );
+ DECL_LINK( CheckNameHdl, Edit * );
};
#include <layout/layout-post.hxx>
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 77a46df84e06..f9e417885e87 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -61,13 +61,19 @@ ScMoveTableDlg::ScMoveTableDlg( Window* pParent,
: ModalDialog ( pParent, ScResId( RID_SCDLG_MOVETAB ) ),
//
+ aFlAction ( this, ScResId( FL_ACTION ) ),
+ aBtnMove ( this, ScResId( BTN_MOVE ) ),
+ aBtnCopy ( this, ScResId( BTN_COPY ) ),
+ aFlLocation ( this, ScResId( FL_LOCATION ) ),
aFtDoc ( this, ScResId( FT_DEST ) ),
aLbDoc ( this, ScResId( LB_DEST ) ),
aFtTable ( this, ScResId( FT_INSERT ) ),
aLbTable ( this, ScResId( LB_INSERT ) ),
- aBtnCopy ( this, ScResId( BTN_COPY ) ),
- aBtnRename ( this, ScResId( BTN_RENAME ) ),
+ aFlName ( this, ScResId( FL_NAME ) ),
+ aFtTabName ( this, ScResId( FT_TABNAME ) ),
aEdTabName ( this, ScResId( ED_INPUT ) ),
+ aFtWarn ( this, ScResId( FT_WARN ) ),
+ aFixedLine ( this, ScResId( FL_SEP1 ) ),
aBtnOk ( this, ScResId( BTN_OK ) ),
aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
aBtnHelp ( this, ScResId( BTN_HELP ) ),
@@ -120,21 +126,16 @@ void ScMoveTableDlg::EnableCopyTable(BOOL bFlag)
aBtnCopy.Disable();
}
-void ScMoveTableDlg::SetRenameTable(BOOL bFlag)
-{
- aBtnRename.Check(bFlag);
- aEdTabName.Enable(bFlag);
-}
-
void ScMoveTableDlg::EnableRenameTable(BOOL bFlag)
{
- aBtnRename.Enable(bFlag);
+ bRenameTable = bFlag;
+ aEdTabName.Enable(bFlag);
ResetRenameInput();
}
void ScMoveTableDlg::ResetRenameInput()
{
- if (!aBtnRename.IsEnabled())
+ if (!aEdTabName.IsEnabled())
{
aEdTabName.SetText(String());
return;
@@ -157,6 +158,33 @@ void ScMoveTableDlg::ResetRenameInput()
else
// move
aEdTabName.SetText(mrDefaultName);
+
+ CheckNewNameExists();
+}
+
+void ScMoveTableDlg::CheckNewNameExists()
+{
+ BOOL bFound = FALSE;
+ USHORT nLast = aLbTable.GetEntryCount() - 1;
+ for ( USHORT i=0; i<=nLast; ++i )
+ {
+ if ( aEdTabName.GetText() == aLbTable.GetEntry( i ) )
+ {
+ if( ( aBtnMove.IsChecked() ) &&
+ ( aLbDoc.GetSelectEntryPos() == 0 ) &&
+ ( aEdTabName.GetText() == mrDefaultName) )
+
+ // Move inside same document, thus same name is allowed.
+ bFound = FALSE;
+ else
+ bFound = TRUE;
+
+ }
+ }
+ if ( bFound )
+ aFtWarn.Show();
+ else
+ aFtWarn.Hide();
}
ScDocument* ScMoveTableDlg::GetSelectedDoc()
@@ -172,10 +200,12 @@ void ScMoveTableDlg::Init()
aBtnOk.SetClickHdl ( LINK( this, ScMoveTableDlg, OkHdl ) );
aLbDoc.SetSelectHdl ( LINK( this, ScMoveTableDlg, SelHdl ) );
aBtnCopy.SetToggleHdl( LINK( this, ScMoveTableDlg, CheckBtnHdl ) );
- aBtnRename.SetToggleHdl( LINK( this, ScMoveTableDlg, CheckBtnHdl ) );
+ aEdTabName.SetModifyHdl( LINK( this, ScMoveTableDlg, CheckNameHdl ) );
+ aBtnMove.Check( TRUE );
aBtnCopy.Check( FALSE );
- aBtnRename.Check( FALSE );
aEdTabName.Enable(false);
+ aFtWarn.SetControlBackground( Color( COL_YELLOW ) );
+ aFtWarn.Hide();
InitDocListBox();
SelHdl( &aLbDoc );
}
@@ -188,6 +218,7 @@ void ScMoveTableDlg::InitDocListBox()
ScDocShell* pScSh = NULL;
USHORT nSelPos = 0;
USHORT i = 0;
+ String aEntryName;
aLbDoc.Clear();
aLbDoc.SetUpdateMode( FALSE );
@@ -198,10 +229,16 @@ void ScMoveTableDlg::InitDocListBox()
if ( pScSh )
{
+ aEntryName = pScSh->GetTitle();
+
if ( pScSh == SfxObjectShell::Current() )
+ {
nSelPos = i;
+ aEntryName += sal_Unicode( ' ' );
+ aEntryName += String( ScResId( STR_CURRENTDOC ) );
+ }
- aLbDoc.InsertEntry( pScSh->GetTitle(), i );
+ aLbDoc.InsertEntry( aEntryName, i );
aLbDoc.SetEntryData( i, (void*)pScSh->GetDocument() );
i++;
@@ -219,9 +256,7 @@ void ScMoveTableDlg::InitDocListBox()
IMPL_LINK( ScMoveTableDlg, CheckBtnHdl, void *, pBtn )
{
- if (pBtn == &aBtnRename)
- aEdTabName.Enable( aBtnRename.IsChecked() );
- else if (pBtn == &aBtnCopy)
+ if (pBtn == &aBtnCopy)
ResetRenameInput();
return 0;
@@ -237,7 +272,6 @@ 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();
if (bCopyTable)
{
@@ -291,6 +325,14 @@ IMPL_LINK( ScMoveTableDlg, SelHdl, ListBox *, pLb )
return 0;
}
+IMPL_LINK( ScMoveTableDlg, CheckNameHdl, Edit *, pEdt )
+{
+ if ( pEdt == &aEdTabName )
+ CheckNewNameExists();
+
+ return 0;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index f463cc1afe63..16e8339cea14 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -439,77 +439,123 @@ ModalDialog RID_SCDLG_MOVETAB
OutputSize = TRUE ;
HelpId = FID_TAB_MOVE ;
SVLook = TRUE ;
- Size = MAP_APPFONT ( 168 , 145 ) ;
+ Size = MAP_APPFONT ( 158 , 236 ) ;
Text [ en-US ] = "Move/Copy Sheet" ;
Moveable = TRUE ;
Closeable = FALSE ;
OKButton BTN_OK
{
- Pos = MAP_APPFONT ( 112 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 66 , 216 ) ;
+ Size = MAP_APPFONT ( 42 , 14 ) ;
TabStop = TRUE ;
DefButton = TRUE ;
};
CancelButton BTN_CANCEL
{
- Pos = MAP_APPFONT ( 112 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 110 , 216 ) ;
+ Size = MAP_APPFONT ( 42 , 14 ) ;
TabStop = TRUE ;
};
HelpButton BTN_HELP
{
- Pos = MAP_APPFONT ( 112 , 43 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 6 , 216 ) ;
+ Size = MAP_APPFONT ( 42 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SEP1
+ {
+ Pos = MAP_APPFONT ( 0 , 208 ) ;
+ Size = MAP_APPFONT (168 , 4 ) ;
+ };
+ FixedLine FL_ACTION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 146 , 8 ) ;
+ Text [ en-US ] = "Action" ;
+ };
+ RadioButton BTN_MOVE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 114 , 10 ) ;
+ Text [ en-US ] = "~Move" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_COPY
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 114 , 10 ) ;
+ Text [ en-US ] = "~Copy" ;
TabStop = TRUE ;
};
+ FixedLine FL_LOCATION
+ {
+ Pos = MAP_APPFONT ( 6 , 42 ) ;
+ Size = MAP_APPFONT ( 146 , 8 ) ;
+ Text [ en-US ] = "Location" ;
+ };
FixedText FT_DEST
{
- Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
Size = MAP_APPFONT ( 100 , 8 ) ;
Text [ en-US ] = "To ~document" ;
};
ListBox LB_DEST
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 17 ) ;
- Size = MAP_APPFONT ( 100 , 60 ) ;
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 120 , 60 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
FixedText FT_INSERT
{
- Pos = MAP_APPFONT ( 6 , 35 ) ;
+ Pos = MAP_APPFONT ( 12 , 83 ) ;
Size = MAP_APPFONT ( 100 , 8 ) ;
Text [ en-US ] = "~Insert before" ;
};
ListBox LB_INSERT
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 46 ) ;
- Size = MAP_APPFONT ( 100 , 62 ) ;
+ Pos = MAP_APPFONT ( 12 , 93 ) ;
+ Size = MAP_APPFONT ( 120 , 62 ) ;
TabStop = TRUE ;
};
- CheckBox BTN_COPY
+ FixedLine FL_NAME
{
- Pos = MAP_APPFONT ( 6 , 114 ) ;
- Size = MAP_APPFONT ( 100 , 10 ) ;
- Text [ en-US ] = "~Copy" ;
- TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 162 ) ;
+ Size = MAP_APPFONT ( 146 , 8 ) ;
+ Text [ en-US ] = "Name" ;
};
CheckBox BTN_RENAME
{
- Pos = MAP_APPFONT ( 6 , 128 ) ;
+ Pos = MAP_APPFONT ( 6 , 189 ) ;
Size = MAP_APPFONT ( 52 , 10 ) ;
Text [ en-US ] = "~Rename" ;
TabStop = TRUE ;
};
+ FixedText FT_TABNAME
+ {
+ Pos = MAP_APPFONT ( 12 , 173 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "New ~name" ;
+ };
Edit ED_INPUT
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 58 , 127 ) ;
- Size = MAP_APPFONT ( 104 , 12 ) ;
+ Pos = MAP_APPFONT ( 12 , 183 ) ;
+ Size = MAP_APPFONT ( 120 , 12 ) ;
TabStop = TRUE ;
};
+ FixedText FT_WARN
+ {
+ Pos = MAP_APPFONT ( 24 , 194 ) ;
+ Size = MAP_APPFONT ( 122 , 8 ) ;
+ Text [ en-US ] = " ! This name is already used." ;
+ };
+ String STR_CURRENTDOC
+ {
+ Text [ en-US ] = "(Current document)" ;
+ };
String STR_NEWDOC
{
Text [ en-US ] = "- new document -" ;