[Libreoffice-commits] .: Branch 'feature/new-autofilter-popup' - 3 commits - sc/inc sc/source svl/inc svl/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Nov 3 22:04:00 PDT 2011
sc/inc/queryparam.hxx | 3 +
sc/source/core/data/dociter.cxx | 15 ++-----
sc/source/core/data/dpshttab.cxx | 6 +-
sc/source/core/data/dptablecache.cxx | 18 +++-----
sc/source/core/tool/doubleref.cxx | 4 -
sc/source/core/tool/queryparam.cxx | 38 ++++++++++-------
sc/source/filter/excel/excimp8.cxx | 74 ++++++++++++++++++-----------------
sc/source/filter/inc/excimp8.hxx | 2
sc/source/ui/unoobj/cellsuno.cxx | 6 ++
sc/source/ui/unoobj/datauno.cxx | 38 ++++++++---------
svl/inc/svl/zforlist.hxx | 5 +-
svl/source/numbers/zforlist.cxx | 9 ++++
12 files changed, 121 insertions(+), 97 deletions(-)
New commits:
commit cf5eed57e7c566144b5b4e6c65ae5a806a8b2d25
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Fri Nov 4 01:03:27 2011 -0400
Remove direct access to the query string (pStr).
I'm about half-way through.
diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 105a801..dd09aa3 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -70,6 +70,9 @@ struct ScQueryEntry
// creates pSearchParam and pSearchText if necessary, always RegExp!
utl::TextSearch* GetSearchTextPtr( bool bCaseSens ) const;
+ bool MatchByString(const rtl::OUString& rStr) const;
+ SC_DLLPUBLIC void SetQueryString(const rtl::OUString& rStr);
+ SC_DLLPUBLIC rtl::OUString GetQueryString() const;
void Clear();
ScQueryEntry& operator=( const ScQueryEntry& r );
bool operator==( const ScQueryEntry& r ) const;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 632abf8..aba2ac5 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -532,7 +532,7 @@ ScDBQueryDataIterator::DataAccessInternal::DataAccessInternal(const ScDBQueryDat
ScQueryEntry& rEntry = mpParam->GetEntry(i);
sal_uInt32 nIndex = 0;
rEntry.bQueryByString =
- !(mpDoc->GetFormatTable()->IsNumberFormat(*rEntry.pStr, nIndex, rEntry.nVal));
+ !(mpDoc->GetFormatTable()->IsNumberFormat(rEntry.GetQueryString(), nIndex, rEntry.nVal));
}
nNumFormat = 0; // werden bei GetNumberFormat initialisiert
pAttrArray = 0;
@@ -814,14 +814,11 @@ bool ScDBQueryDataIterator::DataAccessMatrix::isValidQuery(SCROW nRow, const ScM
// By string
do
{
- if (!rEntry.pStr)
- break;
-
// Equality check first.
OUString aMatStr = rMat.GetString(nField, nRow);
lcl_toUpper(aMatStr);
- OUString aQueryStr = *rEntry.pStr;
+ OUString aQueryStr = rEntry.GetQueryString();
lcl_toUpper(aQueryStr);
bool bDone = false;
switch (rEntry.eOp)
@@ -1108,8 +1105,8 @@ ScQueryCellIterator::ScQueryCellIterator(ScDocument* pDocument, SCTAB nTable,
ScQueryEntry& rEntry = aParam.GetEntry(i);
sal_uInt32 nIndex = 0;
rEntry.bQueryByString =
- !(pDoc->GetFormatTable()->IsNumberFormat(*rEntry.pStr,
- nIndex, rEntry.nVal));
+ !(pDoc->GetFormatTable()->IsNumberFormat(
+ rEntry.GetQueryString(), nIndex, rEntry.nVal));
}
}
nNumFormat = 0; // werden bei GetNumberFormat initialisiert
@@ -1415,7 +1412,7 @@ ScBaseCell* ScQueryCellIterator::BinarySearch()
sal_uLong nFormat = pCol->GetNumberFormat( pItems[nLo].nRow);
ScCellFormat::GetInputString( pItems[nLo].pCell, nFormat, aCellStr,
rFormatter);
- sal_Int32 nTmp = pCollator->compareString( aCellStr, *rEntry.pStr);
+ sal_Int32 nTmp = pCollator->compareString(aCellStr, rEntry.GetQueryString());
if ((rEntry.eOp == SC_LESS_EQUAL && nTmp > 0) ||
(rEntry.eOp == SC_GREATER_EQUAL && nTmp < 0) ||
(rEntry.eOp == SC_EQUAL && nTmp != 0))
@@ -1547,7 +1544,7 @@ ScBaseCell* ScQueryCellIterator::BinarySearch()
sal_uLong nFormat = pCol->GetNumberFormat( pItems[i].nRow);
ScCellFormat::GetInputString( pItems[i].pCell, nFormat, aCellStr,
rFormatter);
- nRes = pCollator->compareString( aCellStr, *rEntry.pStr);
+ nRes = pCollator->compareString( aCellStr, rEntry.GetQueryString());
if (nRes < 0 && bLessEqual)
{
sal_Int32 nTmp = pCollator->compareString( aLastInRangeString,
diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx
index b65bb47..ebac350 100644
--- a/sc/source/core/data/dpshttab.cxx
+++ b/sc/source/core/data/dpshttab.cxx
@@ -78,7 +78,7 @@ ScSheetDPData::ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, con
pSpecial[j] = false;
if (!rEntry.bQueryByString)
{
- if (*rEntry.pStr == EMPTY_STRING &&
+ if (rEntry.GetQueryString().isEmpty() &&
((rEntry.nVal == SC_EMPTYFIELDS) || (rEntry.nVal == SC_NONEMPTYFIELDS)))
pSpecial[j] = true;
}
@@ -86,8 +86,8 @@ ScSheetDPData::ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, con
{
sal_uInt32 nIndex = 0;
rEntry.bQueryByString =
- !(pD->GetFormatTable()->
- IsNumberFormat(*rEntry.pStr, nIndex, rEntry.nVal));
+ !(pD->GetFormatTable()->IsNumberFormat(
+ rEntry.GetQueryString(), nIndex, rEntry.nVal));
}
}
}
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index 463ceb6..8f9852d 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -681,9 +681,9 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, bool *pSpeci
{
if (bMatchWholeCell)
{
- bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr );
- String aStr = *rEntry.pStr;
- sal_Bool bHasStar = false;
+ String aStr = rEntry.GetQueryString();
+ bOk = pTransliteration->isEqual(aCellStr, aStr);
+ bool bHasStar = false;
xub_StrLen nIndex;
if (( nIndex = aStr.Search('*') ) != STRING_NOTFOUND)
bHasStar = sal_True;
@@ -706,12 +706,10 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, bool *pSpeci
else
{
::com::sun::star::uno::Sequence< sal_Int32 > xOff;
- String aCell( pTransliteration->transliterate(
- aCellStr, ScGlobal::eLnge, 0, aCellStr.Len(),
- &xOff ) );
- String aQuer( pTransliteration->transliterate(
- *rEntry.pStr, ScGlobal::eLnge, 0, rEntry.pStr->Len(),
- &xOff ) );
+ String aCell = pTransliteration->transliterate(
+ aCellStr, ScGlobal::eLnge, 0, aCellStr.Len(), &xOff);
+ String aQuer = pTransliteration->transliterate(
+ rEntry.GetQueryString(), ScGlobal::eLnge, 0, rEntry.GetQueryString().getLength(), &xOff);
bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND);
}
if (rEntry.eOp == SC_NOT_EQUAL)
@@ -720,7 +718,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, bool *pSpeci
else
{ // use collator here because data was probably sorted
sal_Int32 nCompare = pCollator->compareString(
- aCellStr, *rEntry.pStr );
+ aCellStr, rEntry.GetQueryString());
switch (rEntry.eOp)
{
case SC_LESS :
diff --git a/sc/source/core/tool/doubleref.cxx b/sc/source/core/tool/doubleref.cxx
index 5724c79..417e28e 100644
--- a/sc/source/core/tool/doubleref.cxx
+++ b/sc/source/core/tool/doubleref.cxx
@@ -141,8 +141,8 @@ bool lcl_createStarQuery(ScQueryParamBase* pParam, const ScDBRangeBase* pDBRef,
if (bValid)
{
// Finally, the right-hand-side value in the 4th column.
- *rEntry.pStr = pQueryRef->getString(3, nRow);
- rEntry.bDoQuery = sal_True;
+ rEntry.SetQueryString(pQueryRef->getString(3, nRow));
+ rEntry.bDoQuery = true;
}
nIndex++;
nRow++;
diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx
index 7895926..ffa9b94 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -96,6 +96,21 @@ ScQueryEntry& ScQueryEntry::operator=( const ScQueryEntry& r )
return *this;
}
+bool ScQueryEntry::MatchByString(const rtl::OUString& rStr) const
+{
+ return rStr.equals(*pStr);
+}
+
+void ScQueryEntry::SetQueryString(const rtl::OUString& rStr)
+{
+ *pStr = String(rStr);
+}
+
+rtl::OUString ScQueryEntry::GetQueryString() const
+{
+ return *pStr;
+}
+
void ScQueryEntry::Clear()
{
bDoQuery = false;
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index a00aa16..94e74ef 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -499,11 +499,11 @@ XclImpAutoFilterData::XclImpAutoFilterData( RootData* pRoot, const ScRange& rRan
}
-void XclImpAutoFilterData::CreateFromDouble( String& rStr, double fVal )
+void XclImpAutoFilterData::CreateFromDouble( rtl::OUString& rStr, double fVal )
{
- rStr += String( ::rtl::math::doubleToUString( fVal,
+ rStr += ::rtl::math::doubleToUString(fVal,
rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), sal_True));
+ ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), true);
}
void XclImpAutoFilterData::SetCellAttribs()
@@ -540,34 +540,34 @@ void XclImpAutoFilterData::InsertQueryParam()
static void ExcelQueryToOooQuery( ScQueryEntry& rEntry )
{
- if( ( rEntry.eOp != SC_EQUAL && rEntry.eOp != SC_NOT_EQUAL ) || rEntry.pStr == NULL )
+ if (rEntry.eOp != SC_EQUAL && rEntry.eOp != SC_NOT_EQUAL)
return;
- else
+
+ String aStr = rEntry.GetQueryString();
+ xub_StrLen nLen = aStr.Len();
+ sal_Unicode nStart = aStr.GetChar( 0 );
+ sal_Unicode nEnd = aStr.GetChar( nLen-1 );
+ if( nLen >2 && nStart == '*' && nEnd == '*' )
{
- xub_StrLen nLen = rEntry.pStr->Len();
- sal_Unicode nStart = rEntry.pStr->GetChar( 0 );
- sal_Unicode nEnd = rEntry.pStr->GetChar( nLen-1 );
- if( nLen >2 && nStart == '*' && nEnd == '*' )
- {
- rEntry.pStr->Erase( nLen-1, 1 );
- rEntry.pStr->Erase( 0, 1 );
- rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_CONTAINS : SC_DOES_NOT_CONTAIN;
- }
- else if( nLen > 1 && nStart == '*' && nEnd != '*' )
- {
- rEntry.pStr->Erase( 0, 1 );
- rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_ENDS_WITH : SC_DOES_NOT_END_WITH;
- }
- else if( nLen > 1 && nStart != '*' && nEnd == '*' )
- {
- rEntry.pStr->Erase( nLen-1, 1 );
- rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_BEGINS_WITH : SC_DOES_NOT_BEGIN_WITH;
- }
- else if( nLen == 2 && nStart == '*' && nEnd == '*' )
- {
- rEntry.pStr->Erase( 0, 1 );
- }
+ aStr.Erase( nLen-1, 1 );
+ aStr.Erase( 0, 1 );
+ rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_CONTAINS : SC_DOES_NOT_CONTAIN;
+ }
+ else if( nLen > 1 && nStart == '*' && nEnd != '*' )
+ {
+ aStr.Erase( 0, 1 );
+ rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_ENDS_WITH : SC_DOES_NOT_END_WITH;
+ }
+ else if( nLen > 1 && nStart != '*' && nEnd == '*' )
+ {
+ aStr.Erase( nLen-1, 1 );
+ rEntry.eOp = ( rEntry.eOp == SC_EQUAL ) ? SC_BEGINS_WITH : SC_DOES_NOT_BEGIN_WITH;
+ }
+ else if( nLen == 2 && nStart == '*' && nEnd == '*' )
+ {
+ aStr.Erase( 0, 1 );
}
+ rEntry.SetQueryString(aStr);
}
void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
@@ -593,7 +593,7 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
aEntry.eOp = bTopOfTop10 ?
(bPercent ? SC_TOPPERC : SC_TOPVAL) : (bPercent ? SC_BOTPERC : SC_BOTVAL);
aEntry.eConnect = SC_AND;
- aEntry.pStr->Assign( String::CreateFromInt32( (sal_Int32) nCntOfTop10 ) );
+ aEntry.SetQueryString(rtl::OUString::valueOf(static_cast<sal_Int32>(nCntOfTop10)));
rStrm.Ignore( 20 );
nFirstEmpty++;
@@ -642,27 +642,33 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
aEntry.eOp = SC_EQUAL;
}
+ rtl::OUString aStr;
+
switch( nType )
{
case EXC_AFTYPE_RK:
rStrm >> nRK;
rStrm.Ignore( 4 );
- CreateFromDouble( *aEntry.pStr, XclTools::GetDoubleFromRK( nRK ) );
+ aStr = aEntry.GetQueryString();
+ CreateFromDouble(aStr, XclTools::GetDoubleFromRK(nRK));
+ aEntry.SetQueryString(aStr);
break;
case EXC_AFTYPE_DOUBLE:
rStrm >> fVal;
- CreateFromDouble( *aEntry.pStr, fVal );
+ aStr = aEntry.GetQueryString();
+ CreateFromDouble(aStr, fVal);
+ aEntry.SetQueryString(aStr);
break;
case EXC_AFTYPE_STRING:
rStrm.Ignore( 4 );
rStrm >> nStrLen[ nE ];
rStrm.Ignore( 3 );
- aEntry.pStr->Erase();
+ aEntry.SetQueryString(rtl::OUString());
break;
case EXC_AFTYPE_BOOLERR:
rStrm >> nBoolErr >> nVal;
rStrm.Ignore( 6 );
- aEntry.pStr->Assign( String::CreateFromInt32( (sal_Int32) nVal ) );
+ aEntry.SetQueryString(rtl::OUString::valueOf(static_cast<sal_Int32>(nVal)));
bIgnore = (sal_Bool) nBoolErr;
break;
case EXC_AFTYPE_EMPTY:
@@ -704,7 +710,7 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
for( nE = 0; nE < 2; nE++ )
if( nStrLen[ nE ] && pQueryEntries[ nE ] )
{
- pQueryEntries[ nE ]->pStr->Assign ( rStrm.ReadUniString( nStrLen[ nE ] ) );
+ pQueryEntries[nE]->SetQueryString(rStrm.ReadUniString(nStrLen[nE]));
ExcelQueryToOooQuery( *pQueryEntries[ nE ] );
}
diff --git a/sc/source/filter/inc/excimp8.hxx b/sc/source/filter/inc/excimp8.hxx
index eb441f3..6a9b36f 100644
--- a/sc/source/filter/inc/excimp8.hxx
+++ b/sc/source/filter/inc/excimp8.hxx
@@ -107,7 +107,7 @@ private:
sal_Bool bAutoOrAdvanced;
ScRange aCriteriaRange;
- void CreateFromDouble( String& rStr, double fVal );
+ void CreateFromDouble( rtl::OUString& rStr, double fVal );
void SetCellAttribs();
void InsertQueryParam();
void AmendAFName(const sal_Bool bUseUnNamed);
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 748b3c0..f6b0267 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -5678,8 +5678,12 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe
rEntry.nField += nFieldStart;
// Im Dialog wird immer der String angezeigt -> muss zum Wert passen
if ( !rEntry.bQueryByString )
+ {
+ rtl::OUString aStr;
pDocSh->GetDocument()->GetFormatTable()->
- GetInputLineString( rEntry.nVal, 0, *rEntry.pStr );
+ GetInputLineString(rEntry.nVal, 0, aStr);
+ rEntry.SetQueryString(aStr);
+ }
}
}
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 62db49e..9a6e4a0 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -1072,19 +1072,19 @@ void ScFilterDescriptorBase::fillQueryParam(
for (i=0; i<nCount; i++)
{
ScQueryEntry& rEntry = rParam.GetEntry(i);
- if (!rEntry.pStr)
- rEntry.pStr = new String; // sollte nicht sein (soll immer initialisiert sein)
rEntry.bDoQuery = sal_True;
rEntry.eConnect = (pAry[i].Connection == sheet::FilterConnection_AND) ? SC_AND : SC_OR;
rEntry.nField = pAry[i].Field;
rEntry.bQueryByString = !pAry[i].IsNumeric;
- *rEntry.pStr = String( pAry[i].StringValue );
rEntry.nVal = pAry[i].NumericValue;
+ rEntry.SetQueryString(pAry[i].StringValue);
if (!rEntry.bQueryByString && pDoc)
{
- pDoc->GetFormatTable()->GetInputLineString(rEntry.nVal, 0, *rEntry.pStr);
+ rtl::OUString aStr;
+ pDoc->GetFormatTable()->GetInputLineString(rEntry.nVal, 0, aStr);
+ rEntry.SetQueryString(aStr);
}
switch (pAry[i].Operator) // FilterOperator
@@ -1110,7 +1110,7 @@ void ScFilterDescriptorBase::fillQueryParam(
rEntry.eOp = SC_EQUAL;
rEntry.nVal = SC_EMPTYFIELDS;
rEntry.bQueryByString = false;
- *rEntry.pStr = EMPTY_STRING;
+ rEntry.SetQueryString(rtl::OUString());
}
break;
case sheet::FilterOperator2::NOT_EMPTY:
@@ -1118,7 +1118,7 @@ void ScFilterDescriptorBase::fillQueryParam(
rEntry.eOp = SC_EQUAL;
rEntry.nVal = SC_NONEMPTYFIELDS;
rEntry.bQueryByString = false;
- *rEntry.pStr = EMPTY_STRING;
+ rEntry.SetQueryString(rtl::OUString());
}
break;
default:
@@ -1180,9 +1180,7 @@ uno::Sequence<sheet::TableFilterField> SAL_CALL ScFilterDescriptorBase::getFilte
{
const ScQueryEntry& rEntry = aParam.GetEntry(i);
- rtl::OUString aStringValue;
- if (rEntry.pStr)
- aStringValue = *rEntry.pStr;
+ rtl::OUString aStringValue = rEntry.GetQueryString();
aField.Connection = (rEntry.eConnect == SC_AND) ? sheet::FilterConnection_AND :
sheet::FilterConnection_OR;
@@ -1196,7 +1194,7 @@ uno::Sequence<sheet::TableFilterField> SAL_CALL ScFilterDescriptorBase::getFilte
case SC_EQUAL:
{
aField.Operator = sheet::FilterOperator_EQUAL;
- if (!rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING)
+ if (!rEntry.bQueryByString && rEntry.GetQueryString().isEmpty())
{
if (rEntry.nVal == SC_EMPTYFIELDS)
{
@@ -1249,9 +1247,7 @@ throw(uno::RuntimeException)
{
const ScQueryEntry& rEntry = aParam.GetEntry(i);
- rtl::OUString aStringValue;
- if (rEntry.pStr)
- aStringValue = *rEntry.pStr;
+ rtl::OUString aStringValue = rEntry.GetQueryString();
aField.Connection = (rEntry.eConnect == SC_AND) ? sheet::FilterConnection_AND : sheet::FilterConnection_OR;
aField.Field = rEntry.nField;
@@ -1264,7 +1260,7 @@ throw(uno::RuntimeException)
case SC_EQUAL:
{
aField.Operator = sheet::FilterOperator2::EQUAL;
- if (!rEntry.bQueryByString && *rEntry.pStr == EMPTY_STRING)
+ if (!rEntry.bQueryByString && rEntry.GetQueryString().isEmpty())
{
if (rEntry.nVal == SC_EMPTYFIELDS)
{
@@ -1319,19 +1315,19 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields(
for (i=0; i<nCount; i++)
{
ScQueryEntry& rEntry = aParam.GetEntry(i);
- if (!rEntry.pStr)
- rEntry.pStr = new String; // sollte nicht sein (soll immer initialisiert sein)
- rEntry.bDoQuery = sal_True;
+ rEntry.bDoQuery = true;
rEntry.eConnect = (pAry[i].Connection == sheet::FilterConnection_AND) ? SC_AND : SC_OR;
rEntry.nField = pAry[i].Field;
rEntry.bQueryByString = !pAry[i].IsNumeric;
- *rEntry.pStr = String( pAry[i].StringValue );
rEntry.nVal = pAry[i].NumericValue;
+ rEntry.SetQueryString(pAry[i].StringValue);
if (!rEntry.bQueryByString && pDocSh)
{
- pDocSh->GetDocument()->GetFormatTable()->GetInputLineString(rEntry.nVal, 0, *rEntry.pStr);
+ rtl::OUString aStr;
+ pDocSh->GetDocument()->GetFormatTable()->GetInputLineString(rEntry.nVal, 0, aStr);
+ rEntry.SetQueryString(aStr);
}
switch (pAry[i].Operator) // FilterOperator
@@ -1351,7 +1347,7 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields(
rEntry.eOp = SC_EQUAL;
rEntry.nVal = SC_EMPTYFIELDS;
rEntry.bQueryByString = false;
- *rEntry.pStr = EMPTY_STRING;
+ rEntry.SetQueryString(rtl::OUString());
}
break;
case sheet::FilterOperator_NOT_EMPTY:
@@ -1359,7 +1355,7 @@ void SAL_CALL ScFilterDescriptorBase::setFilterFields(
rEntry.eOp = SC_EQUAL;
rEntry.nVal = SC_NONEMPTYFIELDS;
rEntry.bQueryByString = false;
- *rEntry.pStr = EMPTY_STRING;
+ rEntry.SetQueryString(rtl::OUString());
}
break;
default:
commit edc751cec8bb0cf213499fac47903921b1fc4bfe
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Thu Nov 3 23:22:46 2011 -0400
Support rtl::OUString reference here as well.
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 67a1678..afcb326 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -502,7 +502,10 @@ public:
/** Format a number according to the standard default format matching
the given format index */
void GetInputLineString( const double& fOutNumber,
- sal_uInt32 nFIndex, String& sOutString );
+ sal_uInt32 nFIndex, String& sOutString );
+
+ void GetInputLineString( const double& fOutNumber,
+ sal_uInt32 nFIndex, rtl::OUString& rOutString );
/** Format a number according to a format code string to be scanned.
@return
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index aaa5064..786e80a 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1512,6 +1512,15 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
ChangeStandardPrec(nOldPrec);
}
+void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
+ sal_uInt32 nFIndex,
+ rtl::OUString& rOutString)
+{
+ String aTmp;
+ GetInputLineString(fOutNumber, nFIndex, aTmp);
+ rOutString = aTmp;
+}
+
void SvNumberFormatter::GetOutputString(const double& fOutNumber,
sal_uInt32 nFIndex,
String& sOutString,
commit 86180c2f253231d4b4612b3b40afa2105ea9b3d5
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Thu Nov 3 23:13:19 2011 -0400
Calling delete on NULL pointer is safe.
diff --git a/sc/source/core/tool/queryparam.cxx b/sc/source/core/tool/queryparam.cxx
index 44d6201..7895926 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -73,11 +73,8 @@ ScQueryEntry::ScQueryEntry(const ScQueryEntry& r) :
ScQueryEntry::~ScQueryEntry()
{
delete pStr;
- if ( pSearchParam )
- {
- delete pSearchParam;
- delete pSearchText;
- }
+ delete pSearchParam;
+ delete pSearchText;
}
ScQueryEntry& ScQueryEntry::operator=( const ScQueryEntry& r )
@@ -90,11 +87,9 @@ ScQueryEntry& ScQueryEntry::operator=( const ScQueryEntry& r )
nField = r.nField;
nVal = r.nVal;
*pStr = *r.pStr;
- if ( pSearchParam )
- {
- delete pSearchParam;
- delete pSearchText;
- }
+
+ delete pSearchParam;
+ delete pSearchText;
pSearchParam = NULL;
pSearchText = NULL;
@@ -111,11 +106,9 @@ void ScQueryEntry::Clear()
nField = 0;
nVal = 0.0;
pStr->Erase();
- if ( pSearchParam )
- {
- delete pSearchParam;
- delete pSearchText;
- }
+
+ delete pSearchParam;
+ delete pSearchText;
pSearchParam = NULL;
pSearchText = NULL;
}
More information about the Libreoffice-commits
mailing list