diff options
author | Faisal M. Al-Otaibi <fmalotaibi@kacst.edu.sa> | 2014-04-08 09:42:20 +0300 |
---|---|---|
committer | Faisal M. Al-Otaibi <fmalotaibi@kacst.edu.sa> | 2014-04-08 10:58:15 +0300 |
commit | d2771b63b94a8aae3c25c83e9dae9f83242f46c1 (patch) | |
tree | 976ff93c1bf86829f0a2aa9b42b48f08a7df25f1 | |
parent | 411297a0ad63a3b7484005fd2ad27dd53b58c3d7 (diff) |
fdo#77123: Add option ignore kashida to the search
This patch will add new checkbox to ignore kashida in the
search and replace dialog.
Change-Id: I9e7179242751103b8418d922ade5b9145170ad15
-rw-r--r-- | cui/source/options/optgdlg.cxx | 1 | ||||
-rw-r--r-- | i18npool/Library_i18npool.mk | 1 | ||||
-rw-r--r-- | i18npool/inc/transliteration_Ignore.hxx | 4 | ||||
-rw-r--r-- | i18npool/source/localedata/data/ar_EG.xml | 1 | ||||
-rw-r--r-- | i18npool/source/registerservices/registerservices.cxx | 2 | ||||
-rw-r--r-- | i18npool/source/transliteration/ignoreKashida_CTL.cxx | 35 | ||||
-rw-r--r-- | i18npool/source/transliteration/transliterationImpl.cxx | 4 | ||||
-rw-r--r-- | i18npool/util/i18npool.component | 3 | ||||
-rw-r--r-- | include/svx/srchdlg.hxx | 1 | ||||
-rw-r--r-- | include/unotools/searchopt.hxx | 2 | ||||
-rw-r--r-- | offapi/com/sun/star/i18n/TransliterationModules.idl | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/i18n/TransliterationModulesExtra.idl | 2 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 9 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs | 6 | ||||
-rw-r--r-- | svl/source/items/srchitem.cxx | 5 | ||||
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 13 | ||||
-rw-r--r-- | svx/uiconfig/ui/findreplacedialog.ui | 16 | ||||
-rw-r--r-- | unotools/source/config/searchopt.cxx | 17 |
18 files changed, 118 insertions, 5 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 4453b50d854a..f833d4408161 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -1394,6 +1394,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet ) { SvtSearchOptions aOpt; aOpt.SetIgnoreDiacritics_CTL (true); + aOpt.SetIgnoreKashida_CTL (true); pLangConfig->aLanguageOptions.SetCTLFontEnabled( m_pCTLSupportCB->IsChecked() ); const sal_uInt16 STATE_COUNT = 1; diff --git a/i18npool/Library_i18npool.mk b/i18npool/Library_i18npool.mk index f8900bf0fb65..4f9e5999a17a 100644 --- a/i18npool/Library_i18npool.mk +++ b/i18npool/Library_i18npool.mk @@ -94,6 +94,7 @@ $(eval $(call gb_Library_add_exception_objects,i18npool,\ i18npool/source/transliteration/ignoreWidth \ i18npool/source/transliteration/ignoreZiZu_ja_JP \ i18npool/source/transliteration/ignoreDiacritics_CTL \ + i18npool/source/transliteration/ignoreKashida_CTL \ i18npool/source/transliteration/katakanaToHiragana \ i18npool/source/transliteration/largeToSmall_ja_JP \ i18npool/source/transliteration/numtochar \ diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx index a1aa29ec5dfe..691b8677e1c0 100644 --- a/i18npool/inc/transliteration_Ignore.hxx +++ b/i18npool/inc/transliteration_Ignore.hxx @@ -118,6 +118,10 @@ TRANSLITERATION_IGNORE(ZiZu_ja_JP) TRANSLITERATION_IGNORE(Diacritics_CTL) #endif +#if defined( TRANSLITERATION_Kashida_CTL ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(Kashida_CTL) +#endif + #undef TRANSLITERATION_IGNORE #define TRANSLITERATION_IGNORE( name ) \ diff --git a/i18npool/source/localedata/data/ar_EG.xml b/i18npool/source/localedata/data/ar_EG.xml index 662a913d8a55..7e52d518d907 100644 --- a/i18npool/source/localedata/data/ar_EG.xml +++ b/i18npool/source/localedata/data/ar_EG.xml @@ -466,6 +466,7 @@ <Transliteration unoid="TOGGLE_CASE"/> <Transliteration unoid="IGNORE_CASE"/> <Transliteration unoid="ignoreDiacritics_CTL"/> + <Transliteration unoid="ignoreKashida_CTL"/> </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 93b38d72a0df..67c59e61b9d2 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -156,6 +156,7 @@ IMPL_CREATEINSTANCE( ignoreProlongedSoundMark_ja_JP) IMPL_CREATEINSTANCE( ignoreMiddleDot_ja_JP) IMPL_CREATEINSTANCE( ignoreSpace_ja_JP) IMPL_CREATEINSTANCE( ignoreDiacritics_CTL) +IMPL_CREATEINSTANCE( ignoreKashida_CTL) IMPL_CREATEINSTANCE( TextToChuyin_zh_TW ) IMPL_CREATEINSTANCE( TextToPinyin_zh_CN ) @@ -381,6 +382,7 @@ static const struct InstancesArray { IMPL_TRANSLITERATION_ITEM (TextToPinyin_zh_CN), IMPL_TRANSLITERATION_ITEM (TextToChuyin_zh_TW), IMPL_TRANSLITERATION_ITEM( ignoreDiacritics_CTL), + IMPL_TRANSLITERATION_ITEM (ignoreKashida_CTL), IMPL_TRANSLITERATION_ITEM (NumToCharUpper_zh_CN), IMPL_TRANSLITERATION_ITEM (NumToCharLower_zh_CN), diff --git a/i18npool/source/transliteration/ignoreKashida_CTL.cxx b/i18npool/source/transliteration/ignoreKashida_CTL.cxx new file mode 100644 index 000000000000..ff0303dbf217 --- /dev/null +++ b/i18npool/source/transliteration/ignoreKashida_CTL.cxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#define TRANSLITERATION_Kashida_CTL +#include <transliteration_Ignore.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +sal_Unicode +ignoreKashida_CTL_translator (const sal_Unicode c) +{ + if( c == 0x0640 ) // Check if it's Kashida + return 0xffff; // Then skip this character + + return c; +} + +ignoreKashida_CTL::ignoreKashida_CTL() +{ + func = ignoreKashida_CTL_translator; + table = 0; + map = 0; + transliterationName = "ignoreKashida_CTL"; + implementationName = "com.sun.star.i18n.Transliteration.ignoreKashida_CTL"; +} + +} } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index 85014b6a3092..7e1d7bf7f34e 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -199,6 +199,10 @@ TransliterationImpl::loadModule( TransliterationModules modType, const Locale& r if (loadModuleByName(OUString("ignoreDiacritics_CTL"), bodyCascade[numCascade], rLocale)) numCascade++; } + if (modType & TransliterationModulesExtra::ignoreKashida_CTL) + if (loadModuleByName(OUString("ignoreKashida_CTL"), bodyCascade[numCascade], rLocale)) + numCascade++; + } else if (modType&TransliterationModules_NON_IGNORE_MASK) { for (sal_Int16 i = 0; TMlist[i].tm; i++) { if (TMlist[i].tm == modType) { diff --git a/i18npool/util/i18npool.component b/i18npool/util/i18npool.component index 9873934226c4..9617a8b4151b 100644 --- a/i18npool/util/i18npool.component +++ b/i18npool/util/i18npool.component @@ -492,4 +492,7 @@ <implementation name="com.sun.star.i18n.Transliteration.ignoreDiacritics_CTL"> <service name="com.sun.star.i18n.Transliteration.l10n"/> </implementation> + <implementation name="com.sun.star.i18n.Transliteration.ignoreKashida_CTL"> + <service name="com.sun.star.i18n.Transliteration.l10n"/> + </implementation> </component> diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx index 56cd87b224ee..da4ec001e9a3 100644 --- a/include/svx/srchdlg.hxx +++ b/include/svx/srchdlg.hxx @@ -178,6 +178,7 @@ private: PushButton* m_pCloseBtn; CheckBox* m_pIgnoreDiacritics; + CheckBox* m_pIgnoreKashida; CheckBox* m_pSelectionBtn; CheckBox* m_pBackwardsBtn; CheckBox* m_pRegExpBtn; diff --git a/include/unotools/searchopt.hxx b/include/unotools/searchopt.hxx index 40e04dd50bea..d9b3cf3c1f7e 100644 --- a/include/unotools/searchopt.hxx +++ b/include/unotools/searchopt.hxx @@ -80,6 +80,7 @@ public: bool IsIgnoreProlongedSoundMark() const; bool IsIgnoreMiddleDot() const; bool IsIgnoreDiacritics_CTL() const; + bool IsIgnoreKashida_CTL() const; void SetMatchFullHalfWidthForms( bool bVal ); void SetMatchHiraganaKatakana( bool bVal ); @@ -100,6 +101,7 @@ public: void SetIgnoreProlongedSoundMark( bool bVal ); void SetIgnoreMiddleDot( bool bVal ); void SetIgnoreDiacritics_CTL( bool bVal ); + void SetIgnoreKashida_CTL( bool bVal ); }; #endif diff --git a/offapi/com/sun/star/i18n/TransliterationModules.idl b/offapi/com/sun/star/i18n/TransliterationModules.idl index a1535724b4ac..cb13f601d1b6 100644 --- a/offapi/com/sun/star/i18n/TransliterationModules.idl +++ b/offapi/com/sun/star/i18n/TransliterationModules.idl @@ -67,7 +67,6 @@ published enum TransliterationModules IGNORE_KANA = 0x00000200, // ja_JP /// Ignore full width and half width character when comparing strings by transliteration service IGNORE_WIDTH = 0x00000400, // ja_JP - // not used yet = 0x00000800, /// Ignore Japanese traditional Kanji character in Japanese fuzzy search ignoreTraditionalKanji_ja_JP = 0x00001000, /// Ignore Japanese traditional Katakana and Hiragana character in Japanese fuzzy search diff --git a/offapi/com/sun/star/i18n/TransliterationModulesExtra.idl b/offapi/com/sun/star/i18n/TransliterationModulesExtra.idl index 45f7ccbeb261..d1f675f4ee57 100644 --- a/offapi/com/sun/star/i18n/TransliterationModulesExtra.idl +++ b/offapi/com/sun/star/i18n/TransliterationModulesExtra.idl @@ -52,6 +52,8 @@ constants TransliterationModulesExtra /// because we cannot extend TransliterationModule we used TranslationModuleExtra and it will act the same way const long ignoreDiacritics_CTL = 0x40000000; + const long ignoreKashida_CTL = 0x00000800; + const long END_OF_MODULE = 0; }; diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 2fd0fe16ec2d..866ad15678fa 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5925,6 +5925,15 @@ </info> <value>true</value> </prop> + <prop oor:name="IsIgnoreKashida_CTL" oor:type="xs:boolean" oor:nillable="false"> + <!-- OldPath: --> + <!-- OldLocation: --> + <!-- UIHints: Edit/Find & Replace --> + <info> + <desc>Specifies search with the use of CTL option.</desc> + </info> + <value>true</value> + </prop> <prop oor:name="IsUseAsianOptions" oor:type="xs:boolean" oor:nillable="false"> <!-- OldPath: --> <!-- OldLocation: --> diff --git a/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs b/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs index c34b2983d4f0..ddcd452c15fa 100644 --- a/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/DataAccess.xcs @@ -958,6 +958,12 @@ </info> <value>true</value> </prop> + <prop oor:name="IsIgnoreKashida_CTL" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Specifies search with the use of CTL option.</desc> + </info> + <value>true</value> + </prop> <prop oor:name="IsUseAsianOptions" oor:type="xs:boolean" oor:nillable="false"> <info> <desc>Specifies that the Asian options for search should be used.</desc> diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx index 8beec542924c..1be294051e40 100644 --- a/svl/source/items/srchitem.cxx +++ b/svl/source/items/srchitem.cxx @@ -84,7 +84,8 @@ static Sequence< OUString > lcl_GetNotifyNames() "Japanese/IsIgnoreWhitespace", // 16 "Japanese/IsIgnoreProlongedSoundMark", // 17 "Japanese/IsIgnoreMiddleDot", // 18 - "IsIgnoreDiacritics_CTL" // 19 + "IsIgnoreDiacritics_CTL", // 19 + "IsIgnoreKashida_CTL" // 20 }; const int nCount = SAL_N_ELEMENTS( aTranslitNames ); @@ -145,6 +146,8 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : rFlags |= TransliterationModules_IGNORE_WIDTH; if ( aOpt.IsIgnoreDiacritics_CTL()) rFlags |= TransliterationModulesExtra::ignoreDiacritics_CTL ; + if ( aOpt.IsIgnoreKashida_CTL()) + rFlags |= TransliterationModulesExtra::ignoreKashida_CTL ; if ( bAsianOptions ) { if ( aOpt.IsMatchHiraganaKatakana()) diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 51e32d39f200..5f92393cedfa 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -306,6 +306,7 @@ SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, Sf get(m_pCloseBtn, "close"); get(m_pIgnoreDiacritics, "ignorediacritics"); + get(m_pIgnoreKashida, "ignorekashida"); get(m_pSelectionBtn, "selection"); get(m_pBackwardsBtn, "backwards"); get(m_pRegExpBtn, "regexp"); @@ -428,6 +429,8 @@ void SvxSearchDialog::Construct_Impl() { m_pIgnoreDiacritics->Check( false ); m_pIgnoreDiacritics->Hide(); + m_pIgnoreKashida->Check( false ); + m_pIgnoreKashida->Hide(); } //component extension - show component search buttons if the commands // vnd.sun.star::SearchViaComponent1 and 2 are supported @@ -513,6 +516,7 @@ bool SvxSearchDialog::Close() aOpt.SetUseAsianOptions ( m_pJapOptionsCB->IsChecked() ); aOpt.SetNotes ( m_pNotesBtn->IsChecked() ); aOpt.SetIgnoreDiacritics_CTL ( m_pIgnoreDiacritics->IsChecked() ); + aOpt.SetIgnoreKashida_CTL ( m_pIgnoreKashida->IsChecked() ); const SfxPoolItem* ppArgs[] = { pSearchItem, 0 }; rBindings.GetDispatcher()->Execute( FID_SEARCH_OFF, SFX_CALLMODE_SLOT, ppArgs ); @@ -614,6 +618,7 @@ void SvxSearchDialog::InitControls_Impl() m_pJapOptionsCB->SetClickHdl( aLink ); m_pJapMatchFullHalfWidthCB->SetClickHdl( aLink ); m_pIgnoreDiacritics->SetClickHdl( aLink ); + m_pIgnoreKashida->SetClickHdl( aLink ); m_pLayoutBtn->SetClickHdl( LINK( this, SvxSearchDialog, TemplateHdl_Impl ) ); m_pFormatBtn->SetClickHdl( LINK( this, SvxSearchDialog, FormatHdl_Impl ) ); m_pNoFormatBtn->SetClickHdl( @@ -666,6 +671,7 @@ void SvxSearchDialog::ShowOptionalControls_Impl() m_pSimilarityBtn->Show(); m_pSelectionBtn->Show(); m_pIgnoreDiacritics->Show(aCTLOptions.IsCTLFontEnabled()); + m_pIgnoreKashida->Show(aCTLOptions.IsCTLFontEnabled()); m_pJapMatchFullHalfWidthCB->Show(aCJKOptions.IsCJKFontEnabled()); m_pJapOptionsCB->Show(aCJKOptions.IsJapaneseFindEnabled()); m_pJapOptionsBtn->Show(aCJKOptions.IsJapaneseFindEnabled()); @@ -744,6 +750,8 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern ) m_pJapOptionsCB->Check( pSearchItem->IsUseAsianOptions() ); if (m_pIgnoreDiacritics->IsVisible()) m_pIgnoreDiacritics->Check( aOpt.IsIgnoreDiacritics_CTL() ); + if (m_pIgnoreKashida->IsVisible()) + m_pIgnoreKashida->Check( aOpt.IsIgnoreKashida_CTL() ); ApplyTransliterationFlags_Impl( pSearchItem->GetTransliterationFlags() ); ShowOptionalControls_Impl(); @@ -1221,6 +1229,8 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn ) TransliterationModules_IGNORE_WIDTH ); if (GetCheckBoxValue(m_pIgnoreDiacritics)) nFlags |= TransliterationModulesExtra::ignoreDiacritics_CTL; + if (GetCheckBoxValue(m_pIgnoreKashida)) + nFlags |= TransliterationModulesExtra::ignoreKashida_CTL; pSearchItem->SetTransliterationFlags( nFlags ); if ( !bWriter ) @@ -2165,6 +2175,7 @@ void SvxSearchDialog::SaveToModule_Impl() SvtSearchOptions aOpt; aOpt.SetIgnoreDiacritics_CTL(GetCheckBoxValue(m_pIgnoreDiacritics)); + aOpt.SetIgnoreKashida_CTL(GetCheckBoxValue(m_pIgnoreKashida)); sal_Int32 nFlags = GetTransliterationFlags(); if( !pSearchItem->IsUseAsianOptions()) @@ -2172,6 +2183,8 @@ void SvxSearchDialog::SaveToModule_Impl() TransliterationModules_IGNORE_WIDTH ); if (GetCheckBoxValue(m_pIgnoreDiacritics)) nFlags |= TransliterationModulesExtra::ignoreDiacritics_CTL; + if (GetCheckBoxValue(m_pIgnoreKashida)) + nFlags |= TransliterationModulesExtra::ignoreKashida_CTL; pSearchItem->SetTransliterationFlags( nFlags ); if ( !bWriter ) diff --git a/svx/uiconfig/ui/findreplacedialog.ui b/svx/uiconfig/ui/findreplacedialog.ui index 380819629d28..82a08d5f4e92 100644 --- a/svx/uiconfig/ui/findreplacedialog.ui +++ b/svx/uiconfig/ui/findreplacedialog.ui @@ -812,7 +812,21 @@ </packing> </child> <child> - <placeholder/> + <object class="GtkCheckButton" id="ignorekashida"> + <property name="label" translatable="yes">Ig_nore kashida CTL</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">4</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> </child> </object> <packing> diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx index 8f11a851edac..5a9e6d608478 100644 --- a/unotools/source/config/searchopt.cxx +++ b/unotools/source/config/searchopt.cxx @@ -33,7 +33,7 @@ using namespace utl; using namespace com::sun::star::uno; using namespace com::sun::star::i18n; -#define MAX_FLAGS_OFFSET 26 +#define MAX_FLAGS_OFFSET 27 class SvtSearchOptions_Impl: public ConfigItem, private boost::noncopyable { @@ -143,7 +143,8 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames() const "Japanese/IsIgnoreProlongedSoundMark", // 23 "Japanese/IsIgnoreMiddleDot", // 24 "IsNotes", // 25 - "IsIgnoreDiacritics_CTL" // 26 + "IsIgnoreDiacritics_CTL", // 26 + "IsIgnoreKashida_CTL" // 27 }; const int nCount = SAL_N_ELEMENTS( aPropNames ); @@ -287,6 +288,8 @@ sal_Int32 SvtSearchOptions::GetTransliterationFlags() const nRes |= TransliterationModules_ignoreMiddleDot_ja_JP; if ( IsIgnoreDiacritics_CTL()) nRes |= TransliterationModulesExtra::ignoreDiacritics_CTL; + if ( IsIgnoreKashida_CTL()) + nRes |= TransliterationModulesExtra::ignoreKashida_CTL; return nRes; } @@ -555,4 +558,14 @@ void SvtSearchOptions::SetIgnoreDiacritics_CTL( bool bVal ) pImpl->SetFlag( 26, bVal ); } +bool SvtSearchOptions::IsIgnoreKashida_CTL() const +{ + return pImpl->GetFlag( 27 ); +} + +void SvtSearchOptions::SetIgnoreKashida_CTL( bool bVal ) +{ + pImpl->SetFlag( 27, bVal ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |