[Libreoffice-commits] .: 5 commits - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Jan 3 13:42:24 PST 2011
sc/inc/document.hxx | 3
sc/inc/scabstdlg.hxx | 3
sc/source/core/data/document.cxx | 2
sc/source/ui/attrdlg/scdlgfact.cxx | 8 --
sc/source/ui/attrdlg/scdlgfact.hxx | 3
sc/source/ui/inc/miscdlgs.hrc | 10 +++
sc/source/ui/inc/mvtabdlg.hxx | 18 ++++-
sc/source/ui/miscdlgs/mvtabdlg.cxx | 112 ++++++++++++++++++++++++++++++-------
sc/source/ui/src/miscdlgs.src | 101 +++++++++++++++++++++++++--------
sc/source/ui/view/tabvwshf.cxx | 3
10 files changed, 201 insertions(+), 62 deletions(-)
New commits:
commit 4ae2c7eea4897f2aa70a78aad3cb58f883a941c0
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Jan 3 16:27:54 2011 -0500
Different warning messages for different causes.
Now we display three different warning texts:
* name is already taken.
* name is empty.
* name contains invalid characters.
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 5b0ced9..3401e54 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -569,7 +569,8 @@ public:
void SetEmbedded( const Rectangle& rRect ); // aus VisArea (1/100 mm)
void SnapVisArea( Rectangle& rRect ) const; // 1/100 mm
- SC_DLLPUBLIC BOOL ValidTabName( const String& rName ) const;
+ static SC_DLLPUBLIC bool ValidTabName( const String& rName );
+
SC_DLLPUBLIC BOOL ValidNewTabName( const String& rName ) const;
SC_DLLPUBLIC void CreateValidTabName(String& rName) const;
SC_DLLPUBLIC BOOL InsertTab( SCTAB nPos, const String& rName,
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index e424e2f..d5f37a1 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -226,7 +226,7 @@ BOOL ScDocument::GetTable( const String& rName, SCTAB& rTab ) const
}
-BOOL ScDocument::ValidTabName( const String& rName ) const
+bool ScDocument::ValidTabName( const String& rName )
{
xub_StrLen nLen = rName.Len();
if (!nLen)
diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc
index 2eae698..094f13e 100644
--- a/sc/source/ui/inc/miscdlgs.hrc
+++ b/sc/source/ui/inc/miscdlgs.hrc
@@ -105,6 +105,9 @@
#define FT_TABNAME 12
#define FT_TABNAME_WARN 13
#define STR_CURRENTDOC 14
+#define STR_TABNAME_WARN_USED 15
+#define STR_TABNAME_WARN_EMPTY 16
+#define STR_TABNAME_WARN_INVALID 17
// Eingabe eines Strings
#define ED_INPUT 10
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 7adaaab..367854a 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -59,7 +59,7 @@ public:
private:
void ResetRenameInput();
- void CheckNewNameExists();
+ void CheckNewTabName();
ScDocument* GetSelectedDoc();
private:
@@ -79,6 +79,10 @@ private:
CancelButton aBtnCancel;
HelpButton aBtnHelp;
+ String maStrTabNameUsed;
+ String maStrTabNameEmpty;
+ String maStrTabNameInvalid;
+
const String& mrDefaultName;
USHORT nDocument;
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index fe44636..f9f78da 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -76,6 +76,10 @@ ScMoveTableDlg::ScMoveTableDlg( Window* pParent,
aBtnOk ( this, ScResId( BTN_OK ) ),
aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
aBtnHelp ( this, ScResId( BTN_HELP ) ),
+
+ maStrTabNameUsed( ScResId(STR_TABNAME_WARN_USED) ),
+ maStrTabNameEmpty( ScResId(STR_TABNAME_WARN_EMPTY) ),
+ maStrTabNameInvalid( ScResId(STR_TABNAME_WARN_INVALID) ),
//
mrDefaultName( rDefault ),
nDocument ( 0 ),
@@ -161,16 +165,35 @@ void ScMoveTableDlg::ResetRenameInput()
// move
aEdTabName.SetText(mrDefaultName);
- CheckNewNameExists();
+ CheckNewTabName();
}
-void ScMoveTableDlg::CheckNewNameExists()
+void ScMoveTableDlg::CheckNewTabName()
{
+ const String& rNewName = aEdTabName.GetText();
+ if (!rNewName.Len())
+ {
+ // New sheet name is empty. This is not good.
+ aFtWarn.SetText(maStrTabNameEmpty);
+ aFtWarn.Show();
+ aBtnOk.Disable();
+ return;
+ }
+
+ if (!ScDocument::ValidTabName(rNewName))
+ {
+ // New sheet name contains invalid characters.
+ aFtWarn.SetText(maStrTabNameInvalid);
+ aFtWarn.Show();
+ aBtnOk.Disable();
+ return;
+ }
+
bool bFound = false;
USHORT nLast = aLbTable.GetEntryCount() - 1;
for ( USHORT i=0; i<=nLast; ++i )
{
- if ( aEdTabName.GetText() == aLbTable.GetEntry( i ) )
+ if ( rNewName == aLbTable.GetEntry( i ) )
{
if( ( aBtnMove.IsChecked() ) &&
( aLbDoc.GetSelectEntryPos() == 0 ) &&
@@ -180,13 +203,20 @@ void ScMoveTableDlg::CheckNewNameExists()
bFound = false;
else
bFound = true;
-
}
}
+
if ( bFound )
+ {
+ aFtWarn.SetText(maStrTabNameUsed);
aFtWarn.Show();
+ aBtnOk.Disable();
+ }
else
+ {
aFtWarn.Hide();
+ aBtnOk.Enable();
+ }
}
ScDocument* ScMoveTableDlg::GetSelectedDoc()
@@ -330,7 +360,7 @@ IMPL_LINK( ScMoveTableDlg, SelHdl, ListBox *, pLb )
IMPL_LINK( ScMoveTableDlg, CheckNameHdl, Edit *, pEdt )
{
if ( pEdt == &aEdTabName )
- CheckNewNameExists();
+ CheckNewTabName();
return 0;
}
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index 49c2297..72e2af3 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -543,7 +543,7 @@ ModalDialog RID_SCDLG_MOVETAB
{
Pos = MAP_APPFONT ( 12 , 197 ) ;
Size = MAP_APPFONT ( 134 , 8 ) ;
- Text [ en-US ] = "This name is already used." ;
+ Text [ en-US ] = "..." ;
};
String STR_CURRENTDOC
{
@@ -553,6 +553,18 @@ ModalDialog RID_SCDLG_MOVETAB
{
Text [ en-US ] = "- new document -" ;
};
+ String STR_TABNAME_WARN_USED
+ {
+ Text [ en-US ] = "This name is already used." ;
+ };
+ String STR_TABNAME_WARN_EMPTY
+ {
+ Text [ en-US ] = "Name is empty." ;
+ };
+ String STR_TABNAME_WARN_INVALID
+ {
+ Text [ en-US ] = "Name contains one or more invalid characters." ;
+ };
};
ModalDialog RID_SCDLG_STRINPUT
commit 96c83ea8159bec87e4e8fda0c833eeb6d6f277b3
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Jan 3 15:34:23 2011 -0500
Force copy when all sheets are selected.
This includes disabling the Move button too.
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 9a60ab4..cd8b197 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -215,7 +215,7 @@ public:
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 SetForceCopyTable () = 0;
virtual void EnableCopyTable (BOOL bFlag=TRUE) = 0;
virtual void EnableRenameTable (BOOL bFlag=TRUE) = 0;
};
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 7977a20..a7c953e 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -510,9 +510,9 @@ void AbstractScMoveTableDlg_Impl::GetTabNameString( String& rString ) const
{
pDlg->GetTabNameString( rString );
}
-void AbstractScMoveTableDlg_Impl::SetCopyTable(BOOL bFla)
+void AbstractScMoveTableDlg_Impl::SetForceCopyTable()
{
- return pDlg->SetCopyTable( bFla );
+ return pDlg->SetForceCopyTable();
}
void AbstractScMoveTableDlg_Impl::EnableCopyTable(BOOL bFlag)
{
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index dff3c30..d86eede 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -265,7 +265,7 @@ class AbstractScMoveTableDlg_Impl : public AbstractScMoveTableDlg //add for ScM
virtual BOOL GetCopyTable () const;
virtual bool GetRenameTable () const;
virtual void GetTabNameString( String& rString ) const;
- virtual void SetCopyTable (BOOL bFlag=TRUE);
+ virtual void SetForceCopyTable ();
virtual void EnableCopyTable (BOOL bFlag=TRUE);
virtual void EnableRenameTable (BOOL bFlag=TRUE);
};
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 4ed57cd..7adaaab 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -53,7 +53,7 @@ public:
BOOL GetCopyTable () const;
bool GetRenameTable () const;
void GetTabNameString( String& rString ) const;
- void SetCopyTable (BOOL bFlag=TRUE);
+ void SetForceCopyTable ();
void EnableCopyTable (BOOL bFlag=TRUE);
void EnableRenameTable (BOOL bFlag=TRUE);
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 2d69c48..fe44636 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -112,9 +112,11 @@ void ScMoveTableDlg::GetTabNameString( String& rString ) const
rString = aEdTabName.GetText();
}
-void ScMoveTableDlg::SetCopyTable(BOOL bFlag)
+void ScMoveTableDlg::SetForceCopyTable()
{
- aBtnCopy.Check(bFlag);
+ aBtnCopy.Check(true);
+ aBtnMove.Disable();
+ aBtnCopy.Disable();
}
void ScMoveTableDlg::EnableCopyTable(BOOL bFlag)
@@ -129,6 +131,7 @@ void ScMoveTableDlg::EnableRenameTable(BOOL bFlag)
{
bRenameTable = bFlag;
aEdTabName.Enable(bFlag);
+ aFtTabName.Enable(bFlag);
ResetRenameInput();
}
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 497a4c0..06d77ac 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -555,8 +555,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
if(nTableCount==nTabSelCount)
{
- pDlg->SetCopyTable();
- pDlg->EnableCopyTable(FALSE);
+ pDlg->SetForceCopyTable();
}
// We support direct renaming of sheet only when one sheet
commit 104f80876620357c35952ae4137a7f753081a5f2
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Jan 3 15:05:51 2011 -0500
Adjusted the dialog layout a bit to make it look more consistent.
diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc
index 5a3b7a1..2eae698 100644
--- a/sc/source/ui/inc/miscdlgs.hrc
+++ b/sc/source/ui/inc/miscdlgs.hrc
@@ -103,7 +103,7 @@
#define FL_LOCATION 9
#define FL_NAME 11
#define FT_TABNAME 12
-#define FT_WARN 13
+#define FT_TABNAME_WARN 13
#define STR_CURRENTDOC 14
// Eingabe eines Strings
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 28fa028..4ed57cd 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -75,7 +75,6 @@ private:
FixedText aFtTabName;
Edit aEdTabName;
FixedText aFtWarn;
- FixedLine aFixedLine;
OKButton aBtnOk;
CancelButton aBtnCancel;
HelpButton aBtnHelp;
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 1c9ff3a..2d69c48 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -72,8 +72,7 @@ ScMoveTableDlg::ScMoveTableDlg( Window* pParent,
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 ) ),
+ aFtWarn ( this, ScResId( FT_TABNAME_WARN ) ),
aBtnOk ( this, ScResId( BTN_OK ) ),
aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
aBtnHelp ( this, ScResId( BTN_HELP ) ),
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index 130a621..49c2297 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -469,41 +469,41 @@ ModalDialog RID_SCDLG_MOVETAB
};
FixedLine FL_ACTION
{
- Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
Size = MAP_APPFONT ( 146 , 8 ) ;
Text [ en-US ] = "Action" ;
};
RadioButton BTN_MOVE
{
- Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Pos = MAP_APPFONT ( 12 , 17 ) ;
Size = MAP_APPFONT ( 114 , 10 ) ;
Text [ en-US ] = "~Move" ;
TabStop = TRUE ;
};
RadioButton BTN_COPY
{
- Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
Size = MAP_APPFONT ( 114 , 10 ) ;
Text [ en-US ] = "~Copy" ;
TabStop = TRUE ;
};
FixedLine FL_LOCATION
{
- Pos = MAP_APPFONT ( 6 , 42 ) ;
+ Pos = MAP_APPFONT ( 6 , 43 ) ;
Size = MAP_APPFONT ( 146 , 8 ) ;
Text [ en-US ] = "Location" ;
};
FixedText FT_DEST
{
- Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Pos = MAP_APPFONT ( 12 , 54 ) ;
Size = MAP_APPFONT ( 100 , 8 ) ;
Text [ en-US ] = "To ~document" ;
};
ListBox LB_DEST
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 12 , 64 ) ;
- Size = MAP_APPFONT ( 120 , 60 ) ;
+ Pos = MAP_APPFONT ( 12 , 65 ) ;
+ Size = MAP_APPFONT ( 134 , 60 ) ;
TabStop = TRUE ;
DropDown = TRUE ;
};
@@ -517,7 +517,7 @@ ModalDialog RID_SCDLG_MOVETAB
{
Border = TRUE ;
Pos = MAP_APPFONT ( 12 , 93 ) ;
- Size = MAP_APPFONT ( 120 , 62 ) ;
+ Size = MAP_APPFONT ( 134 , 62 ) ;
TabStop = TRUE ;
};
FixedLine FL_NAME
@@ -526,13 +526,6 @@ ModalDialog RID_SCDLG_MOVETAB
Size = MAP_APPFONT ( 146 , 8 ) ;
Text [ en-US ] = "Name" ;
};
- CheckBox BTN_RENAME
- {
- Pos = MAP_APPFONT ( 6 , 189 ) ;
- Size = MAP_APPFONT ( 52 , 10 ) ;
- Text [ en-US ] = "~Rename" ;
- TabStop = TRUE ;
- };
FixedText FT_TABNAME
{
Pos = MAP_APPFONT ( 12 , 173 ) ;
@@ -543,18 +536,18 @@ ModalDialog RID_SCDLG_MOVETAB
{
Border = TRUE ;
Pos = MAP_APPFONT ( 12 , 183 ) ;
- Size = MAP_APPFONT ( 120 , 12 ) ;
+ Size = MAP_APPFONT ( 134 , 12 ) ;
TabStop = TRUE ;
};
- FixedText FT_WARN
+ FixedText FT_TABNAME_WARN
{
- Pos = MAP_APPFONT ( 24 , 194 ) ;
- Size = MAP_APPFONT ( 122 , 8 ) ;
- Text [ en-US ] = " ! This name is already used." ;
+ Pos = MAP_APPFONT ( 12 , 197 ) ;
+ Size = MAP_APPFONT ( 134 , 8 ) ;
+ Text [ en-US ] = "This name is already used." ;
};
String STR_CURRENTDOC
{
- Text [ en-US ] = "(Current document)" ;
+ Text [ en-US ] = "(current document)" ;
};
String STR_NEWDOC
{
commit c95c1f0da2d2d45b734405e4d9b11e057c55abd3
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Jan 3 14:17:19 2011 -0500
Indentation fix & BOOL to bool.
diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc
index 8b5fed7..5a3b7a1 100644
--- a/sc/source/ui/inc/miscdlgs.hrc
+++ b/sc/source/ui/inc/miscdlgs.hrc
@@ -98,7 +98,7 @@
#define LB_INSERT 4
#define BTN_COPY 5
#define STR_NEWDOC 6
-#define BTN_MOVE 7
+#define BTN_MOVE 7
#define FL_ACTION 8
#define FL_LOCATION 9
#define FL_NAME 11
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 756a3e3..28fa028 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -64,8 +64,8 @@ private:
private:
FixedLine aFlAction;
- RadioButton aBtnMove;
- RadioButton aBtnCopy;
+ RadioButton aBtnMove;
+ RadioButton aBtnCopy;
FixedLine aFlLocation;
FixedText aFtDoc;
ListBox aLbDoc;
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 2b08805..1c9ff3a 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -164,7 +164,7 @@ void ScMoveTableDlg::ResetRenameInput()
void ScMoveTableDlg::CheckNewNameExists()
{
- BOOL bFound = FALSE;
+ bool bFound = false;
USHORT nLast = aLbTable.GetEntryCount() - 1;
for ( USHORT i=0; i<=nLast; ++i )
{
@@ -175,16 +175,16 @@ void ScMoveTableDlg::CheckNewNameExists()
( aEdTabName.GetText() == mrDefaultName) )
// Move inside same document, thus same name is allowed.
- bFound = FALSE;
+ bFound = false;
else
- bFound = TRUE;
+ bFound = true;
}
}
if ( bFound )
aFtWarn.Show();
else
- aFtWarn.Hide();
+ aFtWarn.Hide();
}
ScDocument* ScMoveTableDlg::GetSelectedDoc()
commit 7d439aeba0682452b287c30995e2553e956b4dd1
Author: Joost Wezenbeek <joost.eekhoorn at gmail.com>
Date: Tue Dec 28 16:07:11 2010 +0100
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.
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 0b33261..9a60ab4 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -217,7 +217,6 @@ public:
virtual void GetTabNameString( String& rString ) const = 0;
virtual void SetCopyTable (BOOL bFlag=TRUE) = 0;
virtual void EnableCopyTable (BOOL bFlag=TRUE) = 0;
- virtual void SetRenameTable (BOOL bFlag=TRUE) = 0;
virtual void EnableRenameTable (BOOL bFlag=TRUE) = 0;
};
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 8607654..7977a20 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 121b791..dff3c30 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 79b5fd0..8b5fed7 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 3c1b6d2..756a3e3 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 a5c0118..2b08805 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 0c3c0db..130a621 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 -" ;
More information about the Libreoffice-commits
mailing list