[Libreoffice-commits] core.git: connectivity/source dbaccess/source include/connectivity svx/source
Julien Nabet (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 9 12:10:47 UTC 2019
connectivity/source/commontools/predicateinput.cxx | 2 -
connectivity/source/parse/sqlnode.cxx | 25 ++++++++--------
dbaccess/source/core/api/SingleSelectQueryComposer.cxx | 26 ++++++++---------
dbaccess/source/ui/querydesign/QueryDesignView.cxx | 18 +++++------
dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 4 +-
include/connectivity/sqlnode.hxx | 10 +++---
svx/source/fmcomp/gridcell.cxx | 2 -
svx/source/form/filtnav.cxx | 2 -
svx/source/form/formcontroller.cxx | 10 +-----
9 files changed, 47 insertions(+), 52 deletions(-)
New commits:
commit 8e0c45246a3de75d84875500ce3485e1ded4b934
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Tue Oct 8 20:43:03 2019 +0200
Commit: Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Wed Oct 9 14:09:22 2019 +0200
Resolve FIXME Decimal Separator should be OUString (connectivity/dbaccess/svx)
instead of a sal_Char
Change-Id: I14fd983dac7ceb83a788c26dd4ea9d1c87444c9a
Reviewed-on: https://gerrit.libreoffice.org/80493
Tested-by: Jenkins
Reviewed-by: Lionel Elie Mamane <lionel at mamane.lu>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx
index 7b9e1a1960ee..3e88af4e5e62 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -256,7 +256,7 @@ namespace dbtools
sTransformedText.clear();
pParseNode->parseNodeToPredicateStr(
sTransformedText, m_xConnection, m_xFormatter, _rxField, OUString(),
- rParseContext.getPreferredLocale(), static_cast<sal_Char>(nDecSeparator), &rParseContext
+ rParseContext.getPreferredLocale(), OUString(nDecSeparator), &rParseContext
);
_rPredicateValue = sTransformedText;
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 09d263e58805..80c752ef5f01 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -191,7 +191,7 @@ SQLParseNodeParameter::SQLParseNodeParameter( const Reference< XConnection >& _r
const Reference< XNumberFormatter >& _xFormatter, const Reference< XPropertySet >& _xField,
const OUString &_sPredicateTableAlias,
const Locale& _rLocale, const IParseContext* _pContext,
- bool _bIntl, bool _bQuote, sal_Char _cDecSep, bool _bPredicate, bool _bParseToSDBC )
+ bool _bIntl, bool _bQuote, OUString _sDecSep, bool _bPredicate, bool _bParseToSDBC )
:rLocale(_rLocale)
,aMetaData( _rxConnection )
,pParser( nullptr )
@@ -200,7 +200,7 @@ SQLParseNodeParameter::SQLParseNodeParameter( const Reference< XConnection >& _r
,xField(_xField)
,sPredicateTableAlias(_sPredicateTableAlias)
,m_rContext( _pContext ? *_pContext : OSQLParser::s_aDefaultContext )
- ,cDecSep(_cDecSep)
+ ,sDecSep(_sDecSep)
,bQuote(_bQuote)
,bInternational(_bIntl)
,bPredicate(_bPredicate)
@@ -254,7 +254,7 @@ void OSQLParseNode::parseNodeToStr(OUString& rString,
parseNodeToStr(
rString, _rxConnection, nullptr, nullptr, OUString(),
pContext ? pContext->getPreferredLocale() : OParseContext::getDefaultLocale(),
- pContext, _bIntl, _bQuote, '.', false );
+ pContext, _bIntl, _bQuote, OUString("."), false );
}
@@ -262,13 +262,13 @@ void OSQLParseNode::parseNodeToPredicateStr(OUString& rString,
const Reference< XConnection >& _rxConnection,
const Reference< XNumberFormatter > & xFormatter,
const css::lang::Locale& rIntl,
- sal_Char _cDec,
+ OUString _sDec,
const IParseContext* pContext ) const
{
OSL_ENSURE(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!");
if (xFormatter.is())
- parseNodeToStr(rString, _rxConnection, xFormatter, nullptr, OUString(), rIntl, pContext, true, true, _cDec, true);
+ parseNodeToStr(rString, _rxConnection, xFormatter, nullptr, OUString(), rIntl, pContext, true, true, _sDec, true);
}
@@ -278,13 +278,13 @@ void OSQLParseNode::parseNodeToPredicateStr(OUString& rString,
const Reference< XPropertySet > & _xField,
const OUString &_sPredicateTableAlias,
const css::lang::Locale& rIntl,
- sal_Char _cDec,
+ OUString _sDec,
const IParseContext* pContext ) const
{
OSL_ENSURE(xFormatter.is(), "OSQLParseNode::parseNodeToPredicateStr:: no formatter!");
if (xFormatter.is())
- parseNodeToStr( rString, _rxConnection, xFormatter, _xField, _sPredicateTableAlias, rIntl, pContext, true, true, _cDec, true );
+ parseNodeToStr( rString, _rxConnection, xFormatter, _xField, _sPredicateTableAlias, rIntl, pContext, true, true, _sDec, true );
}
@@ -297,7 +297,7 @@ void OSQLParseNode::parseNodeToStr(OUString& rString,
const IParseContext* pContext,
bool _bIntl,
bool _bQuote,
- sal_Char _cDecSep,
+ OUString _sDecSep,
bool _bPredicate) const
{
OSL_ENSURE( _rxConnection.is(), "OSQLParseNode::parseNodeToStr: invalid connection!" );
@@ -310,7 +310,7 @@ void OSQLParseNode::parseNodeToStr(OUString& rString,
OSQLParseNode::impl_parseNodeToString_throw( sBuffer,
SQLParseNodeParameter(
_rxConnection, xFormatter, _xField, _sPredicateTableAlias, rIntl, pContext,
- _bIntl, _bQuote, _cDecSep, _bPredicate, false
+ _bIntl, _bQuote, _sDecSep, _bPredicate, false
) );
}
catch( const SQLException& )
@@ -330,7 +330,7 @@ bool OSQLParseNode::parseNodeToExecutableStatement( OUString& _out_rString, cons
{
OSL_PRECOND( _rxConnection.is(), "OSQLParseNode::parseNodeToExecutableStatement: invalid connection!" );
SQLParseNodeParameter aParseParam( _rxConnection,
- nullptr, nullptr, OUString(), OParseContext::getDefaultLocale(), nullptr, false, true, '.', false, true );
+ nullptr, nullptr, OUString(), OParseContext::getDefaultLocale(), nullptr, false, true, OUString("."), false, true );
if ( aParseParam.aMetaData.supportsSubqueriesInFrom() )
{
@@ -2472,8 +2472,9 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet
case SQLNodeType::ApproxNum:
{
OUString aTmp = m_aNodeValue;
- if (rParam.bInternational && rParam.bPredicate && rParam.cDecSep != '.')
- aTmp = aTmp.replace('.', rParam.cDecSep);
+ static OUString strPoint(".");
+ if (rParam.bInternational && rParam.bPredicate && rParam.sDecSep != strPoint)
+ aTmp = aTmp.replaceAll(strPoint, rParam.sDecSep);
if (!rString.isEmpty())
rString.append(" ");
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 46e6adc2c303..9dda10cfcecb 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -1127,7 +1127,7 @@ bool OSingleSelectQueryComposer::setLikePredicate(OSQLParseNode const * pConditi
for (size_t i=2; i < pPart2->count(); i++)
{
pPart2->getChild(i)->parseNodeToPredicateStr(
- aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>(m_sDecimalSep.toChar() ) );
+ aValue, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
}
aItem.Name = getColumnName(pRowValue,_rIterator);
@@ -1140,9 +1140,9 @@ bool OSingleSelectQueryComposer::setLikePredicate(OSQLParseNode const * pConditi
OUString aValue;
OUString aColumnName;
- pPart2->getChild(2)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
- pPart2->getChild(3)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
- pRowValue->parseNodeToPredicateStr( aColumnName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep .toChar() ) );
+ pPart2->getChild(2)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
+ pPart2->getChild(3)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
+ pRowValue->parseNodeToPredicateStr( aColumnName, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
aItem.Name = getColumnName(pRowValue,_rIterator);
aItem.Value <<= aValue;
@@ -1156,12 +1156,12 @@ bool OSingleSelectQueryComposer::setLikePredicate(OSQLParseNode const * pConditi
// Field names
for (size_t i=0;i< pRowValue->count();i++)
- pRowValue->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ pRowValue->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
// Criterion
for(size_t i=0;i< pValue->count();i++)
- pValue->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
- pPart2->getChild(3)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ pValue->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
+ pPart2->getChild(3)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
aItem.Name = aName;
aItem.Value <<= aValue;
@@ -1190,7 +1190,7 @@ bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode const * pC
// go forward - don't display the operator
for (i++;i < pCondition->count();i++)
pCondition->getChild(i)->parseNodeToPredicateStr(
- aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>(m_sDecimalSep.toChar() ) );
+ aValue, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
}
else if (SQL_ISRULE(pCondition->getChild(pCondition->count()-1), column_ref))
{
@@ -1228,7 +1228,7 @@ bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode const * pC
// go backward - don't display the operator
for (i--; i >= 0; i--)
pCondition->getChild(i)->parseNodeToPredicateStr(
- aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ aValue, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
}
else
return false;
@@ -1244,8 +1244,8 @@ bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode const * pC
OUString aValue;
OUString aColumnName;
- pCondition->getChild(2)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
- pCondition->getChild(0)->parseNodeToPredicateStr( aColumnName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep .toChar() ) );
+ pCondition->getChild(2)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
+ pCondition->getChild(0)->parseNodeToPredicateStr( aColumnName, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
aItem.Name = getColumnName(pCondition->getChild(0),_rIterator);
aItem.Value <<= aValue;
@@ -1262,12 +1262,12 @@ bool OSingleSelectQueryComposer::setComparsionPredicate(OSQLParseNode const * pC
// Field names
for (size_t i=0;i< pLhs->count();i++)
- pLhs->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ pLhs->getChild(i)->parseNodeToPredicateStr( aName, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
// Criterion
aItem.Handle = getPredicateType(pCondition->getChild(1));
for(size_t i=0;i< pRhs->count();i++)
- pRhs->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, static_cast<sal_Char>( m_sDecimalSep.toChar() ) );
+ pRhs->getChild(i)->parseNodeToPredicateStr(aValue, m_xConnection, xFormatter, m_aLocale, m_sDecimalSep );
aItem.Name = aName;
aItem.Value <<= aValue;
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 1b2e6e61ddd8..e4b6ad431ea4 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -201,7 +201,7 @@ namespace
xConnection,
rController.getNumberFormatter(),
_rLocale,
- static_cast<sal_Char>(_sDecimal.toChar()),
+ _sDecimal,
&rController.getParser().getContext());
}
return aCondition;
@@ -1341,14 +1341,14 @@ namespace
xConnection,
rController.getNumberFormatter(),
aLocale,
- static_cast<sal_Char>(sDecimal.toChar()),
+ sDecimal,
&rController.getParser().getContext());
pValueExp->parseNodeToPredicateStr( aColumnName,
xConnection,
rController.getNumberFormatter(),
aLocale,
- static_cast<sal_Char>(sDecimal.toChar()),
+ sDecimal,
&rController.getParser().getContext());
// don't display the column name
@@ -1417,7 +1417,7 @@ namespace
xConnection,
rController.getNumberFormatter(),
aLocale,
- static_cast<sal_Char>(sDecimal.toChar()),
+ sDecimal,
&rController.getParser().getContext());
OTableFieldDescRef aDragLeft = new OTableFieldDesc();
@@ -1472,7 +1472,7 @@ namespace
xConnection,
rController.getNumberFormatter(),
_pView->getLocale(),
- static_cast<sal_Char>(_pView->getDecimalSeparator().toChar()),
+ _pView->getDecimalSeparator(),
&rController.getParser().getContext());
pFunction->parseNodeToStr( aColumnName,
@@ -1633,7 +1633,7 @@ namespace
xConnection,
rController.getNumberFormatter(),
_pView->getLocale(),
- static_cast<sal_Char>(_pView->getDecimalSeparator().toChar()),
+ _pView->getDecimalSeparator(),
&rController.getParser().getContext());
}
}
@@ -1675,7 +1675,7 @@ namespace
xConnection,
rController.getNumberFormatter(),
_pView->getLocale(),
- static_cast<sal_Char>(_pView->getDecimalSeparator().toChar()),
+ _pView->getDecimalSeparator(),
&rController.getParser().getContext());
}
@@ -2115,7 +2115,7 @@ namespace
xConnection,
rController.getNumberFormatter(),
_pView->getLocale(),
- static_cast<sal_Char>(_pView->getDecimalSeparator().toChar()),
+ _pView->getDecimalSeparator(),
&rController.getParser().getContext());
sal_Int32 nFunctionType = FKT_NONE;
@@ -2280,7 +2280,7 @@ namespace
xConnection,
rController.getNumberFormatter(),
_pView->getLocale(),
- static_cast<sal_Char>(_pView->getDecimalSeparator().toChar()),
+ _pView->getDecimalSeparator(),
&rController.getParser().getContext());
_pView->fillFunctionInfo(pArgument,sCondition,aDragLeft);
aDragLeft->SetFunctionType(FKT_OTHER);
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index edb0799da3bc..85df2321b40e 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1096,7 +1096,7 @@ bool OSelectionBrowseBox::SaveModified()
xColumn,
pEntry->GetAlias(),
getDesignView()->getLocale(),
- static_cast<sal_Char>(getDesignView()->getDecimalSeparator().toChar()),
+ getDesignView()->getDecimalSeparator(),
&(static_cast<OQueryController&>(getDesignView()->getController()).getParser().getContext()));
}
else
@@ -1133,7 +1133,7 @@ bool OSelectionBrowseBox::SaveModified()
xColumn,
pEntry->GetAlias(),
getDesignView()->getLocale(),
- static_cast<sal_Char>(getDesignView()->getDecimalSeparator().toChar()),
+ getDesignView()->getDecimalSeparator(),
&(static_cast<OQueryController&>(getDesignView()->getController()).getParser().getContext()));
}
else
diff --git a/include/connectivity/sqlnode.hxx b/include/connectivity/sqlnode.hxx
index fe90a29283c4..61c9ff5efc3b 100644
--- a/include/connectivity/sqlnode.hxx
+++ b/include/connectivity/sqlnode.hxx
@@ -82,7 +82,7 @@ namespace connectivity
OUString sPredicateTableAlias;
css::uno::Reference< css::container::XNameAccess > xQueries; // see bParseToSDBCLevel
const IParseContext& m_rContext;
- sal_Char cDecSep;
+ OUString sDecSep;
bool bQuote : 1; /// should we quote identifiers?
bool bInternational : 1; /// should we internationalize keywords and placeholders?
bool bPredicate : 1; /// are we going to parse a mere predicate?
@@ -97,7 +97,7 @@ namespace connectivity
const IParseContext* _pContext,
bool _bIntl,
bool _bQuote,
- sal_Char _cDecSep,
+ OUString _sDecSep,
bool _bPredicate,
bool _bParseToSDBC
);
@@ -321,7 +321,7 @@ namespace connectivity
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
const css::uno::Reference< css::util::XNumberFormatter > & xFormatter,
const css::lang::Locale& rIntl,
- sal_Char _cDec,
+ OUString _sDec,
const IParseContext* pContext = nullptr ) const;
void parseNodeToPredicateStr(OUString& rString,
@@ -330,7 +330,7 @@ namespace connectivity
const css::uno::Reference< css::beans::XPropertySet > & _xField,
const OUString &_sTableAlias,
const css::lang::Locale& rIntl,
- sal_Char _cDec,
+ OUString strDec,
const IParseContext* pContext = nullptr ) const;
OSQLParseNode* getByRule(OSQLParseNode::Rule eRule) const;
@@ -413,7 +413,7 @@ namespace connectivity
const IParseContext* pContext,
bool _bIntl,
bool _bQuote,
- sal_Char _cDecSep,
+ OUString _sDecSep,
bool _bPredicate) const;
private:
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 004830ff8f9f..911d814285e2 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -2904,7 +2904,7 @@ bool DbFilterField::commitControl()
m_rColumn.GetField(),
OUString(),
aAppLocale,
- '.',
+ OUString("."),
getParseContext());
m_aText = aPreparedText;
}
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 0d29422d6429..9b4052de5cb9 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -817,7 +817,7 @@ bool FmFilterModel::ValidateText(FmFilterItem const * pItem, OUString& rText, OU
OUString aPreparedText;
Locale aAppLocale = Application::GetSettings().GetUILanguageTag().getLocale();
pParseNode->parseNodeToPredicateStr(
- aPreparedText, xConnection, xFormatter, xField, OUString(), aAppLocale, '.', getParseContext() );
+ aPreparedText, xConnection, xFormatter, xField, OUString(), aAppLocale, OUString("."), getParseContext() );
rText = aPreparedText;
return true;
}
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 025b6ca05026..e460a025de90 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -3034,13 +3034,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
Locale aAppLocale = Application::GetSettings().GetUILanguageTag().getLocale();
const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetUILocaleDataWrapper() );
- /* FIXME: casting this to sal_Char is plain wrong and of course only
- * works for ASCII separators, but
- * pParseNode->parseNodeToPredicateStr() expects a sal_Char. Fix it
- * there. */
- sal_Char cDecimalSeparator = static_cast<sal_Char>(rLocaleWrapper.getNumDecimalSep()[0]);
- SAL_WARN_IF( static_cast<sal_Unicode>(cDecimalSeparator) != rLocaleWrapper.getNumDecimalSep()[0],
- "svx.form", "FormController::setFilter: wrong cast of decimal separator to sal_Char!");
+ OUString strDecimalSeparator = rLocaleWrapper.getNumDecimalSep();
// retrieving the filter
for (const Sequence < PropertyValue >& rRow : aFilterRows)
@@ -3157,7 +3151,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
,xField
,OUString()
,aAppLocale
- ,cDecimalSeparator
+ ,strDecimalSeparator
,getParseContext());
aRow[rFieldInfo.xText] = sCriteria;
}
More information about the Libreoffice-commits
mailing list