prepare SearchOptions config with IsUseWildcard

Change-Id: Ifba836f259358d7480502e1701f902c2702b4263
This commit is contained in:
Eike Rathke
2016-02-25 15:39:26 +01:00
parent d69eb22d4e
commit a097e18323
3 changed files with 42 additions and 4 deletions

View File

@@ -45,6 +45,7 @@ public:
bool IsWholeWordsOnly() const;
bool IsBackwards() const;
bool IsUseRegularExpression() const;
bool IsUseWildcard() const;
bool IsSimilaritySearch() const;
bool IsUseAsianOptions() const;
bool IsMatchCase() const; // also Japanese search option
@@ -54,6 +55,7 @@ public:
void SetWholeWordsOnly( bool bVal );
void SetBackwards( bool bVal );
void SetUseRegularExpression( bool bVal );
void SetUseWildcard( bool bVal );
void SetSearchForStyles( bool bVal );
void SetSimilaritySearch( bool bVal );
void SetUseAsianOptions( bool bVal );

View File

@@ -5936,6 +5936,15 @@
</info>
<value>false</value>
</prop>
<prop oor:name="IsUseWildcard" oor:type="xs:boolean" oor:nillable="false">
<!-- OldPath: -->
<!-- OldLocation: -->
<!-- UIHints: Edit/Find & Replace -->
<info>
<desc>Specifies search with the use of wildcards.</desc>
</info>
<value>false</value>
</prop>
<prop oor:name="IsUseRegularExpression" oor:type="xs:boolean" oor:nillable="false">
<!-- OldPath: -->
<!-- OldLocation: -->

View File

@@ -33,7 +33,7 @@ using namespace utl;
using namespace com::sun::star::uno;
using namespace com::sun::star::i18n;
#define MAX_FLAGS_OFFSET 28
#define MAX_FLAGS_OFFSET 29
class SvtSearchOptions_Impl : public ConfigItem
{
@@ -63,6 +63,7 @@ public:
bool GetFlag( sal_uInt16 nOffset ) const;
void SetFlag( sal_uInt16 nOffset, bool bVal );
void SetSearchAlgorithm( sal_uInt16 nOffset, bool bVal );
};
SvtSearchOptions_Impl::SvtSearchOptions_Impl() :
@@ -144,12 +145,13 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames()
"Japanese/IsMatch_KiKu", // 20
"Japanese/IsIgnorePunctuation", // 21
"Japanese/IsIgnoreWhitespace", // 22
"Japanese/IsIgnoreProlongedSoundMark", // 23
"Japanese/IsIgnoreProlongedSoundMark", // 23
"Japanese/IsIgnoreMiddleDot", // 24
"IsNotes", // 25
"IsIgnoreDiacritics_CTL", // 26
"IsIgnoreKashida_CTL", // 27
"IsSearchFormatted" // 28
"IsUseWildcard" // 29
};
const int nCount = SAL_N_ELEMENTS( aPropNames );
@@ -161,6 +163,21 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames()
return aNames;
}
void SvtSearchOptions_Impl::SetSearchAlgorithm( sal_uInt16 nOffset, bool bVal )
{
if (bVal)
{
// Search algorithms are mutually exclusive.
if (nOffset != 2 && GetFlag(2))
SetFlag( 2, false );
if (nOffset != 4 && GetFlag(4))
SetFlag( 4, false );
if (nOffset != 29 && GetFlag(29))
SetFlag( 29, false );
}
SetFlag( nOffset, bVal );
}
void SvtSearchOptions_Impl::Load()
{
bool bSucc = false;
@@ -327,7 +344,7 @@ bool SvtSearchOptions::IsUseRegularExpression() const
void SvtSearchOptions::SetUseRegularExpression( bool bVal )
{
pImpl->SetFlag( 2, bVal );
pImpl->SetSearchAlgorithm( 2, bVal );
}
void SvtSearchOptions::SetSearchForStyles( bool bVal )
@@ -342,7 +359,7 @@ bool SvtSearchOptions::IsSimilaritySearch() const
void SvtSearchOptions::SetSimilaritySearch( bool bVal )
{
pImpl->SetFlag( 4, bVal );
pImpl->SetSearchAlgorithm( 4, bVal );
}
bool SvtSearchOptions::IsUseAsianOptions() const
@@ -585,4 +602,14 @@ void SvtSearchOptions::SetSearchFormatted( bool bVal )
pImpl->SetFlag( 28, bVal );
}
bool SvtSearchOptions::IsUseWildcard() const
{
return pImpl->GetFlag( 29 );
}
void SvtSearchOptions::SetUseWildcard( bool bVal )
{
pImpl->SetSearchAlgorithm( 29, bVal );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */