21 #include <string_view>
24 #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
25 #include <com/sun/star/embed/XStorage.hpp>
26 #include <com/sun/star/io/IOException.hpp>
27 #include <com/sun/star/io/XStream.hpp>
32 #include <osl/diagnose.h>
38 #include <com/sun/star/i18n/UnicodeType.hpp>
40 #include <com/sun/star/i18n/UnicodeScript.hpp>
41 #include <com/sun/star/i18n/OrdinalSuffix.hpp>
47 #include <editeng/editids.hrc>
57 #include <com/sun/star/xml/sax/InputSource.hpp>
58 #include <com/sun/star/xml/sax/FastParser.hpp>
59 #include <com/sun/star/xml/sax/Writer.hpp>
60 #include <com/sun/star/xml/sax/SAXParseException.hpp>
66 #include <com/sun/star/ucb/ContentCreationException.hpp>
67 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
68 #include <com/sun/star/ucb/TransferInfo.hpp>
69 #include <com/sun/star/ucb/NameClash.hpp>
72 #include <unordered_map>
73 #include <rtl/character.hxx>
80 using namespace ::
utl;
87 ExclamationMark = 0x02,
112 return ' ' == c ||
'\t' == c || 0x0a == c ||
125 ( css::i18n::KCharacterType::LOWER & nCharType);
131 ( css::i18n::KCharacterType::UPPER & nCharType);
135 sal_Int32 nStt, sal_Int32 nEnd )
137 for( ; nStt < nEnd; ++nStt )
139 css::i18n::UnicodeScript nScript = rCC.
getScript( rTxt, nStt );
142 case css::i18n::UnicodeScript_kCJKRadicalsSupplement:
143 case css::i18n::UnicodeScript_kHangulJamo:
144 case css::i18n::UnicodeScript_kCJKSymbolPunctuation:
145 case css::i18n::UnicodeScript_kHiragana:
146 case css::i18n::UnicodeScript_kKatakana:
147 case css::i18n::UnicodeScript_kHangulCompatibilityJamo:
148 case css::i18n::UnicodeScript_kEnclosedCJKLetterMonth:
149 case css::i18n::UnicodeScript_kCJKCompatibility:
150 case css::i18n::UnicodeScript_k_CJKUnifiedIdeographsExtensionA:
151 case css::i18n::UnicodeScript_kCJKUnifiedIdeograph:
152 case css::i18n::UnicodeScript_kHangulSyllable:
153 case css::i18n::UnicodeScript_kCJKCompatibilityIdeograph:
154 case css::i18n::UnicodeScript_kHalfwidthFullwidthForm:
163 sal_Int32 nStt, sal_Int32 nEnd )
165 for( ; nStt < nEnd; ++nStt )
167 if( css::i18n::UnicodeType::PRIVATE_USE == rCC.
getType( rTxt, nStt ))
180 for( ; *pArr; ++pArr )
233 static int bIsInit = 0;
235 TransliterationFlags::IGNORE_KANA |
236 TransliterationFlags::IGNORE_WIDTH );
239 aWrp.loadModuleIfNeeded(
GetAppLang().getLanguageType() );
257 return cChar ==
'\0' || cChar ==
'\t' || cChar == 0x0a ||
258 cChar ==
' ' || cChar ==
'\'' || cChar ==
'\"' ||
259 cChar ==
'*' || cChar ==
'_' || cChar ==
'%' ||
260 cChar ==
'.' || cChar ==
',' || cChar ==
';' ||
261 cChar ==
':' || cChar ==
'?' || cChar ==
'!' ||
262 cChar ==
'<' || cChar ==
'>' ||
263 cChar ==
'/' || cChar ==
'-';
276 return cChar ==
'%' || cChar ==
';' || cChar ==
':' || cChar ==
'?' || cChar ==
'!' ||
329 const OUString& rUserAutocorrFile )
330 : sShareAutoCorrFile( rShareAutocorrFile )
331 , sUserAutoCorrFile( rUserAutocorrFile )
342 : sShareAutoCorrFile( rCpy.sShareAutoCorrFile )
343 , sUserAutoCorrFile( rCpy.sUserAutoCorrFile )
344 , aSwFlags( rCpy.aSwFlags )
345 , eCharClassLang(rCpy.eCharClassLang)
347 , cStartDQuote( rCpy.cStartDQuote )
348 , cEndDQuote( rCpy.cEndDQuote )
349 , cStartSQuote( rCpy.cStartSQuote )
350 , cEndSQuote( rCpy.cEndSQuote )
385 sal_Int32 nSttPos, sal_Int32 nEndPos,
392 for( ; nSttPos < nEndPos; ++nSttPos )
395 for( ; nSttPos < nEndPos; --nEndPos )
402 std::deque<sal_Int32> aDelimiters;
406 aDelimiters.push_back(nSttPos);
409 for (sal_Int32
n = nSttPos;
n < nEndPos; ++
n)
411 if (IsCompoundWordDelimChar(rTxt[
n ]))
413 aDelimiters.push_back( n + 1 );
422 if (!IsCompoundWordDelimChar(rTxt[nEndPos-1]))
423 aDelimiters.push_back(nEndPos);
427 for (
size_t nI = 0; nI < aDelimiters.size() - 1; ++nI)
429 nSttPos = aDelimiters[nI];
430 nEndPos = aDelimiters[nI + 1];
432 if( nSttPos+2 < nEndPos &&
438 0x1 != rTxt[ nSttPos ] && 0x2 != rTxt[ nSttPos ])
441 OUString sWord( rTxt.copy( nSttPos - 1, nEndPos - nSttPos + 1 ));
445 css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller =
447 if( xSpeller->hasLanguage(static_cast<sal_uInt16>(eLang)) )
449 Sequence< css::beans::PropertyValue > aEmptySeq;
450 if (xSpeller->isValid(sWord, static_cast<sal_uInt16>(eLang), aEmptySeq))
456 OUString sChar = rCC.
lowercase( OUString(cSave) );
457 if( sChar[0] != cSave && rDoc.
ReplaceRange( nSttPos, 1, sChar ))
470 sal_Int32 nSttPos, sal_Int32 nEndPos,
486 for (; nSttPos < nEndPos; ++nSttPos)
489 for (; nSttPos < nEndPos; --nEndPos)
495 sal_Int32 nNumEnd = nEndPos;
496 bool bFoundEnd =
false;
497 bool isValidNumber =
true;
498 sal_Int32
i = nEndPos;
502 bool isDigit = rCC.
isDigit(rTxt, i);
504 isValidNumber &= (isDigit || !rCC.
isLetter(rTxt, i));
506 if (isDigit && !bFoundEnd)
513 if (bFoundEnd && isValidNumber) {
514 sal_Int32 nNum = rTxt.copy(nSttPos, nNumEnd - nSttPos + 1).toInt32();
517 uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix
520 const uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.
getLanguageTag().
getLocale());
521 for (OUString
const &
sSuffix : aSuffixes)
523 OUString sEnd = rTxt.copy(nNumEnd + 1, nEndPos - nNumEnd - 1);
533 rDoc.
SetAttr(nNumEnd + 1, nEndPos,
534 SID_ATTR_CHAR_ESCAPEMENT,
548 sal_Int32 nSttPos, sal_Int32 nEndPos,
558 if( 1 < nSttPos && 1 <= nEndPos - nSttPos )
563 if( 1 < nEndPos - nSttPos &&
564 ' ' == rTxt[ nSttPos-1 ] &&
565 '-' == rTxt[ nSttPos+1 ])
583 rDoc.
Delete( nSttPos, nSttPos + 2 );
590 else if( 3 < nSttPos &&
591 ' ' == rTxt[ nSttPos-1 ] &&
592 '-' == rTxt[ nSttPos-2 ])
594 sal_Int32
n, nLen = 1, nTmpPos = nSttPos - 2;
595 if(
'-' == ( cCh = rTxt[ nTmpPos-1 ]) )
599 cCh = rTxt[ nTmpPos-1 ];
618 rDoc.
Delete( nTmpPos, nTmpPos + nLen );
631 if( 4 <= nEndPos - nSttPos )
633 OUString sTmp( rTxt.copy( nSttPos, nEndPos - nSttPos ) );
634 sal_Int32 nFndPos = sTmp.indexOf(
"--");
635 if( nFndPos != -1 && nFndPos &&
636 nFndPos + 2 < sTmp.getLength() &&
642 nSttPos = nSttPos + nFndPos;
643 rDoc.
Delete( nSttPos, nSttPos + 2 );
644 rDoc.
Insert( nSttPos, (bEnDash || (rCC.
isDigit( sTmp, nFndPos - 1 ) &&
665 OUString allChars =
":;?!%";
666 OUString chars( allChars );
671 bool bHasSpace = chars.indexOf( cChar ) != -1;
672 bool bIsSpecial = allChars.indexOf( cChar ) != -1;
676 sal_Int32 nSttWdPos = nEndPos;
677 bool bWasWordDelim =
false;
687 sal_Int32
nIndex = nSttWdPos + (bWasWordDelim ? 1 : 0);
688 sal_Int32 nProtocolLen = nEndPos - nSttWdPos + 1;
689 if (nIndex + nProtocolLen <= rTxt.getLength())
696 sal_Int32 nStrPos = rTxt.indexOf(
"://", nSttWdPos + 1 );
697 if ( nStrPos == -1 && nEndPos > 0 )
701 if ( ( chars.indexOf( cPrevChar ) == -1 ) && cPrevChar !=
'\t' )
704 sal_Int32
nPos = nEndPos - 1;
707 if ( nPos == 0 )
break;
709 cPrevChar = rTxt[ nPos ];
713 if ( nEndPos - nPos > 0 )
714 rDoc.
Delete( nPos, nEndPos );
719 io_bNbspRunNext =
true;
722 else if ( chars.indexOf( cPrevChar ) != -1 )
723 io_bNbspRunNext =
true;
726 else if ( cChar ==
'/' && nEndPos > 1 && rTxt.getLength() > (nEndPos - 1) )
733 rDoc.
Delete( nEndPos - 2, nEndPos - 1 );
744 sal_Int32 nSttPos, sal_Int32 nEndPos,
749 bool bRet = !sURL.isEmpty();
764 if( ++nEndPos != rTxt.getLength() &&
770 bool bAlphaNum =
false;
771 sal_Int32
nPos = nEndPos;
772 sal_Int32 nFndPos = -1;
785 if( bAlphaNum && nPos+1 < nEndPos && ( !nPos ||
806 rDoc.
Delete( nEndPos, nEndPos + 1 );
807 rDoc.
Delete( nFndPos, nFndPos + 1 );
810 if(
'*' == cInsChar )
813 rDoc.
SetAttr( nFndPos, nEndPos - 1,
814 SID_ATTR_CHAR_WEIGHT,
817 else if(
'/' == cInsChar )
820 rDoc.
SetAttr( nFndPos, nEndPos - 1,
821 SID_ATTR_CHAR_POSTURE,
824 else if(
'-' == cInsChar )
827 rDoc.
SetAttr( nFndPos, nEndPos - 1,
828 SID_ATTR_CHAR_STRIKEOUT,
834 rDoc.
SetAttr( nFndPos, nEndPos - 1,
835 SID_ATTR_CHAR_UNDERLINE,
840 return -1 != nFndPos;
845 const OUString& rTxt,
bool bNormalPos,
846 sal_Int32 nSttPos, sal_Int32 nEndPos,
850 if( rTxt.isEmpty() || nEndPos <= nSttPos )
854 OUString aText( rTxt );
856 *pStr = pStart + nEndPos,
860 bool bAtStart =
false;
863 if (rCC.
isLetter(aText, pStr - pStart))
869 else if (pWordStt && !rCC.
isDigit(aText, pStr - pStart))
872 pWordStt - 1 == pStr &&
874 (pStart + 1) <= pStr &&
875 rCC.
isLetter(aText, pStr-1 - pStart))
880 bAtStart = (pStart == pStr);
881 }
while( !bAtStart );
887 if (rCC.
isDigit(aText, pStr - pStart))
895 sal_Int32
nIndex = pWordStt - pStart;
896 sal_Int32 nProtocolLen = pDelim - pWordStt + 1;
897 if (nIndex + nProtocolLen <= rTxt.getLength())
903 if (0x1 == *pWordStt || 0x2 == *pWordStt)
907 if( *pDelim && 2 >= pDelim - pWordStt &&
912 if ( 1 == pDelim - pWordStt && 0x03B1 <= *pWordStt && *pWordStt <= 0x03C9 && eLang !=
LANGUAGE_GREEK )
921 bAtStart = (pStart == pStr--);
928 else if ( 0x3002 != *pStr && 0xFF0E != *pStr && 0xFF01 != *pStr &&
941 OUString
const*
const pPrevPara = rDoc.
GetPrevPara(bNormalPos);
945 OUString sChar( *pWordStt );
947 if (sChar != OUStringChar(*pWordStt))
954 pStart = aText.getStr();
955 pStr = pStart + aText.getLength();
961 bAtStart = (pStart == pStr);
962 }
while( !bAtStart );
971 bool bContinue =
true;
972 Flags nFlag = Flags::NONE;
982 if (pStr >= pStart + 2 && *(pStr - 2) ==
'.')
991 if (nFlag & Flags::FullStop)
993 nFlag |= Flags::FullStop;
1000 if (nFlag & Flags::ExclamationMark)
1002 nFlag |= Flags::ExclamationMark;
1008 if (nFlag & Flags::QuestionMark)
1010 nFlag |= Flags::QuestionMark;
1014 if (nFlag == Flags::NONE)
1021 if (bContinue && pStr-- == pStart)
1025 }
while (bContinue);
1026 if (Flags::FullStop != nFlag)
1027 pExceptStt =
nullptr;
1030 if( 2 > ( pStr - pStart ) )
1035 bool bValid =
false, bAlphaFnd =
false;
1039 if( rCC.
isDigit( aText, pTmpStr - pStart ) )
1044 else if( rCC.
isLetter( aText, pTmpStr - pStart ) )
1057 if( pTmpStr == pStart )
1067 bool bNumericOnly =
'0' <= *(pStr+1) && *(pStr+1) <=
'9';
1072 if( bNumericOnly && rCC.
isLetter( aText, pStr - pStart ) )
1073 bNumericOnly =
false;
1075 if( pStart == pStr )
1092 sWord = OUString(pStr, pExceptStt - pStr + 1);
1098 OUString sTmp( sWord );
1099 while( !sTmp.isEmpty() &&
1101 sTmp = sTmp.copy(1);
1105 sal_Int32 nLen = sTmp.getLength();
1108 if( nLen + 1 < sTmp.getLength() )
1109 sTmp = sTmp.copy( 0, nLen + 1 );
1111 if( !sTmp.isEmpty() && sTmp.getLength() != sWord.getLength() &&
1121 nSttPos = pWordStt - rTxt.getStr();
1122 OUString sChar = rCC.
titlecase(OUString(cSave));
1123 bool bRet = sChar[0] != cSave && rDoc.
ReplaceRange( nSttPos, 1, sChar );
1132 sal_Int32 nSttPos, sal_Int32 nEndPos,
1135 if (nEndPos - nSttPos < 2)
1148 OUStringBuffer aConverted;
1149 aConverted.append( rCC.
uppercase(OUString(rTxt[nSttPos])) );
1150 aConverted.append( rCC.
lowercase(OUString(rTxt[nSttPos+1])) );
1156 for( sal_Int32
i = nSttPos+2;
i < nEndPos; ++
i )
1164 aConverted.append( rCC.
lowercase(OUString(rTxt[
i])) );
1167 aConverted.append( rTxt[i] );
1171 rDoc.
Delete(nSttPos, nEndPos);
1172 rDoc.
Insert(nSttPos, aConverted.makeStringAndClear());
1184 : (
'\"' == cInsChar
1195 OUString sRet( bSttQuote
1196 ? (
'\"' == cInsChar
1199 : (
'\"' == cInsChar
1202 cRet = !sRet.isEmpty() ? sRet[0] : cInsChar;
1218 bool bLeftQuote =
'\"' == cInsChar &&
1222 cRet = (
'<' == cInsChar || bLeftQuote )
1229 cRet =
GetQuote( cInsChar, bSttQuote, eLang );
1231 OUString sChg( cInsChar );
1233 rDoc.
Insert( nInsPos, sChg );
1235 rDoc.
Replace( nInsPos, sChg );
1237 sChg = OUString(cRet);
1249 rDoc.
Delete( nInsPos-1, nInsPos);
1253 rDoc.
Replace( nInsPos, sChg );
1257 rDoc.
Replace( nInsPos-1,
"I" );
1266 OUString sRet(cRet);
1268 if(
'\"' == cInsChar )
1288 cTmpChar = rTxt[ --nPos ];
1289 if ( cTmpChar == sPrecedingChar )
1292 for (
const sal_Unicode* pCh = aStopChars; *pCh; ++pCh )
1293 if ( cTmpChar == *pCh )
1296 }
while ( nPos > 0 );
1304 bool bInsert,
bool& io_bNbspRunNext,
vcl::Window const * pFrameWin )
1306 bool bIsNextRun = io_bNbspRunNext;
1307 io_bNbspRunNext =
false;
1313 if( nInsPos &&
' ' == cChar &&
1315 ' ' == rTxt[ nInsPos - 1 ])
1320 bool bSingle =
'\'' == cChar;
1321 bool bIsReplaceQuote =
1324 if( bIsReplaceQuote )
1326 bool bSttQuote = !nInsPos;
1337 if ( !bSingle && !bSttQuote && cPrev ==
cApostrophe &&
1339 ( ( ( nInsPos == 2 || ( nInsPos > 2 &&
IsWordDelim( rTxt[ nInsPos-3 ] ) ) ) &&
1341 OUString(
"cdjlnmtsCDJLNMTS").indexOf( rTxt[ nInsPos-2 ] ) > -1 ) ||
1342 ( ( nInsPos == 3 || (nInsPos > 3 &&
IsWordDelim( rTxt[ nInsPos-4 ] ) ) ) &&
1344 ( rTxt[ nInsPos-2 ] ==
'u' || rTxt[ nInsPos-2 ] ==
'U' ) &&
1345 ( rTxt[ nInsPos-3 ] ==
'q' || rTxt[ nInsPos-3 ] ==
'Q' ) ) ) )
1350 else if ( bSingle && ( cPrev ==
'i' ) &&
1352 ( nInsPos == 1 ||
IsWordDelim( rTxt[ nInsPos-2 ] ) ) )
1357 else if ( !bSingle && nInsPos &&
1374 else if ( bSingle && nInsPos && !bSttQuote &&
1410 InsertQuote( rDoc, nInsPos, cChar, bSttQuote, bInsert, eLang, eType );
1416 (
'<' == cChar ||
'>' == cChar) &&
1417 nInsPos > 0 && cChar == rTxt[ nInsPos-1 ] )
1446 rDoc.
Insert( nInsPos, OUString(cChar) );
1448 rDoc.
Replace( nInsPos, OUString(cChar) );
1465 sal_Int32
nPos = nInsPos - 1;
1466 bool bContinue =
true;
1472 rDoc.
Delete( nPos, nPos + 1 );
1487 sal_Int32
nPos = nInsPos - 1;
1493 if ((
'*' == cChar ||
'_' == cChar ||
'/' == cChar ||
'-' == cChar) && (nPos+1 < rTxt.getLength()))
1507 sal_Int32 nCapLttrPos = nPos+1;
1530 sal_Int32 nCapLttrPos1 = nCapLttrPos, nInsPos1 = nInsPos;
1531 while( nCapLttrPos1 < nInsPos &&
1535 while( nCapLttrPos1 < nInsPos1 && nInsPos1 &&
1540 if( (nCapLttrPos1 != nCapLttrPos || nInsPos1 != nInsPos ) &&
1541 nCapLttrPos1 < nInsPos1 &&
1545 nCapLttrPos = nCapLttrPos1;
1551 if( !aPara.isEmpty() )
1553 sal_Int32 nEnd = nCapLttrPos;
1554 while( nEnd < aPara.getLength() &&
1562 nCapLttrPos, nEnd, eLang );
1584 (
'-' != cChar ||
'E' != rtl::toAsciiUpperCase(rTxt[nInsPos-1]) ||
'0' > rTxt[nInsPos-2] ||
'9' < rTxt[nInsPos-2] ) &&
1587 (
' ' == cChar ||
'\t' == cChar || 0x0a == cChar || !cChar ) &&
1588 FnSetINetAttr( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) )
1592 bool bLockKeyOn = pFrameWin && (pFrameWin->
GetIndicatorState() & KeyIndicatorState::CAPSLOCK);
1605 if( !bUnsupported &&
1612 if( !bUnsupported &&
1640 iter->second->SaveCplSttExceptList();
1643 SAL_WARN(
"editeng",
"Save an empty list? ");
1651 iter->second->SaveWrdSttExceptList();
1654 SAL_WARN(
"editeng",
"Save an empty list? ");
1666 pLists = iter->second.get();
1672 pLists = iter->second.get();
1674 pLists =
m_aLangTable.find(aLangTagUndetermined)->second.get();
1676 OSL_ENSURE(pLists,
"No auto correction data");
1688 pLists = iter->second.get();
1694 pLists = iter->second.get();
1696 pLists =
m_aLangTable.find(aLangTagUndetermined)->second.get();
1698 OSL_ENSURE(pLists,
"No auto correction file!");
1709 sal_Int32 nEnd = nPos;
1712 if( ( nPos < rTxt.getLength() &&
1722 sal_Int32 nCapLttrPos = nPos+1;
1727 if( ++nCapLttrPos >= nEnd )
1730 if( 3 > nEnd - nCapLttrPos )
1740 sRet = rTxt.copy( nCapLttrPos, nEnd - nCapLttrPos );
1746 const sal_Int32 nPos)
1748 constexpr sal_Int32 nMinLen = 3;
1749 constexpr sal_Int32 nMaxLen = 9;
1750 std::vector<OUString> aRes;
1751 if (nPos >= nMinLen)
1753 sal_Int32 nBegin = std::max<sal_Int32>(nPos - nMaxLen, 0);
1757 while (nBegin + nMinLen <= nPos && !
IsWordDelim(rTxt[nBegin]))
1760 if (nBegin + nMinLen <= nPos)
1762 OUString sRes = rTxt.copy(nBegin, nPos - nBegin);
1763 aRes.push_back(sRes);
1764 bool bLastStartedWithDelim =
IsWordDelim(sRes[0]);
1765 for (sal_Int32
i = 1;
i <= sRes.getLength() - nMinLen; ++
i)
1767 bool bAdd = bLastStartedWithDelim;
1769 bAdd = bAdd || bLastStartedWithDelim;
1771 aRes.push_back(sRes.copy(i));
1783 OUString sShareDirFile( sUserDirFile );
1791 (nLastCheckTime.
SetTime(nFndPos->second), nLastCheckTime < nAktTime) &&
1792 nAktTime - nLastCheckTime < nMinTime)
1798 sShareDirFile = sUserDirFile;
1801 m_aLangTable.insert(std::make_pair(aTmp, std::unique_ptr<SvxAutoCorrectLanguageLists>(pLists)));
1812 ( sShareDirFile = sUserDirFile, bNewFile )
1817 m_aLangTable.insert(std::make_pair(aTmp, std::unique_ptr<SvxAutoCorrectLanguageLists>(pLists)));
1821 else if( !bNewFile )
1825 return pLists !=
nullptr;
1834 return iter->second->PutText(rShort, rLong);
1836 return m_aLangTable.find(aLanguageTag)->second->PutText(rShort, rLong);
1841 std::vector<SvxAutocorrWord>& aDeleteEntries,
1848 iter->second->MakeCombinedChanges( aNewEntries, aDeleteEntries );
1852 m_aLangTable.find( aLanguageTag )->second->MakeCombinedChanges( aNewEntries, aDeleteEntries );
1876 OUStringBuffer
aName;
1877 aName.append(
'#').append(rName);
1878 for (sal_Int32 nLen = rName.getLength(),
nPos = 1;
nPos < nLen; ++
nPos)
1881 aName[nPos] &= 0x0f;
1883 return aName.makeStringAndClear();
1890 OUStringBuffer
aBuf(OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US));
1892 for (sal_Int32
nPos = 0;
nPos < aBuf.getLength(); ++
nPos)
1908 rPackageName = aBuf.makeStringAndClear();
1913 sal_Int32& rStt, sal_Int32 nEndPos)
1921 const OUString& rTxt, sal_Int32& rStt, sal_Int32 nEndPos,
1937 std::unique_ptr<SvxAutoCorrectLanguageLists>
const& pList =
m_aLangTable.find(aLanguageTag)->second;
1941 rLang = aLanguageTag;
1958 std::unique_ptr<SvxAutoCorrectLanguageLists>
const& pList =
m_aLangTable.find(aLanguageTag)->second;
1962 rLang = aLanguageTag;
1971 std::unique_ptr<SvxAutoCorrectLanguageLists>
const& pList =
m_aLangTable.find(aLanguageTag)->second;
1975 rLang = aLanguageTag;
1983 const OUString& sWord )
1995 auto const& pList =
m_aLangTable.find(aLanguageTag)->second;
1996 if(pList->GetWrdSttExceptList()->find(sWord) != pList->GetWrdSttExceptList()->end() )
2009 auto const& pList =
m_aLangTable.find(aLanguageTag)->second;
2010 if(pList->GetWrdSttExceptList()->find(sWord) != pList->GetWrdSttExceptList()->end() )
2018 auto const& pList =
m_aLangTable.find(aLanguageTag)->second;
2019 if(pList->GetWrdSttExceptList()->find(sWord) != pList->GetWrdSttExceptList()->end() )
2029 if( nPos < pList->
size() )
2031 OUString sLowerWord(sWord.toAsciiLowerCase());
2035 sAbr = (*pList)[
n ];
2039 if( 2 < sAbr.getLength() && sAbr.getLength() - 1 <= sWord.getLength() )
2041 OUString sLowerAbk(sAbr.toAsciiLowerCase());
2042 for (sal_Int32
i = sLowerAbk.getLength(), ii = sLowerWord.getLength();
i;)
2047 if( sLowerAbk[
i] != sLowerWord[--ii])
2053 OSL_ENSURE( !(nPos &&
'~' == (*pList)[ --nPos ][ 0 ] ),
2054 "Wrongly sorted exception list?" );
2059 const OUString& sWord,
bool bAbbreviation)
2102 bool bNewFile,
bool bTst,
bool bUnlocalized )
const
2104 OUString sRet, sExt( rLanguageTag.
getBcp47() );
2109 if (!vecFallBackStrings.empty())
2110 sExt = vecFallBackStrings[0];
2113 sExt =
"_" + sExt +
".dat";
2130 const OUString& rShareAutoCorrectFile,
2131 const OUString& rUserAutoCorrectFile)
2132 : sShareAutoCorrFile( rShareAutoCorrectFile ),
2133 sUserAutoCorrFile( rUserAutoCorrectFile ),
2137 rAutoCorrect(rParent),
2156 if( nAktTime > nMinTime )
2160 &aTstDate, &aTstTime ) &&
2185 std::unique_ptr<SvStringsISortDtor>& rpLst,
2186 const OUString& sStrmName,
2195 if( rStg.
is() && rStg->
IsStream( sStrmName ) )
2198 ( StreamMode::READ | StreamMode::SHARE_DENYWRITE | StreamMode::NOCREATE ) );
2207 uno::Reference< uno::XComponentContext > xContext =
2210 xml::sax::InputSource aParserInput;
2211 aParserInput.sSystemId = sStrmName;
2214 xStrm->SetBufferSize( 8 * 1024 );
2221 uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create( xContext );
2223 xParser->setFastDocumentHandler( xFilter );
2225 xParser->setTokenHandler( xTokenHandler );
2230 xParser->parseStream( aParserInput );
2232 catch(
const xml::sax::SAXParseException& )
2236 catch(
const xml::sax::SAXException& )
2240 catch(
const io::IOException& )
2257 const OUString& sStrmName,
2266 rStg->
Remove( sStrmName );
2272 ( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) );
2276 xStrm->SetBufferSize( 8192 );
2280 uno::Reference< uno::XComponentContext > xContext =
2283 uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
2285 xWriter->setOutputStream(xOut);
2287 uno::Reference < xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
2301 rStg->
Remove( sStrmName );
2320 uno::Reference < io::XStream > xStrm = xStg->openStreamElement(
pXMLImplAutocorr_ListStr, embed::ElementModes::READ );
2323 xml::sax::InputSource aParserInput;
2325 aParserInput.aInputStream = xStrm->getInputStream();
2328 uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
2329 SAL_INFO(
"editeng",
"AutoCorrect Import" );
2334 xParser->setFastDocumentHandler( xFilter );
2336 xParser->setTokenHandler(xTokenHandler);
2339 xParser->parseStream( aParserInput );
2341 catch (
const uno::Exception& )
2361 OSL_ENSURE(
false,
"No valid list" );
2376 OSL_ENSURE(
false,
"No valid list" );
2408 if( !rNew.isEmpty() && pExceptList && pExceptList->
insert( rNew ).second )
2433 catch (
const css::ucb::ContentCreationException&)
2462 catch (
const css::ucb::ContentCreationException &)
2490 OSL_ENSURE(
false,
"No valid list" );
2520 bool bError =
false, bConvert =
false, bCopy =
false;
2540 bCopy = bConvert =
true;
2547 sal_Int32 nSlashPos = sMain.lastIndexOf(
'/');
2548 sMain = sMain.copy(0, nSlashPos);
2551 aInfo.NameClash = NameClash::OVERWRITE;
2554 aInfo.MoveData =
false;
2562 if (bConvert && !bError)
2567 if( xSrcStg.
is() && xDstStg.is() )
2569 std::unique_ptr<SvStringsISortDtor> pTmpWordList;
2577 pTmpWordList.reset();
2587 pTmpWordList->clear();
2604 else if( bCopy && !bError )
2614 ( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) );
2618 refList->SetBufferSize( 8192 );
2619 refList->
SetProperty(
"MediaType",
Any(OUString(
"text/xml" )) );
2621 uno::Reference< uno::XComponentContext > xContext =
2624 uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
2626 xWriter->setOutputStream(xOut);
2672 std::optional<SvxAutocorrWord> xFoundEntry =
pAutocorr_List->FindAndRemove( &aWordToDelete );
2675 if( !xFoundEntry->IsTextOnly() )
2677 OUString
aName( aWordToDelete.GetShort() );
2686 bRet = xStorage->
Commit();
2694 SvxAutocorrWord aWordToAdd(aNewEntrie.GetShort(), aNewEntrie.GetLong(), true );
2695 std::optional<SvxAutocorrWord> xRemoved =
pAutocorr_List->FindAndRemove( &aWordToAdd );
2698 if( !xRemoved->IsTextOnly() )
2701 OUString sStorageName( aWordToAdd.GetShort() );
2708 xStorage->
Remove( sStorageName );
2741 std::optional<SvxAutocorrWord> xRemove =
pAutocorr_List->FindAndRemove( &aNew );
2744 if( !xRemove->IsTextOnly() )
2747 OUString sStgNm( rShort );
2796 catch (
const uno::Exception& )
2813 typedef std::unordered_map<OUString, SvxAutocorrWord> AutocorrWordHashType;
2828 maSortedVector.clear();
2840 mpImpl->DeleteAndDestroyAll();
2846 if (
mpImpl->maSortedVector.empty() )
2848 OUString aShort = aWord.
GetShort();
2849 auto [it,
inserted] =
mpImpl->maHash.emplace( std::move(aShort), std::move(aWord) );
2851 return &(it->second);
2858 if (it ==
mpImpl->maSortedVector.end() || rCmp.compareString( aWord.
GetShort(), it->GetShort() ) != 0)
2860 it =
mpImpl->maSortedVector.insert(it, std::move(aWord));
2874 return mpImpl->maHash.empty() &&
mpImpl->maSortedVector.empty();
2880 if (
mpImpl->maSortedVector.empty() )
2882 AutocorrWordHashType::iterator it =
mpImpl->maHash.find( pWord->
GetShort() );
2883 if( it !=
mpImpl->maHash.end() )
2886 mpImpl->maHash.erase (it);
2896 mpImpl->maSortedVector.erase (it);
2900 return std::optional<SvxAutocorrWord>();
2907 if (
mpImpl->maSortedVector.empty() )
2909 std::vector<SvxAutocorrWord> tmp;
2910 tmp.reserve(
mpImpl->maHash.size());
2911 for (
auto & rPair :
mpImpl->maHash)
2912 tmp.emplace_back(std::move(rPair.second));
2916 std::sort(tmp.begin(), tmp.end(),
2919 return lhs.
GetShort() < rhs.GetShort();
2925 mpImpl->maSortedVector = std::move(tmp);
2927 return mpImpl->maSortedVector;
2931 const OUString &rTxt,
2933 sal_Int32 nEndPos)
const
2935 const OUString& rChk = pFnd->
GetShort();
2937 sal_Int32 left_wildcard = rChk.startsWith(
".*" ) ? 2 : 0;
2938 sal_Int32 right_wildcard = rChk.endsWith(
".*" ) ? 2 : 0;
2939 sal_Int32 nSttWdPos = nEndPos;
2942 bool bColonNameColon = rTxt.getLength() > nEndPos &&
2943 rTxt[nEndPos] ==
':' && rChk[0] ==
':' && rChk.endsWith(
":");
2944 if ( nEndPos + (bColonNameColon ? 1 : 0) >= rChk.getLength() - left_wildcard - right_wildcard )
2947 bool bWasWordDelim =
false;
2948 sal_Int32 nCalcStt = nEndPos - rChk.getLength() + left_wildcard;
2949 if (bColonNameColon)
2951 if( !right_wildcard && ( !nCalcStt || nCalcStt == rStt || left_wildcard || bColonNameColon ||
2952 ( nCalcStt < rStt &&
2956 OUString sWord = rTxt.copy(nCalcStt, rChk.getLength() - left_wildcard);
2957 if( (!left_wildcard && rCmp.isEqual( rChk, sWord )) || (left_wildcard && rCmp.isEqual( rChk.copy(left_wildcard), sWord) ))
2963 if (rTxt.getLength() > nEndPos && rTxt[nEndPos] ==
'/' && rChk.indexOf(
'/') != -1)
2968 while( rStt && !(bWasWordDelim =
IsWordDelim( rTxt[ --rStt ])))
2970 if (bWasWordDelim) rStt++;
2971 OUString left_pattern = rTxt.copy(rStt, nEndPos - rStt - rChk.getLength() + left_wildcard);
2973 left_pattern += (left_pattern.getLength() == 0 && pFnd->
GetLong()[0] == 0x20) ? pFnd->
GetLong().copy(1) : pFnd->
GetLong();
2979 if ( right_wildcard )
2982 OUString sTmp( rChk.copy( left_wildcard, rChk.getLength() - left_wildcard - right_wildcard ) );
2986 while( nSttWdPos && !(bWasWordDelim =
IsWordDelim( rTxt[ --nSttWdPos ])))
2989 sal_Int32 nFndPos = -1;
2991 nFndPos = rTxt.indexOf( sTmp, nFndPos + 1);
2994 not_suffix = bWasWordDelim && (nSttWdPos >= (nFndPos + sTmp.getLength()));
2995 }
while ( (!left_wildcard && nFndPos && !
IsWordDelim( rTxt[ nFndPos - 1 ])) || not_suffix );
2997 if ( nFndPos != -1 )
2999 sal_Int32 extra_repl = nFndPos + sTmp.getLength() > nEndPos ? 1: 0;
3001 if ( left_wildcard )
3004 while( nFndPos && !(bWasWordDelim =
IsWordDelim( rTxt[ --nFndPos ])))
3006 if (bWasWordDelim) nFndPos++;
3008 if (nEndPos + extra_repl <= nFndPos)
3013 OUString aShort = rTxt.copy(nFndPos, nEndPos - nFndPos + extra_repl);
3017 if ( !left_wildcard )
3019 sal_Int32 siz = nEndPos - nFndPos - sTmp.getLength();
3020 aLong = pFnd->
GetLong() + (siz > 0 ? rTxt.copy(nFndPos + sTmp.getLength(), siz) :
"");
3024 nSttWdPos = rTxt.indexOf( sTmp, nFndPos);
3025 if (nSttWdPos != -1)
3027 sal_Int32 nTmp(nFndPos);
3028 while (nTmp < nSttWdPos && !
IsWordDelim(rTxt[nTmp]))
3030 if (nTmp < nSttWdPos)
3032 buf.append(std::u16string_view(rTxt).substr(nFndPos, nSttWdPos - nFndPos)).append(pFnd->
GetLong());
3033 nFndPos = nSttWdPos + sTmp.getLength();
3035 }
while (nSttWdPos != -1);
3036 if (nEndPos - nFndPos > extra_repl)
3037 buf.append(std::u16string_view(rTxt).substr(nFndPos, nEndPos - nFndPos));
3038 aLong = buf.makeStringAndClear();
3042 if ( (rTxt.getLength() > nEndPos &&
IsWordDelim(rTxt[nEndPos])) || rTxt.getLength() == nEndPos )
3052 sal_Int32 nEndPos)
const
3054 for (
auto const& elem :
mpImpl->maHash)
3060 for (
auto const& elem :
mpImpl->maSortedVector)
SvxAutoCorrect & rAutoCorrect
sal_Unicode GetEndDoubleQuote() const
std::unique_ptr< SvStringsISortDtor > pWrdStt_ExcptLst
void GetCharClass_(LanguageType eLang)
SVL_DLLPUBLIC bool IsDocument(const OUString &rURL)
const sal_Unicode aStopDoubleAngleQuoteEnd[]
void SaveCplSttExceptList()
void SimulateKeyPress(sal_uInt16 nKeyCode) const
static const SvxAutocorrWord * lcl_SearchWordsInList(SvxAutoCorrectLanguageLists *pList, const OUString &rTxt, sal_Int32 &rStt, sal_Int32 nEndPos)
SvStringsISortDtor * LoadWrdSttExceptList()
bool FnChgToEnEmDash(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
bool FindInCplSttExceptList(LanguageType eLang, const OUString &sWord, bool bAbbreviation=false)
sal_Int32 getCharacterType(const OUString &rStr, sal_Int32 nPos) const
bool CreateLanguageFile(const LanguageTag &rLanguageTag, bool bNewFile=true)
#define LANGUAGE_ENGLISH_SAFRICA
static LanguageType GetDocLanguage(const SvxAutoCorrDoc &rDoc, sal_Int32 nPos)
Never use an unresolved LANGUAGE_SYSTEM.
#define LANGUAGE_ENGLISH_UK
bool IsAutoCorrFlag(ACFlags nFlag) const
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
virtual void SaveCpltSttWord(ACFlags nFlag, sal_Int32 nPos, const OUString &rExceptWord, sal_Unicode cChar)
bool isDigit(const OUString &rStr, sal_Int32 nPos) const
void MakeUserStorage_Impl()
const SvxAutocorrWord * Insert(SvxAutocorrWord aWord) const
virtual ~SvxAutoCorrDoc()
#define LANGUAGE_ICELANDIC
LanguageTag & reset(const OUString &rBcp47LanguageTag)
static bool IsAutoCorrectChar(sal_Unicode cChar)
AutocorrWordHashType maHash
constexpr sal_Unicode cEnDash
#define LANGUAGE_ENGLISH_US
std::unique_ptr< SvxAutocorrWordList > pAutocorr_List
std::unique_ptr< Impl > mpImpl
KeyIndicatorState GetIndicatorState() const
static bool isLetterType(sal_Int32 nType)
void DeleteAndDestroyAll()
constexpr sal_Unicode cLeftSingleAngleQuote
void InsertQuote(SvxAutoCorrDoc &rDoc, sal_Int32 nInsPos, sal_Unicode cInsChar, bool bSttQuote, bool bIns, LanguageType eLang, ACQuotes eType) const
bool FnChgOrdinalNumber(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
const sal_Unicode aStopDoubleAngleQuoteEndRo[]
LanguageType getLanguageType(bool bResolveSystem=true) const
const sal_Unicode cNonBreakingSpace
const char sImplSttSkipChars[]
OUString sShareAutoCorrFile
static const AllSettings & GetSettings()
const sal_Unicode aStopSingleQuoteEnd[]
bool FnCorrectCapsLock(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
static TransliterationWrapper & GetIgnoreTranslWrapper()
OUString sShareAutoCorrFile
SvxAutocorrWordList * LoadAutocorrWordList()
const OUString & getBcp47(bool bResolveSystem=true) const
constexpr sal_Unicode cRightSingleAngleQuote
const LanguageTag & getLanguageTag() const
const SvxAutocorrWord * SearchWordsInList(const OUString &rTxt, sal_Int32 &rStt, sal_Int32 nEndPos, SvxAutoCorrDoc &rDoc, LanguageTag &rLang)
std::vector< SvxAutocorrWord > AutocorrWordSetType
const_iterator find(const Value &x) const
constexpr OUStringLiteral pXMLImplAutocorr_ListStr
#define LANGUAGE_UKRAINIAN
bool IsStream(const OUString &rEleName) const
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
const OUString & getQuotationMarkStart() const
#define LANGUAGE_FRENCH_SWISS
#define LANGUAGE_GERMAN_AUSTRIAN
OUString sUserAutoCorrFile
bool IsContained(const OUString &rEleName) const
bool AddCplSttException(const OUString &rNew, LanguageType eLang)
const OUString & GetShort() const
#define LANGUAGE_ENGLISH_NZ
virtual OUString const * GetPrevPara(bool bAtNormalPos)=0
const SvxAutocorrWord * SearchWordsInList(const OUString &rTxt, sal_Int32 &rStt, sal_Int32 nEndPos) const
const SvxAutocorrWordList * GetAutocorrWordList()
const OUString & getQuotationMarkEnd() const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
#define LANGUAGE_HUNGARIAN
static bool IsLowerLetter(sal_Int32 nCharType)
std::optional< SvxAutocorrWord > FindAndRemove(const SvxAutocorrWord *pWord)
void LoadXMLExceptList_Imp(std::unique_ptr< SvStringsISortDtor > &rpLst, const OUString &sStrmName, tools::SvRef< SotStorage > &rStg)
OUString GetAutoCorrFileName(const LanguageTag &rLanguageTag, bool bNewFile=false, bool bTstUserExist=false, bool bUnlocalized=false) const
OUString GetPrevAutoCorrWord(SvxAutoCorrDoc const &rDoc, const OUString &rTxt, sal_Int32 nPos)
#define LANGUAGE_PORTUGUESE
constexpr sal_Unicode cEmDash
void FnCapitalStartSentence(SvxAutoCorrDoc &, const OUString &, bool bNormalPos, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
LanguageTag getLoadedLanguageTag() const
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
virtual bool ChgAutoCorrWord(sal_Int32 &rSttPos, sal_Int32 nEndPos, SvxAutoCorrect &rACorrect, OUString *pPara)=0
void SaveWrdSttExceptList(LanguageType eLang)
CharClass & GetCharClass(LanguageType eLang)
LanguageType eCharClassLang
sal_Unicode GetStartSingleQuote() const
OUString getLanguage() const
static ACFlags GetDefaultFlags()
#define LANGUAGE_GALICIAN
void SaveWrdSttExceptList()
#define DFLT_ESC_AUTO_SUPER
void SetExtension(OUString const &rTheExtension)
#define LANGUAGE_SLOVENIAN
bool MakeCombinedChanges(std::vector< SvxAutocorrWord > &aNewEntries, std::vector< SvxAutocorrWord > &aDeleteEntries)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
#define LANGUAGE_UNDETERMINED
void MakeCombinedChanges(std::vector< SvxAutocorrWord > &aNewEntries, std::vector< SvxAutocorrWord > &aDeleteEntries, LanguageType eLang)
static bool lcl_IsInAsciiArr(const char *pArr, const sal_Unicode c)
#define LANGUAGE_SWEDISH_FINLAND
virtual bool GetLongText(const OUString &rShort, OUString &rLong)
virtual void SetAttr(sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId, SfxPoolItem &)=0
bool IsOLEStorage() const
~SvxAutoCorrectLanguageLists()
virtual void SetSize(sal_uInt64 nNewSize) override
#define LANGUAGE_ENGLISH_CAN
const AutocorrWordSetType & getSortedContent() const
static OUString EncryptBlockName_Imp(const OUString &rName)
const LanguageTag & GetLanguageTag() const
SvxAutoCorrectLanguageLists(SvxAutoCorrect &rParent, const OUString &rShareAutoCorrectFile, const OUString &rUserAutoCorrectFile)
std::map< LanguageTag, std::unique_ptr< SvxAutoCorrectLanguageLists > > m_aLangTable
#define LANGUAGE_ROMANIAN
void FnCapitalStartWord(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
#define LANGUAGE_USER_ARAGONESE
#define LANGUAGE_ENGLISH_JAMAICA
std::unique_ptr< SvStringsISortDtor > pCplStt_ExcptLst
OUString titlecase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
static LanguageType getSystemLanguage()
#define LANGUAGE_CATALAN_VALENCIAN
bool MakeBlocklist_Imp(SotStorage &rStg)
sal_Unicode GetQuote(sal_Unicode cInsChar, bool bSttQuote, LanguageType eLang) const
#define TOOLS_WARN_EXCEPTION(area, stream)
static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker()
static void SaveExceptList_Imp(const SvStringsISortDtor &rLst, const OUString &sStrmName, tools::SvRef< SotStorage > const &rStg, bool bConvert=false)
friend class SvxAutoCorrectLanguageLists
virtual bool Delete(sal_Int32 nStt, sal_Int32 nEnd)=0
constexpr sal_Unicode cLeftDoubleAngleQuote
constexpr sal_uInt16 KEY_CAPSLOCK
void setLanguageTag(const LanguageTag &rLanguageTag)
bool operator()(SvxAutocorrWord const &lhs, SvxAutocorrWord const &rhs) const
tools::SvRef< SotStorageStream > OpenSotStream(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE)
virtual bool ReplaceRange(sal_Int32 nPos, sal_Int32 nLen, const OUString &rTxt)=0
#define LANGUAGE_GERMAN_LIECHTENSTEIN
SvxAutoCorrectLanguageLists & GetLanguageList_(LanguageType eLang)
bool FnAddNonBrkSpace(SvxAutoCorrDoc &, const OUString &, sal_Int32 nEndPos, LanguageType eLang, bool &io_bNbspRunNext)
sal_Int16 getType(const OUString &rStr, sal_Int32 nPos) const
sal_Unicode GetStartDoubleQuote() const
std::map< LanguageTag, sal_Int64 > aLastFileTable
bool AddToWrdSttExceptList(const OUString &rNew)
bool SetProperty(OUString const &rName, css::uno::Any const &rValue)
DECL_LISTENERMULTIPLEXER_END void SAL_CALL inserted(::sal_Int32 ID) override
SVL_DLLPUBLIC OUString FindFirstURLInText(OUString const &rText, sal_Int32 &rBegin, sal_Int32 &rEnd, CharClass const &rCharClass, INetURLObject::EncodeMechanism eMechanism=INetURLObject::EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
sal_Int32 loadDefaultCollator(const css::lang::Locale &rLocale, sal_Int32 nOption)
static LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
void LoadEntry(const OUString &sWrong, const OUString &sRight, bool bOnlyTxt)
bool FnSetINetAttr(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
bool AddToCplSttExceptList(const OUString &rNew)
static std::vector< OUString > GetChunkForAutoText(const OUString &rTxt, sal_Int32 nPos)
#define LANGUAGE_DONTKNOW
static css::uno::Reference< css::embed::XStorage > GetStorageFromURL(const OUString &aURL, sal_Int32 nStorageMode, const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
#define LANGUAGE_ENGLISH_EIRE
constexpr LanguageType primary(LanguageType lt)
constexpr OUStringLiteral pXMLImplCplStt_ExcptLstStr
AutocorrWordSetType maSortedVector
const_iterator end() const
virtual ~SvxAutoCorrect()
static bool IsUpperLetter(sal_Int32 nCharType)
bool PutText(const OUString &rShort, const OUString &rLong)
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
::std::vector< OUString > getFallbackStrings(bool bIncludeFullBcp47) const
#define LANGUAGE_GERMAN_LUXEMBOURG
static bool lcl_IsSymbolChar(CharClass const &rCC, const OUString &rTxt, sal_Int32 nStt, sal_Int32 nEnd)
void SetAutoCorrFlag(ACFlags nFlag, bool bOn=true)
tools::Time aLastCheckTime
void SaveCplSttExceptList(LanguageType eLang)
css::i18n::UnicodeScript getScript(const OUString &rStr, sal_Int32 nPos) const
SvStringsISortDtor * GetCplSttExceptList()
static bool lcl_HasPrecedingChar(std::u16string_view rTxt, sal_Int32 nPos, const sal_Unicode sPrecedingChar, const sal_Unicode *aStopChars)
const sal_Unicode aStopDoubleAngleQuoteStart[]
virtual bool SetINetAttr(sal_Int32 nStt, sal_Int32 nEnd, const OUString &rURL)=0
constexpr OUStringLiteral pXMLImplWrdStt_ExcptLstStr
const_iterator begin() const
const LanguageTag & getLocale()
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
bool AddWrtSttException(const OUString &rNew, LanguageType eLang)
const sal_Unicode aStopSingleQuoteEndRuUa[]
#define LANGUAGE_PORTUGUESE_BRAZILIAN
bool FindInWrdSttExceptList(LanguageType eLang, const OUString &sWord)
const char sImplEndSkipChars[]
virtual bool Insert(sal_Int32 nPos, const OUString &rTxt)=0
static bool NonFieldWordDelim(const sal_Unicode c)
virtual void refreshBlockList(const css::uno::Reference< css::embed::XStorage > &rStg)
tools::Time aModifiedTime
#define SAL_INFO(area, stream)
const OUString & getDoubleQuotationMarkEnd() const
sal_Unicode GetEndSingleQuote() const
#define LANGUAGE_ENGLISH_CARIBBEAN
static bool IsWordDelim(const sal_Unicode c)
Reference< XComponentContext > getProcessComponentContext()
OUString sUserAutoCorrFile
SvStringsISortDtor * GetWrdSttExceptList()
#define LANGUAGE_USER_ASTURIAN
SVL_DLLPUBLIC bool GetModifiedDateTimeOfFile(const OUString &rURL, Date *pDate, tools::Time *pTime)
void DeleteAndDestroyAll()
static CollatorWrapper & GetCollatorWrapper()
static const LanguageTag & GetAppLang()
virtual LanguageType GetLanguage(sal_Int32 nPos) const
void RemoveStream_Imp(const OUString &rName)
virtual bool Replace(sal_Int32 nPos, const OUString &rTxt)=0
std::unique_ptr< CharClass > pCharClass
virtual bool TransliterateRTLWord(sal_Int32 &rSttPos, sal_Int32 nEndPos)=0
#define SAL_WARN(area, stream)
css::uno::Any executeCommand(const OUString &rCommandName, const css::uno::Any &rCommandArgument)
bool FnChgWeightUnderl(SvxAutoCorrDoc &, const OUString &, sal_Int32 nEndPos)
SvStringsISortDtor * LoadCplSttExceptList()
SvxAutoCorrect(const OUString &rShareAutocorrFile, const OUString &rUserAutocorrFile)
static void GeneratePackageName(std::u16string_view rShort, OUString &rPackageName)
const OUString & getDoubleQuotationMarkStart() const
const OUString & GetLong() const
virtual bool PutText(const css::uno::Reference< css::embed::XStorage > &rStg, const OUString &rFileName, const OUString &rShort, SfxObjectShell &, OUString &)
constexpr sal_Unicode cRightDoubleAngleQuote
constexpr sal_Unicode cApostrophe
std::pair< const_iterator, bool > insert(Value &&x)
std::vector< OUString >::size_type size_type
#define LANGUAGE_ROMANIAN_MOLDOVA
#define LANGUAGE_ENGLISH_AUS
static bool lcl_FindAbbreviation(const SvStringsISortDtor *pList, const OUString &sWord)
void DoAutoCorrect(SvxAutoCorrDoc &rDoc, const OUString &rTxt, sal_Int32 nPos, sal_Unicode cInsChar, bool bInsert, bool &io_bNbspRunNext, vcl::Window const *pFrameWin=nullptr)
Execute an AutoCorrect.
#define LANGUAGE_GERMAN_SWISS
bool Remove(const OUString &rEleName)
bool isLetter(const OUString &rStr, sal_Int32 nPos) const
static bool NeedsHardspaceAutocorr(sal_Unicode cChar)
std::vector< OUString >::const_iterator const_iterator
static INetProtocol CompareProtocolScheme(OUString const &rTheAbsURIRef)
bool isSystemLocale() const
static bool lcl_IsUnsupportedUnicodeChar(CharClass const &rCC, const OUString &rTxt, sal_Int32 nStt, sal_Int32 nEnd)
bool anyOf(strong_int v) const
OUString getCountry() const
const SvxAutocorrWord * WordMatches(const SvxAutocorrWord *pFnd, const OUString &rTxt, sal_Int32 &rStt, sal_Int32 nEndPos) const
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)