summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/cellvalue.cxx27
-rw-r--r--sc/source/core/data/column.cxx28
-rw-r--r--sc/source/core/data/column2.cxx61
-rw-r--r--sc/source/core/data/column3.cxx69
-rw-r--r--sc/source/core/data/conditio.cxx3
-rw-r--r--sc/source/core/data/dociter.cxx3
-rw-r--r--sc/source/core/data/documen8.cxx4
-rw-r--r--sc/source/core/data/document.cxx2
-rw-r--r--sc/source/core/data/documentimport.cxx6
-rw-r--r--sc/source/core/data/fillinfo.cxx2
-rw-r--r--sc/source/core/data/table2.cxx10
-rw-r--r--sc/source/core/data/table3.cxx4
-rw-r--r--sc/source/core/data/table4.cxx4
-rw-r--r--sc/source/core/data/validat.cxx6
-rw-r--r--sc/source/core/tool/addincol.cxx17
-rw-r--r--sc/source/core/tool/cellform.cxx6
-rw-r--r--sc/source/core/tool/chgtrack.cxx4
-rw-r--r--sc/source/core/tool/ddelink.cxx3
-rw-r--r--sc/source/core/tool/formulagroup.cxx4
-rw-r--r--sc/source/core/tool/interpr1.cxx4
-rw-r--r--sc/source/core/tool/interpr2.cxx4
-rw-r--r--sc/source/core/tool/interpr5.cxx14
-rw-r--r--sc/source/core/tool/rangeseq.cxx7
-rw-r--r--sc/source/core/tool/scmatrix.cxx31
-rw-r--r--sc/source/core/tool/token.cxx3
25 files changed, 194 insertions, 132 deletions
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index 7a7f94165dd4..af12e19661de 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -17,6 +17,7 @@
#include "editutil.hxx"
#include "tokenarray.hxx"
#include "formula/token.hxx"
+#include "svl/sharedstring.hxx"
namespace {
@@ -36,7 +37,7 @@ template<typename _T>
OUString getString( const _T& rVal )
{
if (rVal.meType == CELLTYPE_STRING)
- return *rVal.mpString;
+ return rVal.mpString->getString();
if (rVal.meType == CELLTYPE_EDIT)
{
@@ -163,7 +164,7 @@ ScCellValue::ScCellValue( const ScRefCellValue& rCell ) : meType(rCell.meType),
switch (rCell.meType)
{
case CELLTYPE_STRING:
- mpString = new OUString(rCell.mpString->pData);
+ mpString = new svl::SharedString(*rCell.mpString);
break;
case CELLTYPE_EDIT:
mpEditText = rCell.mpEditText->Clone();
@@ -177,7 +178,7 @@ ScCellValue::ScCellValue( const ScRefCellValue& rCell ) : meType(rCell.meType),
}
ScCellValue::ScCellValue( double fValue ) : meType(CELLTYPE_VALUE), mfValue(fValue) {}
-ScCellValue::ScCellValue( const OUString& rString ) : meType(CELLTYPE_STRING), mpString(new OUString(rString)) {}
+ScCellValue::ScCellValue( const svl::SharedString& rString ) : meType(CELLTYPE_STRING), mpString(new svl::SharedString(rString)) {}
ScCellValue::ScCellValue( const EditTextObject& rEditText ) : meType(CELLTYPE_EDIT), mpEditText(rEditText.Clone()) {}
ScCellValue::ScCellValue( const ScFormulaCell& rFormula ) : meType(CELLTYPE_FORMULA), mpFormula(rFormula.Clone()) {}
@@ -186,7 +187,7 @@ ScCellValue::ScCellValue( const ScCellValue& r ) : meType(r.meType), mfValue(r.m
switch (r.meType)
{
case CELLTYPE_STRING:
- mpString = new OUString(r.mpString->pData);
+ mpString = new svl::SharedString(*r.mpString);
break;
case CELLTYPE_EDIT:
mpEditText = r.mpEditText->Clone();
@@ -233,11 +234,11 @@ void ScCellValue::set( double fValue )
mfValue = fValue;
}
-void ScCellValue::set( const OUString& rStr )
+void ScCellValue::set( const svl::SharedString& rStr )
{
clear();
meType = CELLTYPE_STRING;
- mpString = new OUString(rStr);
+ mpString = new svl::SharedString(rStr);
}
void ScCellValue::set( const EditTextObject& rEditText )
@@ -272,7 +273,7 @@ void ScCellValue::assign( const ScDocument& rDoc, const ScAddress& rPos )
switch (meType)
{
case CELLTYPE_STRING:
- mpString = new OUString(aRefVal.mpString->pData);
+ mpString = new svl::SharedString(*aRefVal.mpString);
break;
case CELLTYPE_EDIT:
if (aRefVal.mpEditText)
@@ -297,7 +298,7 @@ void ScCellValue::assign( const ScCellValue& rOther, ScDocument& rDestDoc, int n
switch (meType)
{
case CELLTYPE_STRING:
- mpString = new OUString(rOther.mpString->pData);
+ mpString = new svl::SharedString(*rOther.mpString);
break;
case CELLTYPE_EDIT:
{
@@ -342,7 +343,7 @@ void ScCellValue::commit( ScDocument& rDoc, const ScAddress& rPos ) const
{
ScSetStringParam aParam;
aParam.setTextInput();
- rDoc.SetString(rPos, *mpString, &aParam);
+ rDoc.SetString(rPos, mpString->getString(), &aParam);
}
break;
case CELLTYPE_EDIT:
@@ -373,7 +374,7 @@ void ScCellValue::release( ScDocument& rDoc, const ScAddress& rPos )
// Currently, string cannot be placed without copying.
ScSetStringParam aParam;
aParam.setTextInput();
- rDoc.SetString(rPos, *mpString, &aParam);
+ rDoc.SetString(rPos, mpString->getString(), &aParam);
delete mpString;
}
break;
@@ -471,7 +472,7 @@ void ScCellValue::swap( ScCellValue& r )
ScRefCellValue::ScRefCellValue() : meType(CELLTYPE_NONE), mfValue(0.0) {}
ScRefCellValue::ScRefCellValue( double fValue ) : meType(CELLTYPE_VALUE), mfValue(fValue) {}
-ScRefCellValue::ScRefCellValue( const OUString* pString ) : meType(CELLTYPE_STRING), mpString(pString) {}
+ScRefCellValue::ScRefCellValue( const svl::SharedString* pString ) : meType(CELLTYPE_STRING), mpString(pString) {}
ScRefCellValue::ScRefCellValue( const EditTextObject* pEditText ) : meType(CELLTYPE_EDIT), mpEditText(pEditText) {}
ScRefCellValue::ScRefCellValue( ScFormulaCell* pFormula ) : meType(CELLTYPE_FORMULA), mpFormula(pFormula) {}
@@ -504,7 +505,7 @@ void ScRefCellValue::commit( ScDocument& rDoc, const ScAddress& rPos ) const
{
ScSetStringParam aParam;
aParam.setTextInput();
- rDoc.SetString(rPos, *mpString, &aParam);
+ rDoc.SetString(rPos, mpString->getString(), &aParam);
}
break;
case CELLTYPE_EDIT:
@@ -557,7 +558,7 @@ OUString ScRefCellValue::getString( const ScDocument* pDoc )
case CELLTYPE_VALUE:
return OUString::number(mfValue);
case CELLTYPE_STRING:
- return *mpString;
+ return mpString->getString();
case CELLTYPE_EDIT:
if (mpEditText)
return ScEditUtil::GetString(*mpEditText, pDoc);
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index d8c3e6084146..4502fe0f4a84 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -44,6 +44,7 @@
#include <svl/poolcach.hxx>
#include <svl/zforlist.hxx>
+#include "svl/sharedstringpool.hxx"
#include <editeng/scripttypeitem.hxx>
#include "editeng/fieldupdater.hxx"
@@ -950,7 +951,7 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
break;
case CELLTYPE_STRING:
{
- OUString aStr = *aCell1.mpString; // make a copy.
+ svl::SharedString aStr = *aCell1.mpString; // make a copy.
it1 = maCells.set_empty(it1, nRow1, nRow1); // original string is gone.
maCells.set(it1, nRow2, aStr);
}
@@ -1018,7 +1019,7 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
break;
case CELLTYPE_STRING:
{
- OUString aStr = *aCell1.mpString; // make a copy.
+ svl::SharedString aStr = *aCell1.mpString; // make a copy.
switch (aCell2.meType)
{
case CELLTYPE_VALUE:
@@ -1471,12 +1472,13 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
std::advance(itDataEnd, nDataSize);
// Convert to simple strings.
- std::vector<OUString> aConverted;
+ std::vector<svl::SharedString> aConverted;
aConverted.reserve(nDataSize);
for (; itData != itDataEnd; ++itData)
{
const EditTextObject& rObj = **itData;
- aConverted.push_back(ScEditUtil::GetString(rObj, pDocument));
+ svl::SharedString aSS = pDocument->GetCellStringPool().intern(ScEditUtil::GetString(rObj, pDocument));
+ aConverted.push_back(aSS);
}
aDestPos.miCellPos = rDestCol.maCells.set(aDestPos.miCellPos, nCurRow, aConverted.begin(), aConverted.end());
}
@@ -1504,7 +1506,11 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
if (rFC.IsValue())
aDestPos.miCellPos = rDestCol.maCells.set(aDestPos.miCellPos, nRow, rFC.GetValue());
else
- aDestPos.miCellPos = rDestCol.maCells.set(aDestPos.miCellPos, nRow, rFC.GetString());
+ {
+ svl::SharedString aSS = pDocument->GetCellStringPool().intern(rFC.GetString());
+ if (aSS.getData())
+ aDestPos.miCellPos = rDestCol.maCells.set(aDestPos.miCellPos, nRow, aSS);
+ }
}
}
break;
@@ -1794,8 +1800,12 @@ class CopyByCloneHandler
}
else
{
- maDestPos.miCellPos =
- mrDestCol.GetCellStore().set(maDestPos.miCellPos, nRow, aStr);
+ svl::SharedString aSS = mrDestCol.GetDoc().GetCellStringPool().intern(aStr);
+ if (aSS.getData())
+ {
+ maDestPos.miCellPos =
+ mrDestCol.GetCellStore().set(maDestPos.miCellPos, nRow, aSS);
+ }
}
setDefaultAttrToDest(nRow);
@@ -1855,8 +1865,8 @@ public:
for (; it != itEnd; ++it, ++nRow)
{
- const OUString& rStr = *it;
- if (rStr.isEmpty())
+ const svl::SharedString& rStr = *it;
+ if (rStr.getString().isEmpty())
{
// String cell with empty value is used to special-case cell value removal.
maDestPos.miCellPos = mrDestCol.GetCellStore().set_empty(
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 2b7d52248ea0..35c91531d037 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -576,10 +576,14 @@ public:
checkLength(aCell);
}
- void operator() (size_t /*nRow*/, const OUString& rStr)
+ void operator() (size_t /*nRow*/, const svl::SharedString& rSS)
{
- ScRefCellValue aCell(&rStr);
- checkLength(aCell);
+ OUString aStr = rSS.getString();
+ if (aStr.getLength() > mnMaxLen)
+ {
+ mnMaxLen = aStr.getLength();
+ maMaxLenStr = aStr;
+ }
}
void operator() (size_t /*nRow*/, const EditTextObject* p)
@@ -1007,26 +1011,27 @@ protected:
};
std::vector<StrEntry> maStrEntries;
+ ScDocument* mpDoc;
- StrEntries(sc::CellStoreType& rCells) : mrCells(rCells) {}
+ StrEntries(sc::CellStoreType& rCells, ScDocument* pDoc) : mrCells(rCells), mpDoc(pDoc) {}
public:
void commitStrings()
{
+ svl::SharedStringPool& rPool = mpDoc->GetCellStringPool();
sc::CellStoreType::iterator it = mrCells.begin();
std::vector<StrEntry>::iterator itStr = maStrEntries.begin(), itStrEnd = maStrEntries.end();
for (; itStr != itStrEnd; ++itStr)
- it = mrCells.set(it, itStr->mnRow, itStr->maStr);
+ it = mrCells.set(it, itStr->mnRow, rPool.intern(itStr->maStr));
}
};
class RemoveEditAttribsHandler : public StrEntries
{
- ScDocument* mpDoc;
boost::scoped_ptr<ScFieldEditEngine> mpEngine;
public:
- RemoveEditAttribsHandler(sc::CellStoreType& rCells, ScDocument* pDoc) : StrEntries(rCells), mpDoc(pDoc) {}
+ RemoveEditAttribsHandler(sc::CellStoreType& rCells, ScDocument* pDoc) : StrEntries(rCells, pDoc) {}
void operator() (size_t nRow, EditTextObject*& pObj)
{
@@ -1838,8 +1843,8 @@ formula::FormulaTokenRef ScColumn::ResolveStaticReference( SCROW nRow )
}
case sc::element_type_string:
{
- OUString aStr = sc::string_block::at(*it->data, aPos.second);
- return formula::FormulaTokenRef(new formula::FormulaStringToken(aStr));
+ const svl::SharedString& rSS = sc::string_block::at(*it->data, aPos.second);
+ return formula::FormulaTokenRef(new formula::FormulaStringToken(rSS.getString()));
}
case sc::element_type_edittext:
{
@@ -1881,9 +1886,9 @@ public:
mrMat.PutString(rCell.GetString(), mnMatCol, nRow - mnTopRow);
}
- void operator() (size_t nRow, const OUString& rStr)
+ void operator() (size_t nRow, const svl::SharedString& rSS)
{
- mrMat.PutString(rStr, mnMatCol, nRow - mnTopRow);
+ mrMat.PutString(rSS.getString(), mnMatCol, nRow - mnTopRow);
}
void operator() (size_t nRow, const EditTextObject* pStr)
@@ -1911,7 +1916,7 @@ struct CellBucket
SCSIZE mnNumValStart;
SCSIZE mnStrValStart;
std::vector<double> maNumVals;
- std::vector<OUString> maStrVals;
+ std::vector<svl::SharedString> maStrVals;
CellBucket() : mnNumValStart(0), mnStrValStart(0) {}
@@ -1925,7 +1930,7 @@ struct CellBucket
}
else if (!maStrVals.empty())
{
- const OUString* p = &maStrVals[0];
+ const svl::SharedString* p = &maStrVals[0];
rMat.PutString(p, maStrVals.size(), nCol, mnStrValStart);
reset();
}
@@ -1947,11 +1952,12 @@ class FillMatrixHandler
SCCOL mnCol;
SCTAB mnTab;
- const ScDocument* mpDoc;
+ ScDocument* mpDoc;
+ svl::SharedStringPool& mrPool;
public:
- FillMatrixHandler(ScMatrix& rMat, size_t nMatCol, size_t nTopRow, SCCOL nCol, SCTAB nTab, const ScDocument* pDoc) :
- mrMat(rMat), mnMatCol(nMatCol), mnTopRow(nTopRow), mnCol(nCol), mnTab(nTab), mpDoc(pDoc) {}
+ FillMatrixHandler(ScMatrix& rMat, size_t nMatCol, size_t nTopRow, SCCOL nCol, SCTAB nTab, ScDocument* pDoc) :
+ mrMat(rMat), mnMatCol(nMatCol), mnTopRow(nTopRow), mnCol(nCol), mnTab(nTab), mpDoc(pDoc), mrPool(pDoc->GetCellStringPool()) {}
void operator() (const sc::CellStoreType::value_type& node, size_t nOffset, size_t nDataSize)
{
@@ -1967,22 +1973,25 @@ public:
break;
case sc::element_type_string:
{
- const OUString* p = &sc::string_block::at(*node.data, nOffset);
+ const svl::SharedString* p = &sc::string_block::at(*node.data, nOffset);
mrMat.PutString(p, nDataSize, mnMatCol, nMatRow);
}
break;
case sc::element_type_edittext:
{
- std::vector<OUString> aStrs;
- aStrs.reserve(nDataSize);
+ std::vector<svl::SharedString> aSSs;
+ aSSs.reserve(nDataSize);
sc::edittext_block::const_iterator it = sc::edittext_block::begin(*node.data);
std::advance(it, nOffset);
sc::edittext_block::const_iterator itEnd = it;
std::advance(itEnd, nDataSize);
for (; it != itEnd; ++it)
- aStrs.push_back(ScEditUtil::GetString(**it, mpDoc));
+ {
+ OUString aStr = ScEditUtil::GetString(**it, mpDoc);
+ aSSs.push_back(mrPool.intern(aStr));
+ }
- const OUString* p = &aStrs[0];
+ const svl::SharedString* p = &aSSs[0];
mrMat.PutString(p, nDataSize, mnMatCol, nMatRow);
}
break;
@@ -2029,7 +2038,7 @@ public:
continue;
}
- OUString aStr = rCell.GetString();
+ svl::SharedString aStr = mrPool.intern(rCell.GetString());
if (!aBucket.maStrVals.empty() && nThisRow == nPrevRow + 1)
{
// Secondary strings.
@@ -2174,7 +2183,7 @@ bool appendStrings(
getBlockIterators<sc::string_block>(it, nLenRemain, itData, itDataEnd);
for (; itData != itDataEnd; ++itData)
- rArray.push_back(rCxt.maStrPool.intern(*itData).getData());
+ rArray.push_back(itData->getData());
}
break;
case sc::element_type_edittext:
@@ -2247,10 +2256,10 @@ void copyFirstBlock( sc::FormulaGroupContext& rCxt, size_t nLen, const sc::CellS
sc::FormulaGroupContext::StrArrayType& rArray = rCxt.maStrArrays.back();
rArray.reserve(nLen);
- const OUString* p = &sc::string_block::at(*rPos.first->data, rPos.second);
- const OUString* pEnd = p + nLen;
+ svl::SharedString* p = &sc::string_block::at(*rPos.first->data, rPos.second);
+ svl::SharedString* pEnd = p + nLen;
for (; p != pEnd; ++p)
- rArray.push_back(rCxt.maStrPool.intern(*p).getData());
+ rArray.push_back(p->getData());
}
}
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index f9f21d521387..c854456c22c0 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1087,7 +1087,7 @@ public:
}
}
- void operator() (size_t nRow, const OUString& rStr)
+ void operator() (size_t nRow, const svl::SharedString& rStr)
{
miNewCellsPos = maNewCells.set(miNewCellsPos, nRow-mnRowOffset, rStr);
}
@@ -1200,7 +1200,7 @@ public:
break;
case sc::element_type_string:
{
- OUString aVal = sc::string_block::at(*aPos.first->data, aPos.second);
+ const svl::SharedString& aVal = sc::string_block::at(*aPos.first->data, aPos.second);
miNewCellsPos = maNewCells.set(
miNewCellsPos, nDestRow-mnRowOffset, aVal);
}
@@ -1454,10 +1454,14 @@ bool ScColumn::ParseString(
else
cFirstChar = 0; // Text
+ svl::SharedStringPool& rPool = pDocument->GetCellStringPool();
+
if ( cFirstChar == '=' )
{
if ( rString.getLength() == 1 ) // = Text
- rCell.set(rString);
+ {
+ rCell.set(rPool.intern(rString));
+ }
else // = Formula
rCell.set(
new ScFormulaCell(
@@ -1477,11 +1481,11 @@ bool ScColumn::ParseString(
bNumeric = aParam.mpNumFormatter->IsNumberFormat(aTest, nIndex, fTest);
if (bNumeric)
// This is a number. Strip out the first char.
- rCell.set(aTest);
+ rCell.set(rPool.intern(aTest));
}
if (!bNumeric)
// This is normal text. Take it as-is.
- rCell.set(rString);
+ rCell.set(rPool.intern(rString));
}
else
{
@@ -1573,7 +1577,7 @@ bool ScColumn::ParseString(
ApplyPattern(nRow, aNewAttrs);
}
- rCell.set(rString);
+ rCell.set(rPool.intern(rString));
}
}
@@ -1739,8 +1743,8 @@ sal_uIntPtr ScColumn::GetCellStringID( SCROW nRow ) const
{
case sc::element_type_string:
{
- const OUString& rStr = sc::string_block::at(*aPos.first->data, aPos.second);
- return pDocument->GetCellStringPool().getIdentifier(rStr);
+ const svl::SharedString& rStr = sc::string_block::at(*aPos.first->data, aPos.second);
+ return reinterpret_cast<sal_uIntPtr>(rStr.getData());
}
break;
case sc::element_type_edittext:
@@ -1768,8 +1772,8 @@ sal_uIntPtr ScColumn::GetCellStringIDIgnoreCase( SCROW nRow ) const
{
case sc::element_type_string:
{
- const OUString& rStr = sc::string_block::at(*aPos.first->data, aPos.second);
- return pDocument->GetCellStringPool().getIdentifierIgnoreCase(rStr);
+ const svl::SharedString& rStr = sc::string_block::at(*aPos.first->data, aPos.second);
+ return reinterpret_cast<sal_uIntPtr>(rStr.getDataIgnoreCase());
}
break;
case sc::element_type_edittext:
@@ -1865,7 +1869,7 @@ public:
processCell(nRow, aCell);
}
- void operator() (size_t nRow, const OUString& rStr)
+ void operator() (size_t nRow, const svl::SharedString& rStr)
{
ScRefCellValue aCell(&rStr);
processCell(nRow, aCell);
@@ -1998,7 +2002,7 @@ public:
switch (maPos.first->type)
{
case sc::element_type_string:
- return sc::string_block::at(*maPos.first->data, maPos.second);
+ return sc::string_block::at(*maPos.first->data, maPos.second).getString();
case sc::element_type_edittext:
{
const EditTextObject* p = sc::edittext_block::at(*maPos.first->data, maPos.second);
@@ -2098,21 +2102,24 @@ class FormulaToValueHandler
ScCellValue maValue;
Entry(SCROW nRow, double f) : mnRow(nRow), maValue(f) {}
- Entry(SCROW nRow, const OUString& rStr) : mnRow(nRow), maValue(rStr) {}
+ Entry(SCROW nRow, const svl::SharedString& rStr) : mnRow(nRow), maValue(rStr) {}
};
typedef std::vector<Entry> EntriesType;
EntriesType maEntries;
+ svl::SharedStringPool& mrStrPool;
public:
+ FormulaToValueHandler(ScDocument& rDoc) : mrStrPool(rDoc.GetCellStringPool()) {}
+
void operator() (size_t nRow, const ScFormulaCell* p)
{
ScFormulaCell* p2 = const_cast<ScFormulaCell*>(p);
if (p2->IsValue())
maEntries.push_back(Entry(nRow, p2->GetValue()));
else
- maEntries.push_back(Entry(nRow, p2->GetString()));
+ maEntries.push_back(Entry(nRow, mrStrPool.intern(p2->GetString())));
}
void commitCells(ScColumn& rColumn)
@@ -2142,7 +2149,7 @@ public:
void ScColumn::RemoveProtected( SCROW nStartRow, SCROW nEndRow )
{
- FormulaToValueHandler aFunc;
+ FormulaToValueHandler aFunc(*pDocument);
sc::CellStoreType::const_iterator itPos = maCells.begin();
ScAttrIterator aAttrIter( pAttrArray, nStartRow, nEndRow );
@@ -2188,12 +2195,20 @@ void ScColumn::SetRawString( SCROW nRow, const OUString& rStr, bool bBroadcast )
if (!ValidRow(nRow))
return;
- rtl_uString* pStr = pDocument->GetCellStringPool().intern(rStr).getData();
- if (!pStr)
+ svl::SharedString aSS = pDocument->GetCellStringPool().intern(rStr);
+ if (!aSS.getData())
+ return;
+
+ SetRawString(nRow, aSS, bBroadcast);
+}
+
+void ScColumn::SetRawString( SCROW nRow, const svl::SharedString& rStr, bool bBroadcast )
+{
+ if (!ValidRow(nRow))
return;
sc::CellStoreType::iterator it = GetPositionToInsert(nRow);
- maCells.set(it, nRow, OUString(pStr));
+ maCells.set(it, nRow, rStr);
maCellTextAttrs.set(nRow, sc::CellTextAttr());
CellStorageModified();
@@ -2204,15 +2219,21 @@ void ScColumn::SetRawString( SCROW nRow, const OUString& rStr, bool bBroadcast )
void ScColumn::SetRawString(
sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const OUString& rStr, bool bBroadcast )
{
- if (!ValidRow(nRow))
+ svl::SharedString aSS = pDocument->GetCellStringPool().intern(rStr);
+ if (!aSS.getData())
return;
- rtl_uString* pStr = pDocument->GetCellStringPool().intern(rStr).getData();
- if (!pStr)
+ SetRawString(rBlockPos, nRow, aSS, bBroadcast);
+}
+
+void ScColumn::SetRawString(
+ sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const svl::SharedString& rStr, bool bBroadcast )
+{
+ if (!ValidRow(nRow))
return;
rBlockPos.miCellPos = GetPositionToInsert(rBlockPos.miCellPos, nRow);
- rBlockPos.miCellPos = maCells.set(rBlockPos.miCellPos, nRow, OUString(pStr));
+ rBlockPos.miCellPos = maCells.set(rBlockPos.miCellPos, nRow, rStr);
rBlockPos.miCellTextAttrPos = maCellTextAttrs.set(
rBlockPos.miCellTextAttrPos, nRow, sc::CellTextAttr());
CellStorageModified();
@@ -2263,7 +2284,7 @@ void ScColumn::GetString( SCROW nRow, OUString& rString ) const
ScCellFormat::GetString(aCell, nFormat, rString, &pColor, *(pDocument->GetFormatTable()), pDocument);
}
-const OUString* ScColumn::GetStringCell( SCROW nRow ) const
+const svl::SharedString* ScColumn::GetStringCell( SCROW nRow ) const
{
std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(nRow);
sc::CellStoreType::const_iterator it = aPos.first;
@@ -2551,7 +2572,7 @@ public:
processCell(nRow, aCell);
}
- void operator() (size_t nRow, const OUString& rStr)
+ void operator() (size_t nRow, const svl::SharedString& rStr)
{
ScRefCellValue aCell(&rStr);
processCell(nRow, aCell);
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 6cc4f1bb022b..418b30379e78 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -40,6 +40,7 @@
#include "editutil.hxx"
#include "tokenarray.hxx"
#include "refupdatecontext.hxx"
+#include "svl/sharedstring.hxx"
using namespace formula;
//------------------------------------------------------------------------
@@ -723,7 +724,7 @@ static bool lcl_GetCellContent( ScRefCellValue& rCell, bool bIsStr1, double& rAr
case CELLTYPE_EDIT:
bVal = false;
if (rCell.meType == CELLTYPE_STRING)
- rArgStr = *rCell.mpString;
+ rArgStr = rCell.mpString->getString();
else if (rCell.mpEditText)
rArgStr = ScEditUtil::GetString(*rCell.mpEditText, pDoc);
break;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 6f4d4a7bd048..189c822001de 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -41,6 +41,7 @@
#include "tools/fract.hxx"
#include "editeng/editobj.hxx"
+#include "svl/sharedstring.hxx"
#include <vector>
@@ -963,7 +964,7 @@ ScCellValue ScCellIterator::getCellValue() const
switch (maCurCell.meType)
{
case CELLTYPE_STRING:
- aRet.mpString = new OUString(*maCurCell.mpString);
+ aRet.mpString = new svl::SharedString(*maCurCell.mpString);
break;
case CELLTYPE_EDIT:
aRet.mpEditText = maCurCell.mpEditText->Clone();
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index db94928c20e7..d69e25b3d79e 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -1407,7 +1407,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp
}
pEngine->SetDefaults( pDefaults, true );
if (aCell.meType == CELLTYPE_STRING)
- pEngine->SetText(*aCell.mpString);
+ pEngine->SetText(aCell.mpString->getString());
else if (aCell.mpEditText)
pEngine->SetText(*aCell.mpEditText);
@@ -1444,7 +1444,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp
else if (aCell.meType == CELLTYPE_STRING)
{
- OUString aOldStr = *aCell.mpString;
+ OUString aOldStr = aCell.mpString->getString();
sal_Int32 nOldLen = aOldStr.getLength();
if ( bConsiderLanguage )
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 093640506686..e3184f0b71f9 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3205,7 +3205,7 @@ OUString ScDocument::GetString( const ScAddress& rPos ) const
return aStr;
}
-const OUString* ScDocument::GetStringCell( const ScAddress& rPos ) const
+const svl::SharedString* ScDocument::GetStringCell( const ScAddress& rPos ) const
{
if (!TableExists(rPos.Tab()))
return NULL;
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 95ae3cfd5f66..334b2f5f0b99 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -150,12 +150,12 @@ void ScDocumentImport::setStringCell(const ScAddress& rPos, const OUString& rStr
if (!pBlockPos)
return;
- rtl_uString* pStr = mpImpl->mrDoc.GetCellStringPool().intern(rStr).getData();
- if (!pStr)
+ svl::SharedString aSS = mpImpl->mrDoc.GetCellStringPool().intern(rStr);
+ if (!aSS.getData())
return;
sc::CellStoreType& rCells = pTab->aCol[rPos.Col()].maCells;
- pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, rPos.Row(), OUString(pStr));
+ pBlockPos->miCellPos = rCells.set(pBlockPos->miCellPos, rPos.Row(), aSS);
}
void ScDocumentImport::setEditCell(const ScAddress& rPos, EditTextObject* pEditText)
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 5646527d8cc6..4ce3ee56bc5e 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -174,7 +174,7 @@ public:
setInfo(nRow, ScRefCellValue(fVal));
}
- void operator() (size_t nRow, const OUString& rStr)
+ void operator() (size_t nRow, const svl::SharedString& rStr)
{
if (!isHidden(nRow))
setInfo(nRow, ScRefCellValue(&rStr));
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index abb8b9e7877a..b66be8c67657 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -938,7 +938,7 @@ public:
mrClipTab.SetValue(nTransCol, mnTransRow, fVal);
}
- void operator() (size_t nRow, const OUString& rStr)
+ void operator() (size_t nRow, const svl::SharedString& rStr)
{
if (mbAsLink)
{
@@ -1533,6 +1533,12 @@ void ScTable::SetRawString( SCCOL nCol, SCROW nRow, const OUString& rStr )
aCol[nCol].SetRawString(nRow, rStr);
}
+void ScTable::SetRawString( SCCOL nCol, SCROW nRow, const svl::SharedString& rStr )
+{
+ if (ValidColRow(nCol, nRow))
+ aCol[nCol].SetRawString(nRow, rStr);
+}
+
void ScTable::GetString( SCCOL nCol, SCROW nRow, OUString& rString ) const
{
if (ValidColRow(nCol,nRow))
@@ -1541,7 +1547,7 @@ void ScTable::GetString( SCCOL nCol, SCROW nRow, OUString& rString ) const
rString = OUString();
}
-const OUString* ScTable::GetStringCell( SCCOL nCol, SCROW nRow ) const
+const svl::SharedString* ScTable::GetStringCell( SCCOL nCol, SCROW nRow ) const
{
if (!ValidColRow(nCol,nRow))
return NULL;
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 1b4e25a2b93d..59e080c11578 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -396,11 +396,11 @@ short ScTable::CompareCell(
OUString aStr1;
OUString aStr2;
if (eType1 == CELLTYPE_STRING)
- aStr1 = *rCell1.mpString;
+ aStr1 = rCell1.mpString->getString();
else
GetString(nCell1Col, nCell1Row, aStr1);
if (eType2 == CELLTYPE_STRING)
- aStr2 = *rCell2.mpString;
+ aStr2 = rCell2.mpString->getString();
else
GetString(nCell2Col, nCell2Row, aStr2);
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index c9150b2aa7c0..b7112bbc661b 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -787,7 +787,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
if ( eCellType == CELLTYPE_STRING )
- aValue = *aSrcCell.mpString;
+ aValue = aSrcCell.mpString->getString();
else
aValue = ScEditUtil::GetString(*aSrcCell.mpEditText, pDocument);
if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered )
@@ -1578,7 +1578,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
OUString aValue;
if (eCellType == CELLTYPE_STRING)
- aValue = *aSrcCell.mpString;
+ aValue = aSrcCell.mpString->getString();
else
aValue = ScEditUtil::GetString(*aSrcCell.mpEditText, pDocument);
sal_Int32 nStringValue;
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 2c66dd541b5d..07a54f97ed4f 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -29,6 +29,7 @@
#include <basic/sbx.hxx>
#include <svl/zforlist.hxx>
+#include "svl/sharedstringpool.hxx"
#include <vcl/msgbox.hxx>
#include <rtl/math.hxx>
@@ -461,7 +462,8 @@ bool ScValidationData::IsDataValid(
}
else
{
- ScRefCellValue aTmpCell(&rTest);
+ svl::SharedString aSS = mpDoc->GetCellStringPool().intern(rTest);
+ ScRefCellValue aTmpCell(&aSS);
bRet = IsDataValid(aTmpCell, rPos);
}
}
@@ -484,7 +486,7 @@ bool ScValidationData::IsDataValid( ScRefCellValue& rCell, const ScAddress& rPos
nVal = rCell.mfValue;
break;
case CELLTYPE_STRING:
- aString = *rCell.mpString;
+ aString = rCell.mpString->getString();
bIsVal = false;
break;
case CELLTYPE_EDIT:
diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index 894d42fbaef1..807bba24a73d 100644
--- a/sc/source/core/tool/addincol.cxx
+++ b/sc/source/core/tool/addincol.cxx
@@ -49,6 +49,7 @@
#include "scmod.hxx"
#include "rangeseq.hxx"
#include "funcdesc.hxx"
+#include "svl/sharedstring.hxx"
using namespace com::sun::star;
@@ -1663,13 +1664,17 @@ void ScUnoAddInCall::SetResult( const uno::Any& rNewRes )
long nColCount = pRowArr[nRow].getLength();
const OUString* pColArr = pRowArr[nRow].getConstArray();
for (nCol=0; nCol<nColCount; nCol++)
- xMatrix->PutString( pColArr[nCol],
- static_cast<SCSIZE>(nCol),
- static_cast<SCSIZE>(nRow) );
+ {
+ xMatrix->PutString(
+ svl::SharedString(pColArr[nCol]),
+ static_cast<SCSIZE>(nCol), static_cast<SCSIZE>(nRow));
+ }
for (nCol=nColCount; nCol<nMaxColCount; nCol++)
- xMatrix->PutString( EMPTY_OUSTRING,
- static_cast<SCSIZE>(nCol),
- static_cast<SCSIZE>(nRow) );
+ {
+ xMatrix->PutString(
+ svl::SharedString(EMPTY_OUSTRING),
+ static_cast<SCSIZE>(nCol), static_cast<SCSIZE>(nRow));
+ }
}
}
}
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 57ada4a4d3d2..1f394f766552 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -17,11 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "cellform.hxx"
+
#include <sfx2/objsh.hxx>
#include <svl/smplhint.hxx>
#include <svl/zforlist.hxx>
+#include "svl/sharedstring.hxx"
-#include "cellform.hxx"
#include "formulacell.hxx"
#include "document.hxx"
#include "cellvalue.hxx"
@@ -47,7 +49,7 @@ void ScCellFormat::GetString( ScRefCellValue& rCell, sal_uLong nFormat, OUString
switch (rCell.meType)
{
case CELLTYPE_STRING:
- rFormatter.GetOutputString(*rCell.mpString, nFormat, rString, ppColor, bUseStarFormat);
+ rFormatter.GetOutputString(rCell.mpString->getString(), nFormat, rString, ppColor, bUseStarFormat);
break;
case CELLTYPE_EDIT:
rFormatter.GetOutputString(rCell.getString(pDoc), nFormat, rString, ppColor );
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 5ba0e350b320..ab07a637bd14 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1643,7 +1643,7 @@ void ScChangeActionContent::GetStringOfCell(
pDoc->GetFormatTable()->GetInputLineString(rCell.mfValue, nFormat, rStr);
break;
case CELLTYPE_STRING:
- rStr = *rCell.mpString;
+ rStr = rCell.mpString->getString();
break;
case CELLTYPE_EDIT:
if (rCell.mpEditText)
@@ -1791,7 +1791,7 @@ void ScChangeActionContent::GetValueString(
switch (rCell.meType)
{
case CELLTYPE_STRING :
- rStr = *rCell.mpString;
+ rStr = rCell.mpString->getString();
break;
case CELLTYPE_EDIT :
if (rCell.mpEditText)
diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx
index e4426015893f..743753713be0 100644
--- a/sc/source/core/tool/ddelink.cxx
+++ b/sc/source/core/tool/ddelink.cxx
@@ -21,6 +21,7 @@
#include <sfx2/linkmgr.hxx>
#include <sfx2/bindings.hxx>
#include <svl/zforlist.hxx>
+#include "svl/sharedstring.hxx"
#include "ddelink.hxx"
#include "brdcst.hxx"
@@ -187,7 +188,7 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged(
// empty cell
pResult->PutEmpty(nC, nR);
else
- pResult->PutString( aEntry, nC, nR );
+ pResult->PutString(svl::SharedString(aEntry), nC, nR);
}
}
}
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 98ae0b4aede5..09076a831445 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -79,10 +79,10 @@ void flushSegment(
ScMatrix& rMat, size_t nCol, rtl_uString** pHead, rtl_uString** pCur, rtl_uString** pTop )
{
size_t nOffset = pHead - pTop;
- std::vector<OUString> aStrs;
+ std::vector<svl::SharedString> aStrs;
aStrs.reserve(pCur - pHead);
for (; pHead != pCur; ++pHead)
- aStrs.push_back(OUString(*pHead));
+ aStrs.push_back(svl::SharedString(*pHead, NULL));
rMat.PutString(&aStrs[0], aStrs.size(), nCol, nOffset);
}
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 617ed167c8af..13fa68b75c7b 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -261,8 +261,8 @@ static void lcl_storeJumpMatResult( const ScMatrix* pMat, ScMatrix* pResMat, SCS
}
else
{
- const OUString& rStr = pMat->GetString( nC, nR );
- pResMat->PutString( rStr, nC, nR );
+ const OUString& rStr = pMat->GetString(nC, nR);
+ pResMat->PutString(svl::SharedString(rStr), nC, nR);
}
}
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index ddaf4c589abc..a915394dc8f9 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2520,8 +2520,8 @@ void ScInterpreter::ScHyperLink()
pResMat->PutDouble( 0.0, 0 );
}
else
- pResMat->PutString( aUrl, 0 );
- pResMat->PutString( aUrl, 1 );
+ pResMat->PutString(svl::SharedString(aUrl), 0);
+ pResMat->PutString(svl::SharedString(aUrl), 1);
bMatrixFormula = true;
PushMatrix(pResMat);
}
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index dc6d71cc21c4..95c386ce18f8 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -450,7 +450,7 @@ ScMatrixRef ScInterpreter::GetMatrix()
nGlobalError = 0;
}
else
- pMat->PutString( aStr, 0);
+ pMat->PutString(svl::SharedString(aStr), 0);
}
}
break;
@@ -1083,9 +1083,9 @@ ScMatrixRef ScInterpreter::MatConcat(const ScMatrixRef& pMat1, const ScMatrixRef
xResMat->PutError( nErr, i, j);
else
{
- OUString aTmp( pMat1->GetString( *pFormatter, i, j));
+ OUString aTmp = pMat1->GetString(*pFormatter, i, j);
aTmp += pMat2->GetString( *pFormatter, i, j);
- xResMat->PutString( aTmp, i, j);
+ xResMat->PutString(svl::SharedString(aTmp), i, j);
}
}
}
@@ -1314,9 +1314,9 @@ void ScInterpreter::ScAmpersand()
pResMat->PutError( nErr, i, j);
else
{
- OUString aTmp( sStr);
+ OUString aTmp = sStr;
aTmp += pMat->GetString( *pFormatter, i, j);
- pResMat->PutString( aTmp, i, j);
+ pResMat->PutString(svl::SharedString(aTmp), i, j);
}
}
}
@@ -1330,9 +1330,9 @@ void ScInterpreter::ScAmpersand()
pResMat->PutError( nErr, i, j);
else
{
- OUString aTmp( pMat->GetString( *pFormatter, i, j));
+ OUString aTmp = pMat->GetString(*pFormatter, i, j);
aTmp += sStr;
- pResMat->PutString( aTmp, i, j);
+ pResMat->PutString(svl::SharedString(aTmp), i, j);
}
}
}
diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx
index 85ba791452fa..d87f4003358e 100644
--- a/sc/source/core/tool/rangeseq.cxx
+++ b/sc/source/core/tool/rangeseq.cxx
@@ -406,9 +406,10 @@ ScMatrixRef ScSequenceToMatrix::CreateMixedMatrix( const com::sun::star::uno::An
// Try string, else use empty as last resort.
if ( pColArr[nCol] >>= aUStr )
- xMatrix->PutString( aUStr,
- static_cast<SCSIZE>(nCol),
- static_cast<SCSIZE>(nRow) );
+ {
+ xMatrix->PutString(
+ svl::SharedString(aUStr), static_cast<SCSIZE>(nCol), static_cast<SCSIZE>(nRow));
+ }
else
xMatrix->PutEmpty(
static_cast<SCSIZE>(nCol),
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 286b42548ccc..ad1712d400a7 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -25,6 +25,7 @@
#include "mtvelements.hxx"
#include <svl/zforlist.hxx>
+#include "svl/sharedstring.hxx"
#include <tools/stream.hxx>
#include <rtl/math.hxx>
@@ -55,7 +56,7 @@ using ::std::unary_function;
*/
struct custom_string_trait
{
- typedef OUString string_type;
+ typedef svl::SharedString string_type;
typedef sc::string_block string_element_block;
static const mdds::mtv::element_t string_type_identifier = sc::element_type_string;
@@ -179,9 +180,9 @@ public:
void PutDouble( double fVal, SCSIZE nIndex);
void PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR);
- void PutString(const OUString& rStr, SCSIZE nC, SCSIZE nR);
- void PutString(const OUString& rStr, SCSIZE nIndex);
- void PutString(const OUString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR);
+ void PutString(const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR);
+ void PutString(const svl::SharedString& rStr, SCSIZE nIndex);
+ void PutString(const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR);
void PutEmpty(SCSIZE nC, SCSIZE nR);
void PutEmptyPath(SCSIZE nC, SCSIZE nR);
@@ -361,7 +362,7 @@ void ScMatrixImpl::PutDouble( double fVal, SCSIZE nIndex)
PutDouble(fVal, nC, nR);
}
-void ScMatrixImpl::PutString(const OUString& rStr, SCSIZE nC, SCSIZE nR)
+void ScMatrixImpl::PutString(const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR)
{
if (ValidColRow( nC, nR))
maMat.set(nR, nC, rStr);
@@ -371,7 +372,7 @@ void ScMatrixImpl::PutString(const OUString& rStr, SCSIZE nC, SCSIZE nR)
}
}
-void ScMatrixImpl::PutString(const OUString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR)
+void ScMatrixImpl::PutString(const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR)
{
if (ValidColRow( nC, nR))
maMat.set(nR, nC, pArray, pArray + nLen);
@@ -381,7 +382,7 @@ void ScMatrixImpl::PutString(const OUString* pArray, size_t nLen, SCSIZE nC, SCS
}
}
-void ScMatrixImpl::PutString(const OUString& rStr, SCSIZE nIndex)
+void ScMatrixImpl::PutString(const svl::SharedString& rStr, SCSIZE nIndex)
{
SCSIZE nC, nR;
CalcPosition(nIndex, nC, nR);
@@ -479,7 +480,7 @@ OUString ScMatrixImpl::GetString(SCSIZE nC, SCSIZE nR) const
switch (maMat.get_type(aPos))
{
case mdds::mtm::element_string:
- return maMat.get_string(aPos);
+ return maMat.get_string(aPos).getString();
case mdds::mtm::element_empty:
return EMPTY_OUSTRING;
case mdds::mtm::element_numeric:
@@ -518,7 +519,7 @@ OUString ScMatrixImpl::GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSI
switch (maMat.get_type(aPos))
{
case mdds::mtm::element_string:
- return maMat.get_string(aPos);
+ return maMat.get_string(aPos).getString();
case mdds::mtm::element_empty:
{
if (!maMatFlag.get<bool>(nR, nC))
@@ -574,7 +575,7 @@ ScMatrixValue ScMatrixImpl::Get(SCSIZE nC, SCSIZE nR) const
break;
case mdds::mtm::element_string:
aVal.nType = SC_MATVAL_STRING;
- aVal.aStr = maMat.get_string(aPos);
+ aVal.aStr = maMat.get_string(aPos).getString();
break;
case mdds::mtm::element_empty:
// Empty path equals empty plus flag.
@@ -1034,7 +1035,7 @@ size_t WalkAndMatchElements<OUString>::compare(const MatrixImplType::element_blo
MatrixImplType::string_block_type::const_iterator itEnd = MatrixImplType::string_block_type::end(*node.data);
for (; it != itEnd; ++it, ++nCount)
{
- if (ScGlobal::GetpTransliteration()->isEqual(*it, maMatchValue))
+ if (ScGlobal::GetpTransliteration()->isEqual(it->getString(), maMatchValue))
{
return mnIndex + nCount;
}
@@ -1354,7 +1355,7 @@ void ScMatrixImpl::Dump() const
switch (maMat.get_type(nRow, nCol))
{
case mdds::mtm::element_string:
- cout << "string (" << maMat.get_string(nRow, nCol) << ")";
+ cout << "string (" << maMat.get_string(nRow, nCol).getString() << ")";
break;
case mdds::mtm::element_numeric:
cout << "numeric (" << maMat.get_numeric(nRow, nCol) << ")";
@@ -1497,17 +1498,17 @@ void ScMatrix::PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR
pImpl->PutDouble(pArray, nLen, nC, nR);
}
-void ScMatrix::PutString(const OUString& rStr, SCSIZE nC, SCSIZE nR)
+void ScMatrix::PutString(const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR)
{
pImpl->PutString(rStr, nC, nR);
}
-void ScMatrix::PutString(const OUString& rStr, SCSIZE nIndex)
+void ScMatrix::PutString(const svl::SharedString& rStr, SCSIZE nIndex)
{
pImpl->PutString(rStr, nIndex);
}
-void ScMatrix::PutString(const OUString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR)
+void ScMatrix::PutString(const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR)
{
pImpl->PutString(pArray, nLen, nC, nR);
}
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 201bd430d0b8..69ba49efda06 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -39,6 +39,7 @@
#include "document.hxx"
#include "refupdatecontext.hxx"
#include "types.hxx"
+#include "svl/sharedstring.hxx"
using ::std::vector;
@@ -1788,7 +1789,7 @@ FormulaToken* ScTokenArray::MergeArray( )
}
else if ( t->GetType() == svString )
{
- pArray->PutString( t->GetString(), nCol, nRow );
+ pArray->PutString(svl::SharedString(t->GetString()), nCol, nRow);
}
break;