summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/tokenstringcontext.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/tool/tokenstringcontext.cxx')
-rw-r--r--sc/source/core/tool/tokenstringcontext.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/sc/source/core/tool/tokenstringcontext.cxx b/sc/source/core/tool/tokenstringcontext.cxx
index a68ae759299a..203d36aaf3e8 100644
--- a/sc/source/core/tool/tokenstringcontext.cxx
+++ b/sc/source/core/tool/tokenstringcontext.cxx
@@ -105,6 +105,49 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula
}
}
+CompileFormulaContext::CompileFormulaContext( ScDocument* pDoc ) :
+ mpDoc(pDoc), meGram(pDoc->GetGrammar())
+{
+ if (!pDoc)
+ return;
+
+ updateTabNames();
+}
+
+void CompileFormulaContext::updateTabNames()
+{
+ // Fetch all sheet names.
+ maTabNames = mpDoc->GetAllTableNames();
+ {
+ std::vector<OUString>::iterator it = maTabNames.begin(), itEnd = maTabNames.end();
+ for (; it != itEnd; ++it)
+ ScCompiler::CheckTabQuotes(*it, formula::FormulaGrammar::extractRefConvention(meGram));
+ }
+}
+
+formula::FormulaGrammar::Grammar CompileFormulaContext::getGrammar() const
+{
+ return meGram;
+}
+
+void CompileFormulaContext::setGrammar( formula::FormulaGrammar::Grammar eGram )
+{
+ bool bUpdate = (meGram != eGram);
+ meGram = eGram;
+ if (bUpdate)
+ updateTabNames();
+}
+
+const std::vector<OUString>& CompileFormulaContext::getTabNames() const
+{
+ return maTabNames;
+}
+
+ScDocument* CompileFormulaContext::getDoc()
+{
+ return mpDoc;
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */