Kaydet (Commit) 1554ec84 authored tarafından Ilmari Lauhakangas's avatar Ilmari Lauhakangas Kaydeden (comit) Thorsten Behrens

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: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 3931e7c0
...@@ -362,7 +362,7 @@ void SvxAutoCorrect::SetAutoCorrFlag( ACFlags nFlag, bool bOn ) ...@@ -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, void SvxAutoCorrect::FnCapitalStartWord( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
sal_Int32 nSttPos, sal_Int32 nEndPos, sal_Int32 nSttPos, sal_Int32 nEndPos,
LanguageType eLang ) LanguageType eLang )
...@@ -447,7 +447,7 @@ void SvxAutoCorrect::FnCapitalStartWord( SvxAutoCorrDoc& rDoc, const OUString& r ...@@ -447,7 +447,7 @@ void SvxAutoCorrect::FnCapitalStartWord( SvxAutoCorrDoc& rDoc, const OUString& r
} }
} }
// Format ordinal numbers suffixes (1st -> 1^st)
bool SvxAutoCorrect::FnChgOrdinalNumber( bool SvxAutoCorrect::FnChgOrdinalNumber(
SvxAutoCorrDoc& rDoc, const OUString& rTxt, SvxAutoCorrDoc& rDoc, const OUString& rTxt,
sal_Int32 nSttPos, sal_Int32 nEndPos, sal_Int32 nSttPos, sal_Int32 nEndPos,
...@@ -526,7 +526,7 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( ...@@ -526,7 +526,7 @@ bool SvxAutoCorrect::FnChgOrdinalNumber(
return bChg; return bChg;
} }
// Replace dashes
bool SvxAutoCorrect::FnChgToEnEmDash( bool SvxAutoCorrect::FnChgToEnEmDash(
SvxAutoCorrDoc& rDoc, const OUString& rTxt, SvxAutoCorrDoc& rDoc, const OUString& rTxt,
sal_Int32 nSttPos, sal_Int32 nEndPos, sal_Int32 nSttPos, sal_Int32 nEndPos,
...@@ -632,7 +632,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash( ...@@ -632,7 +632,7 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
return bRet; return bRet;
} }
// Add non-breaking space before specific punctuation marks in French text
bool SvxAutoCorrect::FnAddNonBrkSpace( bool SvxAutoCorrect::FnAddNonBrkSpace(
SvxAutoCorrDoc& rDoc, const OUString& rTxt, SvxAutoCorrDoc& rDoc, const OUString& rTxt,
sal_Int32 nEndPos, sal_Int32 nEndPos,
...@@ -718,7 +718,7 @@ bool SvxAutoCorrect::FnAddNonBrkSpace( ...@@ -718,7 +718,7 @@ bool SvxAutoCorrect::FnAddNonBrkSpace(
return bRet; return bRet;
} }
// URL recognition
bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const OUString& rTxt, bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
sal_Int32 nSttPos, sal_Int32 nEndPos, sal_Int32 nSttPos, sal_Int32 nEndPos,
LanguageType eLang ) LanguageType eLang )
...@@ -731,7 +731,7 @@ bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const OUString& rTxt, ...@@ -731,7 +731,7 @@ bool SvxAutoCorrect::FnSetINetAttr( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
return bRet; return bRet;
} }
// Automatic *bold*, /italic/, -strikeout- and _underline_
bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString& rTxt, bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
sal_Int32 nEndPos ) sal_Int32 nEndPos )
{ {
...@@ -819,7 +819,7 @@ bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString& rT ...@@ -819,7 +819,7 @@ bool SvxAutoCorrect::FnChgWeightUnderl( SvxAutoCorrDoc& rDoc, const OUString& rT
return -1 != nFndPos; return -1 != nFndPos;
} }
// Capitalize first letter of every sentence
void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
const OUString& rTxt, bool bNormalPos, const OUString& rTxt, bool bNormalPos,
sal_Int32 nSttPos, sal_Int32 nEndPos, sal_Int32 nSttPos, sal_Int32 nEndPos,
...@@ -882,6 +882,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, ...@@ -882,6 +882,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
if (0x1 == *pWordStt || 0x2 == *pWordStt) if (0x1 == *pWordStt || 0x2 == *pWordStt)
return; // already ok return; // already ok
// Only capitalize, if string before specified characters is long enough
if( *pDelim && 2 >= pDelim - pWordStt && if( *pDelim && 2 >= pDelim - pWordStt &&
lcl_IsInAsciiArr( ".-)>", *pDelim ) ) lcl_IsInAsciiArr( ".-)>", *pDelim ) )
return; return;
...@@ -996,6 +997,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, ...@@ -996,6 +997,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
if (Flags::FullStop != nFlag) if (Flags::FullStop != nFlag)
pExceptStt = nullptr; pExceptStt = nullptr;
// Only capitalize, if string is long enough
if( 2 > ( pStr - pStart ) ) if( 2 > ( pStr - pStart ) )
return; return;
...@@ -1097,6 +1099,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, ...@@ -1097,6 +1099,7 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
rDoc.SaveCpltSttWord( ACFlags::CapitalStartSentence, nSttPos, sWord, cSave ); rDoc.SaveCpltSttWord( ACFlags::CapitalStartSentence, nSttPos, sWord, cSave );
} }
// Correct accidental use of cAPS LOCK key
bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rTxt, bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
sal_Int32 nSttPos, sal_Int32 nEndPos, sal_Int32 nSttPos, sal_Int32 nEndPos,
LanguageType eLang ) LanguageType eLang )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment