[Libreoffice-commits] .: 2 commits - sc/inc sc/qa sc/source

Eike Rathke erack at kemper.freedesktop.org
Thu Jul 5 07:18:57 PDT 2012


 sc/inc/global.hxx                |    4 +++
 sc/inc/scmatrix.hxx              |   18 +++++++--------
 sc/qa/unit/ucalc.cxx             |    2 -
 sc/source/core/data/global.cxx   |    8 +++++++
 sc/source/core/tool/interpr1.cxx |    4 +--
 sc/source/core/tool/scmatrix.cxx |   44 +++++++++++++++++++--------------------
 6 files changed, 46 insertions(+), 34 deletions(-)

New commits:
commit 3bdaf6168dc304b5a01bf196f3c695540a72537b
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Jul 5 16:16:04 2012 +0200

    changes to "Replaced deprecated tools/String with OUString in ScMatrix"
    
    Errors during compile:
    
    * sc/source/core/tool/interpr1.cxx: In member function ‘const String& {anonymous}::VectorMatrixAccessor::GetString(SCSIZE) const’:
      sc/source/core/tool/interpr1.cxx:4629:71: error: returning reference to temporary [-Werror]
      * with --enable-werror
    
    * sc/source/core/tool/interpr1.cxx: In function ‘void {anonymous}::lcl_GetLastMatch(SCSIZE&, const {anonymous}::VectorMatrixAccessor&, SCSIZE, bool)’:
      sc/source/core/tool/interpr1.cxx:4724:52: error: ambiguous overload for ‘operator==’ in ‘aStr == (& rMat)->{anonymous}::VectorMatrixAccessor::GetString((rIndex + -1u))’
      sc/source/core/tool/interpr1.cxx:4728:52: error: ambiguous overload for ‘operator==’ in ‘aStr == (& rMat)->{anonymous}::VectorMatrixAccessor::GetString((rIndex + 1u))’
    
    Change-Id: I28eb3d23f4d5c08a30534abdf940597923cbb68c

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index b65d930..58e3cbd 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4622,7 +4622,7 @@ public:
         return mbColVec ? mrMat.GetDouble(0, i) : mrMat.GetDouble(i, 0);
     }
 
-    const String& GetString(SCSIZE i) const
+    const rtl::OUString& GetString(SCSIZE i) const
     {
         return mbColVec ? mrMat.GetString(0, i) : mrMat.GetString(i, 0);
     }
@@ -4716,7 +4716,7 @@ static void lcl_GetLastMatch( SCSIZE& rIndex, const VectorMatrixAccessor& rMat,
     }
     else if (rMat.IsString(rIndex))
     {
-        String aStr( rMat.GetString(rIndex));
+        rtl::OUString aStr( rMat.GetString(rIndex));
         if (bReverse)
             while (rIndex > 0 && rMat.IsString(rIndex-1) &&
                     aStr == rMat.GetString(rIndex-1))
commit b6cfbd08c2a9b686cfe024a63469cbcd10d9a4bd
Author: Sören Möller <soerenmoeller2001 at gmail.com>
Date:   Wed Jul 4 22:53:11 2012 +0200

    Replaced deprecated tools/String with OUString in ScMatrix
    
    Change-Id: If431e5ef8b5c97384a1bb1c7fa36c6894ece8343

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 1f29753..371431f 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -35,6 +35,7 @@
 #include <osl/endian.h>
 #include <com/sun/star/uno/Reference.hxx>
 #include "scdllapi.h"
+#include <rtl/ustring.hxx>
 
 #include <boost/unordered_map.hpp>
 #include <vector>
@@ -231,6 +232,7 @@ const sal_uInt16 IDF_AUTOFILL   = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS);
 
 
 #define EMPTY_STRING ScGlobal::GetEmptyString()
+#define EMPTY_OUSTRING ScGlobal::GetEmptyOUString()
 
                                         //  layer id's for drawing
 #define SC_LAYER_FRONT      0
@@ -496,6 +498,7 @@ class ScGlobal
     static String**         ppRscString;
     static String*          pStrScDoc;
     static String*          pEmptyString;
+    static ::rtl::OUString* pEmptyOUString;
     static String*          pStrClipDocName;
     static SvxBrushItem*    pEmptyBrushItem;
     static SvxBrushItem*    pButtonBrushItem;
@@ -585,6 +588,7 @@ public:
     static SvxBrushItem*    GetEmbeddedBrushItem()  { return pEmbeddedBrushItem; }
     static SvxBrushItem*    GetProtectedBrushItem() { return pProtectedBrushItem; }
     SC_DLLPUBLIC    static const String&    GetEmptyString();
+    SC_DLLPUBLIC    static const ::rtl::OUString&    GetEmptyOUString();
     static const String&    GetScDocString();
 
     /** Returns the specified image list with outline symbols. */
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 222f863..9657540 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -32,8 +32,8 @@
 #include "global.hxx"
 #include "types.hxx"
 #include "formula/errorcodes.hxx"
-#include <tools/string.hxx>
 #include "scdllapi.h"
+#include <rtl/ustring.hxx>
 
 #include <boost/intrusive_ptr.hpp>
 
@@ -53,12 +53,12 @@ struct ScMatrixValue
 {
     union {
         double fVal;
-        const String* pS;
+        const ::rtl::OUString* pS;
     };
     ScMatValType nType;
 
     /// Only valid if ScMatrix methods indicate so!
-    const String& GetString() const { return pS ? *pS : EMPTY_STRING; }
+    const ::rtl::OUString& GetString() const { return pS ? *pS : EMPTY_OUSTRING; }
 
     /// Only valid if ScMatrix methods indicate that this is no string!
     sal_uInt16 GetError() const         { return GetDoubleErrorValue( fVal); }
@@ -92,7 +92,7 @@ struct ScMatrixValue
         if (!pS)
             return r.pS == NULL;
 
-        return GetString().Equals(r.GetString());
+        return GetString().equals(r.GetString());
     }
 
     bool operator!= (const ScMatrixValue& r) const
@@ -274,8 +274,8 @@ public:
 
     void PutDouble( double fVal, SCSIZE nC, SCSIZE nR);
     void PutDouble( double fVal, SCSIZE nIndex);
-    void PutString( const String& rStr, SCSIZE nC, SCSIZE nR);
-    void PutString( const String& rStr, SCSIZE nIndex);
+    void PutString( const ::rtl::OUString& rStr, SCSIZE nC, SCSIZE nR);
+    void PutString( const ::rtl::OUString& rStr, SCSIZE nIndex);
     void PutEmpty( SCSIZE nC, SCSIZE nR);
     /// Jump FALSE without path
     void PutEmptyPath( SCSIZE nC, SCSIZE nR);
@@ -303,15 +303,15 @@ public:
     double GetDouble( SCSIZE nIndex) const;
 
     /// @return empty string if empty or empty path, else string content.
-    const String& GetString( SCSIZE nC, SCSIZE nR) const;
+    const ::rtl::OUString& GetString( SCSIZE nC, SCSIZE nR) const;
     /// @return empty string if empty or empty path, else string content.
-    const String& GetString( SCSIZE nIndex) const;
+    const ::rtl::OUString& GetString( SCSIZE nIndex) const;
 
     /** @returns the matrix element's string if one is present, otherwise the
         numerical value formatted as string, or in case of an error the error
         string is returned; an empty string for empty, a "FALSE" string for
         empty path. */
-    String GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const;
+    ::rtl::OUString GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const;
 
     /// @ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate
     /// an empty string!
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 43c1607..f317f52 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1198,7 +1198,7 @@ struct PartiallyFilledEmptyMatrix
         else if (nCol == 8 && nRow == 2)
         {
             CPPUNIT_ASSERT_MESSAGE("element is not of value type", rVal.nType == SC_MATVAL_STRING);
-            CPPUNIT_ASSERT_MESSAGE("element value is not what is expected", rVal.pS->EqualsAscii("Test"));
+            CPPUNIT_ASSERT_MESSAGE("element value is not what is expected", rVal.pS->equalsAscii("Test"));
         }
         else if (nCol == 8 && nRow == 11)
         {
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index ee2bea9..011d2e0 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -110,6 +110,7 @@ CollatorWrapper* ScGlobal::pCaseCollator = NULL;
 IntlWrapper*    ScGlobal::pScIntlWrapper = NULL;
 sal_Unicode     ScGlobal::cListDelimiter = ',';
 String*         ScGlobal::pEmptyString = NULL;
+::rtl::OUString*       ScGlobal::pEmptyOUString = NULL;
 String*         ScGlobal::pStrClipDocName = NULL;
 
 SvxBrushItem*   ScGlobal::pEmptyBrushItem = NULL;
@@ -520,6 +521,11 @@ const String& ScGlobal::GetEmptyString()
     return *pEmptyString;
 }
 
+const ::rtl::OUString& ScGlobal::GetEmptyOUString()
+{
+    return *pEmptyOUString;
+}
+
 ImageList* ScGlobal::GetOutlineSymbols()
 {
     ImageList*& rpImageList = pOutlineBitmaps;
@@ -531,6 +537,7 @@ ImageList* ScGlobal::GetOutlineSymbols()
 void ScGlobal::Init()
 {
     pEmptyString = new String;
+    pEmptyOUString = new ::rtl::OUString;
 
     //  Die Default-Sprache fuer Zahlenformate (ScGlobal::eLnge)
     //  muss immer LANGUAGE_SYSTEM sein
@@ -680,6 +687,7 @@ void ScGlobal::Clear()
     ScDocumentPool::DeleteVersionMaps();
 
     DELETEZ(pEmptyString);
+    DELETEZ(pEmptyOUString);
 }
 
 //------------------------------------------------------------------------
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 47ed6e9..0aa891a 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -52,7 +52,7 @@ using ::mdds::matrix_element_t;
 
 namespace {
 
-typedef ::mdds::mixed_type_matrix<String, sal_uInt8> MatrixImplType;
+typedef ::mdds::mixed_type_matrix< ::rtl::OUString, sal_uInt8> MatrixImplType;
 
 struct ElemEqual : public unary_function<double, bool>
 {
@@ -194,8 +194,8 @@ public:
     void SetErrorAtInterpreter( sal_uInt16 nError ) const;
     void PutDouble(double fVal, SCSIZE nC, SCSIZE nR);
     void PutDouble( double fVal, SCSIZE nIndex);
-    void PutString(const String& rStr, SCSIZE nC, SCSIZE nR);
-    void PutString(const String& rStr, SCSIZE nIndex);
+    void PutString(const ::rtl::OUString& rStr, SCSIZE nC, SCSIZE nR);
+    void PutString(const ::rtl::OUString& rStr, SCSIZE nIndex);
 
     void PutEmpty(SCSIZE nC, SCSIZE nR);
     void PutEmptyPath(SCSIZE nC, SCSIZE nR);
@@ -204,9 +204,9 @@ public:
     sal_uInt16 GetError( SCSIZE nC, SCSIZE nR) const;
     double GetDouble(SCSIZE nC, SCSIZE nR) const;
     double GetDouble( SCSIZE nIndex) const;
-    const String& GetString(SCSIZE nC, SCSIZE nR) const;
-    const String& GetString( SCSIZE nIndex) const;
-    String GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const;
+    const ::rtl::OUString& GetString(SCSIZE nC, SCSIZE nR) const;
+    const ::rtl::OUString& GetString( SCSIZE nIndex) const;
+    ::rtl::OUString GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const;
     ScMatrixValue Get(SCSIZE nC, SCSIZE nR) const;
     bool IsString( SCSIZE nIndex ) const;
     bool IsString( SCSIZE nC, SCSIZE nR ) const;
@@ -351,17 +351,17 @@ void ScMatrixImpl::PutDouble( double fVal, SCSIZE nIndex)
     PutDouble(fVal, nC, nR);
 }
 
-void ScMatrixImpl::PutString(const String& rStr, SCSIZE nC, SCSIZE nR)
+void ScMatrixImpl::PutString(const ::rtl::OUString& rStr, SCSIZE nC, SCSIZE nR)
 {
     if (ValidColRow( nC, nR))
-        maMat.set_string(nR, nC, new String(rStr));
+        maMat.set_string(nR, nC, new ::rtl::OUString(rStr));
     else
     {
         OSL_FAIL("ScMatrixImpl::PutString: dimension error");
     }
 }
 
-void ScMatrixImpl::PutString(const String& rStr, SCSIZE nIndex)
+void ScMatrixImpl::PutString(const ::rtl::OUString& rStr, SCSIZE nIndex)
 {
     SCSIZE nC, nR;
     CalcPosition(nIndex, nC, nR);
@@ -450,7 +450,7 @@ double ScMatrixImpl::GetDouble( SCSIZE nIndex) const
     return GetDouble(nC, nR);
 }
 
-const String& ScMatrixImpl::GetString(SCSIZE nC, SCSIZE nR) const
+const ::rtl::OUString& ScMatrixImpl::GetString(SCSIZE nC, SCSIZE nR) const
 {
     if (ValidColRowOrReplicated( nC, nR ))
     {
@@ -459,7 +459,7 @@ const String& ScMatrixImpl::GetString(SCSIZE nC, SCSIZE nR) const
             case ::mdds::element_string:
                 return *maMat.get_string(nR, nC);
             case ::mdds::element_empty:
-                return ScGlobal::GetEmptyString();
+                return EMPTY_OUSTRING;
             default:
                 SetErrorAtInterpreter( GetError(nC, nR));
                 OSL_FAIL("ScMatrixImpl::GetString: access error, no string");
@@ -469,22 +469,22 @@ const String& ScMatrixImpl::GetString(SCSIZE nC, SCSIZE nR) const
     {
         OSL_FAIL("ScMatrixImpl::GetString: dimension error");
     }
-    return ScGlobal::GetEmptyString();
+    return EMPTY_OUSTRING;
 }
 
-const String& ScMatrixImpl::GetString( SCSIZE nIndex) const
+const ::rtl::OUString& ScMatrixImpl::GetString( SCSIZE nIndex) const
 {
     SCSIZE nC, nR;
     CalcPosition(nIndex, nC, nR);
     return GetString(nC, nR);
 }
 
-String ScMatrixImpl::GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const
+::rtl::OUString ScMatrixImpl::GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const
 {
     if (!ValidColRowOrReplicated( nC, nR ))
     {
         OSL_FAIL("ScMatrixImpl::GetString: dimension error");
-        return String();
+        return ::rtl::OUString();
     }
 
     if (IsString( nC, nR))
@@ -493,7 +493,7 @@ String ScMatrixImpl::GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE
         {   // result of empty FALSE jump path
             sal_uLong nKey = rFormatter.GetStandardFormat( NUMBERFORMAT_LOGICAL,
                     ScGlobal::eLnge);
-            String aStr;
+            ::rtl::OUString aStr;
             Color* pColor = NULL;
             rFormatter.GetOutputString( 0.0, nKey, aStr, &pColor);
             return aStr;
@@ -511,7 +511,7 @@ String ScMatrixImpl::GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE
     double fVal= GetDouble( nC, nR);
     sal_uLong nKey = rFormatter.GetStandardFormat( NUMBERFORMAT_NUMBER,
             ScGlobal::eLnge);
-    String aStr;
+    ::rtl::OUString aStr;
     rFormatter.GetInputLineString( fVal, nKey, aStr);
     return aStr;
 }
@@ -1010,12 +1010,12 @@ void ScMatrix::PutDouble( double fVal, SCSIZE nIndex)
     pImpl->PutDouble(fVal, nIndex);
 }
 
-void ScMatrix::PutString(const String& rStr, SCSIZE nC, SCSIZE nR)
+void ScMatrix::PutString(const ::rtl::OUString& rStr, SCSIZE nC, SCSIZE nR)
 {
     pImpl->PutString(rStr, nC, nR);
 }
 
-void ScMatrix::PutString(const String& rStr, SCSIZE nIndex)
+void ScMatrix::PutString(const ::rtl::OUString& rStr, SCSIZE nIndex)
 {
     pImpl->PutString(rStr, nIndex);
 }
@@ -1055,17 +1055,17 @@ double ScMatrix::GetDouble( SCSIZE nIndex) const
     return pImpl->GetDouble(nIndex);
 }
 
-const String& ScMatrix::GetString(SCSIZE nC, SCSIZE nR) const
+const ::rtl::OUString& ScMatrix::GetString(SCSIZE nC, SCSIZE nR) const
 {
     return pImpl->GetString(nC, nR);
 }
 
-const String& ScMatrix::GetString( SCSIZE nIndex) const
+const ::rtl::OUString& ScMatrix::GetString( SCSIZE nIndex) const
 {
     return pImpl->GetString(nIndex);
 }
 
-String ScMatrix::GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const
+::rtl::OUString ScMatrix::GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const
 {
     return pImpl->GetString(rFormatter, nC, nR);
 }


More information about the Libreoffice-commits mailing list