diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-11-22 08:01:10 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-11-23 06:25:35 +0100 |
commit | 7b761d244e2c25a68427eb99f3e6bd5a97742501 (patch) | |
tree | 5d6c2a39579f22c9b6a96faab90e618945959362 /sc | |
parent | 100052237a83ff0e0c5fb726fc6ea79f6375dfa8 (diff) |
ManageNames: implement ScNameDlg::IsFormulaValid
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/namedlg/namedlg.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 46970a400762..400a1d5346e1 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -266,7 +266,19 @@ bool ScNameDlg::IsNameValid() bool ScNameDlg::IsFormulaValid() { - return true; + ScCompiler aComp( mpDoc, maCursorPos); + aComp.SetGrammar( mpDoc->GetGrammar() ); + ScTokenArray* pCode = aComp.CompileString(maEdAssign.GetText()); + if (pCode->GetCodeError()) + { + delete pCode; + return false; + } + else + { + delete pCode; + return true; + } } ScRangeName* ScNameDlg::GetRangeName(const rtl::OUString& rScope) @@ -387,7 +399,11 @@ void ScNameDlg::RemovePushed() void ScNameDlg::NameModified() { if (!IsFormulaValid()) + { + //TODO: implement an info text return; + } + ScRangeNameLine aLine; mpRangeManagerTable->GetCurrentLine(aLine); rtl::OUString aOldName = aLine.aName; |