summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-12-07 13:10:57 +0300
committerAndras Timar <andras.timar@collabora.com>2018-12-16 11:02:36 +0100
commitbab0fc531cf063880c27b7d7081d4acbd40b649a (patch)
tree69ddcc2386a442a4aef5501cbff36b56a1096ec7
parentbd5f75d44a55c0608dc328ca74b19302955bf67f (diff)
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: Heiko Tietze <tietze.heiko@gmail.com> Reviewed-by: Sophie Gautier <gautier.sophie@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/65087 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--cui/uiconfig/ui/acorexceptpage.ui6
-rw-r--r--editeng/source/misc/svxacorr.cxx8
-rw-r--r--include/editeng/svxacorr.hxx8
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs9
4 files changed, 19 insertions, 12 deletions
diff --git a/cui/uiconfig/ui/acorexceptpage.ui b/cui/uiconfig/ui/acorexceptpage.ui
index 0dab0855818e..403f479e0662 100644
--- a/cui/uiconfig/ui/acorexceptpage.ui
+++ b/cui/uiconfig/ui/acorexceptpage.ui
@@ -250,7 +250,7 @@
<property name="use_stock">True</property>
<child internal-child="accessible">
<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>
</child>
</object>
@@ -286,7 +286,7 @@
<property name="use_stock">True</property>
<child internal-child="accessible">
<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>
</child>
</object>
@@ -334,7 +334,7 @@
<object class="GtkLabel" id="label2">
<property name="visible">True</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>
<attribute name="weight" value="bold"/>
</attributes>
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 9c8eeb9d2dac..bf52a5cf2a69 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -902,6 +902,10 @@ bool SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
return false; // 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 false;
+
if( bAtStart ) // at the beginning of a paragraph?
{
// Check out the previous paragraph, if it exists.
@@ -1119,6 +1123,10 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT
aConverted += rCC.uppercase(OUString(rTxt[nSttPos]));
aConverted += 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 )
{
if ( IsLowerLetter(rCC.getCharacterType(rTxt, i)) )
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index a7d03a9a971a..46c2b0e9dadf 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -64,7 +64,7 @@ const long SetINetAttr = 0x00000040; // Set INetAttribut
const long Autocorrect = 0x00000080; // Call AutoCorrect
const long ChgQuotes = 0x00000100; // replace double quotes
const long SaveWordCplSttLst= 0x00000200; // Save Auto correction of Capital letter at beginning of sentence.
-const long SaveWordWrdSttLst= 0x00000400; // Save Auto correction of 2 Capital letter at beginning of word.
+const long SaveWordWrdSttLst= 0x00000400; // Save Auto correction of TWo INitial CApitals or sMALL iNITIAL.
const long IgnoreDoubleSpace= 0x00000800; // Ignore 2 Spaces
const long ChgSglQuotes = 0x00001000; // Replace simple quotes
const long CorrectCapsLock = 0x00002000; // Correct accidental use of cAPS LOCK key
@@ -204,8 +204,7 @@ public:
SvStringsISortDtor* GetCplSttExceptList();
bool AddToCplSttExceptList(const OUString& rNew);
- // Load, Set, Get the exception list for 2 Capital letters at the
- // beginning of a word.
+ // Load, Set, Get the exception list for TWo INitial CApitals or sMALL iNITIAL
SvStringsISortDtor* LoadWrdSttExceptList();
void SaveWrdSttExceptList();
void SetWrdSttExceptList( SvStringsISortDtor* pList );
@@ -360,8 +359,7 @@ public:
// Adds a single word. The list will be immediately written to the file!
bool AddCplSttException( const OUString& rNew, LanguageType eLang );
- // Load, Set, Get the exception list for 2 Capital letters at the
- // beginning of a word.
+ // Load, Set, Get the exception list for TWo INitial CApitals or sMALL iNITIAL
void SaveWrdSttExceptList( LanguageType eLang );
SvStringsISortDtor* LoadWrdSttExceptList( LanguageType eLang )
{ return GetLanguageList_( eLang ).LoadWrdSttExceptList(); }
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 108ceb01ec16..d65e0f194c08 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -1418,12 +1418,13 @@
<!-- OldPath: AutoCorrect/Options/All -->
<!-- OldLocation: Soffice.cfg -->
<!-- UIHints: Tools - AutoCorrect/AutoFormat - Exceptions - Words with
- 2 initial capitals -->
+ 2 initial capitals or small initial -->
<info>
<desc>Specifies if defined words with two initial capital letters
- should not be included in the AutoCorrect replacement.</desc>
- <label>Words with two initial capital letters - Add
- automatically</label>
+ or a small initial letter should not be included in the AutoCorrect
+ replacement.</desc>
+ <label>Words with two initial capital letters or a small initial -
+ Add automatically</label>
</info>
<value>true</value>
</prop>