cui/source/options/treeopt.cxx | 10 +- starmath/inc/parse.hxx | 14 --- starmath/inc/smmod.hxx | 27 ------- starmath/inc/starmath.hrc | 8 -- starmath/source/parse.cxx | 149 +++++++--------------------------------- starmath/source/smmod.cxx | 56 --------------- starmath/source/symbol.src | 152 ----------------------------------------- 7 files changed, 33 insertions(+), 383 deletions(-)
New commits: commit a16c38f74e48402b39d478b3b4c9a9b91bbc2cba Author: Thomas Arnhold <tho...@arnhold.org> Date: Sun Sep 8 22:29:30 2013 +0200 Math: Further cleanup and realignment Change-Id: I8cf6265c02db03585aaa86e137e328317f995e4d diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index 637600a..33af82d 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 7730067..206e358 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 f6f7995..99f658d 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 9f61773..5d40679 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 77f7384..fa5642b 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 = commit 9adcd261054a0e99ae032be5e7428e28a6663975 Author: Thomas Arnhold <tho...@arnhold.org> Date: Sun Sep 8 22:09:56 2013 +0200 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 diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index d7eefcf..f57318d 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 8baa1ec..f6f7995 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(); } commit 9a08e65ae2b3d875d2b120acd046742d541ad5ec Author: Thomas Arnhold <tho...@arnhold.org> Date: Sun Sep 8 20:55:11 2013 +0200 String to OUString Change-Id: I24af8d00178d47a8c675b945d4d1291f0bfd0f11 diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index bde4767..d3c0b00 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -821,7 +821,7 @@ void OfaTreeOptionsDialog::ActivateLastSelection() SvTreeListEntry* pEntry = NULL; if ( pLastPageSaver ) { - String sExpand( EXPAND_PROTOCOL ); + OUString sExpand( EXPAND_PROTOCOL ); String sLastURL = bIsFromExtensionManager ? pLastPageSaver->m_sLastPageURL_ExtMgr : pLastPageSaver->m_sLastPageURL_Tools; if ( sLastURL.Len() == 0 ) @@ -848,13 +848,13 @@ void OfaTreeOptionsDialog::ActivateLastSelection() if ( aTreeLB.GetParent( pTemp ) && pTemp->GetUserData() ) { OptionsPageInfo* pPageInfo = (OptionsPageInfo*)pTemp->GetUserData(); - String sPageURL = pPageInfo->m_sPageURL; + OUString sPageURL = pPageInfo->m_sPageURL; if ( bMustExpand - && sPageURL.Len() > 0 - && sExpand.Match( sPageURL ) == STRING_MATCH ) + && !sPageURL.isEmpty() + && sPageURL.startsWith( sExpand ) ) { // cut protocol - OUString sTemp( sPageURL.Copy( sizeof( EXPAND_PROTOCOL ) -1 ) ); + OUString sTemp( sPageURL.copy( sExpand.getLength() ) ); // decode uri class chars sTemp = ::rtl::Uri::decode( sTemp, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits