summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-10-08 08:19:48 +0200
committerNoel Grandin <noel@peralex.com>2013-10-08 10:03:17 +0200
commit8850633fe4cdac306c35caab1a0d14c13d9df864 (patch)
tree3ee83286d83de75f6f8d1742f0253da9c173fee5 /sc/source
parent43a3611347c1f49cf6053bf7e8904d56254d8761 (diff)
convert sc/source/core/data/*.cxx from String to OUString
and fix a bug in ScDPCache::ValidQuery where an inner loop was re-using an outer loop counter. Change-Id: Ie750234a079646bdb7174983814d8d9caf52f491
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/attrib.cxx39
-rw-r--r--sc/source/core/data/dbdocutl.cxx8
-rw-r--r--sc/source/core/data/documen4.cxx2
-rw-r--r--sc/source/core/data/dpcache.cxx24
-rw-r--r--sc/source/core/data/dpdimsave.cxx3
-rw-r--r--sc/source/core/data/dpobject.cxx6
-rw-r--r--sc/source/core/data/dptabres.cxx18
-rw-r--r--sc/source/core/data/drwlayer.cxx10
-rw-r--r--sc/source/core/data/global.cxx28
-rw-r--r--sc/source/core/data/global2.cxx21
-rw-r--r--sc/source/core/data/globalx.cxx6
-rw-r--r--sc/source/core/data/patattr.cxx4
-rw-r--r--sc/source/core/data/stlpool.cxx6
-rw-r--r--sc/source/core/data/table2.cxx4
-rw-r--r--sc/source/core/data/table3.cxx28
-rw-r--r--sc/source/core/data/table4.cxx2
-rw-r--r--sc/source/core/data/table6.cxx4
-rw-r--r--sc/source/core/data/tabprotection.cxx28
18 files changed, 119 insertions, 122 deletions
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 2ec52ec9fc01..042c4b51a5d4 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -744,57 +744,56 @@ SfxPoolItem* ScPageHFItem::Clone( SfxItemPool* ) const
//------------------------------------------------------------------------
-static void lcl_SetSpace( String& rStr, const ESelection& rSel )
+static void lcl_SetSpace( OUString& rStr, const ESelection& rSel )
{
// Text replaced by a space to ensure they are positions:
xub_StrLen nLen = rSel.nEndPos-rSel.nStartPos;
- rStr.Erase( rSel.nStartPos, nLen-1 );
- rStr.SetChar( rSel.nStartPos, ' ' );
+ rStr = rStr.replaceAt( rSel.nStartPos, nLen, " " );
}
-static bool lcl_ConvertFields(EditEngine& rEng, const String* pCommands)
+static bool lcl_ConvertFields(EditEngine& rEng, const OUString* pCommands)
{
bool bChange = false;
sal_Int32 nParCnt = rEng.GetParagraphCount();
for (sal_Int32 nPar = 0; nPar<nParCnt; nPar++)
{
- String aStr = rEng.GetText( nPar );
- xub_StrLen nPos;
+ OUString aStr = rEng.GetText( nPar );
+ sal_Int32 nPos;
- while ((nPos = aStr.Search(pCommands[0])) != STRING_NOTFOUND)
+ while ((nPos = aStr.indexOf(pCommands[0])) != -1)
{
- ESelection aSel( nPar,nPos, nPar,nPos+pCommands[0].Len() );
+ ESelection aSel( nPar,nPos, nPar,nPos+pCommands[0].getLength() );
rEng.QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), aSel );
lcl_SetSpace(aStr, aSel ); bChange = true;
}
- while ((nPos = aStr.Search(pCommands[1])) != STRING_NOTFOUND)
+ while ((nPos = aStr.indexOf(pCommands[1])) != -1)
{
- ESelection aSel( nPar,nPos, nPar,nPos+pCommands[1].Len() );
+ ESelection aSel( nPar,nPos, nPar,nPos+pCommands[1].getLength() );
rEng.QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), aSel );
lcl_SetSpace(aStr, aSel ); bChange = true;
}
- while ((nPos = aStr.Search(pCommands[2])) != STRING_NOTFOUND)
+ while ((nPos = aStr.indexOf(pCommands[2])) != -1)
{
- ESelection aSel( nPar,nPos, nPar,nPos+pCommands[2].Len() );
+ ESelection aSel( nPar,nPos, nPar,nPos+pCommands[2].getLength() );
rEng.QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SVXDATETYPE_VAR), EE_FEATURE_FIELD), aSel );
lcl_SetSpace(aStr, aSel ); bChange = true;
}
- while ((nPos = aStr.Search(pCommands[3])) != STRING_NOTFOUND)
+ while ((nPos = aStr.indexOf(pCommands[3])) != -1)
{
- ESelection aSel( nPar,nPos, nPar,nPos+pCommands[3].Len() );
+ ESelection aSel( nPar,nPos, nPar,nPos+pCommands[3].getLength() );
rEng.QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD ), aSel );
lcl_SetSpace(aStr, aSel ); bChange = true;
}
- while ((nPos = aStr.Search(pCommands[4])) != STRING_NOTFOUND)
+ while ((nPos = aStr.indexOf(pCommands[4])) != -1)
{
- ESelection aSel( nPar,nPos, nPar,nPos+pCommands[4].Len() );
+ ESelection aSel( nPar,nPos, nPar,nPos+pCommands[4].getLength() );
rEng.QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), aSel );
lcl_SetSpace(aStr, aSel ); bChange = true;
}
- while ((nPos = aStr.Search(pCommands[5])) != STRING_NOTFOUND)
+ while ((nPos = aStr.indexOf(pCommands[5])) != -1)
{
- ESelection aSel( nPar,nPos, nPar,nPos+pCommands[5].Len() );
+ ESelection aSel( nPar,nPos, nPar,nPos+pCommands[5].getLength() );
rEng.QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), aSel );
lcl_SetSpace(aStr, aSel ); bChange = true;
}
@@ -841,8 +840,8 @@ SfxPoolItem* ScPageHFItem::Create( SvStream& rStream, sal_uInt16 nVer ) const
if ( nVer < 1 ) //old field command conversions
{
sal_uInt16 i;
- const String& rDel = ScGlobal::GetRscString( STR_HFCMD_DELIMITER );
- String aCommands[SC_FIELD_COUNT];
+ const OUString& rDel = ScGlobal::GetRscString( STR_HFCMD_DELIMITER );
+ OUString aCommands[SC_FIELD_COUNT];
for (i=0; i<SC_FIELD_COUNT; i++)
aCommands[i] = rDel;
aCommands[0] += ScGlobal::GetRscString(STR_HFCMD_PAGE);
diff --git a/sc/source/core/data/dbdocutl.cxx b/sc/source/core/data/dbdocutl.cxx
index a03250aae21e..2db7b5ff361b 100644
--- a/sc/source/core/data/dbdocutl.cxx
+++ b/sc/source/core/data/dbdocutl.cxx
@@ -43,7 +43,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
const uno::Reference<sdbc::XRow>& xRow, long nRowPos,
long nType, sal_Bool bCurrency, StrData* pStrData )
{
- String aString;
+ OUString aString;
double nVal = 0.0;
sal_Bool bValue = false;
sal_Bool bEmptyFlag = false;
@@ -85,7 +85,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
case sdbc::DataType::VARCHAR:
case sdbc::DataType::LONGVARCHAR:
aString = xRow->getString(nRowPos);
- bEmptyFlag = ( aString.Len() == 0 ) && xRow->wasNull();
+ bEmptyFlag = ( aString.isEmpty() ) && xRow->wasNull();
break;
case sdbc::DataType::DATE:
@@ -171,7 +171,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
}
else
{
- if (aString.Len())
+ if (!aString.isEmpty())
{
if (ScStringUtil::isMultiline(aString))
{
@@ -189,7 +189,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
}
if (pStrData)
- pStrData->mnStrLength = aString.Len();
+ pStrData->mnStrLength = aString.getLength();
}
else
pDoc->SetEmptyCell(aPos);
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 250c1a8ce8fc..608cf4d0dd48 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -372,7 +372,7 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam, // Mehrfachopera
aForString.append(ScCompiler::GetNativeSymbol(ocTableOp));
aForString.append(ScCompiler::GetNativeSymbol( ocOpen));
- const String& sSep = ScCompiler::GetNativeSymbol( ocSep);
+ const OUString& sSep = ScCompiler::GetNativeSymbol( ocSep);
if (rParam.nMode == 0) // nur Spalte
{
aRef.Set( rParam.aRefFormulaCell.GetAddress(), true, false, false );
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 5d2e50a881b9..874efb2b2790 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -525,7 +525,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const
&& pCellData->HasStringData() )
)
{ // by String
- String aCellStr = pCellData->GetString();
+ OUString aCellStr = pCellData->GetString();
bool bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
|| (rEntry.eOp == SC_NOT_EQUAL)));
@@ -533,13 +533,13 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const
if (bRealRegExp || bTestRegExp)
{
sal_Int32 nStart = 0;
- sal_Int32 nEnd = aCellStr.Len();
+ sal_Int32 nEnd = aCellStr.getLength();
bool bMatch = (bool) rEntry.GetSearchTextPtr( rParam.bCaseSens )
->SearchForward( aCellStr, &nStart, &nEnd );
// from 614 on, nEnd is behind the found text
if (bMatch && bMatchWholeCell
- && (nStart != 0 || nEnd != aCellStr.Len()))
+ && (nStart != 0 || nEnd != aCellStr.getLength()))
bMatch = false; // RegExp must match entire cell string
if (bRealRegExp)
bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch);
@@ -550,17 +550,17 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const
{
if (bMatchWholeCell)
{
- String aStr = rEntry.GetQueryItem().maString;
+ OUString aStr = rEntry.GetQueryItem().maString;
bOk = pTransliteration->isEqual(aCellStr, aStr);
bool bHasStar = false;
- xub_StrLen nIndex;
- if (( nIndex = aStr.Search('*') ) != STRING_NOTFOUND)
+ sal_Int32 nIndex;
+ if (( nIndex = aStr.indexOf('*') ) != -1)
bHasStar = sal_True;
if (bHasStar && (nIndex>0))
{
- for (i=0;(i<nIndex) && (i< aCellStr.Len()) ; i++)
+ for (sal_Int32 j=0;(j<nIndex) && (j< aCellStr.getLength()) ; j++)
{
- if (aCellStr.GetChar( (sal_uInt16)i ) == aStr.GetChar((sal_uInt16) i ))
+ if (aCellStr[j] == aStr[j])
{
bOk=1;
}
@@ -576,11 +576,11 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const
{
const OUString& rQueryStr = rEntry.GetQueryItem().maString;
::com::sun::star::uno::Sequence< sal_Int32 > xOff;
- String aCell = pTransliteration->transliterate(
- aCellStr, ScGlobal::eLnge, 0, aCellStr.Len(), &xOff);
- String aQuer = pTransliteration->transliterate(
+ OUString aCell = pTransliteration->transliterate(
+ aCellStr, ScGlobal::eLnge, 0, aCellStr.getLength(), &xOff);
+ OUString aQuer = pTransliteration->transliterate(
rQueryStr, ScGlobal::eLnge, 0, rQueryStr.getLength(), &xOff);
- bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND);
+ bOk = (aCell.indexOf( aQuer ) != -1);
}
if (rEntry.eOp == SC_NOT_EQUAL)
bOk = !bOk;
diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx
index 16f68b841bdb..d200971d50ab 100644
--- a/sc/source/core/data/dpdimsave.cxx
+++ b/sc/source/core/data/dpdimsave.cxx
@@ -174,8 +174,7 @@ OUString ScDPSaveGroupDimension::CreateGroupName(const OUString& rPrefix)
const sal_Int32 nMaxAdd = nAdd + aGroups.size(); // limit the loop
while ( nAdd <= nMaxAdd )
{
- String aGroupName( rPrefix );
- aGroupName.Append( OUString::number( nAdd ) );
+ OUString aGroupName = rPrefix + OUString::number( nAdd );
bool bExists = false;
// look for existing groups
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 1594463da5c5..5106cd836bb7 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1418,7 +1418,7 @@ void ScDPObject::ToggleDetails(const DataPilotTableHeaderData& rElemDesc, ScDPOb
}
OSL_ENSURE( xDim.is(), "dimension not found" );
if ( !xDim.is() ) return;
- String aDimName = xDim->getName();
+ OUString aDimName = xDim->getName();
uno::Reference<beans::XPropertySet> xDimProp( xDim, uno::UNO_QUERY );
sal_Bool bDataLayout = ScUnoHelpFunctions::GetBoolProperty( xDimProp,
@@ -1497,7 +1497,7 @@ void ScDPObject::ToggleDetails(const DataPilotTableHeaderData& rElemDesc, ScDPOb
OSL_ENSURE( pModifyData, "no data?" );
if ( pModifyData )
{
- const String aName = rElemDesc.MemberName;
+ const OUString aName = rElemDesc.MemberName;
pModifyData->GetDimensionByName(aDimName)->
GetMemberByName(aName)->SetShowDetails( !bShowDetails ); // toggle
@@ -2673,7 +2673,7 @@ uno::Reference<sdbc::XRowSet> ScDPCollection::DBCaches::createRowSet(
catch ( const sdbc::SQLException& rError )
{
//! store error message
- InfoBox aInfoBox( 0, String(rError.Message) );
+ InfoBox aInfoBox( 0, OUString(rError.Message) );
aInfoBox.Execute();
}
catch ( uno::Exception& )
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index e4ad435d6010..33445d5c8da0 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -1320,14 +1320,14 @@ void ScDPResultMember::ProcessData( const vector< SCROW >& aChildMembers, const
* Parse subtotal string and replace all occurrences of '?' with the caption
* string. Do ensure that escaped characters are not translated.
*/
-static String lcl_parseSubtotalName(const String& rSubStr, const String& rCaption)
+static OUString lcl_parseSubtotalName(const OUString& rSubStr, const OUString& rCaption)
{
- String aNewStr;
- xub_StrLen n = rSubStr.Len();
+ OUStringBuffer aNewStr;
+ xub_StrLen n = rSubStr.getLength();
bool bEscaped = false;
for (xub_StrLen i = 0; i < n; ++i)
{
- sal_Unicode c = rSubStr.GetChar(i);
+ sal_Unicode c = rSubStr[i];
if (!bEscaped && c == sal_Unicode('\\'))
{
bEscaped = true;
@@ -1335,12 +1335,12 @@ static String lcl_parseSubtotalName(const String& rSubStr, const String& rCaptio
}
if (!bEscaped && c == sal_Unicode('?'))
- aNewStr.Append(rCaption);
+ aNewStr.append(rCaption);
else
- aNewStr.Append(c);
+ aNewStr.append(c);
bEscaped = false;
}
- return aNewStr;
+ return aNewStr.makeStringAndClear();
}
void ScDPResultMember::FillMemberResults(
@@ -2346,7 +2346,7 @@ void ScDPDataMember::UpdateRunningTotals(
const ScDPRunningTotalState::IndexArray& rRowVisible = rRunning.GetRowVisible();
const ScDPRunningTotalState::IndexArray& rRowSorted = rRunning.GetRowSorted();
- String aRefFieldName = aReferenceValue.ReferenceField;
+ OUString aRefFieldName = aReferenceValue.ReferenceField;
//! aLocalSubState?
sal_uInt16 nRefOrient = pResultData->GetMeasureRefOrient( nMemberMeasure );
@@ -3963,7 +3963,7 @@ void ScDPResultVisibilityData::fillFieldFilters(vector<ScDPFilteredCache::Criter
for (DimMemberType::const_iterator itr = maDimensions.begin(), itrEnd = maDimensions.end();
itr != itrEnd; ++itr)
{
- const String& rDimName = itr->first;
+ const OUString& rDimName = itr->first;
ScDPFilteredCache::Criterion aCri;
FieldNameMapType::const_iterator itrField = aFieldNames.find(rDimName);
if (itrField == aFieldNames.end())
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index aa193efe7a92..7f95a070d234 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1499,7 +1499,7 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const
uno::Reference< chart2::XChartDocument > xNewChart( ScChartHelper::GetChartFromSdrObject( pNewObject ) );
if( xNewChart.is() && !xNewChart->hasInternalDataProvider() )
{
- String aChartName = ((SdrOle2Obj*)pNewObject)->GetPersistName();
+ OUString aChartName = ((SdrOle2Obj*)pNewObject)->GetPersistName();
::std::vector< ScRangeList > aRangesVector;
pDoc->GetChartRanges( aChartName, aRangesVector, pDoc );
if( !aRangesVector.empty() )
@@ -1652,7 +1652,7 @@ Rectangle ScDrawLayer::GetCellRect( ScDocument& rDoc, const ScAddress& rPos, boo
OUString ScDrawLayer::GetVisibleName( SdrObject* pObj )
{
- String aName = pObj->GetName();
+ OUString aName = pObj->GetName();
if ( pObj->GetObjIdentifier() == OBJ_OLE2 )
{
// For OLE, the user defined name (GetName) is used
@@ -1660,13 +1660,13 @@ OUString ScDrawLayer::GetVisibleName( SdrObject* pObj )
// otherwise the persist name is used so every object appears
// in the Navigator at all.
- if ( !aName.Len() )
+ if ( aName.isEmpty() )
aName = static_cast<SdrOle2Obj*>(pObj)->GetPersistName();
}
return aName;
}
-inline sal_Bool IsNamedObject( SdrObject* pObj, const String& rName )
+inline sal_Bool IsNamedObject( SdrObject* pObj, const OUString& rName )
{
// sal_True if rName is the object's Name or PersistName
// (used to find a named object)
@@ -1710,7 +1710,7 @@ OUString ScDrawLayer::GetNewGraphicName( long* pnCounter ) const
aBase += " ";
bool bThere = true;
- String aGraphicName;
+ OUString aGraphicName;
SCTAB nDummy;
long nId = pnCounter ? *pnCounter : 0;
while (bThere)
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 6ccd42dc3142..7b2b5b333e82 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -104,7 +104,7 @@ IntlWrapper* ScGlobal::pScIntlWrapper = NULL;
sal_Unicode ScGlobal::cListDelimiter = ',';
String* ScGlobal::pEmptyString = NULL;
OUString* ScGlobal::pEmptyOUString = NULL;
-String* ScGlobal::pStrClipDocName = NULL;
+OUString* ScGlobal::pStrClipDocName = NULL;
SvxBrushItem* ScGlobal::pEmptyBrushItem = NULL;
SvxBrushItem* ScGlobal::pButtonBrushItem = NULL;
@@ -388,9 +388,9 @@ const OUString& ScGlobal::GetRscString( sal_uInt16 nIndex )
return *ppRscString[ nIndex ];
}
-String ScGlobal::GetErrorString(sal_uInt16 nErrNumber)
+OUString ScGlobal::GetErrorString(sal_uInt16 nErrNumber)
{
- String sResStr;
+ OUString sResStr;
switch (nErrNumber)
{
case NOTAVAILABLE : nErrNumber = STR_NV_STR; break;
@@ -413,7 +413,7 @@ String ScGlobal::GetErrorString(sal_uInt16 nErrNumber)
return sResStr;
}
-String ScGlobal::GetLongErrorString(sal_uInt16 nErrNumber)
+OUString ScGlobal::GetLongErrorString(sal_uInt16 nErrNumber)
{
switch (nErrNumber)
{
@@ -504,7 +504,7 @@ String ScGlobal::GetLongErrorString(sal_uInt16 nErrNumber)
nErrNumber = STR_ERROR_STR;
break;
}
- String aRes( GetRscString( nErrNumber ) );
+ OUString aRes( GetRscString( nErrNumber ) );
return aRes;
}
@@ -567,8 +567,8 @@ void ScGlobal::Init()
InitAddIns();
- pStrClipDocName = new String( ScResId( SCSTR_NONAME ) );
- *pStrClipDocName += '1';
+ pStrClipDocName = new OUString( ScResId( SCSTR_NONAME ) );
+ *pStrClipDocName += "1";
// ScDocumentPool::InitVersionMaps() ist schon vorher gerufen worden
}
@@ -592,12 +592,12 @@ void ScGlobal::UpdatePPT( OutputDevice* pDev )
}
}
-const String& ScGlobal::GetClipDocName()
+const OUString& ScGlobal::GetClipDocName()
{
return *pStrClipDocName;
}
-void ScGlobal::SetClipDocName( const String& rNew )
+void ScGlobal::SetClipDocName( const OUString& rNew )
{
*pStrClipDocName = rNew;
}
@@ -721,7 +721,7 @@ CharSet ScGlobal::GetCharsetValue( const OUString& rCharSet )
//------------------------------------------------------------------------
-String ScGlobal::GetCharsetString( CharSet eVal )
+OUString ScGlobal::GetCharsetString( CharSet eVal )
{
const sal_Char* pChar;
switch ( eVal )
@@ -816,9 +816,9 @@ OUString ScGlobal::addToken(const OUString& rTokenList, const OUString& rToken,
return aBuf.makeStringAndClear();
}
-bool ScGlobal::IsQuoted( const String& rString, sal_Unicode cQuote )
+bool ScGlobal::IsQuoted( const OUString& rString, sal_Unicode cQuote )
{
- return (rString.Len() >= 2) && (rString.GetChar( 0 ) == cQuote) && (rString.GetChar( rString.Len() - 1 ) == cQuote);
+ return (rString.getLength() >= 2) && (rString[0] == cQuote) && (rString[ rString.getLength() - 1 ] == cQuote);
}
void ScGlobal::AddQuotes( OUString& rString, sal_Unicode cQuote, bool bEscapeEmbedded )
@@ -927,7 +927,7 @@ sal_Bool ScGlobal::EETextObjEqual( const EditTextObject* pObj1,
return false;
}
-void ScGlobal::OpenURL( const String& rURL, const String& rTarget )
+void ScGlobal::OpenURL( const OUString& rURL, const OUString& rTarget )
{
// OpenURL wird immer ueber irgendwelche Umwege durch Mausklicks im GridWindow
// aufgerufen, darum stimmen pScActiveViewShell und nScClickMouseModifier.
@@ -951,7 +951,7 @@ void ScGlobal::OpenURL( const String& rURL, const String& rTarget )
SfxStringItem aTarget( SID_TARGETNAME, rTarget );
aTarget.SetValue(OUString("_blank"));
SfxViewFrame* pFrame = NULL;
- String aReferName;
+ OUString aReferName;
if ( pScActiveViewShell )
{
pFrame = pScActiveViewShell->GetViewFrame();
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index bf8b8c937e4d..54b7c877dc00 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -341,10 +341,10 @@ sal_Bool ScTabOpParam::operator==( const ScTabOpParam& r ) const
&& (nMode == r.nMode) );
}
-String ScGlobal::GetAbsDocName( const String& rFileName,
+OUString ScGlobal::GetAbsDocName( const OUString& rFileName,
SfxObjectShell* pShell )
{
- String aAbsName;
+ OUString aAbsName;
if ( !pShell->HasName() )
{ // maybe relative to document path working directory
INetURLObject aObj;
@@ -374,20 +374,19 @@ String ScGlobal::GetAbsDocName( const String& rFileName,
return aAbsName;
}
-String ScGlobal::GetDocTabName( const String& rFileName,
- const String& rTabName )
+OUString ScGlobal::GetDocTabName( const OUString& rFileName,
+ const OUString& rTabName )
{
- String aDocTab(OUString('\''));
+ OUString aDocTab('\'');
aDocTab += rFileName;
- xub_StrLen nPos = 1;
- while( (nPos = aDocTab.Search( '\'', nPos ))
- != STRING_NOTFOUND )
+ sal_Int32 nPos = 1;
+ while( (nPos = aDocTab.indexOf( '\'', nPos )) != -1 )
{ // escape Quotes
- aDocTab.Insert( '\\', nPos );
+ aDocTab = aDocTab.replaceAt( nPos, 0, "\\" );
nPos += 2;
}
- aDocTab += '\'';
- aDocTab += SC_COMPILER_FILE_TAB_SEP;
+ aDocTab += "'";
+ aDocTab += OUString(SC_COMPILER_FILE_TAB_SEP);
aDocTab += rTabName; // "'Doc'#Tab"
return aDocTab;
}
diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx
index 47a0c3158cd1..15e484ad5ee3 100644
--- a/sc/source/core/data/globalx.cxx
+++ b/sc/source/core/data/globalx.cxx
@@ -119,7 +119,7 @@ void ScGlobal::InitAddIns()
}
-String ScGlobal::GetOrdinalSuffix( sal_Int32 nNumber)
+OUString ScGlobal::GetOrdinalSuffix( sal_Int32 nNumber)
{
try
{
@@ -132,13 +132,13 @@ String ScGlobal::GetOrdinalSuffix( sal_Int32 nNumber)
if ( aSuffixes.getLength() > 0 )
return aSuffixes[0];
else
- return String();
+ return OUString();
}
catch ( Exception& )
{
OSL_FAIL( "GetOrdinalSuffix: exception caught during init" );
}
- return String();
+ return OUString();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 3e18fa4630c2..a6dbe6e6dc12 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -936,13 +936,13 @@ static SfxStyleSheetBase* lcl_CopyStyleToPool
//--------------------------------------------------------
- const String aStrSrcStyle = pSrcStyle->GetName();
+ const OUString aStrSrcStyle = pSrcStyle->GetName();
const SfxStyleFamily eFamily = pSrcStyle->GetFamily();
SfxStyleSheetBase* pDestStyle = pDestPool->Find( aStrSrcStyle, eFamily );
if ( !pDestStyle )
{
- const String aStrParent = pSrcStyle->GetParent();
+ const OUString aStrParent = pSrcStyle->GetParent();
const SfxItemSet& rSrcSet = pSrcStyle->GetItemSet();
pDestStyle = &pDestPool->Make( aStrSrcStyle, eFamily, SFXSTYLEBIT_USERDEF );
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 3d4cb2c63021..04b923a7d204 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -242,7 +242,7 @@ void ScStyleSheetPool::CreateStandardStyles()
Color aColGrey ( COL_LIGHTGRAY );
OUString aStr;
sal_Int32 nStrLen;
- String aHelpFile;//XXX JN welcher Text???
+ OUString aHelpFile;//XXX JN welcher Text???
SfxItemSet* pSet = NULL;
SfxItemSet* pHFSet = NULL;
SvxSetItem* pHFSetItem = NULL;
@@ -257,7 +257,7 @@ void ScStyleSheetPool::CreateStandardStyles()
SvxBoxItem aBoxItem ( ATTR_BORDER );
SvxBoxInfoItem aBoxInfoItem ( ATTR_BORDER_INNER );
- String aStrStandard = ScGlobal::GetRscString(STR_STYLENAME_STANDARD);
+ OUString aStrStandard = ScGlobal::GetRscString(STR_STYLENAME_STANDARD);
//==========================================================
// Zellformatvorlagen:
@@ -492,7 +492,7 @@ ScStyleSheet* ScStyleSheetPool::FindCaseIns( const OUString& rName, SfxStyleFami
SfxStyleSheetBase* pStyle = aStyles[n].get();
if ( pStyle->GetFamily() == eFam )
{
- String aUpName = ScGlobal::pCharClass->uppercase(pStyle->GetName());
+ OUString aUpName = ScGlobal::pCharClass->uppercase(pStyle->GetName());
if (aUpName == aUpSearch)
return (ScStyleSheet*)pStyle;
}
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 9ec6977d9636..abb8b9e7877a 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2096,8 +2096,8 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC
if(pEntry->GetType() != condformat::CONDITION)
continue;
- String aStyleName = static_cast<const ScCondFormatEntry*>(pEntry)->GetStyle();
- if (aStyleName.Len())
+ OUString aStyleName = static_cast<const ScCondFormatEntry*>(pEntry)->GetStyle();
+ if (!aStyleName.isEmpty())
{
SfxStyleSheetBase* pStyleSheet =
pStylePool->Find( aStyleName, SFX_STYLE_FAMILY_PARA );
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index d5649eedc73f..1b4e25a2b93d 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -138,7 +138,7 @@ bool SplitString( const OUString &sWhole,
@return Returnes 1 if sInput1 is greater, 0 if sInput1 == sInput2, and -1 if
sInput2 is greater.
*/
-short Compare( const String &sInput1, const String &sInput2,
+short Compare( const OUString &sInput1, const OUString &sInput2,
const bool bCaseSens, const ScUserListData* pData, const CollatorWrapper *pCW )
{
OUString sStr1( sInput1 ), sStr2( sInput2 ), sPre1, sSuf1, sPre2, sSuf2;
@@ -940,13 +940,13 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
bool bTestPrevSub = ( nLevelCount > 1 );
OUString aSubString;
- String aOutString;
+ OUString aOutString;
bool bIgnoreCase = !rParam.bCaseSens;
- String *pCompString[MAXSUBTOTAL]; // Pointer wegen Compiler-Problemen
+ OUString *pCompString[MAXSUBTOTAL]; // Pointer wegen Compiler-Problemen
for (i=0; i<MAXSUBTOTAL; i++)
- pCompString[i] = new String;
+ pCompString[i] = new OUString;
//! sortieren?
@@ -1058,9 +1058,9 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
else
{ // " Ergebnis"
aOutString = aSubString;
- if (!aOutString.Len())
+ if (aOutString.isEmpty())
aOutString = ScGlobal::GetRscString( STR_EMPTYDATA );
- aOutString += ' ';
+ aOutString += " ";
sal_uInt16 nStrId = STR_TABLE_ERGEBNIS;
if ( nResCount == 1 )
switch ( eResFunc[0] )
@@ -1503,24 +1503,24 @@ public:
else
{
const OUString& rQueryStr = rItem.maString;
- String aCell( mpTransliteration->transliterate(
+ OUString aCell( mpTransliteration->transliterate(
aCellStr, ScGlobal::eLnge, 0, aCellStr.getLength(),
NULL ) );
- String aQuer( mpTransliteration->transliterate(
+ OUString aQuer( mpTransliteration->transliterate(
rQueryStr, ScGlobal::eLnge, 0, rQueryStr.getLength(),
NULL ) );
xub_StrLen nIndex = (rEntry.eOp == SC_ENDS_WITH
- || rEntry.eOp == SC_DOES_NOT_END_WITH)? (aCell.Len()-aQuer.Len()):0;
- xub_StrLen nStrPos = aCell.Search( aQuer, nIndex );
+ || rEntry.eOp == SC_DOES_NOT_END_WITH) ? (aCell.getLength()-aQuer.getLength()) : 0;
+ sal_Int32 nStrPos = aCell.indexOf( aQuer, nIndex );
switch (rEntry.eOp)
{
case SC_EQUAL:
case SC_CONTAINS:
- bOk = ( nStrPos != STRING_NOTFOUND );
+ bOk = ( nStrPos != -1 );
break;
case SC_NOT_EQUAL:
case SC_DOES_NOT_CONTAIN:
- bOk = ( nStrPos == STRING_NOTFOUND );
+ bOk = ( nStrPos == -1 );
break;
case SC_BEGINS_WITH:
bOk = ( nStrPos == 0 );
@@ -1529,10 +1529,10 @@ public:
bOk = ( nStrPos != 0 );
break;
case SC_ENDS_WITH:
- bOk = ( nStrPos + aQuer.Len() == aCell.Len() );
+ bOk = ( nStrPos + aQuer.getLength() == aCell.getLength() );
break;
case SC_DOES_NOT_END_WITH:
- bOk = ( nStrPos + aQuer.Len() != aCell.Len() );
+ bOk = ( nStrPos + aQuer.getLength() != aCell.getLength() );
break;
default:
{
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 0e5d7cdead9a..c9150b2aa7c0 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1650,7 +1650,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
else
{
nStringValue = (sal_Int32)nVal;
- String aStr;
+ OUString aStr;
if ( nHeadNoneTail < 0 )
{
setSuffixCell(
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 22708889a812..e1a650d1220a 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -968,7 +968,7 @@ bool ScTable::SearchRangeForAllEmptyCells(
rMatchedRanges.Join(ScRange(nCol, nRow, nTab, nCol, nLastRow, nTab));
if (bReplace)
{
- const String& rNewStr = rSearchItem.GetReplaceString();
+ const OUString& rNewStr = rSearchItem.GetReplaceString();
for (SCROW i = nRow; i <= nLastRow; ++i)
{
aCol[nCol].SetRawString(i, rNewStr);
@@ -982,7 +982,7 @@ bool ScTable::SearchRangeForAllEmptyCells(
pUndoDoc->SetString(ScAddress(nCol, i, nTab), EMPTY_OUSTRING);
}
}
- rUndoStr = String();
+ rUndoStr = OUString();
}
}
diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx
index 2f3d4a31cc19..bce8aca3399f 100644
--- a/sc/source/core/data/tabprotection.cxx
+++ b/sc/source/core/data/tabprotection.cxx
@@ -94,7 +94,7 @@ ScPassHashProtectable::~ScPassHashProtectable()
class ScTableProtectionImpl
{
public:
- static Sequence<sal_Int8> hashPassword(const String& aPassText, ScPasswordHash eHash = PASSHASH_SHA1);
+ static Sequence<sal_Int8> hashPassword(const OUString& aPassText, ScPasswordHash eHash = PASSHASH_SHA1);
static Sequence<sal_Int8> hashPassword(const Sequence<sal_Int8>& rPassHash, ScPasswordHash eHash = PASSHASH_SHA1);
explicit ScTableProtectionImpl(SCSIZE nOptSize);
@@ -106,19 +106,19 @@ public:
bool isPasswordEmpty() const;
bool hasPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED) const;
- void setPassword(const String& aPassText);
+ void setPassword(const OUString& aPassText);
::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(
ScPasswordHash eHash, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED) const;
void setPasswordHash(
const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword,
ScPasswordHash eHash = PASSHASH_SHA1, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED);
- bool verifyPassword(const String& aPassText) const;
+ bool verifyPassword(const OUString& aPassText) const;
bool isOptionEnabled(SCSIZE nOptId) const;
void setOption(SCSIZE nOptId, bool bEnabled);
private:
- String maPassText;
+ OUString maPassText;
::com::sun::star::uno::Sequence<sal_Int8> maPassHash;
::std::vector<bool> maOptions;
bool mbEmptyPass;
@@ -127,7 +127,7 @@ private:
ScPasswordHash meHash2;
};
-Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(const String& aPassText, ScPasswordHash eHash)
+Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(const OUString& aPassText, ScPasswordHash eHash)
{
Sequence<sal_Int8> aHash;
switch (eHash)
@@ -197,7 +197,7 @@ bool ScTableProtectionImpl::isProtectedWithPass() const
if (!mbProtected)
return false;
- return maPassText.Len() || maPassHash.getLength();
+ return !maPassText.isEmpty() || maPassHash.getLength();
}
void ScTableProtectionImpl::setProtected(bool bProtected)
@@ -207,7 +207,7 @@ void ScTableProtectionImpl::setProtected(bool bProtected)
// don't erase the password data here.
}
-void ScTableProtectionImpl::setPassword(const String& aPassText)
+void ScTableProtectionImpl::setPassword(const OUString& aPassText)
{
// We can't hash it here because we don't know whether this document will
// get saved to Excel or ODF, depending on which we will need to use a
@@ -215,7 +215,7 @@ void ScTableProtectionImpl::setPassword(const String& aPassText)
// hash algorithms that we support, and store them all.
maPassText = aPassText;
- mbEmptyPass = aPassText.Len() == 0;
+ mbEmptyPass = aPassText.isEmpty();
if (mbEmptyPass)
{
maPassHash = Sequence<sal_Int8>();
@@ -232,7 +232,7 @@ bool ScTableProtectionImpl::hasPasswordHash(ScPasswordHash eHash, ScPasswordHash
if (mbEmptyPass)
return true;
- if (maPassText.Len())
+ if (!maPassText.isEmpty())
return true;
if (meHash1 == eHash)
@@ -256,7 +256,7 @@ Sequence<sal_Int8> ScTableProtectionImpl::getPasswordHash(
// Flaged as empty.
return aPassHash;
- if (maPassText.Len())
+ if (!maPassText.isEmpty())
{
// Cleartext password exists. Hash it.
aPassHash = hashPassword(maPassText, eHash);
@@ -303,7 +303,7 @@ void ScTableProtectionImpl::setPasswordHash(
#endif
}
-bool ScTableProtectionImpl::verifyPassword(const String& aPassText) const
+bool ScTableProtectionImpl::verifyPassword(const OUString& aPassText) const
{
#if DEBUG_TAB_PROTECTION
fprintf(stdout, "ScTableProtectionImpl::verifyPassword: input = '%s'\n",
@@ -311,11 +311,11 @@ bool ScTableProtectionImpl::verifyPassword(const String& aPassText) const
#endif
if (mbEmptyPass)
- return aPassText.Len() == 0;
+ return aPassText.isEmpty();
- if (maPassText.Len())
+ if (!maPassText.isEmpty())
// Clear text password exists, and this one takes precedence.
- return aPassText.Equals(maPassText);
+ return aPassText == maPassText;
Sequence<sal_Int8> aHash = hashPassword(aPassText, meHash1);
aHash = hashPassword(aHash, meHash2);