summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-06-01 19:31:38 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2020-06-05 16:56:54 +0200
commitdaa6caafb35c2f263518910f82359f73c0794b63 (patch)
tree7e0d103e3389f68473e589f126ae73712e0e53b1 /cui
parent9bc5e0808c815374d8a56bf0234996f133b19744 (diff)
tdf#133589 AutoCorrect: transliterate to Old Hungarian
In right-to-left paragraph mode, transliterate Hungarian text word by word during typing, also add the associated checkbox to Localized Options page of AutoCorrect dialog window. Old Hungarian (ISO 15924: Hung) is a historical and renewed script which is still in use to transliterate Hungarian writing. As a localized AutoCorrect feature, the patch supports the followings: – word-by-word transliteration of Hungarian texts only in right-to-left paragraph mode. – consonant disambiguation of digraphs and trigraphs based on hyphenation (now pattern-based Huhyphn dictionary of libhyphen, planned dictionary based Hunspell later) – transliteration by extended hu-Hung module of Numbertext library. Note: transliteration of the selected text using AutoCorrect Apply function has't been implemented, yet. Change-Id: Iee0f18e2485c974c35acf0a3abc3a49c2cf80196 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95303 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry-picked from commit da64ec8c8a91db6a6ec9657898f081d5ee67e739) Change-Id: If6639761278048d2fca61f7881a3287d38a1a313 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95378 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/inc/strings.hrc1
-rw-r--r--cui/source/inc/autocdlg.hxx1
-rw-r--r--cui/source/tabpages/autocdlg.cxx16
3 files changed, 17 insertions, 1 deletions
diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 32e13138bf10..0039d4d02fdc 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -331,6 +331,7 @@
#define RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK NC_("RID_SVXSTR_CORRECT_ACCIDENTAL_CAPS_LOCK", "Correct accidental use of cAPS LOCK key")
#define RID_SVXSTR_NON_BREAK_SPACE NC_("RID_SVXSTR_NON_BREAK_SPACE", "Add non-breaking space before specific punctuation marks in French text")
#define RID_SVXSTR_ORDINAL NC_("RID_SVXSTR_ORDINAL", "Format ordinal numbers suffixes (1st -> 1^st)")
+#define RID_SVXSTR_OLD_HUNGARIAN NC_("RID_SVXSTR_OLD_HUNGARIAN", "Transliterate to Old Hungarian if the text direction is from right to left")
#define RID_SVXSTR_DEL_EMPTY_PARA NC_("RID_SVXSTR_DEL_EMPTY_PARA", "Remove blank paragraphs")
#define RID_SVXSTR_USER_STYLE NC_("RID_SVXSTR_USER_STYLE", "Replace Custom Styles")
#define RID_SVXSTR_BULLET NC_("RID_SVXSTR_BULLET", "Replace bullets with: %1")
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index 896a481b711c..b94fd3d80fef 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -268,6 +268,7 @@ class OfaQuoteTabPage : public SfxTabPage
private:
OUString sNonBrkSpace;
OUString sOrdinal;
+ OUString sTransliterateRTL;
sal_UCS4 cSglStartQuote;
sal_UCS4 cSglEndQuote;
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 5b623de576ef..74e1ef127659 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -1525,7 +1525,8 @@ namespace {
enum OfaQuoteOptions
{
ADD_NONBRK_SPACE,
- REPLACE_1ST
+ REPLACE_1ST,
+ TRANSLITERATE_RTL
};
}
@@ -1545,6 +1546,7 @@ OfaQuoteTabPage::OfaQuoteTabPage(weld::Container* pPage, weld::DialogController*
: SfxTabPage(pPage, pController, "cui/ui/applylocalizedpage.ui", "ApplyLocalizedPage", &rSet)
, sNonBrkSpace(CuiResId(RID_SVXSTR_NON_BREAK_SPACE))
, sOrdinal(CuiResId(RID_SVXSTR_ORDINAL))
+ , sTransliterateRTL(CuiResId(RID_SVXSTR_OLD_HUNGARIAN))
, cSglStartQuote(0)
, cSglEndQuote(0)
, cStartQuote(0)
@@ -1619,6 +1621,7 @@ bool OfaQuoteTabPage::FillItemSet( SfxItemSet* )
int nPos = 0;
pAutoCorrect->SetAutoCorrFlag(ACFlags::AddNonBrkSpace, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgOrdinalNumber, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::TransliterateRTL, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE);
}
bool bModified = false;
@@ -1637,6 +1640,12 @@ bool OfaQuoteTabPage::FillItemSet( SfxItemSet* )
pOpt->bChgOrdinalNumber = bCheck;
pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgOrdinalNumber,
m_xSwCheckLB->get_toggle(REPLACE_1ST, CBCOL_SECOND) == TRISTATE_TRUE);
+
+ bCheck = m_xSwCheckLB->get_toggle(TRANSLITERATE_RTL, CBCOL_FIRST) == TRISTATE_TRUE;
+ bModified |= pOpt->bTransliterateRTL != bCheck;
+ pOpt->bTransliterateRTL = bCheck;
+ pAutoCorrect->SetAutoCorrFlag(ACFlags::TransliterateRTL,
+ m_xSwCheckLB->get_toggle(TRANSLITERATE_RTL, CBCOL_SECOND) == TRISTATE_TRUE);
}
pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgQuotes, m_xDoubleTypoCB->get_active());
@@ -1696,11 +1705,14 @@ void OfaQuoteTabPage::Reset( const SfxItemSet* )
CreateEntry(*m_xSwCheckLB, sNonBrkSpace, CBCOL_BOTH, 2);
CreateEntry(*m_xSwCheckLB, sOrdinal, CBCOL_BOTH, 2);
+ CreateEntry(*m_xSwCheckLB, sTransliterateRTL, CBCOL_BOTH, 2);
m_xSwCheckLB->set_toggle(ADD_NONBRK_SPACE, pOpt->bAddNonBrkSpace ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
m_xSwCheckLB->set_toggle(ADD_NONBRK_SPACE, bool(nFlags & ACFlags::AddNonBrkSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
m_xSwCheckLB->set_toggle(REPLACE_1ST, pOpt->bChgOrdinalNumber ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
m_xSwCheckLB->set_toggle(REPLACE_1ST, bool(nFlags & ACFlags::ChgOrdinalNumber) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
+ m_xSwCheckLB->set_toggle(TRANSLITERATE_RTL, pOpt->bTransliterateRTL ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
+ m_xSwCheckLB->set_toggle(TRANSLITERATE_RTL, bool(nFlags & ACFlags::TransliterateRTL) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND);
m_xSwCheckLB->thaw();
}
@@ -1713,10 +1725,12 @@ void OfaQuoteTabPage::Reset( const SfxItemSet* )
CreateEntry(*m_xCheckLB, sNonBrkSpace, CBCOL_FIRST, 1);
CreateEntry(*m_xCheckLB, sOrdinal, CBCOL_FIRST, 1);
+ CreateEntry(*m_xCheckLB, sTransliterateRTL, CBCOL_FIRST, 1);
int nPos = 0;
m_xCheckLB->set_toggle(nPos++, bool(nFlags & ACFlags::AddNonBrkSpace) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
m_xCheckLB->set_toggle(nPos++, bool(nFlags & ACFlags::ChgOrdinalNumber) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
+ m_xCheckLB->set_toggle(nPos++, bool(nFlags & ACFlags::TransliterateRTL) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
m_xCheckLB->thaw();
}