diff options
author | Thomas Arnhold <thomas@arnhold.org> | 2013-09-08 22:29:30 +0200 |
---|---|---|
committer | Thomas Arnhold <thomas@arnhold.org> | 2013-09-08 22:35:34 +0200 |
commit | a16c38f74e48402b39d478b3b4c9a9b91bbc2cba (patch) | |
tree | ac988494c82641783c29bb4de0da02b77d5c1a08 /starmath | |
parent | 9adcd261054a0e99ae032be5e7428e28a6663975 (diff) |
Math: Further cleanup and realignment
Change-Id: I8cf6265c02db03585aaa86e137e328317f995e4d
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/smmod.hxx | 27 | ||||
-rw-r--r-- | starmath/inc/starmath.hrc | 8 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 54 | ||||
-rw-r--r-- | starmath/source/smmod.cxx | 56 | ||||
-rw-r--r-- | starmath/source/symbol.src | 152 |
5 files changed, 28 insertions, 269 deletions
diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index 637600a08212..33af82dcbb25 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -61,36 +61,12 @@ public: #define SM_RESSTR(x) SmResId(x).toString() -class SmNamesArray : public Resource -{ - ResStringArray aNamesAry; - LanguageType nLanguage; - -public: - SmNamesArray( LanguageType nLang, int nRID ) : - Resource( SmResId(RID_LOCALIZED_NAMES) ), - aNamesAry (SmResId( static_cast < sal_uInt16 > ( nRID ))), - nLanguage (nLang) - { - FreeResource(); - } - - LanguageType GetLanguage() const { return nLanguage; } - const ResStringArray& GetNamesArray() const { return aNamesAry; } -}; - -///////////////////////////////////////////////////////////////// - class SmLocalizedSymbolData : public Resource { ResStringArray aUiSymbolNamesAry; ResStringArray aExportSymbolNamesAry; ResStringArray aUiSymbolSetNamesAry; ResStringArray aExportSymbolSetNamesAry; - SmNamesArray *p50NamesAry; - SmNamesArray *p60NamesAry; - LanguageType n50NamesLang; - LanguageType n60NamesLang; public: SmLocalizedSymbolData(); @@ -105,9 +81,6 @@ public: const ResStringArray& GetExportSymbolSetNamesArray() const { return aExportSymbolSetNamesAry; } const OUString GetUiSymbolSetName( const OUString &rExportName ) const; const OUString GetExportSymbolSetName( const OUString &rUiName ) const; - - const ResStringArray* Get50NamesArray( LanguageType nLang ); - const ResStringArray* Get60NamesArray( LanguageType nLang ); }; ///////////////////////////////////////////////////////////////// diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 773006709bc9..206e358132cb 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -416,14 +416,6 @@ #define RID_EXPORT_SYMBOL_NAMES (RID_APP_START + 3103) #define RID_UI_SYMBOLSET_NAMES (RID_APP_START + 3105) #define RID_EXPORT_SYMBOLSET_NAMES (RID_APP_START + 3106) -#define RID_FRENCH_50_NAMES (RID_APP_START + 3107) -#define RID_FRENCH_60_NAMES (RID_APP_START + 3108) -#define RID_ITALIAN_50_NAMES (RID_APP_START + 3109) -#define RID_ITALIAN_60_NAMES (RID_APP_START + 3110) -#define RID_SWEDISH_50_NAMES (RID_APP_START + 3111) -#define RID_SWEDISH_60_NAMES (RID_APP_START + 3112) -#define RID_SPANISH_50_NAMES (RID_APP_START + 3113) -#define RID_SPANISH_60_NAMES (RID_APP_START + 3114) #define RID_CATEGORY_UNARY_BINARY_OPERATORS (RID_APP_START + 4001) #define RID_CATEGORY_RELATIONS (RID_APP_START + 4002) diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index f6f799522410..99f658d71ae8 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -980,17 +980,17 @@ void SmParser::Align() if (TokenInGroup(TGALIGN)) { - pSNode = new SmAlignNode(m_aCurToken); + pSNode = new SmAlignNode(m_aCurToken); - NextToken(); + NextToken(); - // allow for just one align statement in 5.0 - if (TokenInGroup(TGALIGN)) - { - Error(PE_DOUBLE_ALIGN); - delete pSNode; - return; - } + // allow for just one align statement in 5.0 + if (TokenInGroup(TGALIGN)) + { + Error(PE_DOUBLE_ALIGN); + delete pSNode; + return; + } } Expression(); @@ -2296,26 +2296,26 @@ void SmParser::Special() OUString &rName = m_aCurToken.aText; OUString aNewName; - // conversion of symbol names for 6.0 (XML) file format - // (name change on import / export. - // UI uses localized names XML file format does not.) - if (!rName.isEmpty() && rName[0] == '%') + // conversion of symbol names for 6.0 (XML) file format + // (name change on import / export. + // UI uses localized names XML file format does not.) + if (!rName.isEmpty() && rName[0] == '%') + { + if (IsImportSymbolNames()) { - if (IsImportSymbolNames()) - { - const SmLocalizedSymbolData &rLSD = SM_MOD()->GetLocSymbolData(); - aNewName = rLSD.GetUiSymbolName(rName.copy(1)); - bReplace = true; - } - else if (IsExportSymbolNames()) - { - const SmLocalizedSymbolData &rLSD = SM_MOD()->GetLocSymbolData(); - aNewName = rLSD.GetExportSymbolName(rName.copy(1)); - bReplace = true; - } + const SmLocalizedSymbolData &rLSD = SM_MOD()->GetLocSymbolData(); + aNewName = rLSD.GetUiSymbolName(rName.copy(1)); + bReplace = true; } - if (!aNewName.isEmpty()) - aNewName = "%" + aNewName; + else if (IsExportSymbolNames()) + { + const SmLocalizedSymbolData &rLSD = SM_MOD()->GetLocSymbolData(); + aNewName = rLSD.GetExportSymbolName(rName.copy(1)); + bReplace = true; + } + } + if (!aNewName.isEmpty()) + aNewName = "%" + aNewName; if (bReplace && !aNewName.isEmpty() && rName != aNewName) diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index 9f6177345ff2..5d40679adff6 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -62,11 +62,7 @@ SmLocalizedSymbolData::SmLocalizedSymbolData() : aUiSymbolNamesAry ( SmResId(RID_UI_SYMBOL_NAMES) ), aExportSymbolNamesAry ( SmResId(RID_EXPORT_SYMBOL_NAMES) ), aUiSymbolSetNamesAry ( SmResId(RID_UI_SYMBOLSET_NAMES) ), - aExportSymbolSetNamesAry( SmResId(RID_EXPORT_SYMBOLSET_NAMES) ), - p50NamesAry ( 0 ), - p60NamesAry ( 0 ), - n50NamesLang ( LANGUAGE_NONE ), - n60NamesLang ( LANGUAGE_NONE ) + aExportSymbolSetNamesAry( SmResId(RID_EXPORT_SYMBOLSET_NAMES) ) { FreeResource(); } @@ -74,8 +70,6 @@ SmLocalizedSymbolData::SmLocalizedSymbolData() : SmLocalizedSymbolData::~SmLocalizedSymbolData() { - delete p50NamesAry; - delete p60NamesAry; } @@ -162,54 +156,6 @@ const OUString SmLocalizedSymbolData::GetExportSymbolSetName( const OUString &rU return aRes; } - -const ResStringArray* SmLocalizedSymbolData::Get50NamesArray( LanguageType nLang ) -{ - if (nLang != n50NamesLang) - { - int nRID; - switch (nLang) - { - case LANGUAGE_FRENCH : nRID = RID_FRENCH_50_NAMES; break; - case LANGUAGE_ITALIAN : nRID = RID_ITALIAN_50_NAMES; break; - case LANGUAGE_SWEDISH : nRID = RID_SWEDISH_50_NAMES; break; - case LANGUAGE_SPANISH : nRID = RID_SPANISH_50_NAMES; break; - default : nRID = -1; break; - } - delete p50NamesAry; - p50NamesAry = 0; - n50NamesLang = nLang; - if (-1 != nRID) - p50NamesAry = new SmNamesArray( n50NamesLang, nRID ); - } - - return p50NamesAry ? &p50NamesAry->GetNamesArray() : 0; -} - - -const ResStringArray* SmLocalizedSymbolData::Get60NamesArray( LanguageType nLang ) -{ - if (nLang != n60NamesLang) - { - int nRID; - switch (nLang) - { - case LANGUAGE_FRENCH : nRID = RID_FRENCH_60_NAMES; break; - case LANGUAGE_ITALIAN : nRID = RID_ITALIAN_60_NAMES; break; - case LANGUAGE_SWEDISH : nRID = RID_SWEDISH_60_NAMES; break; - case LANGUAGE_SPANISH : nRID = RID_SPANISH_60_NAMES; break; - default : nRID = -1; break; - } - delete p60NamesAry; - p60NamesAry = 0; - n60NamesLang = nLang; - if (-1 != nRID) - p60NamesAry = new SmNamesArray( n60NamesLang, nRID ); - } - - return p60NamesAry ? &p60NamesAry->GetNamesArray() : 0; -} - ///////////////////////////////////////////////////////////////// SFX_IMPL_INTERFACE(SmModule, SfxModule, SmResId(RID_APPLICATION)) diff --git a/starmath/source/symbol.src b/starmath/source/symbol.src index 77f7384a7125..fa5642b75876 100644 --- a/starmath/source/symbol.src +++ b/starmath/source/symbol.src @@ -19,160 +19,8 @@ #include <starmath.hrc> - -///////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////// - Resource RID_LOCALIZED_NAMES { - StringArray RID_FRENCH_50_NAMES - { - ItemList = - { - < "BETA" ; > ; - < "beta" ; > ; - < "ETA" ; > ; - < "eta" ; > ; - < "JOTA" ; > ; - < "jota" ; > ; - < "CHI" ; > ; - < "chi" ; > ; - < "MY" ; > ; - < "my" ; > ; - < "NY" ; > ; - < "ny" ; > ; - < "OMIKRON" ; > ; - < "omikron" ; > ; - < "OMEGA" ; > ; - < "omega" ; > ; - < "RHO" ; > ; - < "rho" ; > ; - < "THETA" ; > ; - < "theta" ; > ; - < "YPSILON" ; > ; - < "ypsilon" ; > ; - < "ZETA" ; > ; - < "zeta" ; > ; - < "varrho" ; > ; - < "vartheta" ; > ; - }; - }; - StringArray RID_FRENCH_60_NAMES - { - ItemList = - { - < "BÊTA" ; > ; - < "bêta" ; > ; - < "ÊTA" ; > ; - < "êta" ; > ; - < "IOTA" ; > ; - < "iota" ; > ; - < "KHI" ; > ; - < "khi" ; > ; - < "MU" ; > ; - < "mu" ; > ; - < "NU" ; > ; - < "nu" ; > ; - < "OMICRON" ; > ; - < "omicron" ; > ; - < "OMÉGA" ; > ; - < "oméga" ; > ; - < "RHÔ" ; > ; - < "rhô" ; > ; - < "THÊTA" ; > ; - < "thêta" ; > ; - < "UPSILON" ; > ; - < "upsilon" ; > ; - < "ZÊTA" ; > ; - < "zêta" ; > ; - < "varrhô" ; > ; - < "varthêta" ; > ; - }; - }; - StringArray RID_ITALIAN_50_NAMES - { - ItemList = - { - < "nu" ; > ; - < "Nu" ; > ; - < "varrho" ; > ; - < "moltomaggioredi" ; > ; - < "indentico" ; > ; - < "nonelemento" ; > ; - < "moltoinferioredi" ; > ; - < "o" ; > ; - < "permille" ; > ; - < "tendentea" ; > ; - < "nonuguale" ; > ; - < "infinite" ; > ; - }; - }; - StringArray RID_ITALIAN_60_NAMES - { - ItemList = - { - < "ni" ; > ; - < "Ni" ; > ; - < "varro" ; > ; - < "molto.maggiore.di" ; > ; - < "identico" ; > ; - < "non.elemento" ; > ; - < "molto.minore.di" ; > ; - < "oppure" ; > ; - < "per.mille" ; > ; - < "tendente.a" ; > ; - < "non.uguale" ; > ; - < "infinito" ; > ; - }; - }; - StringArray RID_SWEDISH_50_NAMES - { - ItemList = - { - < "iota" ; > ; - < "IOTA" ; > ; - < "xi" ; > ; - < "XI" ; > ; - < "rho" ; > ; - < "RHO" ; > ; - < "element" ; > ; - }; - }; - StringArray RID_SWEDISH_60_NAMES - { - ItemList = - { - < "jota" ; > ; - < "JOTA" ; > ; - < "ksi" ; > ; - < "KSI" ; > ; - < "ro" ; > ; - < "RO" ; > ; - < "tillhör" ; > ; - }; - }; - StringArray RID_SPANISH_50_NAMES - { - ItemList = - { - < "distino" ; > ; - < "muchomenos" ; > ; - < "pertenece" ; > ; - < "nopertenece" ; > ; - }; - }; - StringArray RID_SPANISH_60_NAMES - { - ItemList = - { - < "diferente" ; > ; - < "muchomenor" ; > ; - < "elemento" ; > ; - < "sinelemento" ; > ; - }; - }; StringArray RID_EXPORT_SYMBOLSET_NAMES { ItemList = |