[Libreoffice-commits] core.git: svx/source

Eike Rathke erack at redhat.com
Wed Mar 7 19:15:13 UTC 2018


 svx/source/dialog/srchdlg.cxx |   31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

New commits:
commit d99ae18b68d3889c999b59485006f85f7faa201c
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Mar 7 20:02:26 2018 +0100

    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
    
    Change-Id: I65f2a23b66370fdfe2d170c17c7736a3b4177192

diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 3f822f5f84cb..0e46b65fc6a4 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -112,6 +112,10 @@ namespace
     {
         return pBox->IsEnabled() && pBox->IsChecked();
     }
+    bool GetNegatedCheckBoxValue(const CheckBox *pBox)
+    {
+        return pBox->IsEnabled() && !pBox->IsChecked();
+    }
 }
 
 struct SearchDlg_Impl
@@ -474,11 +478,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
@@ -720,7 +728,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());
@@ -800,8 +808,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() );
@@ -1330,9 +1337,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 );
 


More information about the Libreoffice-commits mailing list