diff options
author | Eike Rathke <erack@redhat.com> | 2018-03-07 20:02:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-03-29 12:54:41 +0200 |
commit | dbe02ba3775832ff35d512ad53b1e70028fb2659 (patch) | |
tree | e3c327cbf21958503d87b93df741fcaa1160436b | |
parent | e621e1070fb096f0904bd8f43d906d7a4636c246 (diff) |
Resolves: tdf#116242 handle negated diacritics correctly and show checkbox
This is a combination of 2 commits.
Resolves: tdf#116242 handle negated diacritics correctly and show checkbox
The "ignore diacritics" implementation is not only about CTL,
whatever its names suggest. It uses an ICU
"NFD; [:M:] Remove; NFC" transliteration that decomposes and
removes *any* diacritic.
Thus treat it as such and don't hide the checkbox if CTL is not
enabled, but more important preset the sensitive values, and
handle the UI vs implementation oddity correctly; UI "sensitive" /
code "include" means to *not* *ignore*, obtain the proper negated
value from the checkbox.
Unfortunately the setting is stored in the configuration, so an
update will still present the user with an unchecked
Diacritics-sensitive box s/he has to enable once.
The actual failure (diacritics always ignored) is a fallout from
commit d4064927a2e83c974d4ee9538081e8a4fcdb1e34
AuthorDate: Tue Oct 3 10:26:28 2017 -0800
CommitDate: Thu Oct 26 17:24:26 2017 +0200
tdf#111846 Find & Replace: Rename diacritics and kashida options
(cherry picked from commit d99ae18b68d3889c999b59485006f85f7faa201c)
Change IsIgnoreDiacritics_CTL default to false, tdf#116242 follow-up
And adapt description to reality.
(cherry picked from commit a8959a26e18237c458a853f2ca7524e875d4c1b6)
ab35b74f4cbe7dc91fd0570adcc634faba96b5de
Change-Id: I65f2a23b66370fdfe2d170c17c7736a3b4177192
Reviewed-on: https://gerrit.libreoffice.org/51382
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 4 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs | 4 | ||||
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 31 |
3 files changed, 23 insertions, 16 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 6ec7ec487676..f9ea2cb3ae3a 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5744,9 +5744,9 @@ <!-- OldLocation: --> <!-- UIHints: Edit/Find & Replace --> <info> - <desc>Specifies search with the use of CTL option.</desc> + <desc>Specifies search ignores diacritics, not only CTL though.</desc> </info> - <value>true</value> + <value>false</value> </prop> <prop oor:name="IsIgnoreKashida_CTL" oor:type="xs:boolean" oor:nillable="false"> <!-- OldPath: --> diff --git a/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs b/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs index 1edab99beaff..98a581786d32 100644 --- a/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs @@ -954,9 +954,9 @@ </prop> <prop oor:name="IsIgnoreDiacritics_CTL" oor:type="xs:boolean" oor:nillable="false"> <info> - <desc>Specifies search with the use of CTL option.</desc> + <desc>Specifies search ignores diacritics, not only CTL though.</desc> </info> - <value>true</value> + <value>false</value> </prop> <prop oor:name="IsIgnoreKashida_CTL" oor:type="xs:boolean" oor:nillable="false"> <info> diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 2ee79ba6b44d..3d8ae5e3000b 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -113,6 +113,10 @@ namespace { return pBox->IsEnabled() && pBox->IsChecked(); } + bool GetNegatedCheckBoxValue(const CheckBox *pBox) + { + return pBox->IsEnabled() && !pBox->IsChecked(); + } } struct SearchDlg_Impl @@ -475,11 +479,15 @@ void SvxSearchDialog::Construct_Impl() m_pJapMatchFullHalfWidthCB->Hide(); } SvtCTLOptions aCTLOptions; + // Do not disable and hide the m_pIncludeDiacritics button. + // Include Diacritics == Not Ignore Diacritics => A does not match A-Umlaut (Diaeresis). + // Confusingly these have negated names (following the UI) but the actual + // transliteration is to *ignore* diacritics if "included" (sensitive) is + // _not_ checked. if(!aCTLOptions.IsCTLFontEnabled()) { - m_pIncludeDiacritics->Check( false ); - m_pIncludeDiacritics->Hide(); - m_pIncludeKashida->Check( false ); + m_pIncludeDiacritics->Check( true ); + m_pIncludeKashida->Check( true ); m_pIncludeKashida->Hide(); } //component extension - show component search buttons if the commands @@ -719,7 +727,7 @@ void SvxSearchDialog::ShowOptionalControls_Impl() m_pSimilarityBox->Show(); m_pSimilarityBtn->Show(); m_pSelectionBtn->Show(); - m_pIncludeDiacritics->Show(aCTLOptions.IsCTLFontEnabled()); + m_pIncludeDiacritics->Show(); m_pIncludeKashida->Show(aCTLOptions.IsCTLFontEnabled()); m_pJapMatchFullHalfWidthCB->Show(aCJKOptions.IsCJKFontEnabled()); m_pJapOptionsCB->Show(aCJKOptions.IsJapaneseFindEnabled()); @@ -799,8 +807,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern ) m_pSimilarityBox->Check( pSearchItem->IsLevenshtein() ); if( m_pJapOptionsCB->IsVisible() ) m_pJapOptionsCB->Check( pSearchItem->IsUseAsianOptions() ); - if (m_pIncludeDiacritics->IsVisible()) - m_pIncludeDiacritics->Check( !aOpt.IsIgnoreDiacritics_CTL() ); + m_pIncludeDiacritics->Check( !aOpt.IsIgnoreDiacritics_CTL() ); if (m_pIncludeKashida->IsVisible()) m_pIncludeKashida->Check( !aOpt.IsIgnoreKashida_CTL() ); ApplyTransliterationFlags_Impl( pSearchItem->GetTransliterationFlags() ); @@ -1329,9 +1336,9 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn, void ) if( !pSearchItem->IsUseAsianOptions()) nFlags &= (TransliterationFlags::IGNORE_CASE | TransliterationFlags::IGNORE_WIDTH ); - if (!GetCheckBoxValue(m_pIncludeDiacritics)) + if (GetNegatedCheckBoxValue(m_pIncludeDiacritics)) nFlags |= TransliterationFlags::IGNORE_DIACRITICS_CTL; - if (!GetCheckBoxValue(m_pIncludeKashida)) + if (GetNegatedCheckBoxValue(m_pIncludeKashida)) nFlags |= TransliterationFlags::IGNORE_KASHIDA_CTL; pSearchItem->SetTransliterationFlags( nFlags ); @@ -2287,17 +2294,17 @@ void SvxSearchDialog::SaveToModule_Impl() pSearchItem->SetUseAsianOptions(GetCheckBoxValue(m_pJapOptionsCB)); SvtSearchOptions aOpt; - aOpt.SetIgnoreDiacritics_CTL(!GetCheckBoxValue(m_pIncludeDiacritics)); - aOpt.SetIgnoreKashida_CTL(!GetCheckBoxValue(m_pIncludeKashida)); + aOpt.SetIgnoreDiacritics_CTL(GetNegatedCheckBoxValue(m_pIncludeDiacritics)); + aOpt.SetIgnoreKashida_CTL(GetNegatedCheckBoxValue(m_pIncludeKashida)); aOpt.Commit(); TransliterationFlags nFlags = GetTransliterationFlags(); if( !pSearchItem->IsUseAsianOptions()) nFlags &= (TransliterationFlags::IGNORE_CASE | TransliterationFlags::IGNORE_WIDTH ); - if (!GetCheckBoxValue(m_pIncludeDiacritics)) + if (GetNegatedCheckBoxValue(m_pIncludeDiacritics)) nFlags |= TransliterationFlags::IGNORE_DIACRITICS_CTL; - if (!GetCheckBoxValue(m_pIncludeKashida)) + if (GetNegatedCheckBoxValue(m_pIncludeKashida)) nFlags |= TransliterationFlags::IGNORE_KASHIDA_CTL; pSearchItem->SetTransliterationFlags( nFlags ); |