Kaydet (Commit) 403a47de authored tarafından Caolán McNamara's avatar Caolán McNamara

always 'show' error label, but leave it blank for no error

restore title to dialog, move error strings etc. inside .ui
and use multiples of 6 pixel spacing

Change-Id: Iae39238315cced956e2b6fbbae47bf79f4653920
üst c2a28a73
...@@ -64,13 +64,6 @@ ...@@ -64,13 +64,6 @@
#define FL_SEP1 51 #define FL_SEP1 51
#define FL_SEP2 52 #define FL_SEP2 52
// Insert/Delete/Move/Copy Sheet
#define STR_NEWDOC 6
#define STR_CURRENTDOC 14
#define STR_TABNAME_WARN_USED 15
#define STR_TABNAME_WARN_EMPTY 16
#define STR_TABNAME_WARN_INVALID 17
// String input // String input
#define ED_INPUT 10 #define ED_INPUT 10
......
...@@ -60,9 +60,12 @@ private: ...@@ -60,9 +60,12 @@ private:
FixedText* pFtWarn; FixedText* pFtWarn;
OKButton* pBtnOk; OKButton* pBtnOk;
OUString maStrTabNameUsed; OUString msCurrentDoc;
OUString maStrTabNameEmpty; OUString msNewDoc;
OUString maStrTabNameInvalid;
OUString msStrTabNameUsed;
OUString msStrTabNameEmpty;
OUString msStrTabNameInvalid;
const OUString maDefaultName; const OUString maDefaultName;
......
...@@ -39,11 +39,6 @@ ...@@ -39,11 +39,6 @@
ScMoveTableDlg::ScMoveTableDlg(Window* pParent, const OUString& rDefault) ScMoveTableDlg::ScMoveTableDlg(Window* pParent, const OUString& rDefault)
: ModalDialog ( pParent, "MoveCopySheetDialog", "modules/scalc/ui/movecopysheet.ui" ), : ModalDialog ( pParent, "MoveCopySheetDialog", "modules/scalc/ui/movecopysheet.ui" ),
//
maStrTabNameUsed( SC_RESSTR(STR_TABNAME_WARN_USED) ),
maStrTabNameEmpty( SC_RESSTR(STR_TABNAME_WARN_EMPTY) ),
maStrTabNameInvalid( SC_RESSTR(STR_TABNAME_WARN_INVALID) ),
//
maDefaultName( rDefault ), maDefaultName( rDefault ),
mnCurrentDocPos( 0 ), mnCurrentDocPos( 0 ),
nDocument ( 0 ), nDocument ( 0 ),
...@@ -55,11 +50,23 @@ ScMoveTableDlg::ScMoveTableDlg(Window* pParent, const OUString& rDefault) ...@@ -55,11 +50,23 @@ ScMoveTableDlg::ScMoveTableDlg(Window* pParent, const OUString& rDefault)
get(pBtnMove, "move"); get(pBtnMove, "move");
get(pBtnCopy, "copy"); get(pBtnCopy, "copy");
get(pLbDoc, "toDocument"); get(pLbDoc, "toDocument");
assert(pLbDoc->GetEntryCount() == 2);
msCurrentDoc = pLbDoc->GetEntry(0);
msNewDoc = pLbDoc->GetEntry(1);
pLbDoc->Clear();
assert(pLbDoc->GetEntryCount() == 0);
get(pLbTable, "insertBefore"); get(pLbTable, "insertBefore");
pLbTable->set_height_request(pLbTable->GetTextHeight() * 8);
get(pEdTabName, "newName"); get(pEdTabName, "newName");
get(pFtWarn, "newNameWarn"); get(pFtWarn, "newNameWarn");
get(pBtnOk, "ok"); get(pBtnOk, "ok");
msStrTabNameUsed = get<FixedText>("warnunused")->GetText();
msStrTabNameEmpty = get<FixedText>("warnempty")->GetText();
msStrTabNameInvalid = get<FixedText>("warninvalid")->GetText();
Init(); Init();
} }
...@@ -150,8 +157,8 @@ void ScMoveTableDlg::CheckNewTabName() ...@@ -150,8 +157,8 @@ void ScMoveTableDlg::CheckNewTabName()
if (aNewName.isEmpty()) if (aNewName.isEmpty())
{ {
// New sheet name is empty. This is not good. // New sheet name is empty. This is not good.
pFtWarn->SetText(maStrTabNameEmpty); pFtWarn->SetControlBackground(Color(COL_YELLOW));
pFtWarn->Show(); pFtWarn->SetText(msStrTabNameEmpty);
pBtnOk->Disable(); pBtnOk->Disable();
return; return;
} }
...@@ -159,8 +166,8 @@ void ScMoveTableDlg::CheckNewTabName() ...@@ -159,8 +166,8 @@ void ScMoveTableDlg::CheckNewTabName()
if (!ScDocument::ValidTabName(aNewName)) if (!ScDocument::ValidTabName(aNewName))
{ {
// New sheet name contains invalid characters. // New sheet name contains invalid characters.
pFtWarn->SetText(maStrTabNameInvalid); pFtWarn->SetControlBackground(Color(COL_YELLOW));
pFtWarn->Show(); pFtWarn->SetText(msStrTabNameInvalid);
pBtnOk->Disable(); pBtnOk->Disable();
return; return;
} }
...@@ -180,13 +187,14 @@ void ScMoveTableDlg::CheckNewTabName() ...@@ -180,13 +187,14 @@ void ScMoveTableDlg::CheckNewTabName()
if ( bFound ) if ( bFound )
{ {
pFtWarn->SetText(maStrTabNameUsed); pFtWarn->SetControlBackground(Color(COL_YELLOW));
pFtWarn->Show(); pFtWarn->SetText(msStrTabNameUsed);
pBtnOk->Disable(); pBtnOk->Disable();
} }
else else
{ {
pFtWarn->Hide(); pFtWarn->SetControlBackground();
pFtWarn->SetText(OUString());
pBtnOk->Enable(); pBtnOk->Enable();
} }
} }
...@@ -213,8 +221,6 @@ void ScMoveTableDlg::Init() ...@@ -213,8 +221,6 @@ void ScMoveTableDlg::Init()
pBtnMove->Check( true ); pBtnMove->Check( true );
pBtnCopy->Check( false ); pBtnCopy->Check( false );
pEdTabName->Enable(false); pEdTabName->Enable(false);
pFtWarn->SetControlBackground( Color( COL_YELLOW ) );
pFtWarn->Hide();
InitDocListBox(); InitDocListBox();
SelHdl( pLbDoc ); SelHdl( pLbDoc );
} }
...@@ -244,7 +250,7 @@ void ScMoveTableDlg::InitDocListBox() ...@@ -244,7 +250,7 @@ void ScMoveTableDlg::InitDocListBox()
{ {
mnCurrentDocPos = nSelPos = i; mnCurrentDocPos = nSelPos = i;
aEntryName += sal_Unicode( ' ' ); aEntryName += sal_Unicode( ' ' );
aEntryName += String( ScResId( STR_CURRENTDOC ) ); aEntryName += msCurrentDoc;
} }
pLbDoc->InsertEntry( aEntryName, i ); pLbDoc->InsertEntry( aEntryName, i );
...@@ -256,7 +262,7 @@ void ScMoveTableDlg::InitDocListBox() ...@@ -256,7 +262,7 @@ void ScMoveTableDlg::InitDocListBox()
} }
pLbDoc->SetUpdateMode( sal_True ); pLbDoc->SetUpdateMode( sal_True );
pLbDoc->InsertEntry( String( ScResId( STR_NEWDOC ) ) ); pLbDoc->InsertEntry(msNewDoc);
pLbDoc->SelectEntryPos( nSelPos ); pLbDoc->SelectEntryPos( nSelPos );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment