20#ifndef INCLUDED_EDITENG_SVXACORR_HXX
21#define INCLUDED_EDITENG_SVXACORR_HXX
45namespace tools {
template <
typename T>
class SvRef; }
49 bool operator()( std::u16string_view lhs, std::u16string_view rhs )
const
106 virtual bool Delete( sal_Int32 nStt, sal_Int32 nEnd ) = 0;
107 virtual bool Insert( sal_Int32 nPos,
const OUString& rTxt ) = 0;
108 virtual bool Replace( sal_Int32 nPos,
const OUString& rTxt ) = 0;
109 virtual bool ReplaceRange( sal_Int32 nPos, sal_Int32 nLen,
const OUString& rTxt ) = 0;
111 virtual void SetAttr( sal_Int32 nStt, sal_Int32 nEnd, sal_uInt16 nSlotId,
114 virtual bool SetINetAttr( sal_Int32 nStt, sal_Int32 nEnd,
const OUString& rURL ) = 0;
126 OUString* pPara ) = 0;
128 bool bApply =
false ) = 0;
134 virtual void SaveCpltSttWord(
ACFlags nFlag, sal_Int32 nPos,
135 const OUString& rExceptWord,
149 : sShort(
std::move( aS )), sLong(
std::move( aL )), bIsTxtOnly( bFlag )
152 const OUString&
GetShort()
const {
return sShort; }
153 const OUString&
GetLong()
const {
return sLong; }
166 std::u16string_view rTxt,
168 sal_Int32 nEndPos)
const;
173 void DeleteAndDestroyAll();
175 std::optional<SvxAutocorrWord> FindAndRemove(
const SvxAutocorrWord *pWord);
176 void LoadEntry(
const OUString& sWrong,
const OUString& sRight,
bool bOnlyTxt);
183 const SvxAutocorrWord* SearchWordsInList(std::u16string_view rTxt, sal_Int32& rStt, sal_Int32 nEndPos)
const;
200 bool IsFileChanged_Imp();
201 void LoadXMLExceptList_Imp( std::unique_ptr<SvStringsISortDtor>& rpLst,
202 const OUString& sStrmName,
205 const OUString& sStrmName,
207 bool bConvert =
false);
210 void RemoveStream_Imp(
const OUString& rName );
211 void MakeUserStorage_Impl();
215 OUString aShareAutoCorrectFile,
216 OUString aUserAutoCorrectFile);
226 void SaveCplSttExceptList();
228 bool AddToCplSttExceptList(
const OUString& rNew);
232 void SaveWordStartExceptList();
234 bool AddToWordStartExceptList(
const OUString& rNew);
240 bool PutText(
const OUString& rShort,
const OUString& rLong );
244 bool MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries, std::vector<SvxAutocorrWord>& aDeleteEntries );
274 virtual bool PutText(
const css::uno::Reference < css::embed::XStorage >& rStg,
275 const OUString& rFileName,
const OUString& rShort,
SfxObjectShell&, OUString& );
278 bool CreateLanguageFile(
const LanguageTag& rLanguageTag,
bool bNewFile =
true);
286 virtual bool GetLongText(
const OUString& rShort, OUString& rLong );
288 virtual void refreshBlockList(
const css::uno::Reference < css::embed::XStorage >& rStg);
291 OUString aUserAutocorrFile );
306 sal_Int32 nPos,
sal_Unicode cInsChar,
bool bInsert,
bool& io_bNbspRunNext,
311 OUString GetPrevAutoCorrWord(
SvxAutoCorrDoc const& rDoc,
const OUString& rTxt, sal_Int32 nPos);
317 static std::vector<OUString> GetChunkForAutoText(std::u16string_view rTxt, sal_Int32 nPos);
326 sal_Int32& rStt, sal_Int32 nEndPos,
341 OUString GetQuote(
SvxAutoCorrDoc const & rDoc, sal_Int32 nInsPos,
349 OUString GetAutoCorrFileName(
const LanguageTag& rLanguageTag ,
350 bool bNewFile =
false,
351 bool bTstUserExist =
false,
352 bool bUnlocalized =
false )
const;
359 {
return bool(
nFlags & nFlag); }
360 void SetAutoCorrFlag(
ACFlags nFlag,
bool bOn =
true );
364 {
return GetLanguageList_( eLang ).LoadAutocorrWordList(); }
373 { GetLanguageList_( eLang ).PutText(rShort, rShell ); }
376 std::vector<SvxAutocorrWord>& aDeleteEntries,
383 {
return GetLanguageList_( eLang ).LoadCplSttExceptList(); }
385 {
return GetLanguageList_( eLang ).GetCplSttExceptList(); }
388 bool AddCplSttException(
const OUString& rNew,
LanguageType eLang );
393 {
return GetLanguageList_( eLang ).LoadWordStartExceptList(); }
395 {
return GetLanguageList_( eLang ).GetWordStartExceptList(); }
397 bool AddWordStartException(
const OUString& rNew,
LanguageType eLang);
400 bool FindInWordStartExceptList(
LanguageType eLang,
const OUString& sWord );
401 bool FindInCplSttExceptList(
LanguageType eLang,
const OUString& sWord,
402 bool bAbbreviation =
false);
406 sal_Int32 nSttPos, sal_Int32 nEndPos,
409 sal_Int32 nSttPos, sal_Int32 nEndPos,
412 sal_Int32 nSttPos, sal_Int32 nEndPos,
418 sal_Int32 nSttPos, sal_Int32 nEndPos,
421 sal_Int32 nSttPos, sal_Int32 nEndPos,
425 void FnCapitalStartSentence(
SvxAutoCorrDoc&,
const OUString&,
bool bNormalPos,
426 sal_Int32 nSttPos, sal_Int32 nEndPos,
429 sal_Int32 nSttPos, sal_Int32 nEndPos,
432 static ACFlags GetDefaultFlags();
437 static bool IsAutoCorrectChar(
sal_Unicode cChar );
439 static bool NeedsHardspaceAutocorr(
sal_Unicode cChar );
443 if( !moCharClass || eLang != eCharClassLang )
444 GetCharClass_( eLang );
virtual bool Insert(sal_Int32 nPos, const OUString &rTxt)=0
virtual bool Replace(sal_Int32 nPos, const OUString &rTxt)=0
virtual bool ReplaceRange(sal_Int32 nPos, sal_Int32 nLen, const OUString &rTxt)=0
virtual OUString const * GetPrevPara(bool bAtNormalPos)=0
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
OUString sUserAutoCorrFile
std::unique_ptr< SvStringsISortDtor > pCplStt_ExcptLst
std::unique_ptr< SvxAutocorrWordList > pAutocorr_List
bool MakeCombinedChanges(std::vector< SvxAutocorrWord > &aNewEntries, std::vector< SvxAutocorrWord > &aDeleteEntries)
tools::Time aLastCheckTime
SvxAutoCorrect & rAutoCorrect
void SaveWordStartExceptList()
bool PutText(const OUString &rShort, const OUString &rLong)
OUString sShareAutoCorrFile
void SaveCplSttExceptList()
std::unique_ptr< SvStringsISortDtor > pWordStart_ExcptLst
std::map< LanguageTag, sal_Int64 > aLastFileTable
const SvStringsISortDtor * GetWordStartExceptList(LanguageType eLang)
CharClass & GetCharClass(LanguageType eLang)
const SvStringsISortDtor * GetCplSttExceptList(LanguageType eLang)
OUString sShareAutoCorrFile
void SetStartSingleQuote(const sal_Unicode cStart)
bool IsAutoCorrFlag(ACFlags nFlag) const
LanguageType eCharClassLang
sal_Unicode GetStartSingleQuote() const
std::map< LanguageTag, SvxAutoCorrectLanguageLists > m_aLangTable
std::optional< CharClass > moCharClass
void SetEndSingleQuote(const sal_Unicode cEnd)
sal_Unicode GetEndSingleQuote() const
sal_Unicode GetEndDoubleQuote() const
SvxSwAutoFormatFlags aSwFlags
SvStringsISortDtor * LoadCplSttExceptList(LanguageType eLang)
void PutText(const OUString &rShort, SfxObjectShell &rShell, LanguageType eLang)
void SetEndDoubleQuote(const sal_Unicode cEnd)
const SvxSwAutoFormatFlags & GetSwFlags() const
void SetStartDoubleQuote(const sal_Unicode cStart)
SvxSwAutoFormatFlags & GetSwFlags()
sal_Unicode GetStartDoubleQuote() const
SvStringsISortDtor * LoadWordStartExceptList(LanguageType eLang)
SvxAutocorrWordList * LoadAutocorrWordList(LanguageType eLang)
std::vector< SvxAutocorrWord > AutocorrWordSetType
SvxAutocorrWordList(const SvxAutocorrWordList &)=delete
std::unique_ptr< Impl > mpImpl
const OUString & GetShort() const
const OUString & GetLong() const
SvxAutocorrWord(OUString aS, OUString aL, bool bFlag=true)
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
#define EDITENG_DLLPUBLIC
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
int compareToIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
bool operator()(std::u16string_view lhs, std::u16string_view rhs) const