Kaydet (Commit) 7bf6d0d9 authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#121779: extend TWo CApitals list to also ignore sMALL iNITIALS

Now this list is used also in rules for capitalizing first letter of
every sentence, and for correcting accidental use of Caps Lock key.

Change-Id: I4fbdbccbae32743d5e9a6757344361eefd88e167
Reviewed-on: https://gerrit.libreoffice.org/64759
Tested-by: Jenkins
Reviewed-by: 's avatarHeiko Tietze <tietze.heiko@gmail.com>
Reviewed-by: 's avatarSophie Gautier <gautier.sophie@gmail.com>
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 40144617
...@@ -289,7 +289,7 @@ ...@@ -289,7 +289,7 @@
<property name="use_stock">True</property> <property name="use_stock">True</property>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="newdouble-atkobject"> <object class="AtkObject" id="newdouble-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="acorexceptpage|newdouble-atkobject">New words with two initial capitals</property> <property name="AtkObject::accessible-description" translatable="yes" context="acorexceptpage|newdouble-atkobject">New words with two initial capitals or small initial</property>
</object> </object>
</child> </child>
</object> </object>
...@@ -325,7 +325,7 @@ ...@@ -325,7 +325,7 @@
<property name="use_stock">True</property> <property name="use_stock">True</property>
<child internal-child="accessible"> <child internal-child="accessible">
<object class="AtkObject" id="deldouble-atkobject"> <object class="AtkObject" id="deldouble-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="acorexceptpage|deldouble-atkobject">Delete words with two initial capitals</property> <property name="AtkObject::accessible-description" translatable="yes" context="acorexceptpage|deldouble-atkobject">Delete words with two initial capitals or small initial</property>
</object> </object>
</child> </child>
</object> </object>
...@@ -394,7 +394,7 @@ ...@@ -394,7 +394,7 @@
<object class="GtkLabel" id="label2"> <object class="GtkLabel" id="label2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes" context="acorexceptpage|label2">Words With TWo INitial CApitals</property> <property name="label" translatable="yes" context="acorexceptpage|label2">Words With TWo INitial CApitals or sMALL iNITIAL</property>
<attributes> <attributes>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>
</attributes> </attributes>
......
...@@ -898,6 +898,10 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, ...@@ -898,6 +898,10 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
return; // no valid separator -> no replacement return; // no valid separator -> no replacement
} }
// No replacement for words in TWo INitial CApitals or sMALL iNITIAL list
if (FindInWrdSttExceptList(eLang, OUString(pWordStt, pDelim - pWordStt)))
return;
if( bAtStart ) // at the beginning of a paragraph? if( bAtStart ) // at the beginning of a paragraph?
{ {
// Check out the previous paragraph, if it exists. // Check out the previous paragraph, if it exists.
...@@ -1112,6 +1116,10 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT ...@@ -1112,6 +1116,10 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT
aConverted.append( rCC.uppercase(OUString(rTxt[nSttPos])) ); aConverted.append( rCC.uppercase(OUString(rTxt[nSttPos])) );
aConverted.append( rCC.lowercase(OUString(rTxt[nSttPos+1])) ); aConverted.append( rCC.lowercase(OUString(rTxt[nSttPos+1])) );
// No replacement for words in TWo INitial CApitals or sMALL iNITIAL list
if (FindInWrdSttExceptList(eLang, rTxt.copy(nSttPos, nEndPos - nSttPos)))
return false;
for( sal_Int32 i = nSttPos+2; i < nEndPos; ++i ) for( sal_Int32 i = nSttPos+2; i < nEndPos; ++i )
{ {
if ( IsLowerLetter(rCC.getCharacterType(rTxt, i)) ) if ( IsLowerLetter(rCC.getCharacterType(rTxt, i)) )
......
...@@ -67,7 +67,7 @@ enum class ACFlags : sal_uInt32 { ...@@ -67,7 +67,7 @@ enum class ACFlags : sal_uInt32 {
Autocorrect = 0x00000080, // Call AutoCorrect Autocorrect = 0x00000080, // Call AutoCorrect
ChgQuotes = 0x00000100, // replace double quotes ChgQuotes = 0x00000100, // replace double quotes
SaveWordCplSttLst = 0x00000200, // Save Auto correction of Capital letter at beginning of sentence. SaveWordCplSttLst = 0x00000200, // Save Auto correction of Capital letter at beginning of sentence.
SaveWordWrdSttLst = 0x00000400, // Save Auto correction of 2 Capital letter at beginning of word. SaveWordWrdSttLst = 0x00000400, // Save Auto correction of TWo INitial CApitals or sMALL iNITIAL.
IgnoreDoubleSpace = 0x00000800, // Ignore 2 Spaces IgnoreDoubleSpace = 0x00000800, // Ignore 2 Spaces
ChgSglQuotes = 0x00001000, // Replace simple quotes ChgSglQuotes = 0x00001000, // Replace simple quotes
CorrectCapsLock = 0x00002000, // Correct accidental use of cAPS LOCK key CorrectCapsLock = 0x00002000, // Correct accidental use of cAPS LOCK key
...@@ -209,8 +209,7 @@ public: ...@@ -209,8 +209,7 @@ public:
SvStringsISortDtor* GetCplSttExceptList(); SvStringsISortDtor* GetCplSttExceptList();
bool AddToCplSttExceptList(const OUString& rNew); bool AddToCplSttExceptList(const OUString& rNew);
// Load, Set, Get the exception list for 2 Capital letters at the // Load, Set, Get the exception list for TWo INitial CApitals or sMALL iNITIAL
// beginning of a word.
SvStringsISortDtor* LoadWrdSttExceptList(); SvStringsISortDtor* LoadWrdSttExceptList();
void SaveWrdSttExceptList(); void SaveWrdSttExceptList();
SvStringsISortDtor* GetWrdSttExceptList(); SvStringsISortDtor* GetWrdSttExceptList();
...@@ -363,8 +362,7 @@ public: ...@@ -363,8 +362,7 @@ public:
// Adds a single word. The list will be immediately written to the file! // Adds a single word. The list will be immediately written to the file!
bool AddCplSttException( const OUString& rNew, LanguageType eLang ); bool AddCplSttException( const OUString& rNew, LanguageType eLang );
// Load, Set, Get the exception list for 2 Capital letters at the // Load, Set, Get the exception list for TWo INitial CApitals or sMALL iNITIAL
// beginning of a word.
void SaveWrdSttExceptList( LanguageType eLang ); void SaveWrdSttExceptList( LanguageType eLang );
SvStringsISortDtor* LoadWrdSttExceptList( LanguageType eLang ) SvStringsISortDtor* LoadWrdSttExceptList( LanguageType eLang )
{ return GetLanguageList_( eLang ).LoadWrdSttExceptList(); } { return GetLanguageList_( eLang ).LoadWrdSttExceptList(); }
......
...@@ -1417,12 +1417,13 @@ ...@@ -1417,12 +1417,13 @@
<!-- OldPath: AutoCorrect/Options/All --> <!-- OldPath: AutoCorrect/Options/All -->
<!-- OldLocation: Soffice.cfg --> <!-- OldLocation: Soffice.cfg -->
<!-- UIHints: Tools - AutoCorrect/AutoFormat - Exceptions - Words with <!-- UIHints: Tools - AutoCorrect/AutoFormat - Exceptions - Words with
2 initial capitals --> 2 initial capitals or small initial -->
<info> <info>
<desc>Specifies if defined words with two initial capital letters <desc>Specifies if defined words with two initial capital letters
should not be included in the AutoCorrect replacement.</desc> or a small initial letter should not be included in the AutoCorrect
<label>Words with two initial capital letters - Add replacement.</desc>
automatically</label> <label>Words with two initial capital letters or a small initial -
Add automatically</label>
</info> </info>
<value>true</value> <value>true</value>
</prop> </prop>
......
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