diff options
author | László Németh <nemeth@numbertext.org> | 2020-06-23 18:49:46 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-06-26 09:01:20 +0200 |
commit | 77b213890a96d144d9cfacdfd35ac0bba68b9f7a (patch) | |
tree | ed07e76887e1eae390a4492467c9bdd8140c0a7d | |
parent | 46308ce281ae93e22c0b051b68dad1ee21c6646e (diff) |
tdf#133524 add option to angle quote AutoCorrect
in Localized Options page of AutoCorrect Options
dialog window:
[x] Replace << and >> with angle quotes
Note: this is optional part of Double Quotes replacement.
Change-Id: Ib0c7e8837a89c3772c5db76720811d440e62183a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97094
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r-- | cui/inc/strings.hrc | 1 | ||||
-rw-r--r-- | cui/source/inc/autocdlg.hxx | 1 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 17 | ||||
-rw-r--r-- | editeng/source/misc/acorrcfg.cxx | 22 | ||||
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 5 | ||||
-rw-r--r-- | editeng/source/misc/swafopt.cxx | 1 | ||||
-rw-r--r-- | include/editeng/svxacorr.hxx | 3 | ||||
-rw-r--r-- | include/editeng/swafopt.hxx | 1 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 8 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Writer.xcs | 8 |
10 files changed, 58 insertions, 9 deletions
diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index 20ec52202bc0..d54a0f9cd370 100644 --- a/cui/inc/strings.hrc +++ b/cui/inc/strings.hrc @@ -333,6 +333,7 @@ #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_ANGLE_QUOTES NC_("RID_SVXSTR_ANGLE_QUOTES", "Replace << and >> with angle quotes") #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 11eb7b9de89b..e0c780fe831e 100644 --- a/cui/source/inc/autocdlg.hxx +++ b/cui/source/inc/autocdlg.hxx @@ -269,6 +269,7 @@ private: OUString sNonBrkSpace; OUString sOrdinal; OUString sTransliterateRTL; + OUString sAngleQuotes; sal_UCS4 cSglStartQuote; sal_UCS4 cSglEndQuote; diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 807f0cd2d284..ef413c52d54d 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -1525,7 +1525,8 @@ enum OfaQuoteOptions { ADD_NONBRK_SPACE, REPLACE_1ST, - TRANSLITERATE_RTL + TRANSLITERATE_RTL, + REPLACE_ANGLE_QUOTES }; } @@ -1546,6 +1547,7 @@ OfaQuoteTabPage::OfaQuoteTabPage(weld::Container* pPage, weld::DialogController* , sNonBrkSpace(CuiResId(RID_SVXSTR_NON_BREAK_SPACE)) , sOrdinal(CuiResId(RID_SVXSTR_ORDINAL)) , sTransliterateRTL(CuiResId(RID_SVXSTR_OLD_HUNGARIAN)) + , sAngleQuotes(CuiResId(RID_SVXSTR_ANGLE_QUOTES)) , cSglStartQuote(0) , cSglEndQuote(0) , cStartQuote(0) @@ -1620,6 +1622,7 @@ bool OfaQuoteTabPage::FillItemSet( SfxItemSet* ) pAutoCorrect->SetAutoCorrFlag(ACFlags::AddNonBrkSpace, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE); pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgOrdinalNumber, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE); pAutoCorrect->SetAutoCorrFlag(ACFlags::TransliterateRTL, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE); + pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgAngleQuotes, m_xCheckLB->get_toggle(nPos++) == TRISTATE_TRUE); } bool bModified = false; @@ -1644,6 +1647,12 @@ bool OfaQuoteTabPage::FillItemSet( SfxItemSet* ) pOpt->bTransliterateRTL = bCheck; pAutoCorrect->SetAutoCorrFlag(ACFlags::TransliterateRTL, m_xSwCheckLB->get_toggle(TRANSLITERATE_RTL, CBCOL_SECOND) == TRISTATE_TRUE); + + bCheck = m_xSwCheckLB->get_toggle(REPLACE_ANGLE_QUOTES, CBCOL_FIRST) == TRISTATE_TRUE; + bModified |= pOpt->bChgAngleQuotes != bCheck; + pOpt->bChgAngleQuotes = bCheck; + pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgAngleQuotes, + m_xSwCheckLB->get_toggle(REPLACE_ANGLE_QUOTES, CBCOL_SECOND) == TRISTATE_TRUE); } pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgQuotes, m_xDoubleTypoCB->get_active()); @@ -1704,6 +1713,7 @@ 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); + CreateEntry(*m_xSwCheckLB, sAngleQuotes, 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); @@ -1711,6 +1721,8 @@ void OfaQuoteTabPage::Reset( const SfxItemSet* ) 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->set_toggle(REPLACE_ANGLE_QUOTES, pOpt->bChgAngleQuotes ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); + m_xSwCheckLB->set_toggle(REPLACE_ANGLE_QUOTES, bool(nFlags & ACFlags::ChgAngleQuotes) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_SECOND); m_xSwCheckLB->thaw(); } @@ -1731,6 +1743,9 @@ void OfaQuoteTabPage::Reset( const SfxItemSet* ) m_xCheckLB->append(); m_xCheckLB->set_toggle(nPos, bool(nFlags & ACFlags::TransliterateRTL) ? TRISTATE_TRUE : TRISTATE_FALSE); m_xCheckLB->set_text(nPos++, sTransliterateRTL, 0); + m_xCheckLB->append(); + m_xCheckLB->set_toggle(nPos, bool(nFlags & ACFlags::ChgAngleQuotes) ? TRISTATE_TRUE : TRISTATE_FALSE); + m_xCheckLB->set_text(nPos++, sAngleQuotes, 0); m_xCheckLB->thaw(); } diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index d3e9f75b8413..03d238953b10 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -110,9 +110,10 @@ Sequence<OUString> SvxBaseAutoCorrCfg::GetPropertyNames() "DoubleQuoteAtStart", // 15 "DoubleQuoteAtEnd", // 16 "CorrectAccidentalCapsLock", // 17 - "TransliterateRTL" // 18 + "TransliterateRTL", // 18 + "ChangeAngleQuotes" // 19 }; - const int nCount = 19; + const int nCount = 20; Sequence<OUString> aNames(nCount); OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) @@ -219,12 +220,16 @@ void SvxBaseAutoCorrCfg::Load(bool bInit) if(*o3tl::doAccess<bool>(pValues[nProp])) nFlags |= ACFlags::TransliterateRTL; break;//"TransliterateRTL" + case 19: + if(*o3tl::doAccess<bool>(pValues[nProp])) + nFlags |= ACFlags::ChgAngleQuotes; + break;//"ChangeAngleQuotes" } } } if( nFlags != ACFlags::NONE ) rParent.pAutoCorrect->SetAutoCorrFlag( nFlags ); - rParent.pAutoCorrect->SetAutoCorrFlag( ( static_cast<ACFlags>(0x7fff) & ~nFlags ), false ); + rParent.pAutoCorrect->SetAutoCorrFlag( ( static_cast<ACFlags>(0xffff) & ~nFlags ), false ); } SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rPar) : @@ -272,8 +277,11 @@ void SvxBaseAutoCorrCfg::ImplCommit() // "DoubleQuoteAtEnd" css::uno::Any(bool(nFlags & ACFlags::CorrectCapsLock)), // "CorrectAccidentalCapsLock" - css::uno::Any(bool(nFlags & ACFlags::TransliterateRTL))}); + css::uno::Any(bool(nFlags & ACFlags::TransliterateRTL)), // "TransliterateRTL" + css::uno::Any(bool(nFlags & ACFlags::ChgAngleQuotes))}); + // "ChangeAngleQuotes" + } void SvxBaseAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */) @@ -332,9 +340,10 @@ Sequence<OUString> SvxSwAutoCorrCfg::GetPropertyNames() "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily", //44 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", //45 "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch", //46 - "Format/Option/TransliterateRTL" //47 + "Format/Option/TransliterateRTL", //47 + "Format/Option/ChangeAngleQuotes" //48 }; - const int nCount = 48; + const int nCount = 49; Sequence<OUString> aNames(nCount); OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) @@ -485,6 +494,7 @@ void SvxSwAutoCorrCfg::Load(bool bInit) } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch", case 47 : rSwFlags.bTransliterateRTL = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/TransliterateRTL", + case 48 : rSwFlags.bChgAngleQuotes = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeAngleQuotes", } } } diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 4b271993cd68..4f55ea951167 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -286,6 +286,7 @@ ACFlags SvxAutoCorrect::GetDefaultFlags() | ACFlags::ChgToEnEmDash | ACFlags::AddNonBrkSpace | ACFlags::TransliterateRTL + | ACFlags::ChgAngleQuotes | ACFlags::ChgWeightUnderl | ACFlags::SetINetAttr | ACFlags::ChgQuotes @@ -1380,7 +1381,9 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, break; } // tdf#133524 change "<<" and ">>" to double angle quotation marks - else if ( IsAutoCorrFlag( ACFlags::ChgQuotes ) && ('<' == cChar || '>' == cChar) && + else if ( IsAutoCorrFlag( ACFlags::ChgQuotes ) && + IsAutoCorrFlag( ACFlags::ChgAngleQuotes ) && + ('<' == cChar || '>' == cChar) && nInsPos > 0 && cChar == rTxt[ nInsPos-1 ] ) { const LanguageType eLang = GetDocLanguage( rDoc, nInsPos ); diff --git a/editeng/source/misc/swafopt.cxx b/editeng/source/misc/swafopt.cxx index f682c690ae32..bd6fbcf45695 100644 --- a/editeng/source/misc/swafopt.cxx +++ b/editeng/source/misc/swafopt.cxx @@ -32,6 +32,7 @@ SvxSwAutoFormatFlags::SvxSwAutoFormatFlags() bAddNonBrkSpace = bChgOrdinalNumber = bTransliterateRTL = + bChgAngleQuotes = bChgToEnEmDash = bChgWeightUnderl = bSetINetAttr = diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index c9908c633d01..52f7bfdd5271 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -72,13 +72,14 @@ enum class ACFlags : sal_uInt32 { ChgSglQuotes = 0x00001000, // Replace simple quotes CorrectCapsLock = 0x00002000, // Correct accidental use of cAPS LOCK key TransliterateRTL = 0x00004000, // Transliterate RTL text + ChgAngleQuotes = 0x00008000, // >>, << -> angle quotes in some languages ChgWordLstLoad = 0x20000000, // Replacement list loaded CplSttLstLoad = 0x40000000, // Exception list for Capital letters Start loaded WrdSttLstLoad = 0x80000000, // Exception list for Word Start loaded }; namespace o3tl { - template<> struct typed_flags<ACFlags> : is_typed_flags<ACFlags, 0xe0007fff> {}; + template<> struct typed_flags<ACFlags> : is_typed_flags<ACFlags, 0xe000ffff> {}; } enum class ACQuotes diff --git a/include/editeng/swafopt.hxx b/include/editeng/swafopt.hxx index 682e85e4d77a..4fd1207cefb4 100644 --- a/include/editeng/swafopt.hxx +++ b/include/editeng/swafopt.hxx @@ -104,6 +104,7 @@ struct EDITENG_DLLPUBLIC SvxSwAutoFormatFlags bool bChgToEnEmDash : 1; bool bAddNonBrkSpace : 1; bool bTransliterateRTL : 1; + bool bChgAngleQuotes : 1; bool bChgWeightUnderl : 1; bool bSetINetAttr : 1; diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index fd466a6899f4..ffe91a4d3c8e 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -1372,6 +1372,14 @@ </info> <value>true</value> </prop> + <prop oor:name="ChangeAngleQuotes" oor:type="xs:boolean" oor:nillable="false"> + <!-- UIHints: Tools AutoCorrect/AutoFormat Options - Replace << and >> with angle quotes --> + <info> + <desc>Specifies if << or >> should be replaced by angle quotes automatically.</desc> + <label>Replace angle quotes</label> + </info> + <value>true</value> + </prop> <prop oor:name="RemoveDoubleSpaces" oor:type="xs:boolean" oor:nillable="false"> <!-- OldPath: AutoCorrect/Options/All --> <!-- OldLocation: Soffice.cfg --> diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs index 6beb18105b08..dab6d9af6711 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs @@ -4336,6 +4336,14 @@ </info> <value>true</value> </prop> + <prop oor:name="ChangeAngleQuotes" oor:type="xs:boolean" oor:nillable="false"> + <!-- UIHints: Tools AutoCorrect/AutoFormat Options - Replace << and >> with angle quotes --> + <info> + <desc>Specifies if << or >> should be replaced by angle quotes automatically.</desc> + <label>Replace angle quotes</label> + </info> + <value>true</value> + </prop> <prop oor:name="DelEmptyParagraphs" oor:type="xs:boolean" oor:nillable="false"> <!-- OldPath: Writer/AutoFormat/Options --> <!-- OldLocation: Soffice.cfg --> |