summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorThomas Arnhold <thomas@arnhold.org>2013-09-08 22:09:56 +0200
committerThomas Arnhold <thomas@arnhold.org>2013-09-08 22:35:33 +0200
commit9adcd261054a0e99ae032be5e7428e28a6663975 (patch)
tree7fd8e46b5289cdd0022155f812e930b001084fa0 /starmath
parent9a08e65ae2b3d875d2b120acd046742d541ad5ec (diff)
Math: Remove obsolete GetConversion()
CONVERT_NONE is the default case, as SetConversion() gets never called. We dropped the support for legacy filetypes with 4.0 anyway. Change-Id: Ic49ae7b53497e8198c8b61eab0b0cdc120c2bdd7
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/parse.hxx14
-rw-r--r--starmath/source/parse.cxx107
2 files changed, 6 insertions, 115 deletions
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index d7eefcf82b04..f57318d5aa79 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -159,16 +159,6 @@ typedef ::std::vector< SmErrorDesc* > SmErrDescList;
/**************************************************************************/
-// defines possible conversions of the formula text from the format of
-// one release to the one of another.
-enum SmConvert
-{
- CONVERT_NONE,
- CONVERT_40_TO_50,
- CONVERT_50_TO_60,
- CONVERT_60_TO_50
-};
-
struct SmTokenTableEntry
{
const sal_Char* pIdent;
@@ -190,7 +180,6 @@ class SmParser
m_nTokenIndex;
sal_Int32 m_Row,
m_nColOff;
- SmConvert m_eConversion;
bool bImportSymNames,
m_bExportSymNames;
@@ -265,9 +254,6 @@ public:
const OUString & GetText() const { return m_aBufferString; };
- SmConvert GetConversion() const { return m_eConversion; }
- void SetConversion(SmConvert eConv) { m_eConversion = eConv; }
-
bool IsImportSymbolNames() const { return bImportSymNames; }
void SetImportSymbolNames(bool bVal) { bImportSymNames = bVal; }
bool IsExportSymbolNames() const { return m_bExportSymNames; }
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 8baa1ecb0b76..f6f799522410 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -977,53 +977,24 @@ void SmParser::Align()
// parse alignment info (if any), then go on with rest of expression
{
SmStructureNode *pSNode = 0;
- bool bNeedGroupClose = false;
if (TokenInGroup(TGALIGN))
{
- if (CONVERT_40_TO_50 == GetConversion())
- // encapsulate expression to be aligned in group braces
- // (here group-open brace)
- { Insert("{", GetTokenIndex());
- bNeedGroupClose = true;
-
- // get first valid align statement in sequence
- // (the dominant one in 4.0) and erase all others (especially old
- // discarded tokens) from command string.
- while (TokenInGroup(TGALIGN))
- {
- if (TokenInGroup(TGDISCARDED) || pSNode)
- {
- m_nBufferIndex = GetTokenIndex();
- m_aBufferString = m_aBufferString.replaceAt(m_nBufferIndex, m_aCurToken.aText.getLength(), "");
- }
- else
- pSNode = new SmAlignNode(m_aCurToken);
-
- NextToken();
- }
- }
- else
- {
pSNode = new SmAlignNode(m_aCurToken);
NextToken();
// allow for just one align statement in 5.0
- if (CONVERT_40_TO_50 != GetConversion() && TokenInGroup(TGALIGN))
+ if (TokenInGroup(TGALIGN))
{
Error(PE_DOUBLE_ALIGN);
delete pSNode;
return;
}
- }
}
Expression();
- if (bNeedGroupClose)
- Insert("}", GetTokenIndex());
-
if (pSNode)
{
pSNode->SetSubNodes(lcl_popOrZero(m_aNodeStack), 0);
@@ -1049,10 +1020,8 @@ void SmParser::Line()
}
while (m_aCurToken.eType != TEND && m_aCurToken.eType != TNEWLINE)
- { if (CONVERT_40_TO_50 != GetConversion())
- Expression();
- else
- Align();
+ {
+ Expression();
ExpressionArray.resize(++n);
ExpressionArray[n - 1] = lcl_popOrZero(m_aNodeStack);
}
@@ -1582,35 +1551,8 @@ void SmParser::Term(bool bGroupNumberIdent)
m_aNodeStack.push(pFirstNode);
}
else if (TokenInGroup(TGFUNCTION))
- { if (CONVERT_40_TO_50 != GetConversion())
- { Function();
- }
- else // encapsulate old 4.0 style parsing in braces
- {
- // insert opening brace
- Insert("{", GetTokenIndex());
-
- //
- // parse in 4.0 style
- //
- Function();
-
- SmNode *pFunc = lcl_popOrZero(m_aNodeStack);
-
- if (m_aCurToken.eType == TLPARENT)
- { Term(false);
- }
- else
- { Align();
- }
-
- // insert closing brace
- Insert("}", GetTokenIndex());
-
- SmStructureNode *pSNode = new SmExpressionNode(pFunc->GetToken());
- pSNode->SetSubNodes(pFunc, lcl_popOrZero(m_aNodeStack));
- m_aNodeStack.push(pSNode);
- }
+ {
+ Function();
}
else
Error(PE_UNEXPECTED_CHAR);
@@ -2354,8 +2296,6 @@ void SmParser::Special()
OUString &rName = m_aCurToken.aText;
OUString aNewName;
- if (CONVERT_NONE == GetConversion())
- {
// conversion of symbol names for 6.0 (XML) file format
// (name change on import / export.
// UI uses localized names XML file format does not.)
@@ -2376,41 +2316,7 @@ void SmParser::Special()
}
if (!aNewName.isEmpty())
aNewName = "%" + aNewName;
- }
- else // 5.0 <-> 6.0 formula text (symbol name) conversion
- {
- LanguageType nLanguage = GetLanguage();
- SmLocalizedSymbolData &rData = SM_MOD()->GetLocSymbolData();
- const ResStringArray *pFrom = 0;
- const ResStringArray *pTo = 0;
- if (CONVERT_50_TO_60 == GetConversion())
- {
- pFrom = rData.Get50NamesArray( nLanguage );
- pTo = rData.Get60NamesArray( nLanguage );
- }
- else if (CONVERT_60_TO_50 == GetConversion())
- {
- pFrom = rData.Get60NamesArray( nLanguage );
- pTo = rData.Get50NamesArray( nLanguage );
- }
- if (pFrom && pTo)
- {
- OSL_ENSURE( pFrom->Count() == pTo->Count(),
- "array length mismatch" );
- sal_uInt16 nCount = sal::static_int_cast< sal_uInt16 >(pFrom->Count());
- for (sal_uInt16 i = 0; i < nCount; ++i)
- {
- if (pFrom->GetString(i).equals(rName))
- {
- aNewName = pTo->GetString(i);
- bReplace = true;
- }
- }
- }
- // else:
- // conversion arrays not found or (usually)
- // conversion not necessary
- }
+
if (bReplace && !aNewName.isEmpty() && rName != aNewName)
{
@@ -2458,7 +2364,6 @@ void SmParser::Error(SmParseError eError)
SmParser::SmParser()
: m_aDotLoc( LanguageTag::convertToLocale( LANGUAGE_ENGLISH_US ) )
{
- m_eConversion = CONVERT_NONE;
bImportSymNames = m_bExportSymNames = false;
m_nLang = Application::GetSettings().GetUILanguageTag().getLanguageType();
}