summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-10-08 15:18:16 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-10-08 15:48:12 -0400
commit3786609a153b7fa38393eb646557d241af2d3060 (patch)
treed2d33086cf318229a7893dc0958630834fc1ec16
parenta7ff6e0a3fc5fccad33f06ae9d4ec7019f9ae156 (diff)
No more getIdentifier*() calls because they are not efficient.
They shall never be used. Change-Id: I019c88b1511a67175d782777cd41e0ec0434f497
-rw-r--r--editeng/source/editeng/editobj.cxx55
-rw-r--r--editeng/source/editeng/editobj2.hxx6
-rw-r--r--include/editeng/editobj.hxx4
-rw-r--r--include/svl/sharedstring.hxx3
-rw-r--r--include/svl/sharedstringpool.hxx22
-rw-r--r--sc/inc/column.hxx3
-rw-r--r--sc/inc/document.hxx4
-rw-r--r--sc/inc/table.hxx3
-rw-r--r--sc/qa/unit/ucalc.cxx84
-rw-r--r--sc/qa/unit/ucalc.hxx4
-rw-r--r--sc/source/core/data/column3.cxx48
-rw-r--r--sc/source/core/data/document.cxx14
-rw-r--r--sc/source/core/data/table2.cxx14
-rw-r--r--svl/source/misc/sharedstring.cxx10
-rw-r--r--svl/source/misc/sharedstringpool.cxx22
15 files changed, 87 insertions, 209 deletions
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 0ad6d2865d48..06cbbe274f7f 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -154,16 +154,9 @@ void ContentInfo::NormalizeString( svl::SharedStringPool& rPool )
maText = rPool.intern(OUString(maText.getData()));
}
-sal_uIntPtr ContentInfo::GetStringID( const svl::SharedStringPool& rPool ) const
+const svl::SharedString& ContentInfo::GetSharedString() const
{
- rtl_uString* p = const_cast<rtl_uString*>(maText.getData());
- return rPool.getIdentifier(OUString(p));
-}
-
-sal_uIntPtr ContentInfo::GetStringIDIgnoreCase( const svl::SharedStringPool& rPool ) const
-{
- rtl_uString* p = const_cast<rtl_uString*>(maText.getData());
- return rPool.getIdentifierIgnoreCase(OUString(p));
+ return maText;
}
OUString ContentInfo::GetText() const
@@ -350,14 +343,9 @@ void EditTextObject::NormalizeString( svl::SharedStringPool& rPool )
mpImpl->NormalizeString(rPool);
}
-bool EditTextObject::GetStringIDs( const svl::SharedStringPool& rPool, std::vector<sal_uIntPtr>& rIDs ) const
-{
- return mpImpl->GetStringIDs(rPool, rIDs);
-}
-
-bool EditTextObject::GetStringIDsIgnoreCase( const svl::SharedStringPool& rPool, std::vector<sal_uIntPtr>& rIDs ) const
+std::vector<svl::SharedString> EditTextObject::GetSharedStrings() const
{
- return mpImpl->GetStringIDsIgnoreCase(rPool, rIDs);
+ return mpImpl->GetSharedStrings();
}
const SfxItemPool* EditTextObject::GetPool() const
@@ -656,42 +644,17 @@ void EditTextObjectImpl::NormalizeString( svl::SharedStringPool& rPool )
}
}
-bool EditTextObjectImpl::GetStringIDs( const svl::SharedStringPool& rPool, std::vector<sal_uIntPtr>& rIDs ) const
-{
- std::vector<sal_uIntPtr> aIDs;
- aIDs.reserve(aContents.size());
- ContentInfosType::const_iterator it = aContents.begin(), itEnd = aContents.end();
- for (; it != itEnd; ++it)
- {
- const ContentInfo& rInfo = *it;
- sal_uIntPtr nID = rInfo.GetStringID(rPool);
- if (!nID)
- return false;
-
- aIDs.push_back(nID);
- }
-
- rIDs.swap(aIDs);
- return true;
-}
-
-bool EditTextObjectImpl::GetStringIDsIgnoreCase( const svl::SharedStringPool& rPool, std::vector<sal_uIntPtr>& rIDs ) const
+std::vector<svl::SharedString> EditTextObjectImpl::GetSharedStrings() const
{
- std::vector<sal_uIntPtr> aIDs;
- aIDs.reserve(aContents.size());
+ std::vector<svl::SharedString> aSSs;
+ aSSs.reserve(aContents.size());
ContentInfosType::const_iterator it = aContents.begin(), itEnd = aContents.end();
for (; it != itEnd; ++it)
{
const ContentInfo& rInfo = *it;
- sal_uIntPtr nID = rInfo.GetStringIDIgnoreCase(rPool);
- if (!nID)
- return false;
-
- aIDs.push_back(nID);
+ aSSs.push_back(rInfo.GetSharedString());
}
-
- rIDs.swap(aIDs);
- return true;
+ return aSSs;
}
bool EditTextObjectImpl::IsVertical() const
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index d2ac04546222..5c1c2a23fcb1 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -144,8 +144,7 @@ public:
~ContentInfo();
void NormalizeString( svl::SharedStringPool& rPool );
- sal_uIntPtr GetStringID( const svl::SharedStringPool& rPool ) const;
- sal_uIntPtr GetStringIDIgnoreCase( const svl::SharedStringPool& rPool ) const;
+ const svl::SharedString& GetSharedString() const;
OUString GetText() const;
void SetText( const OUString& rStr );
@@ -210,8 +209,7 @@ public:
void SetUserType( sal_uInt16 n );
void NormalizeString( svl::SharedStringPool& rPool );
- bool GetStringIDs( const svl::SharedStringPool& rPool, std::vector<sal_uIntPtr>& rIDs ) const;
- bool GetStringIDsIgnoreCase( const svl::SharedStringPool& rPool, std::vector<sal_uIntPtr>& rIDs ) const;
+ std::vector<svl::SharedString> GetSharedStrings() const;
bool IsVertical() const;
void SetVertical( bool b );
diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx
index 3d1cccaed7b0..3f78126a75e3 100644
--- a/include/editeng/editobj.hxx
+++ b/include/editeng/editobj.hxx
@@ -51,6 +51,7 @@ struct Section;
namespace svl {
+class SharedString;
class SharedStringPool;
}
@@ -85,8 +86,7 @@ public:
*/
void NormalizeString( svl::SharedStringPool& rPool );
- bool GetStringIDs( const svl::SharedStringPool& rPool, std::vector<sal_uIntPtr>& rIDs ) const;
- bool GetStringIDsIgnoreCase( const svl::SharedStringPool& rPool, std::vector<sal_uIntPtr>& rIDs ) const;
+ std::vector<svl::SharedString> GetSharedStrings() const;
const SfxItemPool* GetPool() const;
sal_uInt16 GetUserType() const; // For OutlinerMode, it can however not save in compatible format
diff --git a/include/svl/sharedstring.hxx b/include/svl/sharedstring.hxx
index b2879a8aa463..1e16c5373de2 100644
--- a/include/svl/sharedstring.hxx
+++ b/include/svl/sharedstring.hxx
@@ -29,6 +29,7 @@ public:
SharedString& operator= ( const SharedString& r );
bool operator== ( const SharedString& r ) const;
+ bool operator!= ( const SharedString& r ) const;
OUString getString() const;
@@ -37,6 +38,8 @@ public:
rtl_uString* getDataIgnoreCase();
const rtl_uString* getDataIgnoreCase() const;
+
+ bool isValid() const;
};
}
diff --git a/include/svl/sharedstringpool.hxx b/include/svl/sharedstringpool.hxx
index 35ce28e6a6ee..c1b76981f229 100644
--- a/include/svl/sharedstringpool.hxx
+++ b/include/svl/sharedstringpool.hxx
@@ -51,28 +51,6 @@ public:
SharedString intern( const OUString& rStr );
/**
- * Get a unique ID of string object that's expected to be in the shared
- * string pool. If the string is not in the pool, NULL is returned. The
- * ID obtained by this method can be used for case sensitive comparison.
- *
- * @param rStr string object to get the ID of.
- *
- * @return unique ID of the string object.
- */
- sal_uIntPtr getIdentifier( const OUString& rStr ) const;
-
- /**
- * Get a unique ID of string object for case insensitive comparison. The
- * string object is expected to be in the pool.
- *
- * @param rStr string object to get the ID of.
- *
- * @return unique ID of the string object usable for case insensitive
- * comparison.
- */
- sal_uIntPtr getIdentifierIgnoreCase( const OUString& rStr ) const;
-
- /**
* Go through all string objects in the pool, and clear those that are no
* longer used outside of the pool.
*/
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index ec29627421e2..d623efa87b4c 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -280,8 +280,7 @@ public:
ScFormulaCell* SetFormulaCell( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell );
bool SetGroupFormulaCell( SCROW nRow, ScFormulaCell* pCell );
- sal_uIntPtr GetCellStringID( SCROW nRow ) const;
- sal_uIntPtr GetCellStringIDIgnoreCase( SCROW nRow ) const;
+ svl::SharedString GetSharedString( SCROW nRow ) const;
void SetRawString( SCROW nRow, const OUString& rStr, bool bBroadcast = true );
void SetRawString( SCROW nRow, const svl::SharedString& rStr, bool bBroadcast = true );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 69c8bdc7b163..076982c27e26 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -855,8 +855,8 @@ public:
SC_DLLPUBLIC svl::SharedStringPool& GetSharedStringPool();
const svl::SharedStringPool& GetSharedStringPool() const;
- sal_uIntPtr GetCellStringID( const ScAddress& rPos ) const;
- sal_uIntPtr GetCellStringIDIgnoreCase( const ScAddress& rPos ) const;
+
+ svl::SharedString GetSharedString( const ScAddress& rPos ) const;
SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString );
SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rString );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 5a216ae3d4d4..2ab016a94300 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -343,8 +343,7 @@ public:
ScFormulaCell* SetFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* pCell );
bool SetGroupFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* pCell );
- sal_uIntPtr GetCellStringID( SCCOL nCol, SCROW nRow ) const;
- sal_uIntPtr GetCellStringIDIgnoreCase( SCCOL nCol, SCROW nRow ) const;
+ svl::SharedString GetSharedString( SCCOL nCol, SCROW nRow ) const;
void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
void SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 3c7bf0740308..9bba942f429a 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -461,7 +461,7 @@ void Test::testCollator()
CPPUNIT_ASSERT_MESSAGE("these strings are supposed to be different!", nRes != 0);
}
-void Test::testCellStringPool()
+void Test::testSharedStringPool()
{
m_pDoc->InsertTab(0, "foo");
@@ -472,34 +472,34 @@ void Test::testCellStringPool()
m_pDoc->SetString(ScAddress(0,3,0), "andy"); // A4
m_pDoc->SetString(ScAddress(0,4,0), "BRUCE"); // A5
- sal_uIntPtr nId1 = m_pDoc->GetCellStringID(ScAddress(0,0,0));
- sal_uIntPtr nId2 = m_pDoc->GetCellStringID(ScAddress(0,1,0));
- CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", nId1);
- CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", nId2);
- CPPUNIT_ASSERT_EQUAL(nId1, nId2);
-
- nId2 = m_pDoc->GetCellStringID(ScAddress(0,2,0));
- CPPUNIT_ASSERT_MESSAGE("They must differ", nId1 != nId2);
-
- nId2 = m_pDoc->GetCellStringID(ScAddress(0,3,0));
- CPPUNIT_ASSERT_MESSAGE("They must differ", nId1 != nId2);
-
- nId2 = m_pDoc->GetCellStringID(ScAddress(0,4,0));
- CPPUNIT_ASSERT_MESSAGE("They must differ", nId1 != nId2);
-
- // A3 and A5 should differ but should be equal case-insensitively.
- nId1 = m_pDoc->GetCellStringID(ScAddress(0,2,0));
- nId2 = m_pDoc->GetCellStringID(ScAddress(0,4,0));
- CPPUNIT_ASSERT_MESSAGE("They must differ", nId1 != nId2);
-
- nId1 = m_pDoc->GetCellStringIDIgnoreCase(ScAddress(0,2,0));
- nId2 = m_pDoc->GetCellStringIDIgnoreCase(ScAddress(0,4,0));
- CPPUNIT_ASSERT_MESSAGE("They must be equal when cases are ignored.", nId1 == nId2);
-
- // A2 and A4 should be equal when ignoring cases.
- nId1 = m_pDoc->GetCellStringIDIgnoreCase(ScAddress(0,1,0));
- nId2 = m_pDoc->GetCellStringIDIgnoreCase(ScAddress(0,3,0));
- CPPUNIT_ASSERT_MESSAGE("They must be equal when cases are ignored.", nId1 == nId2);
+ {
+ // These two shared string objects must go out of scope before the purge test.
+ svl::SharedString aSS1 = m_pDoc->GetSharedString(ScAddress(0,0,0));
+ svl::SharedString aSS2 = m_pDoc->GetSharedString(ScAddress(0,1,0));
+ CPPUNIT_ASSERT_MESSAGE("Failed to get a valid shared string.", aSS1.isValid());
+ CPPUNIT_ASSERT_MESSAGE("Failed to get a valid shared string.", aSS2.isValid());
+ CPPUNIT_ASSERT_EQUAL(aSS1.getData(), aSS2.getData());
+
+ aSS2 = m_pDoc->GetSharedString(ScAddress(0,2,0));
+ CPPUNIT_ASSERT_MESSAGE("They must differ", aSS1.getData() != aSS2.getData());
+
+ aSS2 = m_pDoc->GetSharedString(ScAddress(0,3,0));
+ CPPUNIT_ASSERT_MESSAGE("They must differ", aSS1.getData() != aSS2.getData());
+
+ aSS2 = m_pDoc->GetSharedString(ScAddress(0,4,0));
+ CPPUNIT_ASSERT_MESSAGE("They must differ", aSS1.getData() != aSS2.getData());
+
+ // A3 and A5 should differ but should be equal case-insensitively.
+ aSS1 = m_pDoc->GetSharedString(ScAddress(0,2,0));
+ aSS2 = m_pDoc->GetSharedString(ScAddress(0,4,0));
+ CPPUNIT_ASSERT_MESSAGE("They must differ", aSS1.getData() != aSS2.getData());
+ CPPUNIT_ASSERT_MESSAGE("They must be equal when cases are ignored.", aSS1.getDataIgnoreCase() == aSS2.getDataIgnoreCase());
+
+ // A2 and A4 should be equal when ignoring cases.
+ aSS1 = m_pDoc->GetSharedString(ScAddress(0,1,0));
+ aSS2 = m_pDoc->GetSharedString(ScAddress(0,3,0));
+ CPPUNIT_ASSERT_MESSAGE("They must be equal when cases are ignored.", aSS1.getDataIgnoreCase() == aSS2.getDataIgnoreCase());
+ }
// Check the string counts after purging. Purging shouldn't remove any strings in this case.
svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool();
@@ -568,24 +568,24 @@ void Test::testCellStringPool()
m_pDoc->SetEditText(ScAddress(1,0,0), rEE.CreateTextObject()); // B1
// These two should be equal.
- nId1 = m_pDoc->GetCellStringID(ScAddress(0,0,0));
- nId2 = m_pDoc->GetCellStringID(ScAddress(1,0,0));
- CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", nId1);
- CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", nId2);
- CPPUNIT_ASSERT_EQUAL(nId1, nId2);
+ svl::SharedString aSS1 = m_pDoc->GetSharedString(ScAddress(0,0,0));
+ svl::SharedString aSS2 = m_pDoc->GetSharedString(ScAddress(1,0,0));
+ CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", aSS1.isValid());
+ CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", aSS2.isValid());
+ CPPUNIT_ASSERT_EQUAL(aSS1.getData(), aSS2.getData());
rEE.SetText("ANDY and BRUCE");
m_pDoc->SetEditText(ScAddress(2,0,0), rEE.CreateTextObject()); // C1
- nId2 = m_pDoc->GetCellStringID(ScAddress(2,0,0));
- CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", nId2);
- CPPUNIT_ASSERT_MESSAGE("These two should be different when cases are considered.", nId1 != nId2);
+ aSS2 = m_pDoc->GetSharedString(ScAddress(2,0,0));
+ CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", aSS2.isValid());
+ CPPUNIT_ASSERT_MESSAGE("These two should be different when cases are considered.", aSS1.getData() != aSS2.getData());
// But they should be considered equal when cases are ignored.
- nId1 = m_pDoc->GetCellStringIDIgnoreCase(ScAddress(0,0,0));
- nId2 = m_pDoc->GetCellStringIDIgnoreCase(ScAddress(2,0,0));
- CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", nId1);
- CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", nId2);
- CPPUNIT_ASSERT_EQUAL(nId1, nId2);
+ aSS1 = m_pDoc->GetSharedString(ScAddress(0,0,0));
+ aSS2 = m_pDoc->GetSharedString(ScAddress(2,0,0));
+ CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", aSS1.isValid());
+ CPPUNIT_ASSERT_MESSAGE("Failed to get a valid string ID.", aSS2.isValid());
+ CPPUNIT_ASSERT_EQUAL(aSS1.getDataIgnoreCase(), aSS2.getDataIgnoreCase());
m_pDoc->DeleteTab(0);
}
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index d1ba668e52c8..2c30f434de26 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -80,7 +80,7 @@ public:
*/
void testPerf();
void testCollator();
- void testCellStringPool();
+ void testSharedStringPool();
void testRangeList();
void testInput();
@@ -285,7 +285,7 @@ public:
CPPUNIT_TEST(testPerf);
#endif
CPPUNIT_TEST(testCollator);
- CPPUNIT_TEST(testCellStringPool);
+ CPPUNIT_TEST(testSharedStringPool);
CPPUNIT_TEST(testRangeList);
CPPUNIT_TEST(testInput);
CPPUNIT_TEST(testFormulaHashAndTag);
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index f331d354b2e1..ae84c131cd77 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1736,62 +1736,28 @@ bool ScColumn::SetGroupFormulaCell( SCROW nRow, ScFormulaCell* pCell )
return true;
}
-sal_uIntPtr ScColumn::GetCellStringID( SCROW nRow ) const
+svl::SharedString ScColumn::GetSharedString( SCROW nRow ) const
{
sc::CellStoreType::const_position_type aPos = maCells.position(nRow);
switch (aPos.first->type)
{
case sc::element_type_string:
- {
- 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:
- {
- std::vector<sal_uIntPtr> aIDs;
- const EditTextObject* pObj = sc::edittext_block::at(*aPos.first->data, aPos.second);
- pObj->GetStringIDs(pDocument->GetSharedStringPool(), aIDs);
- if (aIDs.size() != 1)
- // We don't handle multiline content for now.
- return 0;
-
- return aIDs[0];
- }
- break;
- default:
- ;
- }
- return 0;
-}
-
-sal_uIntPtr ScColumn::GetCellStringIDIgnoreCase( SCROW nRow ) const
-{
- sc::CellStoreType::const_position_type aPos = maCells.position(nRow);
- switch (aPos.first->type)
- {
- case sc::element_type_string:
- {
- const svl::SharedString& rStr = sc::string_block::at(*aPos.first->data, aPos.second);
- return reinterpret_cast<sal_uIntPtr>(rStr.getDataIgnoreCase());
- }
- break;
+ return sc::string_block::at(*aPos.first->data, aPos.second);
case sc::element_type_edittext:
{
- std::vector<sal_uIntPtr> aIDs;
const EditTextObject* pObj = sc::edittext_block::at(*aPos.first->data, aPos.second);
- pObj->GetStringIDsIgnoreCase(pDocument->GetSharedStringPool(), aIDs);
- if (aIDs.size() != 1)
+ std::vector<svl::SharedString> aSSs = pObj->GetSharedStrings();
+ if (aSSs.size() != 1)
// We don't handle multiline content for now.
- return 0;
+ return svl::SharedString();
- return aIDs[0];
+ return aSSs[0];
}
break;
default:
;
}
- return 0;
+ return svl::SharedString();
}
namespace {
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index b5f6b8e4dc58..51a5c2ef8eb0 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3213,20 +3213,12 @@ double* ScDocument::GetValueCell( const ScAddress& rPos )
return maTabs[rPos.Tab()]->GetValueCell(rPos.Col(), rPos.Row());
}
-sal_uIntPtr ScDocument::GetCellStringID( const ScAddress& rPos ) const
+svl::SharedString ScDocument::GetSharedString( const ScAddress& rPos ) const
{
if (!TableExists(rPos.Tab()))
- return 0;
-
- return maTabs[rPos.Tab()]->GetCellStringID(rPos.Col(), rPos.Row());
-}
-
-sal_uIntPtr ScDocument::GetCellStringIDIgnoreCase( const ScAddress& rPos ) const
-{
- if (!TableExists(rPos.Tab()))
- return 0;
+ return svl::SharedString();
- return maTabs[rPos.Tab()]->GetCellStringIDIgnoreCase(rPos.Col(), rPos.Row());
+ return maTabs[rPos.Tab()]->GetSharedString(rPos.Col(), rPos.Row());
}
void ScDocument::GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rString )
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index a7504ccb5234..be791ca1abcb 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1505,20 +1505,12 @@ bool ScTable::SetGroupFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* pCell
return aCol[nCol].SetGroupFormulaCell(nRow, pCell);
}
-sal_uIntPtr ScTable::GetCellStringID( SCCOL nCol, SCROW nRow ) const
+svl::SharedString ScTable::GetSharedString( SCCOL nCol, SCROW nRow ) const
{
if (!ValidColRow(nCol, nRow))
- return 0;
-
- return aCol[nCol].GetCellStringID(nRow);
-}
-
-sal_uIntPtr ScTable::GetCellStringIDIgnoreCase( SCCOL nCol, SCROW nRow ) const
-{
- if (!ValidColRow(nCol, nRow))
- return 0;
+ return svl::SharedString();
- return aCol[nCol].GetCellStringIDIgnoreCase(nRow);
+ return aCol[nCol].GetSharedString(nRow);
}
void ScTable::SetValue( SCCOL nCol, SCROW nRow, const double& rVal )
diff --git a/svl/source/misc/sharedstring.cxx b/svl/source/misc/sharedstring.cxx
index e8ad0b7d4fd4..5eb3af5cbbf4 100644
--- a/svl/source/misc/sharedstring.cxx
+++ b/svl/source/misc/sharedstring.cxx
@@ -78,6 +78,11 @@ bool SharedString::operator== ( const SharedString& r ) const
return !r.mpData;
}
+bool SharedString::operator!= ( const SharedString& r ) const
+{
+ return !operator== (r);
+}
+
OUString SharedString::getString() const
{
return mpData ? OUString(mpData) : OUString();
@@ -103,6 +108,11 @@ const rtl_uString* SharedString::getDataIgnoreCase() const
return mpDataIgnoreCase;
}
+bool SharedString::isValid() const
+{
+ return mpData != NULL;
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/misc/sharedstringpool.cxx b/svl/source/misc/sharedstringpool.cxx
index 6b8f15287aca..46bf814f8468 100644
--- a/svl/source/misc/sharedstringpool.cxx
+++ b/svl/source/misc/sharedstringpool.cxx
@@ -52,28 +52,6 @@ SharedString SharedStringPool::intern( const OUString& rStr )
return SharedString(pOrig, aRes.first->pData);
}
-sal_uIntPtr SharedStringPool::getIdentifier( const OUString& rStr ) const
-{
- StrHashType::const_iterator it = maStrPool.find(rStr);
- return (it == maStrPool.end()) ? 0 : reinterpret_cast<sal_uIntPtr>(it->pData);
-}
-
-sal_uIntPtr SharedStringPool::getIdentifierIgnoreCase( const OUString& rStr ) const
-{
- StrHashType::const_iterator itOrig = maStrPool.find(rStr);
- if (itOrig == maStrPool.end())
- // Not in the pool.
- return 0;
-
- StrStoreType::const_iterator itUpper = maStrStore.find(itOrig->pData);
- if (itUpper == maStrStore.end())
- // Passed string is not in the pool.
- return 0;
-
- const rtl_uString* pUpper = itUpper->second.pData;
- return reinterpret_cast<sal_uIntPtr>(pUpper);
-}
-
namespace {
inline sal_Int32 getRefCount( const rtl_uString* p )