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
This commit is contained in:
@@ -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;
|
||||
|
@@ -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 \
|
||||
|
@@ -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 ) \
|
||||
|
@@ -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>
|
||||
|
@@ -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),
|
||||
|
35
i18npool/source/transliteration/ignoreKashida_CTL.cxx
Normal file
35
i18npool/source/transliteration/ignoreKashida_CTL.cxx
Normal file
@@ -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: */
|
@@ -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) {
|
||||
|
@@ -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>
|
||||
|
@@ -178,6 +178,7 @@ private:
|
||||
|
||||
PushButton* m_pCloseBtn;
|
||||
CheckBox* m_pIgnoreDiacritics;
|
||||
CheckBox* m_pIgnoreKashida;
|
||||
CheckBox* m_pSelectionBtn;
|
||||
CheckBox* m_pBackwardsBtn;
|
||||
CheckBox* m_pRegExpBtn;
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
};
|
||||
|
||||
|
@@ -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: -->
|
||||
|
@@ -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>
|
||||
|
@@ -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())
|
||||
|
@@ -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 )
|
||||
|
@@ -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>
|
||||
|
@@ -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: */
|
||||
|
Reference in New Issue
Block a user