[Libreoffice-commits] core.git: sc/inc sc/source
Eike Rathke
erack at redhat.com
Thu Jul 21 10:56:06 UTC 2016
sc/inc/docoptio.hxx | 28 +++++++++++++++++++++++-----
sc/source/core/tool/docoptio.cxx | 2 +-
2 files changed, 24 insertions(+), 6 deletions(-)
New commits:
commit d7a0bc2a7eab58311f3925d0ce9b2b863188bfe8
Author: Eike Rathke <erack at redhat.com>
Date: Thu Jul 21 12:54:33 2016 +0200
directly set eFormulaSearchType if regex or wildcards are set to true
... and setting false to false doesn't changge anything. In both cases we don't
need to call ConvertToSearchType() in GetFormulaSearchType() later.
Also, in GetFormulaSearchType() check if both, bFormulaRegexEnabled and
bFormulaWildcardsEnabled are true, which souldn't happen if the setters are
used, but ...
Change-Id: I58c4519e102a3d8d05c8816d059361ce3dda294f
diff --git a/sc/inc/docoptio.hxx b/sc/inc/docoptio.hxx
index 3c2a8c7..a7f81e2 100644
--- a/sc/inc/docoptio.hxx
+++ b/sc/inc/docoptio.hxx
@@ -97,26 +97,44 @@ public:
utl::SearchParam::SearchType GetFormulaSearchType() const
{
- if (eFormulaSearchType == eSearchTypeUnknown)
+ if (eFormulaSearchType == eSearchTypeUnknown || (bFormulaRegexEnabled && bFormulaWildcardsEnabled))
eFormulaSearchType = utl::SearchParam::ConvertToSearchType( bFormulaWildcardsEnabled, bFormulaRegexEnabled);
return eFormulaSearchType;
}
void SetFormulaRegexEnabled( bool bVal )
{
- bFormulaRegexEnabled = bVal;
- eFormulaSearchType = eSearchTypeUnknown;
if (bVal)
+ {
+ bFormulaRegexEnabled = true;
bFormulaWildcardsEnabled = false;
+ eFormulaSearchType = utl::SearchParam::SRCH_REGEXP;
+ }
+ else if (!bFormulaRegexEnabled)
+ ; // nothing changes for setting false to false
+ else
+ {
+ bFormulaRegexEnabled = false;
+ eFormulaSearchType = eSearchTypeUnknown;
+ }
}
bool IsFormulaRegexEnabled() const { return GetFormulaSearchType() == utl::SearchParam::SRCH_REGEXP; }
void SetFormulaWildcardsEnabled( bool bVal )
{
- bFormulaWildcardsEnabled = bVal;
- eFormulaSearchType = eSearchTypeUnknown;
if (bVal)
+ {
bFormulaRegexEnabled = false;
+ bFormulaWildcardsEnabled = true;
+ eFormulaSearchType = utl::SearchParam::SRCH_WILDCARD;
+ }
+ else if (!bFormulaWildcardsEnabled)
+ ; // nothing changes for setting false to false
+ else
+ {
+ bFormulaWildcardsEnabled = false;
+ eFormulaSearchType = eSearchTypeUnknown;
+ }
}
bool IsFormulaWildcardsEnabled() const { return GetFormulaSearchType() == utl::SearchParam::SRCH_WILDCARD; }
diff --git a/sc/source/core/tool/docoptio.cxx b/sc/source/core/tool/docoptio.cxx
index 5220a84..dede444 100644
--- a/sc/source/core/tool/docoptio.cxx
+++ b/sc/source/core/tool/docoptio.cxx
@@ -98,7 +98,7 @@ void ScDocOptions::ResetDocOptions()
bLookUpColRowNames = true;
bFormulaRegexEnabled= false;
bFormulaWildcardsEnabled= true;
- eFormulaSearchType = eSearchTypeUnknown;
+ eFormulaSearchType = utl::SearchParam::SRCH_WILDCARD;
bWriteCalcConfig = true;
}
More information about the Libreoffice-commits
mailing list