From 1554ec8430728a0dca2dc0177b93bda8d1256065 Mon Sep 17 00:00:00 2001 From: Ilmari Lauhakangas Date: Wed, 23 Jan 2019 19:48:10 +0200 Subject: [PATCH] Add comments to autocorrect functions It was difficult to find the sentence capitalization function. I thought it would be a good idea to add the UI strings of the options as comments before the function blocks. Also added a couple of notes inside FnCapitalStartSentence. Change-Id: I7047b199193ee0b61ba7fd955411952aae33ab41 Reviewed-on: https://gerrit.libreoffice.org/66812 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- editeng/source/misc/svxacorr.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 940ac0bae248..658ada0bed31 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -362,7 +362,7 @@ void SvxAutoCorrect::SetAutoCorrFlag( ACFlags nFlag, bool bOn ) } - // Two capital letters at the beginning of word? +// Correct TWo INitial CApitals void SvxAutoCorrect::FnCapitalStartWord( SvxAutoCorrDoc& rDoc, const OUString& rTxt, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang ) @@ -447,7 +447,7 @@ void SvxAutoCorrect::FnCapitalStartWord( SvxAutoCorrDoc& rDoc, const OUString& r } } - +// Format ordinal numbers suffixes (1st -> 1^st) bool SvxAutoCorrect::FnChgOrdinalNumber( SvxAutoCorrDoc& rDoc, const OUString& rTxt, sal_Int32 nSttPos, sal_Int32 nEndPos, @@ -526,7 +526,7 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( return bChg; } - +// Replace dashes bool SvxAutoCorrect::FnChgToEnEmDash( SvxAutoCorrDoc& rDoc, const OUString& rTxt, sal_Int32 nSttPos, sal_Int32 nEndPos, @@ -632,7 +632,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash( return bRet; } - +// Add non-breaking space before specific punctuation marks in French text bool SvxAutoCorrect::FnAddNonBrkSpace( SvxAutoCorrDoc& rDoc, const OUString& rTxt, sal_Int32 nEndPos, @@ -718,7 +718,7 @@ bool SvxAutoCorrect::FnAddNonBrkSpace( return bRet; } - +// URL recognition bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const OUString& rTxt, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang ) @@ -731,7 +731,7 @@ bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const OUString& rTxt, return bRet; } - +// Automatic *bold*, /italic/, -strikeout- and _underline_ bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString& rTxt, sal_Int32 nEndPos ) { @@ -819,7 +819,7 @@ bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString& rT return -1 != nFndPos; } - +// Capitalize first letter of every sentence void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, const OUString& rTxt, bool bNormalPos, sal_Int32 nSttPos, sal_Int32 nEndPos, @@ -882,6 +882,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, if (0x1 == *pWordStt || 0x2 == *pWordStt) return; // already ok + // Only capitalize, if string before specified characters is long enough if( *pDelim && 2 >= pDelim - pWordStt && lcl_IsInAsciiArr( ".-)>", *pDelim ) ) return; @@ -996,6 +997,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, if (Flags::FullStop != nFlag) pExceptStt = nullptr; + // Only capitalize, if string is long enough if( 2 > ( pStr - pStart ) ) return; @@ -1097,6 +1099,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, rDoc.SaveCpltSttWord( ACFlags::CapitalStartSentence, nSttPos, sWord, cSave ); } +// Correct accidental use of cAPS LOCK key bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rTxt, sal_Int32 nSttPos, sal_Int32 nEndPos, LanguageType eLang )