Kaydet (Commit) 10005223 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

ManageNames: need to store the strings in variables

üst 23da9369
...@@ -68,7 +68,12 @@ private: ...@@ -68,7 +68,12 @@ private:
ScDocShell* mpDocShell; ScDocShell* mpDocShell;
ScAddress maCursorPos; ScAddress maCursorPos;
rtl::OUString maGlobalNameStr; const String mErrMsgInvalidSym;
const rtl::OUString maErrMsgModifiedFailed;
const rtl::OUString maGlobalNameStr;
const rtl::OUString maErrInvalidNameStr;
const rtl::OUString maErrNameInUse;
const rtl::OUString maStrInfoDefault;
std::map<rtl::OUString, ScRangeName*> maRangeMap; std::map<rtl::OUString, ScRangeName*> maRangeMap;
......
...@@ -42,7 +42,12 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen ...@@ -42,7 +42,12 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen
mpDoc( pDocShell->GetDocument() ), mpDoc( pDocShell->GetDocument() ),
mpDocShell ( pDocShell ), mpDocShell ( pDocShell ),
maCursorPos( aCursorPos ), maCursorPos( aCursorPos ),
maGlobalNameStr( ResId::toString( ScResId( STR_GLOBAL_SCOPE ) ) ),
mErrMsgInvalidSym( ScResId( STR_INVALIDSYMBOL ) ),
maGlobalNameStr ( ResId::toString(ScResId(STR_GLOBAL_SCOPE)) ),
maErrInvalidNameStr( ResId::toString(ScResId(STR_ERR_NAME_INVALID))),
maErrNameInUse ( ResId::toString(ScResId(STR_ERR_NAME_EXISTS))),
maStrInfoDefault ( ResId::toString(ScResId(STR_DEFAULT_INFO))),
maRangeMap( aRangeMap ) maRangeMap( aRangeMap )
{ {
// Initialize scope list. // Initialize scope list.
...@@ -62,7 +67,7 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen ...@@ -62,7 +67,7 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen
maEdName.SetModifyHdl( LINK( this, ScNameDefDlg, NameModifyHdl )); maEdName.SetModifyHdl( LINK( this, ScNameDefDlg, NameModifyHdl ));
maEdRange.SetGetFocusHdl( LINK( this, ScNameDefDlg, AssignGetFocusHdl ) ); maEdRange.SetGetFocusHdl( LINK( this, ScNameDefDlg, AssignGetFocusHdl ) );
maFtInfo.SetText(ResId::toString( ScResId( STR_DEFAULT_INFO ) )); maFtInfo.SetText(maStrInfoDefault);
maBtnAdd.Disable(); // empty name is invalid maBtnAdd.Disable(); // empty name is invalid
...@@ -96,17 +101,17 @@ bool ScNameDefDlg::IsNameValid() ...@@ -96,17 +101,17 @@ bool ScNameDefDlg::IsNameValid()
if (!ScRangeData::IsNameValid( aName, mpDoc )) if (!ScRangeData::IsNameValid( aName, mpDoc ))
{ {
maFtInfo.SetText(ResId::toString(ScResId( STR_ERR_NAME_INVALID ))); maFtInfo.SetText(maErrInvalidNameStr);
maBtnAdd.Disable(); maBtnAdd.Disable();
return false; return false;
} }
else if (pRangeName->findByUpperName(ScGlobal::pCharClass->upper(aName))) else if (pRangeName->findByUpperName(ScGlobal::pCharClass->upper(aName)))
{ {
maFtInfo.SetText(ResId::toString(ScResId( STR_ERR_NAME_EXISTS ))); maFtInfo.SetText(maErrNameInUse);
maBtnAdd.Disable(); maBtnAdd.Disable();
return false; return false;
} }
maFtInfo.SetText(ResId::toString( ScResId( STR_DEFAULT_INFO ) )); maFtInfo.SetText(maStrInfoDefault);
maBtnAdd.Enable(); maBtnAdd.Enable();
return true; return true;
} }
......
...@@ -135,7 +135,7 @@ ModelessDialog RID_SCDLG_NAMES_DEFINE ...@@ -135,7 +135,7 @@ ModelessDialog RID_SCDLG_NAMES_DEFINE
}; };
String STR_ERR_NAME_INVALID String STR_ERR_NAME_INVALID
{ {
Text [ en-US ] = "Invalid name. Only use letters, numbers and underscore and don't use names like cell addresses"; Text [ en-US ] = "Invalid name. Only use letters, numbers and underscore.";
}; };
String STR_DEFAULT_INFO String STR_DEFAULT_INFO
{ {
......
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