26#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
27#include <com/sun/star/embed/XStorage.hpp>
28#include <com/sun/star/io/IOException.hpp>
29#include <com/sun/star/io/XStream.hpp>
34#include <osl/diagnose.h>
40#include <com/sun/star/i18n/UnicodeType.hpp>
42#include <com/sun/star/i18n/UnicodeScript.hpp>
43#include <com/sun/star/i18n/OrdinalSuffix.hpp>
49#include <editeng/editids.hrc>
59#include <com/sun/star/xml/sax/InputSource.hpp>
60#include <com/sun/star/xml/sax/FastParser.hpp>
61#include <com/sun/star/xml/sax/Writer.hpp>
62#include <com/sun/star/xml/sax/SAXParseException.hpp>
68#include <com/sun/star/ucb/ContentCreationException.hpp>
69#include <com/sun/star/ucb/XCommandEnvironment.hpp>
70#include <com/sun/star/ucb/TransferInfo.hpp>
71#include <com/sun/star/ucb/NameClash.hpp>
74#include <unordered_map>
75#include <rtl/character.hxx>
89 ExclamationMark = 0x02,
106constexpr std::u16string_view
108 sImplSttSkipChars =
u"\"'([{\u2018\u2019\u201a\u201b\u201c\u201d\u201e\u201f\u0083\u0084\u0089\u0091\u0092\u0093\u0094",
110 sImplEndSkipChars =
u"\"')]}\u2018\u2019\u201a\u201b\u201c\u201d\u201e\u201f\u0083\u0084\u0089\u0091\u0092\u0093\u0094";
116 return ' ' == c ||
'\t' == c || 0x0a == c ||
129 ( css::i18n::KCharacterType::LOWER & nCharType);
135 ( css::i18n::KCharacterType::UPPER & nCharType);
139 sal_Int32 nStt, sal_Int32 nEnd )
141 for( ; nStt < nEnd; ++nStt )
143 css::i18n::UnicodeScript nScript = rCC.
getScript( rTxt, nStt );
146 case css::i18n::UnicodeScript_kCJKRadicalsSupplement:
147 case css::i18n::UnicodeScript_kHangulJamo:
148 case css::i18n::UnicodeScript_kCJKSymbolPunctuation:
149 case css::i18n::UnicodeScript_kHiragana:
150 case css::i18n::UnicodeScript_kKatakana:
151 case css::i18n::UnicodeScript_kHangulCompatibilityJamo:
152 case css::i18n::UnicodeScript_kEnclosedCJKLetterMonth:
153 case css::i18n::UnicodeScript_kCJKCompatibility:
154 case css::i18n::UnicodeScript_kCJKUnifiedIdeographsExtensionA:
155 case css::i18n::UnicodeScript_kCJKUnifiedIdeograph:
156 case css::i18n::UnicodeScript_kHangulSyllable:
157 case css::i18n::UnicodeScript_kCJKCompatibilityIdeograph:
158 case css::i18n::UnicodeScript_kHalfwidthFullwidthForm:
167 sal_Int32 nStt, sal_Int32 nEnd )
169 for( ; nStt < nEnd; ++nStt )
171 if( css::i18n::UnicodeType::PRIVATE_USE == rCC.
getType( rTxt, nStt ))
177static bool lcl_IsInArr(std::u16string_view arr,
const sal_uInt32 c)
179 return std::any_of(
arr.begin(),
arr.end(), [c](
const auto c1) { return c1 == c; });
217 static std::unique_ptr<LocaleDataWrapper> xLclDtWrp;
219 if (!xLclDtWrp || xLclDtWrp->getLoadedLanguageTag() != aLcl)
225 static int bIsInit = 0;
226 static TransliterationWrapper aWrp( ::comphelper::getProcessComponentContext(),
227 TransliterationFlags::IGNORE_KANA |
228 TransliterationFlags::IGNORE_WIDTH );
231 aWrp.loadModuleIfNeeded(
GetAppLang().getLanguageType() );
249 return cChar ==
'\0' || cChar ==
'\t' || cChar == 0x0a ||
250 cChar ==
' ' || cChar ==
'\'' || cChar ==
'\"' ||
251 cChar ==
'*' || cChar ==
'_' || cChar ==
'%' ||
252 cChar ==
'.' || cChar ==
',' || cChar ==
';' ||
253 cChar ==
':' || cChar ==
'?' || cChar ==
'!' ||
254 cChar ==
'<' || cChar ==
'>' ||
255 cChar ==
'/' || cChar ==
'-';
268 return cChar ==
'%' || cChar ==
';' || cChar ==
':' || cChar ==
'?' || cChar ==
'!' ||
324 OUString aUserAutocorrFile )
325 : sShareAutoCorrFile(
std::move( aShareAutocorrFile ))
326 , sUserAutoCorrFile(
std::move( aUserAutocorrFile ))
337 : sShareAutoCorrFile( rCpy.sShareAutoCorrFile )
338 , sUserAutoCorrFile( rCpy.sUserAutoCorrFile )
339 , aSwFlags( rCpy.aSwFlags )
340 , eCharClassLang(rCpy.eCharClassLang)
342 , cStartDQuote( rCpy.cStartDQuote )
343 , cEndDQuote( rCpy.cEndDQuote )
344 , cStartSQuote( rCpy.cStartSQuote )
345 , cEndSQuote( rCpy.cEndSQuote )
380 sal_Int32 nSttPos, sal_Int32 nEndPos,
387 for( ; nSttPos < nEndPos; ++nSttPos )
390 for( ; nSttPos < nEndPos; --nEndPos )
397 std::deque<sal_Int32> aDelimiters;
401 aDelimiters.push_back(nSttPos);
404 for (sal_Int32
n = nSttPos;
n < nEndPos; ++
n)
406 if (IsCompoundWordDelimChar(rTxt[
n ]))
408 aDelimiters.push_back(
n + 1 );
417 if (!IsCompoundWordDelimChar(rTxt[nEndPos-1]))
418 aDelimiters.push_back(nEndPos);
422 for (
size_t nI = 0; nI < aDelimiters.size() - 1; ++nI)
424 nSttPos = aDelimiters[nI];
425 nEndPos = aDelimiters[nI + 1];
427 if( nSttPos+2 < nEndPos &&
433 0x1 != rTxt[ nSttPos ] && 0x2 != rTxt[ nSttPos ])
436 OUString sWord( rTxt.copy( nSttPos - 1, nEndPos - nSttPos + 1 ));
440 css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller =
442 if( xSpeller->hasLanguage(
static_cast<sal_uInt16
>(eLang)) )
444 Sequence< css::beans::PropertyValue > aEmptySeq;
445 if (xSpeller->isValid(sWord,
static_cast<sal_uInt16
>(eLang), aEmptySeq))
451 OUString sChar = rCC.
lowercase( OUString(cSave) );
452 if( sChar[0] != cSave && rDoc.
ReplaceRange( nSttPos, 1, sChar ))
465 sal_Int32 nSttPos, sal_Int32 nEndPos,
481 for (; nSttPos < nEndPos; ++nSttPos)
484 for (; nSttPos < nEndPos; --nEndPos)
490 sal_Int32 nNumEnd = nEndPos;
491 bool bFoundEnd =
false;
492 bool isValidNumber =
true;
493 sal_Int32
i = nEndPos;
497 bool isDigit = rCC.
isDigit(rTxt,
i);
499 isValidNumber &= (isDigit || !rCC.
isLetter(rTxt,
i));
501 if (isDigit && !bFoundEnd)
508 if (bFoundEnd && isValidNumber) {
509 sal_Int32 nNum =
o3tl::toInt32(rTxt.subView(nSttPos, nNumEnd - nSttPos + 1));
512 uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix
515 const uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.
getLanguageTag().
getLocale());
516 for (OUString
const &
sSuffix : aSuffixes)
518 std::u16string_view sEnd = rTxt.subView(nNumEnd + 1, nEndPos - nNumEnd - 1);
528 rDoc.
SetAttr(nNumEnd + 1, nEndPos,
529 SID_ATTR_CHAR_ESCAPEMENT,
543 sal_Int32 nSttPos, sal_Int32 nEndPos,
554 OUString aOrigTxt = rTxt;
555 sal_Int32 nFirstReplacementTextLengthChange = 0;
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 );
585 nFirstReplacementTextLengthChange = -1;
591 else if( 3 < nSttPos &&
592 ' ' == rTxt[ nSttPos-1 ] &&
593 '-' == rTxt[ nSttPos-2 ])
595 sal_Int32
n, nLen = 1, nTmpPos = nSttPos - 2;
596 if(
'-' == ( cCh = rTxt[ nTmpPos-1 ]) )
600 cCh = rTxt[ nTmpPos-1 ];
619 rDoc.
Delete( nTmpPos, nTmpPos + nLen );
621 nFirstReplacementTextLengthChange = 1 - nLen;
633 if( 4 <= nEndPos - nSttPos )
635 std::u16string_view sTmpView( aOrigTxt.subView( nSttPos, nEndPos - nSttPos ) );
636 size_t nFndPos = sTmpView.find(
u"--");
637 if (nFndPos > 0 && nFndPos < sTmpView.size() - 2)
643 sal_Int32 nStart = nSttPos + nFndPos;
644 sal_uInt32 chStart = aOrigTxt.iterateCodePoints(&nStart, -1);
645 OUString sStart(&chStart, 1);
649 sal_Int32 nEnd = nSttPos + nFndPos + 2;
650 sal_uInt32 chEnd = aOrigTxt.iterateCodePoints(&nEnd, 1);
651 OUString sEnd(&chEnd, 1);
655 nSttPos = nSttPos + nFndPos + nFirstReplacementTextLengthChange;
656 rDoc.
Delete(nSttPos, nSttPos + 2);
682 OUString allChars =
":;?!%";
683 OUString chars( allChars );
688 bool bHasSpace = chars.indexOf( cChar ) != -1;
689 bool bIsSpecial = allChars.indexOf( cChar ) != -1;
693 sal_Int32 nSttWdPos = nEndPos;
694 bool bWasWordDelim =
false;
704 size_t nIndex = nSttWdPos + (bWasWordDelim ? 1 : 0);
705 size_t nProtocolLen = nEndPos - nSttWdPos + 1;
706 if (
nIndex + nProtocolLen <= rTxt.size())
713 size_t nStrPos = rTxt.find(
u"://", nSttWdPos + 1 );
714 if ( nStrPos == std::u16string_view::npos && nEndPos > 0 )
718 if ( ( chars.indexOf( cPrevChar ) == -1 ) && cPrevChar !=
'\t' )
721 sal_Int32
nPos = nEndPos - 1;
724 if (
nPos == 0 )
break;
726 cPrevChar = rTxt[
nPos ];
730 if ( nEndPos -
nPos > 0 )
736 io_bNbspRunNext =
true;
739 else if ( chars.indexOf( cPrevChar ) != -1 )
740 io_bNbspRunNext =
true;
743 else if ( cChar ==
'/' && nEndPos > 1 &&
static_cast<sal_Int32
>(rTxt.size()) > (nEndPos - 1) )
750 rDoc.
Delete( nEndPos - 2, nEndPos - 1 );
761 sal_Int32 nSttPos, sal_Int32 nEndPos,
766 bool bRet = !sURL.isEmpty();
774 sal_Int32 nSttPos, sal_Int32 nEndPos,
778 bool bRet = !sURL.isEmpty();
793 if( ++nEndPos != rTxt.getLength() &&
799 bool bAlphaNum =
false;
800 sal_Int32
nPos = nEndPos;
801 sal_Int32 nFndPos = -1;
814 if( bAlphaNum &&
nPos+1 < nEndPos && ( !
nPos ||
835 rDoc.
Delete( nEndPos, nEndPos + 1 );
836 rDoc.
Delete( nFndPos, nFndPos + 1 );
839 if(
'*' == cInsChar )
842 rDoc.
SetAttr( nFndPos, nEndPos - 1,
843 SID_ATTR_CHAR_WEIGHT,
846 else if(
'/' == cInsChar )
849 rDoc.
SetAttr( nFndPos, nEndPos - 1,
850 SID_ATTR_CHAR_POSTURE,
853 else if(
'-' == cInsChar )
856 rDoc.
SetAttr( nFndPos, nEndPos - 1,
857 SID_ATTR_CHAR_STRIKEOUT,
863 rDoc.
SetAttr( nFndPos, nEndPos - 1,
864 SID_ATTR_CHAR_UNDERLINE,
869 return -1 != nFndPos;
874 const OUString& rTxt,
bool bNormalPos,
875 sal_Int32 nSttPos, sal_Int32 nEndPos,
879 if( rTxt.isEmpty() || nEndPos <= nSttPos )
883 OUString aText( rTxt );
885 *pStr = pStart + nEndPos,
889 bool bAtStart =
false;
892 if (rCC.
isLetter(aText, pStr - pStart))
898 else if (pWordStt && !rCC.
isDigit(aText, pStr - pStart))
901 pWordStt - 1 == pStr &&
903 (pStart + 1) <= pStr &&
904 rCC.
isLetter(aText, pStr-1 - pStart))
909 bAtStart = (pStart == pStr);
910 }
while( !bAtStart );
916 if (rCC.
isDigit(aText, pStr - pStart))
924 sal_Int32
nIndex = pWordStt - pStart;
925 sal_Int32 nProtocolLen = pDelim - pWordStt + 1;
926 if (
nIndex + nProtocolLen <= rTxt.getLength())
932 if (0x1 == *pWordStt || 0x2 == *pWordStt)
936 if( *pDelim && 2 >= pDelim - pWordStt &&
941 if ( 1 == pDelim - pWordStt && 0x03B1 <= *pWordStt && *pWordStt <= 0x03C9 && eLang !=
LANGUAGE_GREEK )
950 bAtStart = (pStart == pStr--);
957 else if ( 0x3002 != *pStr && 0xFF0E != *pStr && 0xFF01 != *pStr &&
970 OUString
const*
const pPrevPara = rDoc.
GetPrevPara(bNormalPos);
974 OUString sChar( *pWordStt );
976 if (sChar != OUStringChar(*pWordStt))
983 pStart = aText.getStr();
984 pStr = pStart + aText.getLength();
990 bAtStart = (pStart == pStr);
991 }
while( !bAtStart );
1000 bool bContinue =
true;
1001 Flags nFlag = Flags::NONE;
1011 if (pStr >= pStart + 2 && *(pStr - 2) ==
'.')
1020 if (nFlag & Flags::FullStop)
1022 nFlag |= Flags::FullStop;
1029 if (nFlag & Flags::ExclamationMark)
1031 nFlag |= Flags::ExclamationMark;
1037 if (nFlag & Flags::QuestionMark)
1039 nFlag |= Flags::QuestionMark;
1043 if (nFlag == Flags::NONE)
1050 if (bContinue && pStr-- == pStart)
1054 }
while (bContinue);
1055 if (Flags::FullStop != nFlag)
1056 pExceptStt =
nullptr;
1059 if( 2 > ( pStr - pStart ) )
1064 bool bValid =
false, bAlphaFnd =
false;
1068 if( rCC.
isDigit( aText, pTmpStr - pStart ) )
1073 else if( rCC.
isLetter( aText, pTmpStr - pStart ) )
1086 if( pTmpStr == pStart )
1096 bool bNumericOnly =
'0' <= *(pStr+1) && *(pStr+1) <=
'9';
1101 if( bNumericOnly && rCC.
isLetter( aText, pStr - pStart ) )
1102 bNumericOnly =
false;
1104 if( pStart == pStr )
1121 sWord = OUString(pStr, pExceptStt - pStr + 1);
1127 OUString sTmp( sWord );
1128 while( !sTmp.isEmpty() &&
1130 sTmp = sTmp.copy(1);
1134 sal_Int32 nLen = sTmp.getLength();
1137 if( nLen + 1 < sTmp.getLength() )
1138 sTmp = sTmp.copy( 0, nLen + 1 );
1140 if( !sTmp.isEmpty() && sTmp.getLength() != sWord.getLength() &&
1150 nSttPos = pWordStt - rTxt.getStr();
1151 OUString sChar = rCC.
titlecase(OUString(cSave));
1152 bool bRet = sChar[0] != cSave && rDoc.
ReplaceRange( nSttPos, 1, sChar );
1161 sal_Int32 nSttPos, sal_Int32 nEndPos,
1164 if (nEndPos - nSttPos < 2)
1177 OUStringBuffer aConverted;
1178 aConverted.append( rCC.
uppercase(OUString(rTxt[nSttPos])) );
1179 aConverted.append( rCC.
lowercase(OUString(rTxt[nSttPos+1])) );
1185 for( sal_Int32
i = nSttPos+2;
i < nEndPos; ++
i )
1193 aConverted.append( rCC.
lowercase(OUString(rTxt[
i])) );
1196 aConverted.append( rTxt[
i] );
1200 rDoc.
Delete(nSttPos, nEndPos);
1201 rDoc.
Insert(nSttPos, aConverted.makeStringAndClear());
1213 : (
'\"' == cInsChar
1224 OUString sRet( bSttQuote
1225 ? (
'\"' == cInsChar
1228 : (
'\"' == cInsChar
1231 cRet = !sRet.isEmpty() ? sRet[0] : cInsChar;
1247 bool bLeftQuote =
'\"' == cInsChar &&
1251 cRet = (
'<' == cInsChar || bLeftQuote )
1258 cRet =
GetQuote( cInsChar, bSttQuote, eLang );
1260 OUString sChg( cInsChar );
1262 rDoc.
Insert( nInsPos, sChg );
1264 rDoc.
Replace( nInsPos, sChg );
1266 sChg = OUString(cRet);
1278 rDoc.
Delete( nInsPos-1, nInsPos);
1282 rDoc.
Replace( nInsPos, sChg );
1286 rDoc.
Replace( nInsPos-1,
"I" );
1295 OUString sRet(cRet);
1297 if(
'\"' == cInsChar )
1317 cTmpChar = rTxt[ --
nPos ];
1318 if ( cTmpChar == sPrecedingChar )
1321 if ( cTmpChar == sStopChar )
1324 for (
const sal_Unicode* pCh = aStopChars; *pCh; ++pCh )
1325 if ( cTmpChar == *pCh )
1328 }
while (
nPos > 0 );
1336 bool bInsert,
bool& io_bNbspRunNext,
vcl::Window const * pFrameWin )
1338 bool bIsNextRun = io_bNbspRunNext;
1339 io_bNbspRunNext =
false;
1345 if( nInsPos &&
' ' == cChar &&
1347 ' ' == rTxt[ nInsPos - 1 ])
1352 bool bSingle =
'\'' == cChar;
1353 bool bIsReplaceQuote =
1356 if( bIsReplaceQuote )
1358 bool bSttQuote = !nInsPos;
1369 if ( !bSingle && !bSttQuote && cPrev ==
cApostrophe &&
1371 ( ( ( nInsPos == 2 || ( nInsPos > 2 &&
IsWordDelim( rTxt[ nInsPos-3 ] ) ) ) &&
1373 OUString(
"cdjlnmtsCDJLNMTS").indexOf( rTxt[ nInsPos-2 ] ) > -1 ) ||
1374 ( ( nInsPos == 3 || (nInsPos > 3 &&
IsWordDelim( rTxt[ nInsPos-4 ] ) ) ) &&
1376 ( rTxt[ nInsPos-2 ] ==
'u' || rTxt[ nInsPos-2 ] ==
'U' ) &&
1377 ( rTxt[ nInsPos-3 ] ==
'q' || rTxt[ nInsPos-3 ] ==
'Q' ) ) ) )
1382 else if ( bSingle && ( cPrev ==
'i' ) &&
1384 ( nInsPos == 1 ||
IsWordDelim( rTxt[ nInsPos-2 ] ) ) )
1389 else if ( !bSingle && nInsPos &&
1408 else if ( bSingle && nInsPos && !bSttQuote &&
1425 if ( !sStartChar || !sEndChar ) {
1433 if ( rCC.
isLetter(rTxt, nInsPos-1) )
1439 else if ( bSingle && nInsPos && !bSttQuote &&
1466 (
'<' == cChar ||
'>' == cChar) &&
1467 nInsPos > 0 && cChar == rTxt[ nInsPos-1 ] )
1496 rDoc.
Insert( nInsPos, OUString(cChar) );
1498 rDoc.
Replace( nInsPos, OUString(cChar) );
1515 sal_Int32
nPos = nInsPos - 1;
1516 bool bContinue =
true;
1537 sal_Int32
nPos = nInsPos - 1;
1543 if ((
'*' == cChar ||
'_' == cChar ||
'/' == cChar ||
'-' == cChar) && (
nPos+1 < rTxt.getLength()))
1557 sal_Int32 nCapLttrPos =
nPos+1;
1583 sal_Int32 nCapLttrPos1 = nCapLttrPos, nInsPos1 = nInsPos;
1584 while( nCapLttrPos1 < nInsPos &&
1588 while( nCapLttrPos1 < nInsPos1 && nInsPos1 &&
1593 if( (nCapLttrPos1 != nCapLttrPos || nInsPos1 != nInsPos ) &&
1594 nCapLttrPos1 < nInsPos1 &&
1598 nCapLttrPos = nCapLttrPos1;
1604 if( !aPara.isEmpty() )
1606 sal_Int32 nEnd = nCapLttrPos;
1607 while( nEnd < aPara.getLength() &&
1615 nCapLttrPos, nEnd, eLang );
1637 (
'-' != cChar ||
'E' != rtl::toAsciiUpperCase(rTxt[nInsPos-1]) ||
'0' > rTxt[nInsPos-2] ||
'9' < rTxt[nInsPos-2] ) &&
1640 (
' ' == cChar ||
'\t' == cChar || 0x0a == cChar || !cChar ) &&
1641 FnSetINetAttr( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) ||
1643 (
' ' == cChar ||
'\t' == cChar || 0x0a == cChar || !cChar ) &&
1644 FnSetDOIAttr( rDoc, rTxt, nCapLttrPos, nInsPos, eLang ) ) )
1648 bool bLockKeyOn = pFrameWin && (pFrameWin->
GetIndicatorState() & KeyIndicatorState::CAPSLOCK);
1661 if( !bUnsupported &&
1668 if( !bUnsupported &&
1696 iter->second.SaveCplSttExceptList();
1699 SAL_WARN(
"editeng",
"Save an empty list? ");
1707 iter->second.SaveWordStartExceptList();
1710 SAL_WARN(
"editeng",
"Save an empty list? ");
1722 pLists = &iter->second;
1728 pLists = &iter->second;
1730 pLists = &
m_aLangTable.find(aLangTagUndetermined)->second;
1732 OSL_ENSURE(pLists,
"No auto correction data");
1744 pLists = &iter->second;
1750 pLists = &iter->second;
1752 pLists = &
m_aLangTable.find(aLangTagUndetermined)->second;
1754 OSL_ENSURE(pLists,
"No auto correction file!");
1765 sal_Int32 nEnd =
nPos;
1768 if( (
nPos < rTxt.getLength() &&
1778 sal_Int32 nCapLttrPos =
nPos+1;
1783 if( ++nCapLttrPos >= nEnd )
1786 if( 3 > nEnd - nCapLttrPos )
1796 sRet = rTxt.copy( nCapLttrPos, nEnd - nCapLttrPos );
1802 const sal_Int32 nPos)
1804 constexpr sal_Int32 nMinLen = 3;
1805 constexpr sal_Int32 nMaxLen = 9;
1806 std::vector<OUString> aRes;
1807 if (
nPos >= nMinLen)
1809 sal_Int32 nBegin = std::max<sal_Int32>(
nPos - nMaxLen, 0);
1816 if (nBegin + nMinLen <=
nPos)
1818 OUString sRes( rTxt.substr(nBegin,
nPos - nBegin) );
1819 aRes.push_back(sRes);
1820 bool bLastStartedWithDelim =
IsWordDelim(sRes[0]);
1821 for (sal_Int32
i = 1;
i <= sRes.getLength() - nMinLen; ++
i)
1823 bool bAdd = bLastStartedWithDelim;
1825 bAdd = bAdd || bLastStartedWithDelim;
1827 aRes.push_back(sRes.copy(
i));
1839 OUString sShareDirFile( sUserDirFile );
1847 (nLastCheckTime.
SetTime(nFndPos->second), nLastCheckTime < nAktTime) &&
1848 nAktTime - nLastCheckTime < nMinTime)
1854 sShareDirFile = sUserDirFile;
1855 auto itBool =
m_aLangTable.emplace(std::piecewise_construct,
1856 std::forward_as_tuple(rLanguageTag),
1857 std::forward_as_tuple(*
this, sShareDirFile, sUserDirFile));
1858 pLists = &itBool.first->second;
1869 ( sShareDirFile = sUserDirFile, bNewFile )
1872 auto itBool =
m_aLangTable.emplace(std::piecewise_construct,
1873 std::forward_as_tuple(rLanguageTag),
1874 std::forward_as_tuple(*
this, sShareDirFile, sUserDirFile));
1875 pLists = &itBool.first->second;
1879 else if( !bNewFile )
1883 return pLists !=
nullptr;
1892 return iter->second.PutText(rShort, rLong);
1894 return m_aLangTable.find(aLanguageTag)->second.PutText(rShort, rLong);
1899 std::vector<SvxAutocorrWord>& aDeleteEntries,
1906 iter->second.MakeCombinedChanges( aNewEntries, aDeleteEntries );
1910 m_aLangTable.find( aLanguageTag )->second.MakeCombinedChanges( aNewEntries, aDeleteEntries );
1934 OUStringBuffer
aName;
1935 aName.append(
'#').append(rName);
1936 for (
size_t nLen = rName.size(),
nPos = 1;
nPos < nLen; ++
nPos)
1941 return aName.makeStringAndClear();
1948 OUStringBuffer
aBuf(OStringToOUString(sByte, RTL_TEXTENCODING_ASCII_US));
1966 rPackageName =
aBuf.makeStringAndClear();
1971 sal_Int32& rStt, sal_Int32 nEndPos)
1979 std::u16string_view rTxt, sal_Int32& rStt, sal_Int32 nEndPos,
1999 rLang = aLanguageTag;
2020 rLang = aLanguageTag;
2033 rLang = aLanguageTag;
2041 const OUString& sWord )
2054 if(rList.GetWordStartExceptList()->find(sWord) != rList.GetWordStartExceptList()->end() )
2068 if(rList.GetWordStartExceptList()->find(sWord) != rList.GetWordStartExceptList()->end() )
2077 if(rList.GetWordStartExceptList()->find(sWord) != rList.GetWordStartExceptList()->end() )
2087 if( nPos < pList->
size() )
2089 OUString sLowerWord(sWord.toAsciiLowerCase());
2093 sAbr = (*pList)[
n ];
2097 if( 2 < sAbr.getLength() && sAbr.getLength() - 1 <= sWord.getLength() )
2099 OUString sLowerAbk(sAbr.toAsciiLowerCase());
2100 for (sal_Int32
i = sLowerAbk.getLength(), ii = sLowerWord.getLength();
i;)
2105 if( sLowerAbk[
i] != sLowerWord[--ii])
2111 OSL_ENSURE( !(
nPos &&
'~' == (*pList)[ --
nPos ][ 0 ] ),
2112 "Wrongly sorted exception list?" );
2117 const OUString& sWord,
bool bAbbreviation)
2160 bool bNewFile,
bool bTst,
bool bUnlocalized )
const
2162 OUString sRet, sExt( rLanguageTag.
getBcp47() );
2167 if (!vecFallBackStrings.empty())
2168 sExt = vecFallBackStrings[0];
2171 sExt =
"_" + sExt +
".dat";
2188 OUString aShareAutoCorrectFile,
2189 OUString aUserAutoCorrectFile)
2190: sShareAutoCorrFile(
std::move( aShareAutoCorrectFile )),
2191 sUserAutoCorrFile(
std::move( aUserAutoCorrectFile )),
2195 rAutoCorrect(rParent),
2214 if( nAktTime > nMinTime )
2218 &aTstDate, &aTstTime ) &&
2243 std::unique_ptr<SvStringsISortDtor>& rpLst,
2244 const OUString& sStrmName,
2253 if( rStg.
is() && rStg->IsStream( sStrmName ) )
2256 ( StreamMode::READ | StreamMode::SHARE_DENYWRITE | StreamMode::NOCREATE ) );
2265 uno::Reference< uno::XComponentContext > xContext =
2268 xml::sax::InputSource aParserInput;
2269 aParserInput.sSystemId = sStrmName;
2272 xStrm->SetBufferSize( 8 * 1024 );
2279 uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create( xContext );
2281 xParser->setFastDocumentHandler( xFilter );
2283 xParser->setTokenHandler( xTokenHandler );
2288 xParser->parseStream( aParserInput );
2290 catch(
const xml::sax::SAXParseException& )
2294 catch(
const xml::sax::SAXException& )
2298 catch(
const io::IOException& )
2315 const OUString& sStrmName,
2324 rStg->Remove( sStrmName );
2330 ( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) );
2333 xStrm->SetSize( 0 );
2334 xStrm->SetBufferSize( 8192 );
2335 xStrm->SetProperty(
"MediaType",
Any(OUString(
"text/xml" )) );
2338 uno::Reference< uno::XComponentContext > xContext =
2341 uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
2343 xWriter->setOutputStream(xOut);
2345 uno::Reference < xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
2359 rStg->Remove( sStrmName );
2378 uno::Reference < io::XStream > xStrm = xStg->openStreamElement(
pXMLImplAutocorr_ListStr, embed::ElementModes::READ );
2381 xml::sax::InputSource aParserInput;
2383 aParserInput.aInputStream = xStrm->getInputStream();
2386 uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
2387 SAL_INFO(
"editeng",
"AutoCorrect Import" );
2392 xParser->setFastDocumentHandler( xFilter );
2394 xParser->setTokenHandler(xTokenHandler);
2397 xParser->parseStream( aParserInput );
2399 catch (
const uno::Exception& )
2419 OSL_ENSURE(
false,
"No valid list" );
2434 OSL_ENSURE(
false,
"No valid list" );
2490 catch (
const css::ucb::ContentCreationException&)
2519 catch (
const css::ucb::ContentCreationException &)
2547 OSL_ENSURE(
false,
"No valid list" );
2561 xStg->IsStream( rName ) )
2563 xStg->Remove( rName );
2577 bool bError =
false, bConvert =
false, bCopy =
false;
2597 bCopy = bConvert =
true;
2604 sal_Int32 nSlashPos = sMain.lastIndexOf(
'/');
2605 sMain = sMain.copy(0, nSlashPos);
2608 aInfo.NameClash = NameClash::OVERWRITE;
2611 aInfo.MoveData =
false;
2619 if (bConvert && !bError)
2624 if( xSrcStg.
is() && xDstStg.
is() )
2626 std::unique_ptr<SvStringsISortDtor> pTmpWordList;
2634 pTmpWordList.reset();
2644 pTmpWordList->clear();
2661 else if( bCopy && !bError )
2671 ( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) );
2674 refList->SetSize( 0 );
2675 refList->SetBufferSize( 8192 );
2676 refList->SetProperty(
"MediaType",
Any(OUString(
"text/xml" )) );
2678 uno::Reference< uno::XComponentContext > xContext =
2681 uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
2683 xWriter->setOutputStream(xOut);
2723 bool bRet = xStorage.
is() &&
ERRCODE_NONE == xStorage->GetError();
2729 std::optional<SvxAutocorrWord> xFoundEntry =
pAutocorr_List->FindAndRemove( &aWordToDelete );
2732 if( !xFoundEntry->IsTextOnly() )
2734 OUString
aName( aWordToDelete.GetShort() );
2735 if (xStorage->IsOLEStorage())
2740 if( xStorage->IsContained(
aName ) )
2742 xStorage->Remove(
aName );
2743 bRet = xStorage->Commit();
2751 SvxAutocorrWord aWordToAdd(aNewEntrie.GetShort(), aNewEntrie.GetLong(),
true );
2752 std::optional<SvxAutocorrWord> xRemoved =
pAutocorr_List->FindAndRemove( &aWordToAdd );
2755 if( !xRemoved->IsTextOnly() )
2758 OUString sStorageName( aWordToAdd.
GetShort() );
2759 if (xStorage->IsOLEStorage())
2764 if( xStorage->IsContained( sStorageName ) )
2765 xStorage->Remove( sStorageName );
2798 std::optional<SvxAutocorrWord> xRemove =
pAutocorr_List->FindAndRemove( &aNew );
2801 if( !xRemove->IsTextOnly() )
2804 OUString sStgNm( rShort );
2805 if (xStg->IsOLEStorage())
2810 if( xStg->IsContained( sStgNm ) )
2811 xStg->Remove( sStgNm );
2853 catch (
const uno::Exception& )
2870typedef std::unordered_map<OUString, SvxAutocorrWord> AutocorrWordHashType;
2897 mpImpl->DeleteAndDestroyAll();
2903 if (
mpImpl->maSortedVector.empty() )
2905 OUString aShort = aWord.
GetShort();
2906 auto [it,
inserted] =
mpImpl->maHash.emplace( std::move(aShort), std::move(aWord) );
2908 return &(it->second);
2917 it =
mpImpl->maSortedVector.insert(it, std::move(aWord));
2931 return mpImpl->maHash.empty() &&
mpImpl->maSortedVector.empty();
2937 if (
mpImpl->maSortedVector.empty() )
2939 AutocorrWordHashType::iterator it =
mpImpl->maHash.find( pWord->
GetShort() );
2940 if( it !=
mpImpl->maHash.end() )
2943 mpImpl->maHash.erase (it);
2953 mpImpl->maSortedVector.erase (it);
2957 return std::optional<SvxAutocorrWord>();
2964 if (
mpImpl->maSortedVector.empty() )
2966 std::vector<SvxAutocorrWord> tmp;
2967 tmp.reserve(
mpImpl->maHash.size());
2968 for (
auto & rPair :
mpImpl->maHash)
2969 tmp.emplace_back(std::move(rPair.second));
2973 std::sort(tmp.begin(), tmp.end(),
2976 return lhs.GetShort() < rhs.GetShort();
2982 mpImpl->maSortedVector = std::move(tmp);
2984 return mpImpl->maSortedVector;
2988 std::u16string_view rTxt,
2990 sal_Int32 nEndPos)
const
2992 const OUString& rChk = pFnd->
GetShort();
2994 sal_Int32 left_wildcard = rChk.startsWith(
".*" ) ? 2 : 0;
2995 sal_Int32 right_wildcard = rChk.endsWith(
".*" ) ? 2 : 0;
2996 assert(nEndPos >= 0);
2997 size_t nSttWdPos = nEndPos;
3000 bool bColonNameColon =
static_cast<sal_Int32
>(rTxt.size()) > nEndPos &&
3001 rTxt[nEndPos] ==
':' && rChk[0] ==
':' && rChk.endsWith(
":");
3002 if ( nEndPos + (bColonNameColon ? 1 : 0) < rChk.getLength() - left_wildcard - right_wildcard )
3005 bool bWasWordDelim =
false;
3006 sal_Int32 nCalcStt = nEndPos - rChk.getLength() + left_wildcard;
3007 if (bColonNameColon)
3009 if( !right_wildcard && ( !nCalcStt || nCalcStt == rStt || left_wildcard || bColonNameColon ||
3010 ( nCalcStt < rStt &&
3014 OUString sWord( rTxt.substr(nCalcStt, rChk.getLength() - left_wildcard) );
3015 if( (!left_wildcard && rCmp.isEqual( rChk, sWord )) || (left_wildcard && rCmp.isEqual( rChk.copy(left_wildcard), sWord) ))
3021 if (
static_cast<sal_Int32
>(rTxt.size()) > nEndPos && rTxt[nEndPos] ==
'/' && rChk.indexOf(
'/') != -1)
3026 while( rStt && !(bWasWordDelim =
IsWordDelim( rTxt[ --rStt ])))
3028 if (bWasWordDelim) rStt++;
3029 OUString left_pattern( rTxt.substr(rStt, nEndPos - rStt - rChk.getLength() + left_wildcard) );
3031 left_pattern += (left_pattern.getLength() == 0 && pFnd->
GetLong()[0] == 0x20) ? pFnd->
GetLong().subView(1) : pFnd->
GetLong();
3037 if ( right_wildcard )
3040 OUString sTmp( rChk.copy( left_wildcard, rChk.getLength() - left_wildcard - right_wildcard ) );
3044 while( nSttWdPos && !(bWasWordDelim =
IsWordDelim( rTxt[ --nSttWdPos ])))
3047 size_t nFndPos = std::u16string_view::npos;
3049 nFndPos = rTxt.find( sTmp, nFndPos + 1);
3050 if (nFndPos == std::u16string_view::npos)
3052 not_suffix = bWasWordDelim && (nSttWdPos >= (nFndPos + sTmp.getLength()));
3053 }
while ( (!left_wildcard && nFndPos && !
IsWordDelim( rTxt[ nFndPos - 1 ])) || not_suffix );
3055 if ( nFndPos != std::u16string_view::npos )
3057 sal_Int32 extra_repl =
static_cast<sal_Int32
>(nFndPos) + sTmp.getLength() > nEndPos ? 1: 0;
3059 if ( left_wildcard )
3062 while( nFndPos && !(bWasWordDelim =
IsWordDelim( rTxt[ --nFndPos ])))
3064 if (bWasWordDelim) nFndPos++;
3066 if (nEndPos + extra_repl <=
static_cast<sal_Int32
>(nFndPos))
3071 OUString aShort( rTxt.substr(nFndPos, nEndPos - nFndPos + extra_repl) );
3075 if ( !left_wildcard )
3077 sal_Int32 siz = nEndPos - nFndPos - sTmp.getLength();
3078 aLong = pFnd->
GetLong() + (siz > 0 ? rTxt.substr(nFndPos + sTmp.getLength(), siz) :
u"");
3082 nSttWdPos = rTxt.find( sTmp, nFndPos);
3083 if (nSttWdPos != std::u16string_view::npos)
3085 sal_Int32 nTmp(nFndPos);
3086 while (nTmp <
static_cast<sal_Int32
>(nSttWdPos) && !
IsWordDelim(rTxt[nTmp]))
3088 if (nTmp <
static_cast<sal_Int32
>(nSttWdPos))
3090 buf.append(rTxt.substr(nFndPos, nSttWdPos - nFndPos)).append(pFnd->
GetLong());
3091 nFndPos = nSttWdPos + sTmp.getLength();
3093 }
while (nSttWdPos != std::u16string_view::npos);
3094 if (
static_cast<sal_Int32
>(nEndPos - nFndPos) > extra_repl)
3095 buf.append(rTxt.substr(nFndPos, nEndPos - nFndPos));
3096 aLong = buf.makeStringAndClear();
3100 if ( (
static_cast<sal_Int32
>(rTxt.size()) > nEndPos &&
IsWordDelim(rTxt[nEndPos])) ||
static_cast<sal_Int32
>(rTxt.size()) == nEndPos )
3109 sal_Int32 nEndPos)
const
3111 for (
auto const& elem :
mpImpl->maHash)
3117 for (
auto const& elem :
mpImpl->maSortedVector)
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
OUString titlecase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
sal_Int32 getCharacterType(const OUString &rStr, sal_Int32 nPos) const
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
const LanguageTag & getLanguageTag() const
static bool isLetterType(sal_Int32 nType)
bool isLetter(const OUString &rStr, sal_Int32 nPos) const
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
sal_Int16 getType(const OUString &rStr, sal_Int32 nPos) const
css::i18n::UnicodeScript getScript(const OUString &rStr, sal_Int32 nPos) const
bool isDigit(const OUString &rStr, sal_Int32 nPos) const
sal_Int32 loadDefaultCollator(const css::lang::Locale &rLocale, sal_Int32 nOption)
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
void SetExtension(std::u16string_view rTheExtension)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
static INetProtocol CompareProtocolScheme(std::u16string_view aTheAbsURIRef)
LanguageType getLanguageType(bool bResolveSystem=true) const
bool isSystemLocale() const
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
OUString getLanguage() const
const OUString & getBcp47(bool bResolveSystem=true) const
OUString getCountry() const
LanguageTag & reset(const OUString &rBcp47LanguageTag)
::std::vector< OUString > getFallbackStrings(bool bIncludeFullBcp47) const
static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker()
const OUString & getDoubleQuotationMarkStart() const
const OUString & getQuotationMarkStart() const
const OUString & getDoubleQuotationMarkEnd() const
const OUString & getQuotationMarkEnd() const
static LanguageType getConfiguredSystemLanguage()
bool Remove(const OUString &rEleName)
tools::SvRef< SotStorageStream > OpenSotStream(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE)
bool IsOLEStorage() const
virtual bool Insert(sal_Int32 nPos, const OUString &rTxt)=0
virtual bool Replace(sal_Int32 nPos, const OUString &rTxt)=0
virtual ~SvxAutoCorrDoc()
virtual bool ReplaceRange(sal_Int32 nPos, sal_Int32 nLen, const OUString &rTxt)=0
virtual LanguageType GetLanguage(sal_Int32 nPos) const
virtual OUString const * GetPrevPara(bool bAtNormalPos)=0
virtual void SaveCpltSttWord(ACFlags nFlag, sal_Int32 nPos, const OUString &rExceptWord, sal_Unicode cChar)
virtual void SetAttr(sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId, SfxPoolItem &)=0
virtual bool SetINetAttr(sal_Int32 nStt, sal_Int32 nEnd, const OUString &rURL)=0
virtual bool TransliterateRTLWord(sal_Int32 &rSttPos, sal_Int32 nEndPos, bool bApply=false)=0
virtual bool ChgAutoCorrWord(sal_Int32 &rSttPos, sal_Int32 nEndPos, SvxAutoCorrect &rACorrect, OUString *pPara)=0
virtual bool Delete(sal_Int32 nStt, sal_Int32 nEnd)=0
SvxAutocorrWordList * LoadAutocorrWordList()
OUString sUserAutoCorrFile
std::unique_ptr< SvStringsISortDtor > pCplStt_ExcptLst
std::unique_ptr< SvxAutocorrWordList > pAutocorr_List
const SvxAutocorrWordList * GetAutocorrWordList()
void LoadXMLExceptList_Imp(std::unique_ptr< SvStringsISortDtor > &rpLst, const OUString &sStrmName, tools::SvRef< SotStorage > &rStg)
static void SaveExceptList_Imp(const SvStringsISortDtor &rLst, const OUString &sStrmName, tools::SvRef< SotStorage > const &rStg, bool bConvert=false)
bool MakeCombinedChanges(std::vector< SvxAutocorrWord > &aNewEntries, std::vector< SvxAutocorrWord > &aDeleteEntries)
void RemoveStream_Imp(const OUString &rName)
~SvxAutoCorrectLanguageLists()
tools::Time aModifiedTime
tools::Time aLastCheckTime
bool AddToWordStartExceptList(const OUString &rNew)
void MakeUserStorage_Impl()
SvxAutoCorrect & rAutoCorrect
bool MakeBlocklist_Imp(SotStorage &rStg)
void SaveWordStartExceptList()
SvStringsISortDtor * LoadCplSttExceptList()
SvStringsISortDtor * GetWordStartExceptList()
bool PutText(const OUString &rShort, const OUString &rLong)
SvxAutoCorrectLanguageLists(SvxAutoCorrect &rParent, OUString aShareAutoCorrectFile, OUString aUserAutoCorrectFile)
bool AddToCplSttExceptList(const OUString &rNew)
OUString sShareAutoCorrFile
SvStringsISortDtor * GetCplSttExceptList()
void SaveCplSttExceptList()
SvStringsISortDtor * LoadWordStartExceptList()
std::unique_ptr< SvStringsISortDtor > pWordStart_ExcptLst
bool AddWordStartException(const OUString &rNew, LanguageType eLang)
sal_Unicode GetQuote(sal_Unicode cInsChar, bool bSttQuote, LanguageType eLang) const
virtual void refreshBlockList(const css::uno::Reference< css::embed::XStorage > &rStg)
bool FnCorrectCapsLock(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
void FnCapitalStartWord(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
std::map< LanguageTag, sal_Int64 > aLastFileTable
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.
void FnCapitalStartSentence(SvxAutoCorrDoc &, const OUString &, bool bNormalPos, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
static std::vector< OUString > GetChunkForAutoText(std::u16string_view rTxt, sal_Int32 nPos)
OUString GetAutoCorrFileName(const LanguageTag &rLanguageTag, bool bNewFile=false, bool bTstUserExist=false, bool bUnlocalized=false) const
CharClass & GetCharClass(LanguageType eLang)
void InsertQuote(SvxAutoCorrDoc &rDoc, sal_Int32 nInsPos, sal_Unicode cInsChar, bool bSttQuote, bool bIns, LanguageType eLang, ACQuotes eType) const
OUString sShareAutoCorrFile
OUString GetPrevAutoCorrWord(SvxAutoCorrDoc const &rDoc, const OUString &rTxt, sal_Int32 nPos)
void MakeCombinedChanges(std::vector< SvxAutocorrWord > &aNewEntries, std::vector< SvxAutocorrWord > &aDeleteEntries, LanguageType eLang)
SvxAutoCorrect(OUString aShareAutocorrFile, OUString aUserAutocorrFile)
bool FindInCplSttExceptList(LanguageType eLang, const OUString &sWord, bool bAbbreviation=false)
OUString sUserAutoCorrFile
bool FnChgToEnEmDash(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
bool IsAutoCorrFlag(ACFlags nFlag) const
LanguageType eCharClassLang
sal_Unicode GetStartSingleQuote() const
std::map< LanguageTag, SvxAutoCorrectLanguageLists > m_aLangTable
bool FnSetINetAttr(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
std::optional< CharClass > moCharClass
void SaveWordStartExceptList(LanguageType eLang)
void SaveCplSttExceptList(LanguageType eLang)
void GetCharClass_(LanguageType eLang)
sal_Unicode GetEndSingleQuote() const
sal_Unicode GetEndDoubleQuote() const
void SetAutoCorrFlag(ACFlags nFlag, bool bOn=true)
bool CreateLanguageFile(const LanguageTag &rLanguageTag, bool bNewFile=true)
bool FnChgOrdinalNumber(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
bool FnChgWeightUnderl(SvxAutoCorrDoc &, const OUString &, sal_Int32 nEndPos)
bool AddCplSttException(const OUString &rNew, LanguageType eLang)
static bool NeedsHardspaceAutocorr(sal_Unicode cChar)
SvxAutoCorrectLanguageLists & GetLanguageList_(LanguageType eLang)
virtual ~SvxAutoCorrect()
bool FnAddNonBrkSpace(SvxAutoCorrDoc &, std::u16string_view, sal_Int32 nEndPos, LanguageType eLang, bool &io_bNbspRunNext)
static bool IsAutoCorrectChar(sal_Unicode cChar)
const SvxAutocorrWord * SearchWordsInList(std::u16string_view rTxt, sal_Int32 &rStt, sal_Int32 nEndPos, SvxAutoCorrDoc &rDoc, LanguageTag &rLang)
virtual bool PutText(const css::uno::Reference< css::embed::XStorage > &rStg, const OUString &rFileName, const OUString &rShort, SfxObjectShell &, OUString &)
virtual bool GetLongText(const OUString &rShort, OUString &rLong)
sal_Unicode GetStartDoubleQuote() const
bool FnSetDOIAttr(SvxAutoCorrDoc &, const OUString &, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang)
bool FindInWordStartExceptList(LanguageType eLang, const OUString &sWord)
static ACFlags GetDefaultFlags()
const SvxAutocorrWord * WordMatches(const SvxAutocorrWord *pFnd, std::u16string_view rTxt, sal_Int32 &rStt, sal_Int32 nEndPos) const
const AutocorrWordSetType & getSortedContent() const
const SvxAutocorrWord * Insert(SvxAutocorrWord aWord) const
std::vector< SvxAutocorrWord > AutocorrWordSetType
const SvxAutocorrWord * SearchWordsInList(std::u16string_view rTxt, sal_Int32 &rStt, sal_Int32 nEndPos) const
std::optional< SvxAutocorrWord > FindAndRemove(const SvxAutocorrWord *pWord)
void LoadEntry(const OUString &sWrong, const OUString &sRight, bool bOnlyTxt)
std::unique_ptr< Impl > mpImpl
void DeleteAndDestroyAll()
const OUString & GetShort() const
const OUString & GetLong() const
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 >())
const_iterator begin() const
std::vector< Value >::const_iterator const_iterator
const_iterator find(const Value &x) const
const_iterator end() const
std::vector< Value >::size_type size_type
css::uno::Any executeCommand(const OUString &rCommandName, const css::uno::Any &rCommandArgument)
void SimulateKeyPress(sal_uInt16 nKeyCode) const
KeyIndicatorState GetIndicatorState() const
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DFLT_ESC_AUTO_SUPER
constexpr sal_uInt16 KEY_CAPSLOCK
#define LANGUAGE_GERMAN_AUSTRIAN
#define LANGUAGE_GERMAN_SWISS
#define LANGUAGE_ROMANIAN
#define LANGUAGE_ENGLISH_AUS
#define LANGUAGE_PORTUGUESE
#define LANGUAGE_HUNGARIAN
#define LANGUAGE_SWEDISH_FINLAND
#define LANGUAGE_GERMAN_LUXEMBOURG
#define LANGUAGE_ENGLISH_CAN
#define LANGUAGE_FRENCH_SWISS
#define LANGUAGE_UNDETERMINED
#define LANGUAGE_GALICIAN
#define LANGUAGE_ENGLISH_JAMAICA
#define LANGUAGE_ICELANDIC
#define LANGUAGE_USER_ASTURIAN
#define LANGUAGE_ENGLISH_CARIBBEAN
#define LANGUAGE_ENGLISH_EIRE
#define LANGUAGE_ROMANIAN_MOLDOVA
#define LANGUAGE_ENGLISH_UK
#define LANGUAGE_ENGLISH_NZ
#define LANGUAGE_UKRAINIAN
#define LANGUAGE_DONTKNOW
#define LANGUAGE_USER_ARAGONESE
#define LANGUAGE_ENGLISH_SAFRICA
#define LANGUAGE_GERMAN_LIECHTENSTEIN
constexpr LanguageType primary(LanguageType lt)
#define LANGUAGE_PORTUGUESE_BRAZILIAN
#define LANGUAGE_CATALAN_VALENCIAN
#define LANGUAGE_SLOVENIAN
#define LANGUAGE_ENGLISH_US
DECL_LISTENERMULTIPLEXER_END void SAL_CALL inserted(::sal_Int32 ID) override
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
SVL_DLLPUBLIC bool IsDocument(const OUString &rURL)
SVL_DLLPUBLIC bool GetModifiedDateTimeOfFile(const OUString &rURL, Date *pDate, tools::Time *pTime)
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)
SVL_DLLPUBLIC OUString FindFirstDOIInText(OUString const &rText, sal_Int32 &rBegin, sal_Int32 &rEnd, CharClass const &rCharClass)
const LanguageTag & getLocale()
Reference< XComponentContext > getProcessComponentContext()
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
constexpr OUStringLiteral EMPTY
bool operator()(SvxAutocorrWord const &lhs, SvxAutocorrWord const &rhs) const
AutocorrWordSetType maSortedVector
AutocorrWordHashType maHash
void DeleteAndDestroyAll()
bool anyOf(strong_int v) const
static bool lcl_FindAbbreviation(const SvStringsISortDtor *pList, const OUString &sWord)
constexpr OUStringLiteral sEnDash(u"\u2013")
constexpr OUStringLiteral pXMLImplAutocorr_ListStr
constexpr sal_Unicode cApostrophe
static bool IsUpperLetter(sal_Int32 nCharType)
constexpr OUStringLiteral pXMLImplWordStart_ExcptLstStr
constexpr sal_Unicode cLeftSingleAngleQuote
constexpr sal_Unicode cRightDoubleAngleQuote
const sal_Unicode aStopDoubleAngleQuoteEnd[]
static bool NonFieldWordDelim(const sal_Unicode c)
static bool IsLowerLetter(sal_Int32 nCharType)
const sal_Unicode aStopDoubleAngleQuoteStart[]
static const LanguageTag & GetAppLang()
constexpr sal_Unicode cEnDash
static const SvxAutocorrWord * lcl_SearchWordsInList(SvxAutoCorrectLanguageLists *pList, std::u16string_view rTxt, sal_Int32 &rStt, sal_Int32 nEndPos)
static bool lcl_IsUnsupportedUnicodeChar(CharClass const &rCC, const OUString &rTxt, sal_Int32 nStt, sal_Int32 nEnd)
constexpr std::u16string_view sImplEndSkipChars
static CollatorWrapper & GetCollatorWrapper()
constexpr std::u16string_view sImplSttSkipChars
constexpr OUStringLiteral pXMLImplCplStt_ExcptLstStr
const sal_Unicode aStopSingleQuoteEnd[]
static bool lcl_IsSymbolChar(CharClass const &rCC, const OUString &rTxt, sal_Int32 nStt, sal_Int32 nEnd)
static bool IsWordDelim(const sal_Unicode c)
const sal_Unicode cNonBreakingSpace
constexpr sal_Unicode cRightSingleAngleQuote
constexpr sal_Unicode cEmDash
constexpr OUStringLiteral sEmDash(u"\u2014")
const sal_Unicode aStopSingleQuoteEndRuUa[]
const sal_Unicode aStopDoubleAngleQuoteEndRo[]
static void GeneratePackageName(std::u16string_view rShort, OUString &rPackageName)
constexpr sal_Unicode cLeftDoubleAngleQuote
static LanguageType GetDocLanguage(const SvxAutoCorrDoc &rDoc, sal_Int32 nPos)
Never use an unresolved LANGUAGE_SYSTEM.
static OUString EncryptBlockName_Imp(std::u16string_view rName)
static LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
static bool lcl_HasPrecedingChar(std::u16string_view rTxt, sal_Int32 nPos, const sal_Unicode sPrecedingChar, const sal_Unicode sStopChar, const sal_Unicode *aStopChars)
static bool lcl_IsInArr(std::u16string_view arr, const sal_uInt32 c)
static TransliterationWrapper & GetIgnoreTranslWrapper()