Kaydet (Commit) 9c15d1ad authored tarafından Noel Grandin's avatar Noel Grandin

in editeng module, convert remains of String to OUString

Change-Id: I634e1fc2b63461d94a9e7d27c809d559740da7c0
üst 0d586f5b
...@@ -67,7 +67,7 @@ class EditRTFParser : public SvxRTFParser ...@@ -67,7 +67,7 @@ class EditRTFParser : public SvxRTFParser
private: private:
EditSelection aCurSel; EditSelection aCurSel;
EditEngine* mpEditEngine; EditEngine* mpEditEngine;
CharSet eDestCharSet; rtl_TextEncoding eDestCharSet;
MapMode aRTFMapMode; MapMode aRTFMapMode;
MapMode aEditMapMode; MapMode aEditMapMode;
...@@ -102,8 +102,9 @@ public: ...@@ -102,8 +102,9 @@ public:
virtual SvParserState CallParser(); virtual SvParserState CallParser();
void SetDestCharSet( CharSet eCharSet ) { eDestCharSet = eCharSet; } void SetDestCharSet( rtl_TextEncoding eCharSet ) { eDestCharSet = eCharSet; }
CharSet GetDestCharSet() const { return eDestCharSet; } rtl_TextEncoding
GetDestCharSet() const { return eDestCharSet; }
sal_uInt16 GetDefTab() const { return nDefTab; } sal_uInt16 GetDefTab() const { return nDefTab; }
Font GetDefFont() { return GetFont( nDefFont ); } Font GetDefFont() { return GetFont( nDefFont ); }
......
...@@ -421,7 +421,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) ...@@ -421,7 +421,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel )
} }
rOutput.WriteNumber( static_cast<sal_uInt32>( nVal ) ); rOutput.WriteNumber( static_cast<sal_uInt32>( nVal ) );
CharSet eChrSet = pFontItem->GetCharSet(); rtl_TextEncoding eChrSet = pFontItem->GetCharSet();
DBG_ASSERT( eChrSet != 9, "SystemCharSet?!" ); DBG_ASSERT( eChrSet != 9, "SystemCharSet?!" );
if( RTL_TEXTENCODING_DONTKNOW == eChrSet ) if( RTL_TEXTENCODING_DONTKNOW == eChrSet )
eChrSet = osl_getThreadTextEncoding(); eChrSet = osl_getThreadTextEncoding();
......
...@@ -444,12 +444,12 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) ...@@ -444,12 +444,12 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit)
case 19: case 19:
{ {
sal_Int32 nVal = 0; pValues[nProp] >>= nVal; sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
rSwFlags.aBulletFont.SetCharSet(CharSet(nVal)); rSwFlags.aBulletFont.SetCharSet(rtl_TextEncoding(nVal));
} }
break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset", break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
case 20: case 20:
{ {
sal_Int32 nVal = 0; pValues[nProp] >>= nVal; sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
rSwFlags.aBulletFont.SetPitch(FontPitch(nVal)); rSwFlags.aBulletFont.SetPitch(FontPitch(nVal));
} }
break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch", break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
...@@ -520,7 +520,7 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) ...@@ -520,7 +520,7 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit)
case 45 : case 45 :
{ {
sal_Int32 nVal = 0; pValues[nProp] >>= nVal; sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
rSwFlags.aByInputBulletFont.SetCharSet(CharSet(nVal)); rSwFlags.aByInputBulletFont.SetCharSet(rtl_TextEncoding(nVal));
} }
break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
case 46 : case 46 :
......
...@@ -113,7 +113,7 @@ static inline int IsUpperLetter( sal_Int32 nCharType ) ...@@ -113,7 +113,7 @@ static inline int IsUpperLetter( sal_Int32 nCharType )
0 == ( ::com::sun::star::i18n::KCharacterType::LOWER & nCharType); 0 == ( ::com::sun::star::i18n::KCharacterType::LOWER & nCharType);
} }
bool lcl_IsUnsupportedUnicodeChar( CharClass& rCC, const String& rTxt, bool lcl_IsUnsupportedUnicodeChar( CharClass& rCC, const OUString& rTxt,
xub_StrLen nStt, xub_StrLen nEnd ) xub_StrLen nStt, xub_StrLen nEnd )
{ {
for( ; nStt < nEnd; ++nStt ) for( ; nStt < nEnd; ++nStt )
...@@ -141,7 +141,7 @@ bool lcl_IsUnsupportedUnicodeChar( CharClass& rCC, const String& rTxt, ...@@ -141,7 +141,7 @@ bool lcl_IsUnsupportedUnicodeChar( CharClass& rCC, const String& rTxt,
return false; return false;
} }
static sal_Bool lcl_IsSymbolChar( CharClass& rCC, const String& rTxt, static sal_Bool lcl_IsSymbolChar( CharClass& rCC, const OUString& rTxt,
xub_StrLen nStt, xub_StrLen nEnd ) xub_StrLen nStt, xub_StrLen nEnd )
{ {
for( ; nStt < nEnd; ++nStt ) for( ; nStt < nEnd; ++nStt )
...@@ -403,7 +403,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const OUString& rTx ...@@ -403,7 +403,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttWrd( SvxAutoCorrDoc& rDoc, const OUString& rTx
0x1 != rTxt[ nSttPos ] && 0x2 != rTxt[ nSttPos ]) 0x1 != rTxt[ nSttPos ] && 0x2 != rTxt[ nSttPos ])
{ {
// test if the word is in an exception list // test if the word is in an exception list
String sWord( rTxt.copy( nSttPos - 1, nEndPos - nSttPos + 1 )); OUString sWord( rTxt.copy( nSttPos - 1, nEndPos - nSttPos + 1 ));
if( !FindInWrdSttExceptList(eLang, sWord) ) if( !FindInWrdSttExceptList(eLang, sWord) )
{ {
// Check that word isn't correctly spelled before correcting: // Check that word isn't correctly spelled before correcting:
...@@ -483,8 +483,8 @@ sal_Bool SvxAutoCorrect::FnChgOrdinalNumber( ...@@ -483,8 +483,8 @@ sal_Bool SvxAutoCorrect::FnChgOrdinalNumber(
uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix( nNum, rCC.getLanguageTag().getLocale( ) ); uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix( nNum, rCC.getLanguageTag().getLocale( ) );
for ( sal_Int32 nSuff = 0; nSuff < aSuffixes.getLength(); nSuff++ ) for ( sal_Int32 nSuff = 0; nSuff < aSuffixes.getLength(); nSuff++ )
{ {
String sSuffix( aSuffixes[ nSuff ] ); OUString sSuffix( aSuffixes[ nSuff ] );
String sEnd = rTxt.copy( nNumEnd + 1, nEndPos - nNumEnd - 1 ); OUString sEnd = rTxt.copy( nNumEnd + 1, nEndPos - nNumEnd - 1 );
if ( sSuffix == sEnd ) if ( sSuffix == sEnd )
{ {
...@@ -709,11 +709,11 @@ sal_Bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const OUString& rT ...@@ -709,11 +709,11 @@ sal_Bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const OUString& rT
sal_Int32 nStart(nSttPos); sal_Int32 nStart(nSttPos);
sal_Int32 nEnd(nEndPos); sal_Int32 nEnd(nEndPos);
String sURL( URIHelper::FindFirstURLInText( rTxt, nStart, nEnd, OUString sURL( URIHelper::FindFirstURLInText( rTxt, nStart, nEnd,
GetCharClass( eLang ) )); GetCharClass( eLang ) ));
nSttPos = (xub_StrLen)nStart; nSttPos = (xub_StrLen)nStart;
nEndPos = (xub_StrLen)nEnd; nEndPos = (xub_StrLen)nEnd;
sal_Bool bRet = 0 != sURL.Len(); sal_Bool bRet = !sURL.isEmpty();
if( bRet ) // also Attribut setzen: if( bRet ) // also Attribut setzen:
rDoc.SetINetAttr( nSttPos, nEndPos, sURL ); rDoc.SetINetAttr( nSttPos, nEndPos, sURL );
return bRet; return bRet;
...@@ -736,7 +736,8 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString ...@@ -736,7 +736,8 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString
--nEndPos; --nEndPos;
sal_Bool bAlphaNum = sal_False; sal_Bool bAlphaNum = sal_False;
xub_StrLen nPos = nEndPos, nFndPos = STRING_NOTFOUND; xub_StrLen nPos = nEndPos;
sal_Int32 nFndPos = -1;
CharClass& rCC = GetCharClass( eLang ); CharClass& rCC = GetCharClass( eLang );
while( nPos ) while( nPos )
...@@ -753,7 +754,7 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString ...@@ -753,7 +754,7 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString
nFndPos = nPos; nFndPos = nPos;
else else
// Condition is not satisfied, so cancel // Condition is not satisfied, so cancel
nFndPos = STRING_NOTFOUND; nFndPos = -1;
nPos = 0; nPos = 0;
} }
break; break;
...@@ -763,7 +764,7 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString ...@@ -763,7 +764,7 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString
} }
} }
if( STRING_NOTFOUND != nFndPos ) if( -1 != nFndPos )
{ {
// first delete the Character at the end - this allows insertion // first delete the Character at the end - this allows insertion
// of an empty hint in SetAttr which would be removed by Delete // of an empty hint in SetAttr which would be removed by Delete
...@@ -788,7 +789,7 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString ...@@ -788,7 +789,7 @@ sal_Bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString
} }
} }
return STRING_NOTFOUND != nFndPos; return -1 != nFndPos;
} }
...@@ -802,8 +803,8 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, ...@@ -802,8 +803,8 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
return sal_False; return sal_False;
CharClass& rCC = GetCharClass( eLang ); CharClass& rCC = GetCharClass( eLang );
String aText( rTxt ); OUString aText( rTxt );
const sal_Unicode *pStart = aText.GetBuffer(), const sal_Unicode *pStart = aText.getStr(),
*pStr = pStart + nEndPos, *pStr = pStart + nEndPos,
*pWordStt = 0, *pWordStt = 0,
*pDelim = 0; *pDelim = 0;
...@@ -896,8 +897,8 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, ...@@ -896,8 +897,8 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
aText = aPrevPara; aText = aPrevPara;
bAtStart = sal_False; bAtStart = sal_False;
pStart = aText.GetBuffer(); pStart = aText.getStr();
pStr = pStart + aText.Len(); pStr = pStart + aText.getLength();
do { // overwrite all blanks do { // overwrite all blanks
--pStr; --pStr;
...@@ -1037,7 +1038,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, ...@@ -1037,7 +1038,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
if( IsWordDelim( *pStr )) if( IsWordDelim( *pStr ))
++pStr; ++pStr;
String sWord; OUString sWord;
// check on the basis of the exception list // check on the basis of the exception list
if( pExceptStt ) if( pExceptStt )
...@@ -1048,20 +1049,20 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc, ...@@ -1048,20 +1049,20 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
// Delete all non alphanumeric. Test the characters at the // Delete all non alphanumeric. Test the characters at the
// beginning/end of the word ( recognizes: "(min.", "/min.", and so on.) // beginning/end of the word ( recognizes: "(min.", "/min.", and so on.)
String sTmp( sWord ); OUString sTmp( sWord );
while( sTmp.Len() && while( !sTmp.isEmpty() &&
!rCC.isLetterNumeric( sTmp, 0 ) ) !rCC.isLetterNumeric( sTmp, 0 ) )
sTmp.Erase( 0, 1 ); sTmp = sTmp.copy(1);
// Remove all non alphanumeric characters towards the end up until // Remove all non alphanumeric characters towards the end up until
// the last one. // the last one.
xub_StrLen nLen = sTmp.Len(); xub_StrLen nLen = sTmp.getLength();
while( nLen && !rCC.isLetterNumeric( sTmp, nLen-1 ) ) while( nLen && !rCC.isLetterNumeric( sTmp, nLen-1 ) )
--nLen; --nLen;
if( nLen + 1 < sTmp.Len() ) if( nLen + 1 < sTmp.getLength() )
sTmp.Erase( nLen + 1 ); sTmp = sTmp.copy( 0, nLen + 1 );
if( sTmp.Len() && sTmp.Len() != sWord.Len() && if( !sTmp.isEmpty() && sTmp.getLength() != sWord.getLength() &&
FindInCplSttExceptList(eLang, sTmp)) FindInCplSttExceptList(eLang, sTmp))
return sal_False; return sal_False;
...@@ -1100,9 +1101,9 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT ...@@ -1100,9 +1101,9 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT
if ( !IsUpperLetter(rCC.getCharacterType(rTxt, nSttPos+1)) ) if ( !IsUpperLetter(rCC.getCharacterType(rTxt, nSttPos+1)) )
return false; return false;
String aConverted; OUString aConverted;
aConverted.Append( rCC.uppercase(OUString(rTxt[nSttPos])) ); aConverted += rCC.uppercase(OUString(rTxt[nSttPos]));
aConverted.Append( rCC.lowercase(OUString(rTxt[nSttPos+1])) ); aConverted += rCC.lowercase(OUString(rTxt[nSttPos+1]));
for (xub_StrLen i = nSttPos+2; i < nEndPos; ++i) for (xub_StrLen i = nSttPos+2; i < nEndPos; ++i)
{ {
...@@ -1112,10 +1113,10 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT ...@@ -1112,10 +1113,10 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT
if ( IsUpperLetter(rCC.getCharacterType(rTxt, i)) ) if ( IsUpperLetter(rCC.getCharacterType(rTxt, i)) )
// Another uppercase letter. Convert it. // Another uppercase letter. Convert it.
aConverted.Append(rCC.lowercase(OUString(rTxt[i]))); aConverted += rCC.lowercase(OUString(rTxt[i]));
else else
// This is not an alphabetic letter. Leave it as-is. // This is not an alphabetic letter. Leave it as-is.
aConverted.Append(rTxt[i]); aConverted += OUString( rTxt[i] );
} }
// Replace the word. // Replace the word.
...@@ -1143,14 +1144,14 @@ sal_Unicode SvxAutoCorrect::GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote, ...@@ -1143,14 +1144,14 @@ sal_Unicode SvxAutoCorrect::GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote,
else else
{ {
LocaleDataWrapper& rLcl = GetLocaleDataWrapper( eLang ); LocaleDataWrapper& rLcl = GetLocaleDataWrapper( eLang );
String sRet( bSttQuote OUString sRet( bSttQuote
? ( '\"' == cInsChar ? ( '\"' == cInsChar
? rLcl.getDoubleQuotationMarkStart() ? rLcl.getDoubleQuotationMarkStart()
: rLcl.getQuotationMarkStart() ) : rLcl.getQuotationMarkStart() )
: ( '\"' == cInsChar : ( '\"' == cInsChar
? rLcl.getDoubleQuotationMarkEnd() ? rLcl.getDoubleQuotationMarkEnd()
: rLcl.getQuotationMarkEnd() )); : rLcl.getQuotationMarkEnd() ));
cRet = sRet.Len() ? sRet.GetChar( 0 ) : cInsChar; cRet = !sRet.isEmpty() ? sRet[0] : cInsChar;
} }
} }
return cRet; return cRet;
...@@ -1204,7 +1205,7 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, ...@@ -1204,7 +1205,7 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos,
LanguageType eLang = rDoc.GetLanguage( nInsPos, sal_False ); LanguageType eLang = rDoc.GetLanguage( nInsPos, sal_False );
sal_Unicode cRet = GetQuote( cInsChar, bSttQuote, eLang ); sal_Unicode cRet = GetQuote( cInsChar, bSttQuote, eLang );
String sRet = OUString(cRet); OUString sRet = OUString(cRet);
if( '\"' == cInsChar ) if( '\"' == cInsChar )
{ {
...@@ -1218,9 +1219,9 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, ...@@ -1218,9 +1219,9 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos,
case LANGUAGE_FRENCH_SWISS: case LANGUAGE_FRENCH_SWISS:
case LANGUAGE_FRENCH_LUXEMBOURG: case LANGUAGE_FRENCH_LUXEMBOURG:
if( bSttQuote ) if( bSttQuote )
sRet += ' '; sRet += " ";
else else
sRet.Insert( ' ', 0 ); sRet = " " + sRet;
break; break;
} }
} }
...@@ -1690,7 +1691,7 @@ static void GeneratePackageName ( const OUString& rShort, OUString& rPackageName ...@@ -1690,7 +1691,7 @@ static void GeneratePackageName ( const OUString& rShort, OUString& rPackageName
} }
static const SvxAutocorrWord* lcl_SearchWordsInList( static const SvxAutocorrWord* lcl_SearchWordsInList(
SvxAutoCorrectLanguageListsPtr pList, const String& rTxt, SvxAutoCorrectLanguageListsPtr pList, const OUString& rTxt,
sal_Int32& rStt, sal_Int32 nEndPos) sal_Int32& rStt, sal_Int32 nEndPos)
{ {
const SvxAutocorrWordList* pAutoCorrWordList = pList->GetAutocorrWordList(); const SvxAutocorrWordList* pAutoCorrWordList = pList->GetAutocorrWordList();
...@@ -1991,8 +1992,8 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( ...@@ -1991,8 +1992,8 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
rpLst = new SvStringsISortDtor; rpLst = new SvStringsISortDtor;
{ {
String sStrmName( pStrmName, RTL_TEXTENCODING_MS_1252 ); OUString sStrmName( pStrmName, strlen(pStrmName), RTL_TEXTENCODING_MS_1252 );
String sTmp( sStrmName ); OUString sTmp( sStrmName );
if( rStg.Is() && rStg->IsStream( sStrmName ) ) if( rStg.Is() && rStg->IsStream( sStrmName ) )
{ {
...@@ -2059,7 +2060,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( ...@@ -2059,7 +2060,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp(
{ {
if( rStg.Is() ) if( rStg.Is() )
{ {
String sStrmName( pStrmName, RTL_TEXTENCODING_MS_1252 ); OUString sStrmName( pStrmName, strlen(pStrmName), RTL_TEXTENCODING_MS_1252 );
if( rLst.empty() ) if( rLst.empty() )
{ {
rStg->Remove( sStrmName ); rStg->Remove( sStrmName );
...@@ -2120,7 +2121,7 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() ...@@ -2120,7 +2121,7 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList()
try try
{ {
uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sShareAutoCorrFile, embed::ElementModes::READ ); uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sShareAutoCorrFile, embed::ElementModes::READ );
String aXMLWordListName( pXMLImplAutocorr_ListStr, RTL_TEXTENCODING_MS_1252 ); OUString aXMLWordListName( pXMLImplAutocorr_ListStr, strlen(pXMLImplAutocorr_ListStr), RTL_TEXTENCODING_MS_1252 );
uno::Reference < io::XStream > xStrm = xStg->openStreamElement( aXMLWordListName, embed::ElementModes::READ ); uno::Reference < io::XStream > xStrm = xStg->openStreamElement( aXMLWordListName, embed::ElementModes::READ );
uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
...@@ -2222,7 +2223,7 @@ sal_Bool SvxAutoCorrectLanguageLists::AddToWrdSttExceptList(const OUString& rNew ...@@ -2222,7 +2223,7 @@ sal_Bool SvxAutoCorrectLanguageLists::AddToWrdSttExceptList(const OUString& rNew
SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadCplSttExceptList() SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadCplSttExceptList()
{ {
SotStorageRef xStg = new SotStorage( sShareAutoCorrFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_True ); SotStorageRef xStg = new SotStorage( sShareAutoCorrFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_True );
String sTemp ( RTL_CONSTASCII_USTRINGPARAM ( pXMLImplCplStt_ExcptLstStr ) ); OUString sTemp ( pXMLImplCplStt_ExcptLstStr );
if( xStg.Is() && xStg->IsContained( sTemp ) ) if( xStg.Is() && xStg->IsContained( sTemp ) )
LoadXMLExceptList_Imp( pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg ); LoadXMLExceptList_Imp( pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg );
...@@ -2261,7 +2262,7 @@ void SvxAutoCorrectLanguageLists::SetCplSttExceptList( SvStringsISortDtor* pList ...@@ -2261,7 +2262,7 @@ void SvxAutoCorrectLanguageLists::SetCplSttExceptList( SvStringsISortDtor* pList
SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadWrdSttExceptList() SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadWrdSttExceptList()
{ {
SotStorageRef xStg = new SotStorage( sShareAutoCorrFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_True ); SotStorageRef xStg = new SotStorage( sShareAutoCorrFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_True );
String sTemp ( RTL_CONSTASCII_USTRINGPARAM ( pXMLImplWrdStt_ExcptLstStr ) ); OUString sTemp ( pXMLImplWrdStt_ExcptLstStr );
if( xStg.Is() && xStg->IsContained( sTemp ) ) if( xStg.Is() && xStg->IsContained( sTemp ) )
LoadXMLExceptList_Imp( pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg ); LoadXMLExceptList_Imp( pWrdStt_ExcptLst, pXMLImplWrdStt_ExcptLstStr, xStg );
return pWrdStt_ExcptLst; return pWrdStt_ExcptLst;
...@@ -2375,8 +2376,8 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() ...@@ -2375,8 +2376,8 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
if( xSrcStg.Is() && xDstStg.Is() ) if( xSrcStg.Is() && xDstStg.Is() )
{ {
String sXMLWord ( RTL_CONSTASCII_USTRINGPARAM ( pXMLImplWrdStt_ExcptLstStr ) ); OUString sXMLWord ( pXMLImplWrdStt_ExcptLstStr );
String sXMLSentence ( RTL_CONSTASCII_USTRINGPARAM ( pXMLImplCplStt_ExcptLstStr ) ); OUString sXMLSentence ( pXMLImplCplStt_ExcptLstStr );
SvStringsISortDtor *pTmpWordList = NULL; SvStringsISortDtor *pTmpWordList = NULL;
if (xSrcStg->IsContained( sXMLWord ) ) if (xSrcStg->IsContained( sXMLWord ) )
...@@ -2419,7 +2420,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() ...@@ -2419,7 +2420,7 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl()
sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg )
{ {
String sStrmName( pXMLImplAutocorr_ListStr, RTL_TEXTENCODING_MS_1252 ); OUString sStrmName( pXMLImplAutocorr_ListStr, strlen(pXMLImplAutocorr_ListStr), RTL_TEXTENCODING_MS_1252 );
sal_Bool bRet = sal_True, bRemove = !pAutocorr_List || pAutocorr_List->empty(); sal_Bool bRet = sal_True, bRemove = !pAutocorr_List || pAutocorr_List->empty();
if( !bRemove ) if( !bRemove )
{ {
...@@ -2429,7 +2430,7 @@ sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) ...@@ -2429,7 +2430,7 @@ sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg )
{ {
refList->SetSize( 0 ); refList->SetSize( 0 );
refList->SetBufferSize( 8192 ); refList->SetBufferSize( 8192 );
String aPropName( OUString( "MediaType" ) ); OUString aPropName( "MediaType" );
OUString aMime( "text/xml" ); OUString aMime( "text/xml" );
uno::Any aAny; uno::Any aAny;
aAny <<= aMime; aAny <<= aMime;
...@@ -2764,21 +2765,21 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p ...@@ -2764,21 +2765,21 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p
sal_Int32 &rStt, sal_Int32 &rStt,
sal_Int32 nEndPos) const sal_Int32 nEndPos) const
{ {
const String& rChk = pFnd->GetShort(); const OUString& rChk = pFnd->GetShort();
xub_StrLen left_wildcard = ( rChk.GetChar( 0 ) == C_ASTERISK ) ? 1 : 0; // "*word" pattern? xub_StrLen left_wildcard = ( rChk[0] == C_ASTERISK ) ? 1 : 0; // "*word" pattern?
xub_StrLen nSttWdPos = nEndPos; xub_StrLen nSttWdPos = nEndPos;
if( nEndPos >= rChk.Len() - left_wildcard) if( nEndPos >= rChk.getLength() - left_wildcard)
{ {
bool bWasWordDelim = false; bool bWasWordDelim = false;
xub_StrLen nCalcStt = nEndPos - rChk.Len() + left_wildcard; xub_StrLen nCalcStt = nEndPos - rChk.getLength() + left_wildcard;
if( ( !nCalcStt || nCalcStt == rStt || left_wildcard || if( ( !nCalcStt || nCalcStt == rStt || left_wildcard ||
( nCalcStt < rStt && ( nCalcStt < rStt &&
IsWordDelim( rTxt[ nCalcStt - 1 ] ))) ) IsWordDelim( rTxt[ nCalcStt - 1 ] ))) )
{ {
TransliterationWrapper& rCmp = GetIgnoreTranslWrapper(); TransliterationWrapper& rCmp = GetIgnoreTranslWrapper();
OUString sWord = rTxt.copy(nCalcStt, rChk.Len() - left_wildcard); OUString sWord = rTxt.copy(nCalcStt, rChk.getLength() - left_wildcard);
if( (!left_wildcard && rCmp.isEqual( rChk, sWord )) || (left_wildcard && rCmp.isEqual( rChk.Copy(1), sWord) )) if( (!left_wildcard && rCmp.isEqual( rChk, sWord )) || (left_wildcard && rCmp.isEqual( rChk.copy(1), sWord) ))
{ {
rStt = nCalcStt; rStt = nCalcStt;
if (!left_wildcard) return pFnd; if (!left_wildcard) return pFnd;
...@@ -2786,14 +2787,14 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p ...@@ -2786,14 +2787,14 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p
while( rStt && !(bWasWordDelim = IsWordDelim( rTxt[ --rStt ]))) while( rStt && !(bWasWordDelim = IsWordDelim( rTxt[ --rStt ])))
; ;
if (bWasWordDelim) rStt++; if (bWasWordDelim) rStt++;
SvxAutocorrWord* pNew = new SvxAutocorrWord(rTxt.copy(rStt, nEndPos - rStt), rTxt.copy(rStt, nEndPos - rStt - rChk.Len() + 1) + pFnd->GetLong()); SvxAutocorrWord* pNew = new SvxAutocorrWord(rTxt.copy(rStt, nEndPos - rStt), rTxt.copy(rStt, nEndPos - rStt - rChk.getLength() + 1) + pFnd->GetLong());
if( Insert( pNew ) ) return pNew; else delete pNew; if( Insert( pNew ) ) return pNew; else delete pNew;
} }
} }
// match "word*" patterns, eg. "i18n*" // match "word*" patterns, eg. "i18n*"
if ( rChk.GetChar( rChk.Len() - 1) == C_ASTERISK ) if ( rChk[ rChk.getLength() - 1] == C_ASTERISK )
{ {
String sTmp( rChk.Copy( 0, rChk.Len() - 1 ) ); OUString sTmp( rChk.copy( 0, rChk.getLength() - 1 ) );
// Get the last word delimiter position // Get the last word delimiter position
bool not_suffix; bool not_suffix;
while( nSttWdPos && !(bWasWordDelim = IsWordDelim( rTxt[ --nSttWdPos ]))) while( nSttWdPos && !(bWasWordDelim = IsWordDelim( rTxt[ --nSttWdPos ])))
...@@ -2802,13 +2803,13 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p ...@@ -2802,13 +2803,13 @@ const SvxAutocorrWord* SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *p
sal_Int32 nFndPos = -1; sal_Int32 nFndPos = -1;
do { do {
nFndPos = rTxt.indexOf( sTmp, nFndPos + 1); nFndPos = rTxt.indexOf( sTmp, nFndPos + 1);
not_suffix = (bWasWordDelim && (nSttWdPos >= nFndPos + sTmp.Len())); not_suffix = (bWasWordDelim && (nSttWdPos >= nFndPos + sTmp.getLength()));
} while ( nFndPos != -1 && (!(!nFndPos || IsWordDelim( rTxt[ nFndPos - 1 ])) || not_suffix)); } while ( nFndPos != -1 && (!(!nFndPos || IsWordDelim( rTxt[ nFndPos - 1 ])) || not_suffix));
if ( nFndPos != -1 ) if ( nFndPos != -1 )
{ {
// store matching pattern and its replacement as a new list item, eg. "i18ns" -> "internationalizations" // store matching pattern and its replacement as a new list item, eg. "i18ns" -> "internationalizations"
OUString aShort = rTxt.copy(nFndPos, nEndPos - nFndPos + ((rTxt[nEndPos] != 0x20) ? 1: 0)); OUString aShort = rTxt.copy(nFndPos, nEndPos - nFndPos + ((rTxt[nEndPos] != 0x20) ? 1: 0));
OUString aLong = pFnd->GetLong() + rTxt.copy(nFndPos + sTmp.Len(), nEndPos - nFndPos - sTmp.Len()); OUString aLong = pFnd->GetLong() + rTxt.copy(nFndPos + sTmp.getLength(), nEndPos - nFndPos - sTmp.getLength());
SvxAutocorrWord* pNew = new SvxAutocorrWord(aShort, aLong); SvxAutocorrWord* pNew = new SvxAutocorrWord(aShort, aLong);
if( Insert( pNew ) ) if( Insert( pNew ) )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment