summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-10-07 17:27:02 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-10-08 15:48:10 -0400
commit658fc68d574bd49b8b233ad5ed886758e290b3aa (patch)
treeb1acc482e6b8a8aac78e729b1ea0419aea4df607 /sc
parentee8fad644e28d1e298afb7c6eed4d454617e7dc7 (diff)
Store svl::SharedString in document cell storage instead of OUString.
With this, both ScColumn and ScMatrix store svl::SharedString as their string values, instead of OUString. Change-Id: I3faece94d98f774881fd72b3ed5f6143504cd350
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/cellform.hxx1
-rw-r--r--sc/inc/cellvalue.hxx16
-rw-r--r--sc/inc/column.hxx4
-rw-r--r--sc/inc/document.hxx11
-rw-r--r--sc/inc/mtvelements.hxx7
-rw-r--r--sc/inc/scmatrix.hxx8
-rw-r--r--sc/inc/table.hxx3
-rw-r--r--sc/qa/unit/ucalc.cxx9
-rw-r--r--sc/qa/unit/ucalc_sharedformula.cxx5
-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
-rw-r--r--sc/source/filter/excel/excform.cxx3
-rw-r--r--sc/source/filter/excel/xetable.cxx2
-rw-r--r--sc/source/filter/excel/xihelper.cxx3
-rw-r--r--sc/source/filter/excel/xilink.cxx3
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx5
-rw-r--r--sc/source/filter/xcl97/XclImpChangeTrack.cxx3
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx6
-rw-r--r--sc/source/filter/xml/XMLDDELinksContext.cxx8
-rw-r--r--sc/source/filter/xml/XMLTrackedChangesContext.cxx14
-rw-r--r--sc/source/ui/docshell/docsh.cxx2
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx21
-rw-r--r--sc/source/ui/undo/undocell.cxx8
-rw-r--r--sc/source/ui/view/gridwin.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh5.cxx3
48 files changed, 285 insertions, 188 deletions
diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx
index 7779297be25f..1f6b13a9254a 100644
--- a/sc/inc/cellform.hxx
+++ b/sc/inc/cellform.hxx
@@ -22,6 +22,7 @@
#include <tools/solar.h>
#include "scdllapi.h"
+#include "rtl/ustring.hxx"
class SvNumberFormatter;
class Color;
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx
index fd112a6ab23a..c2606b511e72 100644
--- a/sc/inc/cellvalue.hxx
+++ b/sc/inc/cellvalue.hxx
@@ -18,6 +18,12 @@ class EditTextObject;
class ScColumn;
struct ScRefCellValue;
+namespace svl {
+
+class SharedString;
+
+}
+
/**
* Store arbitrary cell value of any kind. It only stores cell value and
* nothing else. It creates a copy of the original cell value, and manages
@@ -28,7 +34,7 @@ struct SC_DLLPUBLIC ScCellValue
CellType meType;
union {
double mfValue;
- OUString* mpString;
+ svl::SharedString* mpString;
EditTextObject* mpEditText;
ScFormulaCell* mpFormula;
};
@@ -36,7 +42,7 @@ struct SC_DLLPUBLIC ScCellValue
ScCellValue();
ScCellValue( const ScRefCellValue& rCell );
ScCellValue( double fValue );
- ScCellValue( const OUString& rString );
+ ScCellValue( const svl::SharedString& rString );
ScCellValue( const EditTextObject& rEditText );
ScCellValue( const ScFormulaCell& rFormula );
ScCellValue( const ScCellValue& r );
@@ -45,7 +51,7 @@ struct SC_DLLPUBLIC ScCellValue
void clear();
void set( double fValue );
- void set( const OUString& rStr );
+ void set( const svl::SharedString& rStr );
void set( const EditTextObject& rEditText );
void set( const ScFormulaCell& rFormula );
void set( ScFormulaCell* pFormula );
@@ -98,14 +104,14 @@ struct SC_DLLPUBLIC ScRefCellValue
CellType meType;
union {
double mfValue;
- const OUString* mpString;
+ const svl::SharedString* mpString;
const EditTextObject* mpEditText;
ScFormulaCell* mpFormula;
};
ScRefCellValue();
ScRefCellValue( double fValue );
- ScRefCellValue( const OUString* pString );
+ ScRefCellValue( const svl::SharedString* pString );
ScRefCellValue( const EditTextObject* pEditText );
ScRefCellValue( ScFormulaCell* pFormula );
ScRefCellValue( const ScRefCellValue& r );
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index e4fe323b93f2..ab14017d9d87 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -284,13 +284,15 @@ public:
sal_uIntPtr GetCellStringIDIgnoreCase( SCROW nRow ) const;
void SetRawString( SCROW nRow, const OUString& rStr, bool bBroadcast = true );
+ void SetRawString( SCROW nRow, const svl::SharedString& rStr, bool bBroadcast = true );
void SetRawString( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const OUString& rStr, bool bBroadcast = true );
+ void SetRawString( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const svl::SharedString& rStr, bool bBroadcast = true );
void SetValue( SCROW nRow, double fVal );
void SetValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, double fVal, bool bBroadcast = true );
void SetError( SCROW nRow, const sal_uInt16 nError);
void GetString( SCROW nRow, OUString& rString ) const;
- const OUString* GetStringCell( SCROW nRow ) const;
+ const svl::SharedString* GetStringCell( SCROW nRow ) const;
double* GetValueCell( SCROW nRow );
void GetInputString( SCROW nRow, OUString& rString ) const;
double GetValue( SCROW nRow ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ad6471688ac8..baae1db07a92 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -50,7 +50,12 @@
namespace editeng { class SvxBorderLine; }
namespace formula { struct VectorRefArray; }
-namespace svl { class SharedStringPool; }
+namespace svl {
+
+class SharedString;
+class SharedStringPool;
+
+}
namespace sc {
struct FormulaGroupContext;
@@ -847,7 +852,7 @@ public:
* the cell at specified position is not a string cell. Note that
* it returns NULL even for a edit cell.
*/
- const OUString* GetStringCell( const ScAddress& rPos ) const;
+ const svl::SharedString* GetStringCell( const ScAddress& rPos ) const;
/**
* Return a pointer to the double value stored in value cell.
@@ -859,7 +864,7 @@ public:
*/
double* GetValueCell( const ScAddress& rPos );
- svl::SharedStringPool& GetCellStringPool();
+ SC_DLLPUBLIC svl::SharedStringPool& GetCellStringPool();
const svl::SharedStringPool& GetCellStringPool() const;
sal_uIntPtr GetCellStringID( const ScAddress& rPos ) const;
sal_uIntPtr GetCellStringIDIgnoreCase( const ScAddress& rPos ) const;
diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index f0e5fff7dc9d..6279efaa03c0 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -13,6 +13,7 @@
#include "address.hxx"
#include "formulacell.hxx"
#include "svl/broadcast.hxx"
+#include "svl/sharedstring.hxx"
#include "editeng/editobj.hxx"
#include "calcmacros.hxx"
@@ -62,7 +63,7 @@ const mdds::mtv::element_t element_type_empty = mdds::mtv::element_type_empty;
typedef mdds::mtv::noncopyable_managed_element_block<element_type_broadcaster, SvtBroadcaster> broadcaster_block;
typedef mdds::mtv::default_element_block<element_type_celltextattr, CellTextAttr> celltextattr_block;
-typedef mdds::mtv::default_element_block<element_type_string, rtl::OUString> string_block;
+typedef mdds::mtv::default_element_block<element_type_string, svl::SharedString> string_block;
typedef mdds::mtv::noncopyable_managed_element_block<element_type_edittext, EditTextObject> edittext_block;
typedef mdds::mtv::noncopyable_managed_element_block<element_type_formula, ScFormulaCell> formula_block;
@@ -79,9 +80,9 @@ MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(SvtBroadcaster, sc::element_type_broadcast
MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(ScFormulaCell, sc::element_type_formula, NULL, sc::formula_block)
MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(EditTextObject, sc::element_type_edittext, NULL, sc::edittext_block)
-namespace rtl {
+namespace svl {
-MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(OUString, sc::element_type_string, OUString(), sc::string_block)
+MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(SharedString, sc::element_type_string, SharedString(), sc::string_block)
}
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 2ef596b1eda3..61112171fd94 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -34,6 +34,8 @@ class ScInterpreter;
class SvNumberFormatter;
class ScMatrixImpl;
+namespace svl { class SharedString; }
+
/**
* Try NOT to use this struct. This struct should go away in a hopefully
* not so distant futture.
@@ -242,9 +244,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);
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7d5fa1eabc16..923dafd1dce0 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -350,8 +350,9 @@ public:
void SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
void SetRawString( SCCOL nCol, SCROW nRow, const OUString& rStr );
+ void SetRawString( SCCOL nCol, SCROW nRow, const svl::SharedString& rStr );
void GetString( SCCOL nCol, SCROW nRow, OUString& rString ) const;
- const OUString* GetStringCell( SCCOL nCol, SCROW nRow ) const;
+ const svl::SharedString* GetStringCell( SCCOL nCol, SCROW nRow ) const;
double* GetValueCell( SCCOL nCol, SCROW nRow );
void GetInputString( SCCOL nCol, SCROW nRow, OUString& rString ) const;
double GetValue( const ScAddress& rPos ) const
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 1a2bf71d3189..8017845d6a61 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1475,6 +1475,7 @@ struct PartiallyFilledEmptyMatrix
void Test::testMatrix()
{
+ svl::SharedStringPool& rPool = m_pDoc->GetCellStringPool();
ScMatrixRef pMat, pMat2;
// First, test the zero matrix type.
@@ -1524,7 +1525,7 @@ void Test::testMatrix()
pMat->PutBoolean(true, 1, 1);
pMat->PutDouble(-12.5, 4, 5);
OUString aStr("Test");
- pMat->PutString(aStr, 8, 2);
+ pMat->PutString(rPool.intern(aStr), 8, 2);
pMat->PutEmptyPath(8, 11);
checkMatrixElements<PartiallyFilledEmptyMatrix>(*pMat);
@@ -1546,7 +1547,7 @@ void Test::testMatrix()
pMat->PutDouble(-25, 1, 1);
CPPUNIT_ASSERT_EQUAL(-25.0, pMat->GetMinValue(false));
CPPUNIT_ASSERT_EQUAL(-8.0, pMat->GetMaxValue(false));
- pMat->PutString("Test", 0, 0);
+ pMat->PutString(rPool.intern("Test"), 0, 0);
CPPUNIT_ASSERT_EQUAL(0.0, pMat->GetMaxValue(true)); // text as zero.
CPPUNIT_ASSERT_EQUAL(-8.0, pMat->GetMaxValue(false)); // ignore text.
pMat->PutBoolean(true, 0, 0);
@@ -1562,7 +1563,7 @@ void Test::testMatrix()
pMat = new ScMatrix(3, 3);
pMat->PutDouble(2.5, 0, 0);
pMat->PutDouble(1.2, 0, 1);
- pMat->PutString("A", 1, 1);
+ pMat->PutString(rPool.intern("A"), 1, 1);
pMat->PutDouble(2.3, 2, 1);
pMat->PutDouble(-20, 2, 2);
@@ -1585,7 +1586,7 @@ void Test::testMatrix()
}
pMat2 = new ScMatrix(3, 3, 10.0);
- pMat2->PutString("B", 1, 0);
+ pMat2->PutString(rPool.intern("B"), 1, 0);
pMat2->MergeDoubleArray(aDoubles, ScMatrix::Mul);
{
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index 00378ddb2155..b76671549626 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -15,6 +15,7 @@
#include "clipparam.hxx"
#include "undoblk.hxx"
#include "scopetools.hxx"
+#include "svl/sharedstring.hxx"
#include "formula/grammar.hxx"
@@ -156,10 +157,10 @@ void Test::testSharedFormulas()
// Set string value to B16 to make B17:B18 shared.
aPos.SetRow(15);
- ScCellValue aCell("Test");
+ ScCellValue aCell(svl::SharedString("Test"));
CPPUNIT_ASSERT_MESSAGE("This should be a string value.", aCell.meType == CELLTYPE_STRING);
aCell.commit(*m_pDoc, aPos);
- CPPUNIT_ASSERT_EQUAL(*aCell.mpString, m_pDoc->GetString(aPos));
+ CPPUNIT_ASSERT_EQUAL(aCell.mpString->getString(), m_pDoc->GetString(aPos));
aPos.SetRow(16);
pFC = m_pDoc->GetFormulaCell(aPos);
// B17:B18 should be shared.
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;
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index d0b0c03376ca..74bb54684c26 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -27,6 +27,7 @@
#include "scmatrix.hxx"
#include "formula/errorcodes.hxx"
+#include "svl/sharedstring.hxx"
#include "imp_op.hxx"
#include "root.hxx"
@@ -1850,7 +1851,7 @@ void ExcelToSc::ReadExtensionArray( unsigned int n, XclImpStream& aIn )
}
if( NULL != pMatrix )
{
- pMatrix->PutString( aString, nC, nR );
+ pMatrix->PutString(svl::SharedString(aString), nC, nR);
}
break;
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 8fd6dc532e4b..42273bc96520 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2360,7 +2360,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
case CELLTYPE_STRING:
{
xCell.reset(new XclExpLabelCell(
- GetRoot(), aXclPos, pPattern, nMergeBaseXFId, *rScCell.mpString));
+ GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScCell.mpString->getString()));
}
break;
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index 104e288fcec8..6a0eb82031c3 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -19,6 +19,7 @@
#include "xihelper.hxx"
#include <svl/itemset.hxx>
+#include "svl/sharedstring.hxx"
#include <editeng/editobj.hxx>
#include <tools/urlobj.hxx>
#include "scitems.hxx"
@@ -877,7 +878,7 @@ ScMatrixRef XclImpCachedMatrix::CreateScMatrix() const
xScMatrix->PutDouble( itValue->GetValue(), nScCol, nScRow );
break;
case EXC_CACHEDVAL_STRING:
- xScMatrix->PutString( itValue->GetString(), nScCol, nScRow );
+ xScMatrix->PutString(svl::SharedString(itValue->GetString()), nScCol, nScRow);
break;
case EXC_CACHEDVAL_BOOL:
xScMatrix->PutBoolean( itValue->GetBool(), nScCol, nScRow );
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index d8835f04822c..20dc8dfd4ce6 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -29,6 +29,7 @@
#include "tokenarray.hxx"
#include "externalrefmgr.hxx"
#include "scmatrix.hxx"
+#include "svl/sharedstring.hxx"
#include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
@@ -296,7 +297,7 @@ XclImpExtName::MOper::MOper(XclImpStream& rStrm) :
case 0x02:
{
OUString aStr = rStrm.ReadUniString();
- mxCached->PutString(aStr, nCol, nRow);
+ mxCached->PutString(svl::SharedString(aStr), nCol, nRow);
}
break;
case 0x04:
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index c7e3adfae55c..2c6424e62069 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -32,6 +32,7 @@
#include <oox/token/tokens.hxx>
#include <rtl/strbuf.hxx>
+#include "svl/sharedstring.hxx"
using namespace oox;
@@ -845,9 +846,9 @@ void XclExpChTrCellContent::GetCellData(
OUString sCellStr;
if (rScCell.meType == CELLTYPE_STRING)
{
- sCellStr = *rScCell.mpString;
+ sCellStr = rScCell.mpString->getString();
rpData->mpFormattedString = XclExpStringHelper::CreateCellString(
- rRoot, *rScCell.mpString, NULL);
+ rRoot, sCellStr, NULL);
}
else
{
diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
index f16aba682d28..a60b302feab7 100644
--- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
@@ -21,6 +21,7 @@
#include "XclImpChangeTrack.hxx"
#include <sot/storage.hxx>
#include <svl/zforlist.hxx>
+#include "svl/sharedstringpool.hxx"
#include "chgviset.hxx"
#include "formulacell.hxx"
#include "chgtrack.hxx"
@@ -249,7 +250,7 @@ void XclImpChangeTrack::ReadCell(
if( pStrm->IsValid() )
{
rCell.meType = CELLTYPE_STRING;
- rCell.mpString = new OUString(sString);
+ rCell.mpString = new svl::SharedString(GetDoc().GetCellStringPool().intern(sString));
}
}
break;
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index 72993ac4cbb0..1fd98cd1d730 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/util/DateTime.hpp>
#include <tools/datetime.hxx>
#include <svl/zforlist.hxx>
+#include "svl/sharedstring.hxx"
#define SC_CHANGE_ID_PREFIX "ct"
@@ -293,11 +294,12 @@ void ScChangeTrackingExportHelper::WriteStringCell(const ScCellValue& rCell)
rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING);
SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_CHANGE_TRACK_TABLE_CELL, true, true);
- if (!rCell.mpString->isEmpty())
+ OUString aStr = rCell.mpString->getString();
+ if (!aStr.isEmpty())
{
SvXMLElementExport aElemP(rExport, XML_NAMESPACE_TEXT, XML_P, true, false);
bool bPrevCharWasSpace(true);
- rExport.GetTextParagraphExport()->exportText(*rCell.mpString, bPrevCharWasSpace);
+ rExport.GetTextParagraphExport()->exportText(aStr, bPrevCharWasSpace);
}
}
diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx b/sc/source/filter/xml/XMLDDELinksContext.cxx
index 4f6d51fb568c..ba904b652f93 100644
--- a/sc/source/filter/xml/XMLDDELinksContext.cxx
+++ b/sc/source/filter/xml/XMLDDELinksContext.cxx
@@ -25,6 +25,7 @@
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/nmspmap.hxx>
#include <sax/tools/converter.hxx>
+#include "svl/sharedstringpool.hxx"
using namespace com::sun::star;
using namespace xmloff::token;
@@ -142,7 +143,8 @@ void ScXMLDDELinkContext::AddRowsToTable(const sal_Int32 nRowsP)
void ScXMLDDELinkContext::EndElement()
{
- if (nPosition > -1 && nColumns && nRows && GetScImport().GetDocument())
+ ScDocument* pDoc = GetScImport().GetDocument();
+ if (nPosition > -1 && nColumns && nRows)
{
bool bSizeMatch = (static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size());
OSL_ENSURE( bSizeMatch, "ScXMLDDELinkContext::EndElement: matrix dimension doesn't match cells count");
@@ -163,6 +165,8 @@ void ScXMLDDELinkContext::EndElement()
sal_Int32 nIndex(0);
ScDDELinkCells::iterator aItr(aDDELinkTable.begin());
ScDDELinkCells::iterator aEndItr(aDDELinkTable.end());
+
+ svl::SharedStringPool& rPool = pDoc->GetCellStringPool();
while (aItr != aEndItr)
{
if (nIndex % nColumns == 0)
@@ -178,7 +182,7 @@ void ScXMLDDELinkContext::EndElement()
if( aItr->bEmpty )
pMatrix->PutEmpty( nScCol, nScRow );
else if( aItr->bString )
- pMatrix->PutString( aItr->sValue, nScCol, nScRow );
+ pMatrix->PutString(rPool.intern(aItr->sValue), nScCol, nScRow);
else
pMatrix->PutDouble( aItr->fValue, nScCol, nScRow );
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index b66b08131724..590b0e373058 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -32,6 +32,7 @@
#include <xmloff/xmluconv.hxx>
#include <sax/tools/converter.hxx>
#include <svl/zforlist.hxx>
+#include "svl/sharedstringpool.hxx"
#include <com/sun/star/text/XTextCursor.hpp>
#include <com/sun/star/text/ControlCharacter.hpp>
@@ -1265,6 +1266,7 @@ void ScXMLChangeCellContext::EndElement()
{
if (!bEmpty)
{
+ ScDocument* pDoc = GetScImport().GetDocument();
if (pEditTextObj)
{
if (GetImport().GetTextImport()->GetCursor().is())
@@ -1278,12 +1280,10 @@ void ScXMLChangeCellContext::EndElement()
sal_True );
}
}
- if (GetScImport().GetDocument())
- {
- // The cell will own the text object instance.
- mrOldCell.meType = CELLTYPE_EDIT;
- mrOldCell.mpEditText = pEditTextObj->CreateTextObject();
- }
+
+ // The cell will own the text object instance.
+ mrOldCell.meType = CELLTYPE_EDIT;
+ mrOldCell.mpEditText = pEditTextObj->CreateTextObject();
GetScImport().GetTextImport()->ResetCursor();
pEditTextObj->release();
}
@@ -1294,7 +1294,7 @@ void ScXMLChangeCellContext::EndElement()
if (!sText.isEmpty() && bString)
{
mrOldCell.meType = CELLTYPE_STRING;
- mrOldCell.mpString = new OUString(sText);
+ mrOldCell.mpString = new svl::SharedString(pDoc->GetCellStringPool().intern(sText));
}
else
{
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index b2d482818c54..0b15f2d81dd8 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -1961,7 +1961,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter);
}
else
- aString = *pCell->mpString;
+ aString = pCell->mpString->getString();
bString = true;
break;
case CELLTYPE_EDIT :
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 37122f644e24..5db75525a98e 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -45,6 +45,7 @@
#include "svl/stritem.hxx"
#include "svl/urihelper.hxx"
#include "svl/zformat.hxx"
+#include "svl/sharedstring.hxx"
#include "sfx2/linkmgr.hxx"
#include "tools/urlobj.hxx"
#include "unotools/ucbhelper.hxx"
@@ -644,7 +645,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
xMat->PutDouble(pToken->GetDouble(), nC, nR);
break;
case svString:
- xMat->PutString(pToken->GetString(), nC, nR);
+ xMat->PutString(svl::SharedString(pToken->GetString()), nC, nR);
break;
default:
;
@@ -1349,9 +1350,9 @@ struct ColumnBatch
};
template<>
-inline OUString ColumnBatch<OUString>::getValue(ScRefCellValue& raCell) const
+inline svl::SharedString ColumnBatch<svl::SharedString>::getValue(ScRefCellValue& rCell) const
{
- return raCell.getString(NULL);
+ return svl::SharedString(rCell.getString(NULL));
}
template<class T>
@@ -1361,7 +1362,7 @@ inline T ColumnBatch<T>::getValue(ScRefCellValue& raCell) const
}
template<>
-inline void ColumnBatch<OUString>::putValues(ScMatrixRef& xMat, const SCCOL nCol) const
+inline void ColumnBatch<svl::SharedString>::putValues(ScMatrixRef& xMat, const SCCOL nCol) const
{
xMat->PutString(maStorage.data(), maStorage.size(), nCol, mnRowStart);
}
@@ -1419,8 +1420,8 @@ static ScTokenArray* convertToTokenArray(
static_cast<SCSIZE>(nCol2-nCol1+1), static_cast<SCSIZE>(nRow2-nRow1+1));
ScRefCellValue aCell;
- ColumnBatch<OUString> stringBatch(CELLTYPE_STRING, CELLTYPE_EDIT);
- ColumnBatch<double> doubleBatch(CELLTYPE_VALUE, CELLTYPE_VALUE);
+ ColumnBatch<svl::SharedString> aStringBatch(CELLTYPE_STRING, CELLTYPE_EDIT);
+ ColumnBatch<double> aDoubleBatch(CELLTYPE_VALUE, CELLTYPE_VALUE);
for (SCCOL nCol = nDataCol1; nCol <= nDataCol2; ++nCol)
{
@@ -1431,8 +1432,8 @@ static ScTokenArray* convertToTokenArray(
aCell.assign(*pSrcDoc, ScAddress(nCol, nRow, nTab));
- stringBatch.update(aCell, nC, nR, xMat);
- doubleBatch.update(aCell, nC, nR, xMat);
+ aStringBatch.update(aCell, nC, nR, xMat);
+ aDoubleBatch.update(aCell, nC, nR, xMat);
if (aCell.hasEmptyValue())
// Skip empty cells. Matrix's default values are empty elements.
@@ -1463,8 +1464,8 @@ static ScTokenArray* convertToTokenArray(
}
}
- stringBatch.flush(nC, xMat);
- doubleBatch.flush(nC, xMat);
+ aStringBatch.flush(nC, xMat);
+ aDoubleBatch.flush(nC, xMat);
}
if (!bFirstTab)
pArray->AddOpCode(ocSep);
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index bdecc941d79b..807875944c19 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -17,13 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "undocell.hxx"
+
#include "scitems.hxx"
#include <editeng/eeitem.hxx>
#include <editeng/editobj.hxx>
#include <svl/zforlist.hxx>
+#include "svl/sharedstringpool.hxx"
#include <sfx2/app.hxx>
-#include "undocell.hxx"
#include "document.hxx"
#include "docpool.hxx"
#include "patattr.hxx"
@@ -481,7 +483,7 @@ void ScUndoSetCell::SetValue( const ScCellValue& rVal )
{
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(maPos, *rVal.mpString);
+ pDoc->SetString(maPos, rVal.mpString->getString());
}
break;
case CELLTYPE_EDIT:
@@ -668,7 +670,7 @@ ScUndoThesaurus::ScUndoThesaurus( ScDocShell* pNewDocShell,
else
{
aOldCell.meType = CELLTYPE_STRING;
- aOldCell.mpString = new OUString(aUndoStr);
+ aOldCell.mpString = new svl::SharedString(pDocShell->GetDocument()->GetCellStringPool().intern(aUndoStr));
}
SetChangeTrack(aOldCell);
}
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 5f12fde489f4..2de9a7701085 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5463,7 +5463,7 @@ bool ScGridWindow::ContinueOnlineSpelling()
pEngine->SetDefaultLanguage(nCellLang);
if (eType == CELLTYPE_STRING)
- pEngine->SetText(*pCell->mpString);
+ pEngine->SetText(pCell->mpString->getString());
else
pEngine->SetText(*pCell->mpEditText);
diff --git a/sc/source/ui/view/tabvwsh5.cxx b/sc/source/ui/view/tabvwsh5.cxx
index 79e506434997..c6fcaceeb56b 100644
--- a/sc/source/ui/view/tabvwsh5.cxx
+++ b/sc/source/ui/view/tabvwsh5.cxx
@@ -38,6 +38,7 @@
#include "editsh.hxx"
#include "hints.hxx"
#include "cellvalue.hxx"
+#include "svl/sharedstring.hxx"
//==================================================================
@@ -332,7 +333,7 @@ void ScTabViewShell::MakeNumberInfoItem( ScDocument* pDoc,
case CELLTYPE_STRING:
{
- aCellString = *aCell.mpString;
+ aCellString = aCell.mpString->getString();
eValType = SVX_VALUE_TYPE_STRING;
}
break;