From 2389c4b6fdf5b999e3740e56c00a9d522449512d Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 8 Oct 2001 10:47:58 +0000 Subject: [PATCH] #92615# renaming of italian symbols from version 5.x to 6.0 --- starmath/inc/smmod.hxx | 39 +++++++++++++++++++----- starmath/inc/starmath.hrc | 6 ++-- starmath/source/document.cxx | 54 ++++++++++++++++++++-------------- starmath/source/smmod.cxx | 57 ++++++++++++++++++++++++++++++++---- starmath/source/symbol.src | 40 +++++++++++++++++++++++-- 5 files changed, 158 insertions(+), 38 deletions(-) diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index 76d82e599913..b602c6eada25 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -2,9 +2,9 @@ * * $RCSfile: smmod.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tl $ $Date: 2001-08-28 07:46:06 $ + * last change: $Author: tl $ $Date: 2001-10-08 11:46:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,6 +70,9 @@ #define _SM_DLL // fuer SD_MOD() #include "smdll.hxx" // fuer SdModuleDummy #endif +#ifndef _STARMATH_HRC +#include "starmath.hrc" +#endif class SvxErrorHandler; class SvFactory; @@ -94,14 +97,36 @@ class SvtSysLocale; ///////////////////////////////////////////////////////////////// +class SmNamesArray : public Resource +{ + ResStringArray aNamesAry; + LanguageType nLanguage; + +public: + SmNamesArray( LanguageType nLang, int nRID ) : + Resource( SmResId(RID_LOCALIZED_NAMES) ), + nLanguage (nLang), + aNamesAry (ResId(nRID)) + { + FreeResource(); + } + + LanguageType GetLanguage() const { return nLanguage; } + const ResStringArray& GetNamesArray() const { return aNamesAry; } +}; + +///////////////////////////////////////////////////////////////// + class SmLocalizedSymbolData : public Resource { ResStringArray aUiSymbolNamesAry; ResStringArray aExportSymbolNamesAry; ResStringArray aUiSymbolSetNamesAry; ResStringArray aExportSymbolSetNamesAry; - ResStringArray aFrench50NamesAry; - ResStringArray aFrench60NamesAry; + SmNamesArray *p50NamesAry; + SmNamesArray *p60NamesAry; + LanguageType n50NamesLang; + LanguageType n60NamesLang; public: SmLocalizedSymbolData(); @@ -117,8 +142,8 @@ public: const String GetUiSymbolSetName( const String &rExportName ) const; const String GetExportSymbolSetName( const String &rUiName ) const; - const ResStringArray& GetFrench50NamesArray() const { return aFrench50NamesAry; } - const ResStringArray& GetFrench60NamesArray() const { return aFrench60NamesAry; } + const ResStringArray* Get50NamesArray( LanguageType nLang ); + const ResStringArray* Get60NamesArray( LanguageType nLang ); }; ///////////////////////////////////////////////////////////////// @@ -146,7 +171,7 @@ public: SmConfig * GetConfig(); SmRectCache * GetRectCache() { return pRectCache; } - const SmLocalizedSymbolData & GetLocSymbolData() const; + SmLocalizedSymbolData & GetLocSymbolData() const; void GetState(SfxItemSet&); diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 35024ce8e94b..b6ec34165d59 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -2,9 +2,9 @@ * * $RCSfile: starmath.hrc,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: tl $ $Date: 2001-08-02 15:32:47 $ + * last change: $Author: tl $ $Date: 2001-10-08 11:46:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -461,6 +461,8 @@ #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 HID_SMA_OPTIONSDIALOG (HID_SMA_START + 1) #define HID_SMA_FONTDIALOG (HID_SMA_START + 2) diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 6900acdc9160..cd764334eb51 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -2,9 +2,9 @@ * * $RCSfile: document.cxx,v $ * - * $Revision: 1.40 $ + * $Revision: 1.41 $ * - * last change: $Author: tl $ $Date: 2001-08-08 11:22:18 $ + * last change: $Author: tl $ $Date: 2001-10-08 11:47:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -690,19 +690,24 @@ void SmDocShell::Convert40To50Txt( String &rText ) void SmDocShell::Convert50To60Txt( String &rText ) { - // change french 50 symbol-names to their 60 equivalent - // even in strings ("") and comments (%%). - // Thus a simple text replacement should work. - if (LANGUAGE_FRENCH == Application::GetSettings().GetUILanguage()) + // change 50 symbol-names to their 60 equivalent + LanguageType nLang = Application::GetSettings().GetUILanguage(); + SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + const ResStringArray *p50Names = rData.Get50NamesArray( nLang ); + const ResStringArray *p60Names = rData.Get60NamesArray( nLang ); + if (p50Names && p60Names) { - const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); - const ResStringArray &rFrench50 = rData.GetFrench50NamesArray(); - const ResStringArray &rFrench60 = rData.GetFrench60NamesArray(); - USHORT nCount = rFrench50.Count(); + DBG_ASSERT( p50Names->Count() == p60Names->Count(), + "array length mismatch" ); + USHORT nCount = p50Names->Count(); + String aPreSym( RTL_CONSTASCII_STRINGPARAM("%") ); for (USHORT i = 0; i < nCount; ++i) { - rText.SearchAndReplaceAll( rFrench50.GetString(i), - rFrench60.GetString(i) ); + String a50Tmp( aPreSym ); + String a60Tmp( aPreSym ); + a50Tmp += p50Names->GetString(i); + a60Tmp += p60Names->GetString(i); + rText.SearchAndReplaceAll( a50Tmp, a60Tmp ); } } } @@ -710,19 +715,24 @@ void SmDocShell::Convert50To60Txt( String &rText ) void SmDocShell::Convert60To50Txt( String &rText ) { - // change french 60 symbol-names to their 50 equivalent - // even in strings ("") and comments (%%). - // Thus a simple text replacement should work. - if (LANGUAGE_FRENCH == Application::GetSettings().GetUILanguage()) + // change 50 symbol-names to their 60 equivalent + LanguageType nLang = Application::GetSettings().GetUILanguage(); + SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); + const ResStringArray *p50Names = rData.Get50NamesArray( nLang ); + const ResStringArray *p60Names = rData.Get60NamesArray( nLang ); + if (p50Names && p60Names) { - const SmLocalizedSymbolData &rData = SM_MOD1()->GetLocSymbolData(); - const ResStringArray &rFrench50 = rData.GetFrench50NamesArray(); - const ResStringArray &rFrench60 = rData.GetFrench60NamesArray(); - USHORT nCount = rFrench60.Count(); + DBG_ASSERT( p50Names->Count() == p60Names->Count(), + "array length mismatch" ); + USHORT nCount = p60Names->Count(); + String aPreSym( RTL_CONSTASCII_STRINGPARAM("%") ); for (USHORT i = 0; i < nCount; ++i) { - rText.SearchAndReplaceAll( rFrench60.GetString(i), - rFrench50.GetString(i) ); + String a50Tmp( aPreSym ); + String a60Tmp( aPreSym ); + a50Tmp += p50Names->GetString(i); + a60Tmp += p60Names->GetString(i); + rText.SearchAndReplaceAll( a60Tmp, a50Tmp ); } } } diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index 472d25f7913b..e15603c5cd6c 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -2,9 +2,9 @@ * * $RCSfile: smmod.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tl $ $Date: 2001-08-28 07:47:20 $ + * last change: $Author: tl $ $Date: 2001-10-08 11:47:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -130,8 +130,10 @@ SmLocalizedSymbolData::SmLocalizedSymbolData() : aExportSymbolNamesAry ( ResId(RID_EXPORT_SYMBOL_NAMES) ), aUiSymbolSetNamesAry ( ResId(RID_UI_SYMBOLSET_NAMES) ), aExportSymbolSetNamesAry( ResId(RID_EXPORT_SYMBOLSET_NAMES) ), - aFrench50NamesAry ( ResId(RID_FRENCH_50_NAMES) ), - aFrench60NamesAry ( ResId(RID_FRENCH_60_NAMES) ) + p50NamesAry ( 0 ), + p60NamesAry ( 0 ), + n50NamesLang ( LANGUAGE_NONE ), + n60NamesLang ( LANGUAGE_NONE ) { FreeResource(); } @@ -139,6 +141,8 @@ SmLocalizedSymbolData::SmLocalizedSymbolData() : SmLocalizedSymbolData::~SmLocalizedSymbolData() { + delete p50NamesAry; + delete p60NamesAry; } @@ -226,6 +230,49 @@ const String SmLocalizedSymbolData::GetExportSymbolSetName( const String &rUiNam } +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; + 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; + 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)) @@ -266,7 +313,7 @@ SmConfig * SmModule::GetConfig() return pConfig; } -const SmLocalizedSymbolData & SmModule::GetLocSymbolData() const +SmLocalizedSymbolData & SmModule::GetLocSymbolData() const { if (!pLocSymbolData) ((SmModule *) this)->pLocSymbolData = new SmLocalizedSymbolData; diff --git a/starmath/source/symbol.src b/starmath/source/symbol.src index 4333c3bb8d45..d4a286a499ca 100644 --- a/starmath/source/symbol.src +++ b/starmath/source/symbol.src @@ -2,9 +2,9 @@ * * $RCSfile: symbol.src,v $ * - * $Revision: 1.20 $ + * $Revision: 1.21 $ * - * last change: $Author: kz $ $Date: 2001-09-26 20:23:43 $ + * last change: $Author: tl $ $Date: 2001-10-08 11:47:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -133,6 +133,42 @@ Resource RID_LOCALIZED_NAMES < "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_EXPORT_SYMBOLSET_NAMES { ItemList =