summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-12-30 10:26:07 +0100
committerLászló Németh <nemeth@numbertext.org>2022-12-30 11:03:39 +0000
commit57d79744c77eef96b4c2bd3b16e0a04317ffcf9e (patch)
tree7945482864b5be38eb2b88ba2c3fd38a1c21e293 /cui
parentb22bbfa25ab1f0b9cfa1dedc85b8f9874f0a5e5b (diff)
tdf#136306 offapi linguistic: add options to disable rule-based compounding
Add two new spell checking options to disable rule-based closed and hyphenated compound word recognition with Hunspell dictionaries: com::sun::star::linguistic2::XLinguProperties::IsSpellClosedCompound com::sun::star::linguistic2::XLinguProperties::IsSpellHyphenatedCompound For professional proofreaders, it can be more important to avoid of the mistakes of the rule-based compound word recognition, than to speed up proofreading. Disabling the following two new options will report all rule-based closed compound words (default in Dutch, German, Hungarian etc. dictionaries) and rule-based hyphenated compound words (all languages with BREAK usage in their Hunspell dictionaries): - "Accept possible closed compound words" - "Accept possible hyphenated compound words" For example, disabling the second one, dictionary word "scot-free" will be still correct word in English spell checking, but not the previously accepted compound "arbitrary-word-with-hyphen". Note: the second option works with the update to Hunspell 1.7.2. Change-Id: Id879610927d5e8269fda5ad207c1c2fe1f57a0b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144875 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'cui')
-rw-r--r--cui/inc/strings.hrc2
-rw-r--r--cui/source/inc/optlingu.hxx2
-rw-r--r--cui/source/options/optlingu.cxx26
3 files changed, 29 insertions, 1 deletions
diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 1d4fe526dabd..0d311518ad53 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -293,6 +293,8 @@
#define RID_CUISTR_CAPITAL_WORDS NC_("RID_SVXSTR_CAPITAL_WORDS", "Check uppercase words")
#define RID_CUISTR_WORDS_WITH_DIGITS NC_("RID_SVXSTR_WORDS_WITH_DIGITS", "Check words with numbers ")
#define RID_CUISTR_SPELL_SPECIAL NC_("RID_SVXSTR_SPELL_SPECIAL", "Check special regions")
+#define RID_CUISTR_SPELL_CLOSED_COMPOUND NC_("RID_SVXSTR_SPELL_CLOSED_COMPOUND", "Accept possible closed compound words")
+#define RID_CUISTR_SPELL_HYPHENATED_COMPOUND NC_("RID_SVXSTR_SPELL_HYPHENATED_COMPOUND", "Accept possible hyphenated compound words")
#define RID_CUISTR_SPELL_AUTO NC_("RID_SVXSTR_SPELL_AUTO", "Check spelling as you type")
#define RID_CUISTR_GRAMMAR_AUTO NC_("RID_SVXSTR_GRAMMAR_AUTO", "Check grammar as you type")
#define RID_CUISTR_NUM_MIN_WORDLEN NC_("RID_SVXSTR_NUM_MIN_WORDLEN", "Minimal number of characters for hyphenation: ")
diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
index 365acfbbb0fb..29adee861417 100644
--- a/cui/source/inc/optlingu.hxx
+++ b/cui/source/inc/optlingu.hxx
@@ -84,6 +84,8 @@ private:
OUString sWordsWithDigits;
OUString sSpellSpecial;
OUString sSpellAuto;
+ OUString sSpellClosedCompound;
+ OUString sSpellHyphenatedCompound;
OUString sGrammarAuto;
OUString sNumMinWordlen;
OUString sNumPreBreak;
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 6db7634159b1..b80343657f22 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -193,7 +193,9 @@ enum EID_OPTIONS
EID_NUM_PRE_BREAK,
EID_NUM_POST_BREAK,
EID_HYPH_AUTO,
- EID_HYPH_SPECIAL
+ EID_HYPH_SPECIAL,
+ EID_SPELL_CLOSED_COMPOUND,
+ EID_SPELL_HYPHENATED_COMPOUND
};
}
@@ -205,6 +207,8 @@ static OUString lcl_GetPropertyName( EID_OPTIONS eEntryId )
case EID_SPELL_AUTO: return UPN_IS_SPELL_AUTO;
case EID_GRAMMAR_AUTO: return UPN_IS_GRAMMAR_AUTO;
case EID_CAPITAL_WORDS: return UPN_IS_SPELL_UPPER_CASE;
+ case EID_SPELL_CLOSED_COMPOUND: return UPN_IS_SPELL_CLOSED_COMPOUND;
+ case EID_SPELL_HYPHENATED_COMPOUND: return UPN_IS_SPELL_HYPHENATED_COMPOUND;
case EID_WORDS_WITH_DIGITS: return UPN_IS_SPELL_WITH_DIGITS;
case EID_SPELL_SPECIAL: return UPN_IS_SPELL_SPECIAL;
case EID_NUM_MIN_WORDLEN: return UPN_HYPH_MIN_WORD_LENGTH;
@@ -827,6 +831,8 @@ SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController*
, sWordsWithDigits(CuiResId(RID_CUISTR_WORDS_WITH_DIGITS))
, sSpellSpecial (CuiResId(RID_CUISTR_SPELL_SPECIAL))
, sSpellAuto (CuiResId(RID_CUISTR_SPELL_AUTO))
+ , sSpellClosedCompound (CuiResId(RID_CUISTR_SPELL_CLOSED_COMPOUND))
+ , sSpellHyphenatedCompound (CuiResId(RID_CUISTR_SPELL_HYPHENATED_COMPOUND))
, sGrammarAuto (CuiResId(RID_CUISTR_GRAMMAR_AUTO))
, sNumMinWordlen (CuiResId(RID_CUISTR_NUM_MIN_WORDLEN))
, sNumPreBreak (CuiResId(RID_CUISTR_NUM_PRE_BREAK))
@@ -1210,6 +1216,24 @@ void SvxLinguTabPage::Reset( const SfxItemSet* rSet )
m_xLinguOptionsCLB->append();
++nEntry;
+ aLngCfg.GetProperty( UPN_IS_SPELL_CLOSED_COMPOUND ) >>= bVal;
+ nUserData = OptionsUserData( EID_SPELL_CLOSED_COMPOUND, false, 0, true, bVal).GetUserData();
+ m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xLinguOptionsCLB->set_text(nEntry, sSpellClosedCompound, 0);
+ m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+
+ m_xLinguOptionsCLB->append();
+ ++nEntry;
+
+ aLngCfg.GetProperty( UPN_IS_SPELL_HYPHENATED_COMPOUND ) >>= bVal;
+ nUserData = OptionsUserData( EID_SPELL_HYPHENATED_COMPOUND, false, 0, true, bVal).GetUserData();
+ m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xLinguOptionsCLB->set_text(nEntry, sSpellHyphenatedCompound, 0);
+ m_xLinguOptionsCLB->set_id(nEntry, OUString::number(nUserData));
+
+ m_xLinguOptionsCLB->append();
+ ++nEntry;
+
aLngCfg.GetProperty( UPN_IS_SPELL_SPECIAL ) >>= bVal;
nUserData = OptionsUserData( EID_SPELL_SPECIAL, false, 0, true, bVal).GetUserData();
m_xLinguOptionsCLB->set_toggle(nEntry, bVal ? TRISTATE_TRUE : TRISTATE_FALSE);