summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-03-07 20:02:26 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-03-19 08:49:01 +0100
commit31f3e18d52c0cc124cd7a789a8f1fbc7c2534701 (patch)
tree1e93fd5bf00500681155a3afb67ee362c5814295 /svx/source
parentafe0aa7fde7e4d4f9a928235e41953bf73e2ea6c (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/50914 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/dialog/srchdlg.cxx31
1 files changed, 19 insertions, 12 deletions
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 );