[Libreoffice-commits] core.git: 5 commits - include/svl include/svx offapi/com sc/inc sc/source svl/source svx/source svx/uiconfig unotools/source
Eike Rathke
erack at redhat.com
Fri Feb 26 00:42:15 UTC 2016
include/svl/srchdefs.hxx | 5 +-
include/svl/srchitem.hxx | 17 +++++++-
include/svx/srchdlg.hxx | 1
offapi/com/sun/star/util/SearchDescriptor.idl | 22 ++++++++++
sc/inc/unonames.hxx | 1
sc/source/ui/unoobj/srchuno.cxx | 4 +
svl/source/items/srchitem.cxx | 24 ++++++++++-
svx/source/dialog/srchdlg.cxx | 55 ++++++++++++++++++++++++--
svx/uiconfig/ui/findreplacedialog.ui | 29 ++++++++++---
unotools/source/config/searchopt.cxx | 2
10 files changed, 143 insertions(+), 17 deletions(-)
New commits:
commit 393f11f88648e1c7cace6224aa7afcbf9d68ddd6
Author: Eike Rathke <erack at redhat.com>
Date: Fri Feb 26 00:13:07 2016 +0100
add Wildcards to Find&Replace dialog
Enabled only for Calc. Writer needs to be adapted to support wildcards.
The global escape character is '\' set in SvxSearchItem ctor.
Change-Id: I1af78f296deff81e023ee9f0e936f5f506f80c83
diff --git a/include/svl/srchdefs.hxx b/include/svl/srchdefs.hxx
index 8fb303c..8c84b03 100644
--- a/include/svl/srchdefs.hxx
+++ b/include/svl/srchdefs.hxx
@@ -39,11 +39,12 @@ enum class SearchOptionFlags
MORE = 0x0800,
SIMILARITY = 0x1000,
CONTENT = 0x2000,
- ALL = 0x3fff
+ WILDCARD = 0x4000,
+ ALL = 0x7fff
};
namespace o3tl
{
- template<> struct typed_flags<SearchOptionFlags> : is_typed_flags<SearchOptionFlags, 0x3fff> {};
+ template<> struct typed_flags<SearchOptionFlags> : is_typed_flags<SearchOptionFlags, 0x7fff> {};
}
#endif
diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index cc4beda..cd08fc8 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -180,6 +180,7 @@ private:
VclPtr<CheckBox> m_pSelectionBtn;
VclPtr<CheckBox> m_pBackwardsBtn;
VclPtr<CheckBox> m_pRegExpBtn;
+ VclPtr<CheckBox> m_pWildcardBtn;
VclPtr<CheckBox> m_pSimilarityBox;
VclPtr<PushButton> m_pSimilarityBtn;
VclPtr<CheckBox> m_pLayoutBtn;
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index d0424bc..d54cce8 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -97,6 +97,7 @@ using namespace comphelper;
#define MODIFY_COLUMNS 0x00002000
#define MODIFY_ALLTABLES 0x00004000
#define MODIFY_NOTES 0x00008000
+#define MODIFY_WILDCARD 0x00010000
namespace
{
@@ -304,6 +305,7 @@ SvxSearchDialog::SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWi
get(m_pSelectionBtn, "selection");
get(m_pBackwardsBtn, "backwards");
get(m_pRegExpBtn, "regexp");
+ get(m_pWildcardBtn, "wildcard");
get(m_pSimilarityBox, "similarity");
get(m_pSimilarityBtn, "similaritybtn");
get(m_pLayoutBtn, "layout");
@@ -384,6 +386,7 @@ void SvxSearchDialog::dispose()
m_pSelectionBtn.clear();
m_pBackwardsBtn.clear();
m_pRegExpBtn.clear();
+ m_pWildcardBtn.clear();
m_pSimilarityBox.clear();
m_pSimilarityBtn.clear();
m_pLayoutBtn.clear();
@@ -552,6 +555,7 @@ bool SvxSearchDialog::Close()
aOpt.SetWholeWordsOnly ( m_pWordBtn->IsChecked() );
aOpt.SetBackwards ( m_pBackwardsBtn->IsChecked() );
aOpt.SetUseRegularExpression ( m_pRegExpBtn->IsChecked() );
+ aOpt.SetUseWildcard ( m_pWildcardBtn->IsChecked() );
aOpt.SetSearchForStyles ( m_pLayoutBtn->IsChecked() );
aOpt.SetSimilaritySearch ( m_pSimilarityBox->IsChecked() );
aOpt.SetUseAsianOptions ( m_pJapOptionsCB->IsChecked() );
@@ -651,6 +655,7 @@ void SvxSearchDialog::InitControls_Impl()
m_pSelectionBtn->SetClickHdl( aLink2 );
m_pMatchCaseCB->SetClickHdl( aLink2 );
m_pRegExpBtn->SetClickHdl( aLink2 );
+ m_pWildcardBtn->SetClickHdl( aLink2 );
m_pBackwardsBtn->SetClickHdl( aLink2 );
m_pNotesBtn->SetClickHdl( aLink2 );
m_pSimilarityBox->SetClickHdl( aLink2 );
@@ -706,6 +711,7 @@ void SvxSearchDialog::ShowOptionalControls_Impl()
m_pNotesBtn->Show(bWriterApp);
m_pBackwardsBtn->Show();
m_pRegExpBtn->Show(!bDrawApp);
+ m_pWildcardBtn->Show(bCalcApp); /* TODO:WILDCARD enable for other apps if hey handle it */
m_pSimilarityBox->Show();
m_pSimilarityBtn->Show();
m_pSelectionBtn->Show();
@@ -780,6 +786,8 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
m_pSelectionBtn->Check( pSearchItem->GetSelection() );
if ( ( nModifyFlag & MODIFY_REGEXP ) == 0 )
m_pRegExpBtn->Check( pSearchItem->GetRegExp() );
+ if ( ( nModifyFlag & MODIFY_WILDCARD ) == 0 )
+ m_pWildcardBtn->Check( pSearchItem->GetWildcard() );
if ( ( nModifyFlag & MODIFY_LAYOUT ) == 0 )
m_pLayoutBtn->Check( pSearchItem->GetPattern() );
if (m_pNotesBtn->IsChecked())
@@ -854,6 +862,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
m_pSearchAllBtn->Hide();
m_pRegExpBtn->Hide();
+ m_pWildcardBtn->Hide();
m_pLayoutBtn->Hide();
// only look for formatting in Writer
@@ -863,6 +872,8 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
}
else
{
+ m_pWildcardBtn->Hide(); /* TODO:WILDCARD do not hide for other apps if they handle it */
+
if ( !pSearchList )
{
// Get attribute sets, if it not has been done already
@@ -942,6 +953,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
m_pWordBtn->Disable();
m_pRegExpBtn->Disable();
+ m_pWildcardBtn->Disable();
m_pMatchCaseCB->Disable();
bDisableSearch = !m_pSearchTmplLB->GetEntryCount();
@@ -980,6 +992,7 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
m_pReplaceTmplLB->Hide();
EnableControl_Impl(m_pRegExpBtn);
+ EnableControl_Impl(m_pWildcardBtn);
EnableControl_Impl(m_pMatchCaseCB);
if ( m_pRegExpBtn->IsChecked() )
@@ -1121,6 +1134,8 @@ void SvxSearchDialog::ClickHdl_Impl(void* pCtrl)
m_pSimilarityBtn->Enable();
m_pRegExpBtn->Check( false );
m_pRegExpBtn->Disable();
+ m_pWildcardBtn->Check( false );
+ m_pWildcardBtn->Disable();
EnableControl_Impl(m_pWordBtn);
if ( m_pLayoutBtn->IsChecked() )
@@ -1129,6 +1144,7 @@ void SvxSearchDialog::ClickHdl_Impl(void* pCtrl)
m_pLayoutBtn->Check( false );
}
m_pRegExpBtn->Disable();
+ m_pWildcardBtn->Disable();
m_pLayoutBtn->Disable();
m_pFormatBtn->Disable();
m_pNoFormatBtn->Disable();
@@ -1137,6 +1153,7 @@ void SvxSearchDialog::ClickHdl_Impl(void* pCtrl)
else
{
EnableControl_Impl(m_pRegExpBtn);
+ EnableControl_Impl(m_pWildcardBtn);
if (!m_pNotesBtn->IsChecked())
EnableControl_Impl(m_pLayoutBtn);
EnableControl_Impl(m_pFormatBtn);
@@ -1167,6 +1184,8 @@ void SvxSearchDialog::ClickHdl_Impl(void* pCtrl)
m_pWordBtn->Disable();
m_pRegExpBtn->Check( false );
m_pRegExpBtn->Disable();
+ m_pWildcardBtn->Check( false );
+ m_pWildcardBtn->Disable();
m_pMatchCaseCB->Check( false );
m_pMatchCaseCB->Disable();
m_pNotesBtn->Disable();
@@ -1182,6 +1201,7 @@ void SvxSearchDialog::ClickHdl_Impl(void* pCtrl)
else
{
EnableControl_Impl(m_pRegExpBtn);
+ EnableControl_Impl(m_pWildcardBtn);
EnableControl_Impl(m_pMatchCaseCB);
EnableControl_Impl(m_pNotesBtn);
@@ -1189,6 +1209,17 @@ void SvxSearchDialog::ClickHdl_Impl(void* pCtrl)
{
m_pWordBtn->Check( false );
m_pWordBtn->Disable();
+ m_pWildcardBtn->Check( false );
+ m_pWildcardBtn->Disable();
+ m_pSimilarityBox->Check( false );
+ m_pSimilarityBox->Disable();
+ m_pSimilarityBtn->Disable();
+ }
+ else if ( m_pWildcardBtn->IsChecked() )
+ {
+ m_pRegExpBtn->Check( false );
+ m_pRegExpBtn->Disable();
+ m_pSimilarityBox->Check( false );
m_pSimilarityBox->Disable();
m_pSimilarityBtn->Disable();
}
@@ -1254,9 +1285,12 @@ IMPL_LINK_TYPED( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn, void )
}
pSearchItem->SetRegExp( false );
+ pSearchItem->SetWildcard( false );
pSearchItem->SetLevenshtein( false );
if (GetCheckBoxValue(m_pRegExpBtn))
pSearchItem->SetRegExp( true );
+ else if (GetCheckBoxValue(m_pWildcardBtn))
+ pSearchItem->SetWildcard( true );
else if (GetCheckBoxValue(m_pSimilarityBox))
pSearchItem->SetLevenshtein( true );
@@ -1652,6 +1686,10 @@ void SvxSearchDialog::EnableControls_Impl( const SearchOptionFlags nFlags )
m_pRegExpBtn->Enable();
else
m_pRegExpBtn->Disable();
+ if ( ( SearchOptionFlags::WILDCARD & nOptions ) )
+ m_pWildcardBtn->Enable();
+ else
+ m_pWildcardBtn->Disable();
if ( ( SearchOptionFlags::EXACT & nOptions ) )
m_pMatchCaseCB->Enable();
else
@@ -1735,11 +1773,17 @@ void SvxSearchDialog::EnableControl_Impl( Control* pCtrl )
return;
}
if ( m_pRegExpBtn == pCtrl && ( SearchOptionFlags::REG_EXP & nOptions )
- && !m_pSimilarityBox->IsChecked())
+ && !m_pSimilarityBox->IsChecked() && !m_pWildcardBtn->IsChecked())
{
m_pRegExpBtn->Enable();
return;
}
+ if ( m_pWildcardBtn == pCtrl && ( SearchOptionFlags::WILDCARD & nOptions )
+ && !m_pSimilarityBox->IsChecked() && !m_pRegExpBtn->IsChecked())
+ {
+ m_pWildcardBtn->Enable();
+ return;
+ }
if ( m_pMatchCaseCB == pCtrl && ( SearchOptionFlags::EXACT & nOptions ) )
{
if (!m_pJapOptionsCB->IsChecked())
@@ -1772,8 +1816,8 @@ void SvxSearchDialog::EnableControl_Impl( Control* pCtrl )
m_pNoFormatBtn->Enable();
return;
}
- if ( m_pSimilarityBox == pCtrl &&
- ( SearchOptionFlags::SIMILARITY & nOptions ) )
+ if ( m_pSimilarityBox == pCtrl && ( SearchOptionFlags::SIMILARITY & nOptions )
+ && !m_pRegExpBtn->IsChecked() && !m_pWildcardBtn->IsChecked())
{
m_pSimilarityBox->Enable();
@@ -2132,6 +2176,8 @@ void SvxSearchDialog::SetModifyFlag_Impl( const Control* pCtrl )
nModifyFlag |= MODIFY_SELECTION;
else if ( m_pRegExpBtn == pCtrl )
nModifyFlag |= MODIFY_REGEXP;
+ else if ( m_pWildcardBtn == pCtrl )
+ nModifyFlag |= MODIFY_WILDCARD;
else if ( m_pLayoutBtn == pCtrl )
nModifyFlag |= MODIFY_LAYOUT;
else if ( m_pSimilarityBox == pCtrl )
@@ -2169,9 +2215,12 @@ void SvxSearchDialog::SaveToModule_Impl()
}
pSearchItem->SetRegExp( false );
+ pSearchItem->SetWildcard( false );
pSearchItem->SetLevenshtein( false );
if (GetCheckBoxValue(m_pRegExpBtn))
pSearchItem->SetRegExp( true );
+ else if (GetCheckBoxValue(m_pWildcardBtn))
+ pSearchItem->SetWildcard( true );
else if (GetCheckBoxValue(m_pSimilarityBox))
pSearchItem->SetLevenshtein( true );
diff --git a/svx/uiconfig/ui/findreplacedialog.ui b/svx/uiconfig/ui/findreplacedialog.ui
index aa25614..bf2989c 100644
--- a/svx/uiconfig/ui/findreplacedialog.ui
+++ b/svx/uiconfig/ui/findreplacedialog.ui
@@ -510,6 +510,21 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="wildcard">
+ <property name="label" translatable="yes">Wil_dcards</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="no_show_all">True</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -561,7 +576,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">6</property>
<property name="width">2</property>
</packing>
</child>
@@ -607,7 +622,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
</packing>
</child>
<child>
@@ -652,7 +667,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">3</property>
</packing>
</child>
<child>
@@ -742,7 +757,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
</packing>
</child>
<child>
@@ -757,7 +772,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
</packing>
</child>
<child>
@@ -772,7 +787,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
</packing>
</child>
</object>
@@ -823,7 +838,7 @@
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Search _direction:</property>
+ <property name="label" translatable="yes">Search direction:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">calcsearchin</property>
</object>
commit 82e23b52acf52fe8334d0fcba62d6b956d222445
Author: Eike Rathke <erack at redhat.com>
Date: Thu Feb 25 21:22:53 2016 +0100
add missing comma
this ended up as IsSearchFormattedIsUseWildcard ...
Change-Id: Iaa39f51b0e5ef49d65a636b0a2d926d30a2a1dd8
diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx
index be8716f..79e1030 100644
--- a/unotools/source/config/searchopt.cxx
+++ b/unotools/source/config/searchopt.cxx
@@ -150,7 +150,7 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames()
"IsNotes", // 25
"IsIgnoreDiacritics_CTL", // 26
"IsIgnoreKashida_CTL", // 27
- "IsSearchFormatted" // 28
+ "IsSearchFormatted", // 28
"IsUseWildcard" // 29
};
commit 8555034abf9e53190fa559c1a705868766a5677f
Author: Eike Rathke <erack at redhat.com>
Date: Thu Feb 25 20:06:23 2016 +0100
handle SearchWildcard API option
Change-Id: I5350167638a5831e1f125728397fecfc637ee004
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index c031789..415399e 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -368,6 +368,7 @@
#define SC_UNO_SRCHBYROW "SearchByRow"
#define SC_UNO_SRCHCASE "SearchCaseSensitive"
#define SC_UNO_SRCHREGEXP "SearchRegularExpression"
+#define SC_UNO_SRCHWILDCARD "SearchWildcard"
#define SC_UNO_SRCHSIM "SearchSimilarity"
#define SC_UNO_SRCHSIMADD "SearchSimilarityAdd"
#define SC_UNO_SRCHSIMEX "SearchSimilarityExchange"
diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx
index edc4809..1ad31eb 100644
--- a/sc/source/ui/unoobj/srchuno.cxx
+++ b/sc/source/ui/unoobj/srchuno.cxx
@@ -46,6 +46,7 @@ static const SfxItemPropertyMapEntry* lcl_GetSearchPropertyMap()
{OUString(SC_UNO_SRCHBYROW), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_SRCHCASE), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_SRCHREGEXP), 0, cppu::UnoType<bool>::get(), 0, 0},
+ {OUString(SC_UNO_SRCHWILDCARD), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_SRCHSIM), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_SRCHSIMADD), 0, cppu::UnoType<sal_Int16>::get(), 0, 0},
{OUString(SC_UNO_SRCHSIMEX), 0, cppu::UnoType<sal_Int16>::get(), 0, 0},
@@ -74,6 +75,7 @@ ScCellSearchObj::ScCellSearchObj() :
pSearchItem->SetBackward(false);
pSearchItem->SetSelection(false);
pSearchItem->SetRegExp(false);
+ pSearchItem->SetWildcard(false);
pSearchItem->SetPattern(false);
pSearchItem->SetLevenshtein(false);
pSearchItem->SetLEVRelaxed(false);
@@ -146,6 +148,7 @@ void SAL_CALL ScCellSearchObj::setPropertyValue(
else if (aString == SC_UNO_SRCHBYROW) pSearchItem->SetRowDirection( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if (aString == SC_UNO_SRCHCASE) pSearchItem->SetExact( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if (aString == SC_UNO_SRCHREGEXP) pSearchItem->SetRegExp( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
+ else if (aString == SC_UNO_SRCHWILDCARD) pSearchItem->SetWildcard( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if (aString == SC_UNO_SRCHSIM) pSearchItem->SetLevenshtein( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if (aString == SC_UNO_SRCHSIMREL) pSearchItem->SetLEVRelaxed( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if (aString == SC_UNO_SRCHSTYLES) pSearchItem->SetPattern( ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
@@ -170,6 +173,7 @@ uno::Any SAL_CALL ScCellSearchObj::getPropertyValue( const OUString& aPropertyNa
else if (aString == SC_UNO_SRCHBYROW) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetRowDirection() );
else if (aString == SC_UNO_SRCHCASE) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetExact() );
else if (aString == SC_UNO_SRCHREGEXP) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetRegExp() );
+ else if (aString == SC_UNO_SRCHWILDCARD) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetWildcard() );
else if (aString == SC_UNO_SRCHSIM) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsLevenshtein() );
else if (aString == SC_UNO_SRCHSIMREL) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->IsLEVRelaxed() );
else if (aString == SC_UNO_SRCHSTYLES) ScUnoHelpFunctions::SetBoolInAny( aRet, pSearchItem->GetPattern() );
commit ced11176337a1b37ed32ca9ea2aa3af0b2459b02
Author: Eike Rathke <erack at redhat.com>
Date: Thu Feb 25 19:51:31 2016 +0100
add optional boolean SearchWildcard to css::util::SearchDescriptor service
Change-Id: Iec1b0d8c0f03074acea2640a6e5d309921f04c59
diff --git a/offapi/com/sun/star/util/SearchDescriptor.idl b/offapi/com/sun/star/util/SearchDescriptor.idl
index 4057420..8d7e68d 100644
--- a/offapi/com/sun/star/util/SearchDescriptor.idl
+++ b/offapi/com/sun/star/util/SearchDescriptor.idl
@@ -49,6 +49,9 @@ published service SearchDescriptor
[property] boolean SearchWords;
/** If `TRUE`, the search string is evaluated as a regular expression.
+
+ <p> SearchRegularExpression, SearchWildcard and SearchSimilarity
+ are mutually exclusive, only one can be `TRUE` at the same time. </p>
*/
[property] boolean SearchRegularExpression;
@@ -72,6 +75,9 @@ published service SearchDescriptor
<li>SearchSimilarityExchange
</li>
</ul>
+
+ <p> SearchRegularExpression, SearchWildcard and SearchSimilarity
+ are mutually exclusive, only one can be `TRUE` at the same time. </p>
*/
[property] boolean SearchSimilarity;
@@ -107,6 +113,22 @@ published service SearchDescriptor
*/
[property] short SearchSimilarityExchange;
+ /** If `TRUE`, the search string is evaluated as a wildcard pattern.
+
+ <p> Wildcards are '*' (asterisk) for any sequence of characters,
+ including an empty sequence, and '?' (question mark) for exactly
+ one character. Escape character is '\' (U+005C REVERSE SOLIDUS)
+ aka backslash, it escapes the special meaning of a question
+ mark, asterisk or escape character that follows immediately
+ after the escape character. </p>
+
+ <p> SearchRegularExpression, SearchWildcard and SearchSimilarity
+ are mutually exclusive, only one can be `TRUE` at the same time. </p>
+
+ @since LibreOffice 5.2
+ */
+ [optional, property] boolean SearchWildcard;
+
};
commit 3a0abd3019ec3ca29b8f1378cdb32ebf741e6306
Author: Eike Rathke <erack at redhat.com>
Date: Thu Feb 25 18:02:25 2016 +0100
add SvxSearchItem::GetWildcard() SetWildcard()
Change-Id: I0aeb7fbcedad381a385ffe6649ac51e8c961ca11
diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx
index dd7afac..6c997d5 100644
--- a/include/svl/srchitem.hxx
+++ b/include/svl/srchitem.hxx
@@ -135,6 +135,9 @@ public:
inline bool GetRegExp() const;
void SetRegExp( bool bVal );
+ inline bool GetWildcard() const;
+ void SetWildcard( bool bVal );
+
bool GetPattern() const { return m_bPattern; }
void SetPattern(bool bNewPattern) { m_bPattern = bNewPattern; }
@@ -239,7 +242,17 @@ bool SvxSearchItem::GetRegExp() const
// adapted to use only new types.
assert( (m_aSearchOpt.algorithmType == css::util::SearchAlgorithms_REGEXP) ==
(m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::REGEXP));
- return m_aSearchOpt.algorithmType == css::util::SearchAlgorithms_REGEXP ;
+ return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::REGEXP ;
+}
+
+bool SvxSearchItem::GetWildcard() const
+{
+ // Ensure old and new algorithm types are in sync, in this case old is not
+ // REGEXP or APPROXIMATE.
+ assert( (m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::WILDCARD) ?
+ (m_aSearchOpt.algorithmType != css::util::SearchAlgorithms_REGEXP &&
+ m_aSearchOpt.algorithmType != css::util::SearchAlgorithms_APPROXIMATE) : true );
+ return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::WILDCARD ;
}
bool SvxSearchItem::IsLEVRelaxed() const
@@ -283,7 +296,7 @@ bool SvxSearchItem::IsLevenshtein() const
// adapted to use only new types.
assert( (m_aSearchOpt.algorithmType == css::util::SearchAlgorithms_APPROXIMATE) ==
(m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::APPROXIMATE));
- return m_aSearchOpt.algorithmType == css::util::SearchAlgorithms_APPROXIMATE;
+ return m_aSearchOpt.AlgorithmType2 == css::util::SearchAlgorithms2::APPROXIMATE;
}
const css::util::SearchOptions2 & SvxSearchItem::GetSearchOptions() const
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index 99d1a56..881c464 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -137,6 +137,11 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
m_bAsianOptions = aOpt.IsUseAsianOptions();
m_bNotes = aOpt.IsNotes();
+ if (aOpt.IsUseWildcard())
+ {
+ m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::WILDCARD;
+ m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; // something valid
+ }
if (aOpt.IsUseRegularExpression())
{
m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::REGEXP;
@@ -348,7 +353,22 @@ void SvxSearchItem::SetRegExp( bool bVal )
m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::REGEXP;
m_aSearchOpt.algorithmType = SearchAlgorithms_REGEXP;
}
- else if ( SearchAlgorithms_REGEXP == m_aSearchOpt.algorithmType )
+ else if ( SearchAlgorithms2::REGEXP == m_aSearchOpt.AlgorithmType2 )
+ {
+ m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE;
+ m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE;
+ }
+}
+
+
+void SvxSearchItem::SetWildcard( bool bVal )
+{
+ if ( bVal )
+ {
+ m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::WILDCARD;
+ m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; // something valid
+ }
+ else if ( SearchAlgorithms2::REGEXP == m_aSearchOpt.AlgorithmType2 )
{
m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE;
m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE;
@@ -372,7 +392,7 @@ void SvxSearchItem::SetLevenshtein( bool bVal )
m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::APPROXIMATE;
m_aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE;
}
- else if ( SearchAlgorithms_APPROXIMATE == m_aSearchOpt.algorithmType )
+ else if ( SearchAlgorithms2::APPROXIMATE == m_aSearchOpt.AlgorithmType2 )
{
m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE;
m_aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE;
More information about the Libreoffice-commits
mailing list