diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2017-04-17 21:35:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-26 08:50:54 +0200 |
commit | c70d49c7c888da8cfd73db8585e7be1f37fc398a (patch) | |
tree | c0e540401850018464ca76300536faf9aa7e27d2 /sw/source/filter/ww8 | |
parent | cd4344d3bdef631b3e64ac12a9e64bc9670c1b7c (diff) |
use strong_int for LanguageType
Change-Id: If99a944f7032180355da291ad283b4cfcea4f448
Reviewed-on: https://gerrit.libreoffice.org/36629
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/ww8')
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/writerwordglue.cxx | 214 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 22 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.hxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8struc.hxx | 2 |
10 files changed, 141 insertions, 149 deletions
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 2f78e3977b26..597316b2002c 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2325,15 +2325,15 @@ void RtfAttributeOutput::CharLanguage(const SvxLanguageItem& rLanguage) { case RES_CHRATR_LANGUAGE: m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LANG); - m_aStylesEnd.append((sal_Int32)rLanguage.GetLanguage()); + m_aStylesEnd.append((sal_Int32)static_cast<sal_uInt16>(rLanguage.GetLanguage())); break; case RES_CHRATR_CJK_LANGUAGE: m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LANGFE); - m_aStyles.append((sal_Int32)rLanguage.GetLanguage()); + m_aStyles.append((sal_Int32)static_cast<sal_uInt16>(rLanguage.GetLanguage())); break; case RES_CHRATR_CTL_LANGUAGE: m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ALANG); - m_aStyles.append((sal_Int32)rLanguage.GetLanguage()); + m_aStyles.append((sal_Int32)static_cast<sal_uInt16>(rLanguage.GetLanguage())); break; } } diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index a2a6aa29c454..ed06ad119548 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -834,8 +834,8 @@ namespace sw } sal_uLong MSDateTimeFormatToSwFormat(OUString& rParams, - SvNumberFormatter *pFormatter, sal_uInt16 &rLang, bool bHijri, - sal_uInt16 nDocLang) + SvNumberFormatter *pFormatter, LanguageType &rLang, bool bHijri, + LanguageType nDocLang) { // tell the Formatter about the new entry sal_Int32 nCheckPos = 0; @@ -906,14 +906,10 @@ namespace sw sal_Unicode nChar = rParams[nI]; // Change the localized word string to english - switch ( nDocLang ) + if ( nDocLang == LANGUAGE_FRENCH ) { - case LANGUAGE_FRENCH: - if ( ( nChar == 'a' || nChar == 'A' ) && IsNotAM(rParams, nI) ) - rParams = rParams.replaceAt(nI, 1, "Y"); - break; - default: - ; + if ( ( nChar == 'a' || nChar == 'A' ) && IsNotAM(rParams, nI) ) + rParams = rParams.replaceAt(nI, 1, "Y"); } if (nChar == '/') { @@ -934,111 +930,103 @@ namespace sw if ( !bForceJapanese && !bForceNatNum ) { // Convert to the localized equivalent for OOo - switch ( rLang ) + if ( rLang == LANGUAGE_FINNISH ) { - case LANGUAGE_FINNISH: - { - if (nChar == 'y' || nChar == 'Y') - rParams = rParams.replaceAt(nI, 1, "V"); - else if (nChar == 'm' || nChar == 'M') - rParams = rParams.replaceAt(nI, 1, "K"); - else if (nChar == 'd' || nChar == 'D') - rParams = rParams.replaceAt(nI, 1, "P"); - else if (nChar == 'h' || nChar == 'H') - rParams = rParams.replaceAt(nI, 1, "T"); - } - break; - case LANGUAGE_DANISH: - case LANGUAGE_NORWEGIAN: - case LANGUAGE_NORWEGIAN_BOKMAL: - case LANGUAGE_NORWEGIAN_NYNORSK: - case LANGUAGE_SWEDISH: - case LANGUAGE_SWEDISH_FINLAND: - { - if (nChar == 'h' || nChar == 'H') - rParams = rParams.replaceAt(nI, 1, "T"); - } - break; - case LANGUAGE_PORTUGUESE: - case LANGUAGE_PORTUGUESE_BRAZILIAN: - case LANGUAGE_SPANISH_MODERN: - case LANGUAGE_SPANISH_DATED: - case LANGUAGE_SPANISH_MEXICAN: - case LANGUAGE_SPANISH_GUATEMALA: - case LANGUAGE_SPANISH_COSTARICA: - case LANGUAGE_SPANISH_PANAMA: - case LANGUAGE_SPANISH_DOMINICAN_REPUBLIC: - case LANGUAGE_SPANISH_VENEZUELA: - case LANGUAGE_SPANISH_COLOMBIA: - case LANGUAGE_SPANISH_PERU: - case LANGUAGE_SPANISH_ARGENTINA: - case LANGUAGE_SPANISH_ECUADOR: - case LANGUAGE_SPANISH_CHILE: - case LANGUAGE_SPANISH_URUGUAY: - case LANGUAGE_SPANISH_PARAGUAY: - case LANGUAGE_SPANISH_BOLIVIA: - case LANGUAGE_SPANISH_EL_SALVADOR: - case LANGUAGE_SPANISH_HONDURAS: - case LANGUAGE_SPANISH_NICARAGUA: - case LANGUAGE_SPANISH_PUERTO_RICO: - { - if (nChar == 'a' || nChar == 'A') - rParams = rParams.replaceAt(nI, 1, "O"); - else if (nChar == 'y' || nChar == 'Y') - rParams = rParams.replaceAt(nI, 1, "A"); - } - break; - case LANGUAGE_DUTCH: - case LANGUAGE_DUTCH_BELGIAN: - { - if (nChar == 'y' || nChar == 'Y') - rParams = rParams.replaceAt(nI, 1, "J"); - else if (nChar == 'u' || nChar == 'U') - rParams = rParams.replaceAt(nI, 1, "H"); - } - break; - case LANGUAGE_ITALIAN: - case LANGUAGE_ITALIAN_SWISS: - { - if (nChar == 'a' || nChar == 'A') - rParams = rParams.replaceAt(nI, 1, "O"); - else if (nChar == 'g' || nChar == 'G') - rParams = rParams.replaceAt(nI, 1, "X"); - else if (nChar == 'y' || nChar == 'Y') - rParams = rParams.replaceAt(nI, 1, "A"); - else if (nChar == 'd' || nChar == 'D') - rParams = rParams.replaceAt(nI, 1, "G"); - } - break; - case LANGUAGE_GERMAN: - case LANGUAGE_GERMAN_SWISS: - case LANGUAGE_GERMAN_AUSTRIAN: - case LANGUAGE_GERMAN_LUXEMBOURG: - case LANGUAGE_GERMAN_LIECHTENSTEIN: - { - if (nChar == 'y' || nChar == 'Y') - rParams = rParams.replaceAt(nI, 1, "J"); - else if (nChar == 'd' || nChar == 'D') - rParams = rParams.replaceAt(nI, 1, "T"); - } - break; - case LANGUAGE_FRENCH: - case LANGUAGE_FRENCH_BELGIAN: - case LANGUAGE_FRENCH_CANADIAN: - case LANGUAGE_FRENCH_SWISS: - case LANGUAGE_FRENCH_LUXEMBOURG: - case LANGUAGE_FRENCH_MONACO: - { - if (nChar == 'y' || nChar == 'Y' || nChar == 'a') - rParams = rParams.replaceAt(nI, 1, "A"); - else if (nChar == 'd' || nChar == 'D' || nChar == 'j') - rParams = rParams.replaceAt(nI, 1, "J"); - } - break; - default: - { - ; // Nothing - } + if (nChar == 'y' || nChar == 'Y') + rParams = rParams.replaceAt(nI, 1, "V"); + else if (nChar == 'm' || nChar == 'M') + rParams = rParams.replaceAt(nI, 1, "K"); + else if (nChar == 'd' || nChar == 'D') + rParams = rParams.replaceAt(nI, 1, "P"); + else if (nChar == 'h' || nChar == 'H') + rParams = rParams.replaceAt(nI, 1, "T"); + } + else if ( rLang.anyOf( + LANGUAGE_DANISH, + LANGUAGE_NORWEGIAN, + LANGUAGE_NORWEGIAN_BOKMAL, + LANGUAGE_NORWEGIAN_NYNORSK, + LANGUAGE_SWEDISH, + LANGUAGE_SWEDISH_FINLAND)) + { + if (nChar == 'h' || nChar == 'H') + rParams = rParams.replaceAt(nI, 1, "T"); + } + else if ( rLang.anyOf( + LANGUAGE_PORTUGUESE, + LANGUAGE_PORTUGUESE_BRAZILIAN, + LANGUAGE_SPANISH_MODERN, + LANGUAGE_SPANISH_DATED, + LANGUAGE_SPANISH_MEXICAN, + LANGUAGE_SPANISH_GUATEMALA, + LANGUAGE_SPANISH_COSTARICA, + LANGUAGE_SPANISH_PANAMA, + LANGUAGE_SPANISH_DOMINICAN_REPUBLIC, + LANGUAGE_SPANISH_VENEZUELA, + LANGUAGE_SPANISH_COLOMBIA, + LANGUAGE_SPANISH_PERU, + LANGUAGE_SPANISH_ARGENTINA, + LANGUAGE_SPANISH_ECUADOR, + LANGUAGE_SPANISH_CHILE, + LANGUAGE_SPANISH_URUGUAY, + LANGUAGE_SPANISH_PARAGUAY, + LANGUAGE_SPANISH_BOLIVIA, + LANGUAGE_SPANISH_EL_SALVADOR, + LANGUAGE_SPANISH_HONDURAS, + LANGUAGE_SPANISH_NICARAGUA, + LANGUAGE_SPANISH_PUERTO_RICO)) + { + if (nChar == 'a' || nChar == 'A') + rParams = rParams.replaceAt(nI, 1, "O"); + else if (nChar == 'y' || nChar == 'Y') + rParams = rParams.replaceAt(nI, 1, "A"); + } + else if ( rLang.anyOf( + LANGUAGE_DUTCH, + LANGUAGE_DUTCH_BELGIAN)) + { + if (nChar == 'y' || nChar == 'Y') + rParams = rParams.replaceAt(nI, 1, "J"); + else if (nChar == 'u' || nChar == 'U') + rParams = rParams.replaceAt(nI, 1, "H"); + } + else if ( rLang.anyOf( + LANGUAGE_ITALIAN, + LANGUAGE_ITALIAN_SWISS)) + { + if (nChar == 'a' || nChar == 'A') + rParams = rParams.replaceAt(nI, 1, "O"); + else if (nChar == 'g' || nChar == 'G') + rParams = rParams.replaceAt(nI, 1, "X"); + else if (nChar == 'y' || nChar == 'Y') + rParams = rParams.replaceAt(nI, 1, "A"); + else if (nChar == 'd' || nChar == 'D') + rParams = rParams.replaceAt(nI, 1, "G"); + } + else if ( rLang.anyOf( + LANGUAGE_GERMAN, + LANGUAGE_GERMAN_SWISS, + LANGUAGE_GERMAN_AUSTRIAN, + LANGUAGE_GERMAN_LUXEMBOURG, + LANGUAGE_GERMAN_LIECHTENSTEIN)) + { + if (nChar == 'y' || nChar == 'Y') + rParams = rParams.replaceAt(nI, 1, "J"); + else if (nChar == 'd' || nChar == 'D') + rParams = rParams.replaceAt(nI, 1, "T"); + } + else if ( rLang.anyOf( + LANGUAGE_FRENCH, + LANGUAGE_FRENCH_BELGIAN, + LANGUAGE_FRENCH_CANADIAN, + LANGUAGE_FRENCH_SWISS, + LANGUAGE_FRENCH_LUXEMBOURG, + LANGUAGE_FRENCH_MONACO)) + { + if (nChar == 'y' || nChar == 'Y' || nChar == 'a') + rParams = rParams.replaceAt(nI, 1, "A"); + else if (nChar == 'd' || nChar == 'D' || nChar == 'j') + rParams = rParams.replaceAt(nI, 1, "J"); } } } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 7da2c6f353cc..5047e4f0d0bd 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1290,19 +1290,19 @@ void WW8AttributeOutput::CharLanguage( const SvxLanguageItem& rLanguage ) { // use sprmCRgLid0_80 rather than sprmCLid m_rWW8Export.InsUInt16( nId ); - m_rWW8Export.InsUInt16( rLanguage.GetLanguage() ); + m_rWW8Export.InsUInt16( (sal_uInt16)rLanguage.GetLanguage() ); // Word 2000 and above apparently require both old and new versions of // these sprms to be set, without it spellchecking doesn't work if ( nId == NS_sprm::sprmCRgLid0_80 ) { m_rWW8Export.InsUInt16( NS_sprm::sprmCRgLid0 ); - m_rWW8Export.InsUInt16( rLanguage.GetLanguage() ); + m_rWW8Export.InsUInt16( (sal_uInt16)rLanguage.GetLanguage() ); } else if ( nId == NS_sprm::sprmCRgLid1_80 ) { m_rWW8Export.InsUInt16( NS_sprm::sprmCRgLid1 ); - m_rWW8Export.InsUInt16( rLanguage.GetLanguage() ); + m_rWW8Export.InsUInt16( (sal_uInt16)rLanguage.GetLanguage() ); } } } @@ -2293,7 +2293,7 @@ bool MSWordExportBase::GetNumberFormat(const SwField& rField, OUString& rStr) const SvNumberformat* pNumFormat = pNFormatr->GetEntry( nFormatIdx ); if( pNumFormat ) { - sal_uInt16 nLng = rField.GetLanguage(); + LanguageType nLng = rField.GetLanguage(); LocaleDataWrapper aLocDat(pNFormatr->GetComponentContext(), LanguageTag(nLng)); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 1cb9d41845ad..702232035341 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2858,11 +2858,11 @@ std::size_t Custom8BitToUnicode(rtl_TextToUnicodeConverter hConverter, return nDestChars; } -bool SwWW8ImplReader::LangUsesHindiNumbers(sal_uInt16 nLang) +bool SwWW8ImplReader::LangUsesHindiNumbers(LanguageType nLang) { bool bResult = false; - switch (nLang) + switch ((sal_uInt16)nLang) { case 0x1401: // Arabic(Algeria) case 0x3c01: // Arabic(Bahrain) @@ -3014,7 +3014,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp sal_uInt8 nBCode = 0; sal_uInt16 nUCode; - sal_uInt16 nCTLLang = 0; + LanguageType nCTLLang = LANGUAGE_SYSTEM; const SfxPoolItem * pItem = GetFormatAttr(RES_CHRATR_CTL_LANGUAGE); if (pItem != nullptr) nCTLLang = static_cast<const SvxLanguageItem *>(pItem)->GetLanguage(); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 9c3d471f645b..d3658d3e6bfd 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1391,7 +1391,7 @@ private: bool ReadChar(long nPosCp, long nCpOfs); bool ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCpOfs); bool ReadChars(WW8_CP& rPos, WW8_CP nNextAttr, long nTextEnd, long nCpOfs); - static bool LangUsesHindiNumbers(sal_uInt16 nLang); + static bool LangUsesHindiNumbers(LanguageType nLang); static sal_Unicode TranslateToHindiNumbers(sal_Unicode); void SetDocumentGrid(SwFrameFormat &rFormat, const wwSection &rSection); @@ -1805,9 +1805,9 @@ public: // really private, but can only be done public eF_ResT Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr ); eF_ResT Read_F_Author( WW8FieldDesc*, OUString& ); eF_ResT Read_F_TemplName( WW8FieldDesc*, OUString& ); - short GetTimeDatePara(OUString& rStr, sal_uInt32& rFormat, sal_uInt16 &rLang, + short GetTimeDatePara(OUString& rStr, sal_uInt32& rFormat, LanguageType &rLang, int nWhichDefault, bool bHijri = false); - bool ForceFieldLanguage(SwField &rField, sal_uInt16 nLang); + bool ForceFieldLanguage(SwField &rField, LanguageType nLang); eF_ResT Read_F_DateTime( WW8FieldDesc*, OUString& rStr ); eF_ResT Read_F_FileName( WW8FieldDesc*, OUString& rStr); eF_ResT Read_F_Num( WW8FieldDesc* pF, OUString& ); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 51d46b9bbc49..a2be43e0e82a 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -389,14 +389,14 @@ static SvxNumType GetNumberPara(const OUString& rStr, bool bAllowPageDesc = fals return aType; } -bool SwWW8ImplReader::ForceFieldLanguage(SwField &rField, sal_uInt16 nLang) +bool SwWW8ImplReader::ForceFieldLanguage(SwField &rField, LanguageType nLang) { bool bRet(false); const SvxLanguageItem *pLang = static_cast<const SvxLanguageItem*>(GetFormatAttr(RES_CHRATR_LANGUAGE)); OSL_ENSURE(pLang, "impossible"); - sal_uInt16 nDefault = pLang ? pLang->GetValue() : LANGUAGE_ENGLISH_US; + LanguageType nDefault = pLang ? pLang->GetValue() : LANGUAGE_ENGLISH_US; if (nLang != nDefault) { @@ -408,7 +408,7 @@ bool SwWW8ImplReader::ForceFieldLanguage(SwField &rField, sal_uInt16 nLang) return bRet; } -OUString GetWordDefaultDateStringAsUS(SvNumberFormatter* pFormatter, sal_uInt16 nLang) +OUString GetWordDefaultDateStringAsUS(SvNumberFormatter* pFormatter, LanguageType nLang) { //Get the system date in the correct final language layout, convert to //a known language and modify the 2 digit year part to be 4 digit, and @@ -432,7 +432,7 @@ OUString GetWordDefaultDateStringAsUS(SvNumberFormatter* pFormatter, sal_uInt16 } short SwWW8ImplReader::GetTimeDatePara(OUString& rStr, sal_uInt32& rFormat, - sal_uInt16 &rLang, int nWhichDefault, bool bHijri) + LanguageType &rLang, int nWhichDefault, bool bHijri) { bool bRTL = false; if (m_pPlcxMan && !m_bVer67) @@ -1655,7 +1655,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr ) sal_uInt32 nFormat = 0; - sal_uInt16 nLang(0); + LanguageType nLang(LANGUAGE_SYSTEM); if (bDateTime) { short nDT = GetTimeDatePara(rStr, nFormat, nLang, pF->nId); @@ -1758,7 +1758,7 @@ eF_ResT SwWW8ImplReader::Read_F_DateTime( WW8FieldDesc*pF, OUString& rStr ) sal_uInt32 nFormat = 0; - sal_uInt16 nLang(0); + LanguageType nLang(LANGUAGE_SYSTEM); short nDT = GetTimeDatePara(rStr, nFormat, nLang, ww::eDATE, bHijri); if( css::util::NumberFormat::UNDEFINED == nDT ) // no D/T-Formatstring diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index f430a140ccab..8c80b6f2c332 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -842,7 +842,7 @@ void wwSectionManager::CreateSep(const long nTextPos, bool /*bMustHaveBreak*/) aLastSection = maSegments.back(); //Here - sal_uInt16 nLIdx = ( ( mrReader.m_pWwFib->m_lid & 0xff ) == 0x9 ) ? 1 : 0; + sal_uInt16 nLIdx = ( ( (sal_uInt16)mrReader.m_pWwFib->m_lid & 0xff ) == 0x9 ) ? 1 : 0; //BEGIN read section values wwSection aNewSection(*mrReader.m_pPaM->GetPoint()); @@ -3867,7 +3867,7 @@ void SwWW8ImplReader::Read_Language( sal_uInt16 nId, const sal_uInt8* pData, sho else { sal_uInt16 nLang = SVBT16ToShort( pData ); // Language-Id - NewAttr(SvxLanguageItem((const LanguageType)nLang, nId)); + NewAttr(SvxLanguageItem(LanguageType(nLang), nId)); } } @@ -4513,7 +4513,7 @@ void SwWW8ImplReader::Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short n aLang = m_pPlcxMan->GetChpPLCF()->HasSprm(0x486E); if (aLang.pSprm && aLang.nRemainingData >= 2) - nLang = SVBT16ToShort(aLang.pSprm); + nLang = LanguageType(SVBT16ToShort(aLang.pSprm)); else { nLang = static_cast<const SvxLanguageItem *>( diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 8f51cc10d9db..1410d42dab34 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -5531,7 +5531,9 @@ WW8Fib::WW8Fib(SvStream& rSt, sal_uInt8 nWantedVersion, sal_uInt32 nOffset) sal_Int16 cpnBtePap_Ver67=0; // read FIB - rSt.ReadInt16( m_lid ); + sal_Int16 nTmpLid = 0; + rSt.ReadInt16( nTmpLid ); + m_lid = LanguageType(nTmpLid); rSt.ReadInt16( m_pnNext ); rSt.ReadUChar( aBits1 ); rSt.ReadUChar( aBits2 ); @@ -5577,7 +5579,9 @@ WW8Fib::WW8Fib(SvStream& rSt, sal_uInt8 nWantedVersion, sal_uInt32 nOffset) && (bVer67 || WW8ReadINT16( rSt, pnLvcFirst_W6 )) // 8 && (bVer67 || WW8ReadINT16( rSt, cpnBteLvc_W6 )) // 9 */ - rSt.ReadInt16( m_lidFE ); + sal_Int16 nTmpFE = 0; + rSt.ReadInt16( nTmpFE ); + m_lidFE = LanguageType(nTmpFE); rSt.ReadUInt16( m_clw ); } @@ -5926,7 +5930,7 @@ WW8Fib::WW8Fib(sal_uInt8 nVer, bool bDot) m_cQuickSaves = m_nFib >= 0x00D9 ? 0xF : 0; // --> #i90932# - m_lid = 0x409; // LANGUAGE_ENGLISH_US + m_lid = LanguageType(0x409); // LANGUAGE_ENGLISH_US LanguageType nLang = Application::GetSettings().GetLanguageTag().getLanguageType(); m_fFarEast = MsLangId::isCJK(nLang); @@ -5957,7 +5961,7 @@ void WW8Fib::WriteHeader(SvStream& rStrm) Set_UInt16( pData, m_wIdent ); Set_UInt16( pData, m_nFib ); Set_UInt16( pData, m_nProduct ); - Set_UInt16( pData, m_lid ); + Set_UInt16( pData, (sal_uInt16)m_lid ); Set_UInt16( pData, m_pnNext ); sal_uInt16 nBits16 = 0; @@ -6013,7 +6017,7 @@ void WW8Fib::WriteHeader(SvStream& rStrm) Set_UInt16( pData, m_wMagicCreatedPrivate ); Set_UInt16( pData, m_wMagicRevisedPrivate ); pData += 9 * sizeof( sal_Int16 ); - Set_UInt16( pData, m_lidFE ); + Set_UInt16( pData, (sal_uInt16)m_lidFE ); Set_UInt16( pData, m_clw ); } @@ -6268,12 +6272,12 @@ void WW8Fib::Write(SvStream& rStrm) rStrm.WriteBytes(pDataPtr.get(), m_fcMin - nUnencryptedHdr); } -rtl_TextEncoding WW8Fib::GetFIBCharset(sal_uInt16 chs, sal_uInt16 nLidLocale) +rtl_TextEncoding WW8Fib::GetFIBCharset(sal_uInt16 chs, LanguageType nLidLocale) { OSL_ENSURE(chs <= 0x100, "overflowed winword charset set"); if (chs == 0x0100) return RTL_TEXTENCODING_APPLE_ROMAN; - if (chs == 0 && nLidLocale >= 999) + if (chs == 0 && (sal_uInt16)nLidLocale >= 999) { /* nLidLocale: @@ -7859,9 +7863,9 @@ void WW8DopTypography::WriteToMem(sal_uInt8 *&pData) const Set_UInt16(pData,rgxchLPunct[i]); } -sal_uInt16 WW8DopTypography::GetConvertedLang() const +LanguageType WW8DopTypography::GetConvertedLang() const { - sal_uInt16 nLang; + LanguageType nLang; //I have assumed peoples republic/taiwan == simplified/traditional //This isn't a documented issue, so we might have it all wrong, diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index c3b9cd284e0b..9a1b277c8480 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -1135,7 +1135,7 @@ public: */ sal_uInt16 m_nFib; // 0x2 FIB version written sal_uInt16 m_nProduct; // 0x4 product version written by - sal_Int16 m_lid; // 0x6 language stamp---localized version; + LanguageType m_lid; // 0x6 language stamp---localized version; WW8_PN m_pnNext; // 0x8 bool m_fDot :1; // 0xa 0001 @@ -1190,8 +1190,8 @@ public: sal_uInt16 m_wMagicCreatedPrivate; // private data sal_uInt16 m_wMagicRevisedPrivate; // private data - sal_Int16 m_lidFE; // Language id if document was written by Far East version - // of Word (i.e. FIB.fFarEast is on) + LanguageType m_lidFE; // Language id if document was written by Far East version + // of Word (i.e. FIB.fFarEast is on) sal_uInt16 m_clw; // Number of fields in the array of longs // end of WW8 section @@ -1529,7 +1529,7 @@ public: void WriteHeader(SvStream& rStrm); void Write(SvStream& rStrm); - static rtl_TextEncoding GetFIBCharset(sal_uInt16 chs, sal_uInt16 nLidLocale); + static rtl_TextEncoding GetFIBCharset(sal_uInt16 chs, LanguageType nLidLocale); ww::WordVersion GetFIBVersion() const; bool GetBaseCp(ManTypes nType, WW8_CP * cp) const; sal_Unicode getNumDecimalSep() const { return m_nNumDecimalSep;} diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx index ba7768caac0b..9eb87651695b 100644 --- a/sw/source/filter/ww8/ww8struc.hxx +++ b/sw/source/filter/ww8/ww8struc.hxx @@ -375,7 +375,7 @@ public: void WriteToMem(sal_uInt8 *&pData) const; //Maps what I think is the language this is to affect to the OOo language - sal_uInt16 GetConvertedLang() const; + LanguageType GetConvertedLang() const; sal_uInt16 fKerningPunct : 1; // true if we're kerning punctuation sal_uInt16 iJustification : 2; // Kinsoku method of justification: |