[Libreoffice-commits] core.git: Branch 'private/kohei/calc-shared-string' - editeng/source include/editeng include/svl sc/inc sc/qa sc/source svl/source

Kohei Yoshida kohei.yoshida at collabora.com
Tue Oct 8 12:17:27 PDT 2013


 editeng/source/editeng/editobj.cxx   |   55 +++-------------------
 editeng/source/editeng/editobj2.hxx  |    6 --
 include/editeng/editobj.hxx          |    4 -
 include/svl/sharedstring.hxx         |    3 +
 include/svl/sharedstringpool.hxx     |   22 ---------
 sc/inc/column.hxx                    |    3 -
 sc/inc/document.hxx                  |    4 -
 sc/inc/table.hxx                     |    3 -
 sc/qa/unit/ucalc.cxx                 |   84 +++++++++++++++++------------------
 sc/qa/unit/ucalc.hxx                 |    4 -
 sc/source/core/data/column3.cxx      |   48 ++------------------
 sc/source/core/data/document.cxx     |   14 +----
 sc/source/core/data/table2.cxx       |   14 +----
 svl/source/misc/sharedstring.cxx     |   10 ++++
 svl/source/misc/sharedstringpool.cxx |   22 ---------
 15 files changed, 87 insertions(+), 209 deletions(-)

New commits:
commit 3f8c8b25a6158034f38e4076cb72239741098ba9
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Oct 8 15:18:16 2013 -0400

    No more getIdentifier*() calls because they are not efficient.
    
    They shall never be used.
    
    Change-Id: I019c88b1511a67175d782777cd41e0ec0434f497

diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 0ad6d28..06cbbe2 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 d2ac045..5c1c2a2 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 3d1ccca..3f78126 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 b2879a8..1e16c53 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 35ce28e..c1b7698 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 25d2a83..d1f9f63 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 c0de4b5f..12f42fe 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 5a216ae..2ab016a 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 f682bc4..bdf0049 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 d1ba668..2c30f43 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 0ac951a..ea56fe2 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 c6bb3a2..c7e0791 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 a82b5a9..b6c2641 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 e8ad0b7..5eb3af5 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 6b8f152..46bf814 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 )


More information about the Libreoffice-commits mailing list