cui/inc/strings.hrc | 1 cui/source/inc/autocdlg.hxx | 1 cui/source/tabpages/autocdlg.cxx | 16 +++++++- editeng/source/misc/acorrcfg.cxx | 25 +++++++------ editeng/source/misc/svxacorr.cxx | 7 ++- editeng/source/misc/swafopt.cxx | 1 include/editeng/svxacorr.hxx | 3 + include/editeng/swafopt.hxx | 1 officecfg/registry/schema/org/openoffice/Office/Common.xcs | 8 ++++ officecfg/registry/schema/org/openoffice/Office/Writer.xcs | 8 ++++ 10 files changed, 56 insertions(+), 15 deletions(-)
New commits: commit 7ffc9d592299a71c86f11a57bc2cd5037927f522 Author: László Németh <[email protected]> AuthorDate: Tue Jun 23 18:49:46 2020 +0200 Commit: Adolfo Jayme Barrientos <[email protected]> CommitDate: Tue Jun 30 19:44:42 2020 +0200 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. Note: fix also redundant loading of new localized option added by commit da64ec8c8a91db6a6ec9657898f081d5ee67e739 (tdf#133589 AutoCorrect: transliterate to Old Hungarian) Conflicts: cui/source/tabpages/autocdlg.cxx editeng/source/misc/svxacorr.cxx Change-Id: Ib0c7e8837a89c3772c5db76720811d440e62183a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97094 Tested-by: Jenkins Reviewed-by: László Németh <[email protected]> (cherry-picked from commit 77b213890a96d144d9cfacdfd35ac0bba68b9f7a and commit 076c95b27bf0e9be1fa1c077674cf974b22210fd) Change-Id: I3877ae930fa3e1e813a4b93b9ec4c2b18f8f5dd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97359 Tested-by: Jenkins Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> Reviewed-by: Adolfo Jayme Barrientos <[email protected]> diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index dcfbcc0f4e9c..b68c94ee3532 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 4f1c0f3632e0..449e231d9ada 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -1526,7 +1526,8 @@ enum OfaQuoteOptions { ADD_NONBRK_SPACE, REPLACE_1ST, - TRANSLITERATE_RTL + TRANSLITERATE_RTL, + REPLACE_ANGLE_QUOTES }; } @@ -1547,6 +1548,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) @@ -1622,6 +1624,7 @@ bool OfaQuoteTabPage::FillItemSet( SfxItemSet* ) 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); + pAutoCorrect->SetAutoCorrFlag(ACFlags::ChgAngleQuotes, m_xCheckLB->get_toggle(nPos++, CBCOL_FIRST) == TRISTATE_TRUE); } bool bModified = false; @@ -1646,6 +1649,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()); @@ -1706,6 +1715,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); @@ -1713,6 +1723,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(); } @@ -1726,11 +1738,13 @@ 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); + CreateEntry(*m_xCheckLB, sAngleQuotes, 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->set_toggle(nPos++, bool(nFlags & ACFlags::ChgAngleQuotes) ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST); m_xCheckLB->thaw(); } diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index d3e9f75b8413..aa08f4196664 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,8 @@ 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 }; - const int nCount = 48; + const int nCount = 47; Sequence<OUString> aNames(nCount); OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) @@ -484,7 +491,6 @@ void SvxSwAutoCorrCfg::Load(bool bInit) rSwFlags.aByInputBulletFont.SetPitch(FontPitch(nVal)); } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch", - case 47 : rSwFlags.bTransliterateRTL = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/TransliterateRTL", } } } @@ -586,11 +592,8 @@ void SvxSwAutoCorrCfg::ImplCommit() // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily" css::uno::Any(sal_Int32(rSwFlags.aByInputBulletFont.GetCharSet())), // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset" - css::uno::Any(sal_Int32(rSwFlags.aByInputBulletFont.GetPitch())), + css::uno::Any(sal_Int32(rSwFlags.aByInputBulletFont.GetPitch()))}); // "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch" - css::uno::Any(rSwFlags.bTransliterateRTL)}); - // "Format/Option/TransliterateRTL" - } void SvxSwAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */ ) diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 32d4d6e9fa5f..983660bab918 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 @@ -1382,8 +1383,10 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt, InsertQuote( rDoc, nInsPos, cChar, bSttQuote, bInsert, eLang, eType ); break; } - // tdf#133524 change "<<" and ">>" to double angle quoation marks - else if ( IsAutoCorrFlag( ACFlags::ChgQuotes ) && ('<' == cChar || '>' == cChar) && + // tdf#133524 change "<<" and ">>" to double angle quotation marks + 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 --> _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
