[Libreoffice-commits] core.git: Branch 'private/kohei/calc-shared-string' - 2 commits - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Wed Oct 9 14:52:08 PDT 2013


 sc/source/core/data/column.cxx                         |    2 +-
 sc/source/core/data/column2.cxx                        |   11 +++++++----
 sc/source/filter/excel/excrecds.cxx                    |    5 ++---
 sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx |    5 ++---
 4 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 6370a7d76171703791d647426250ca73880031e9
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 9 17:50:10 2013 -0400

    We are supposed to keep track of max-length string.
    
    Change-Id: I3a0d999f55d89734b26ee66c16cf8cadbcbac246

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index ca9281f..3af1cf9 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -596,6 +596,8 @@ public:
         ScRefCellValue aCell(const_cast<ScFormulaCell*>(p));
         checkLength(aCell);
     }
+
+    const OUString& getMaxLenStr() const { return maMaxLenStr; }
 };
 
 }
@@ -652,6 +654,8 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
             sc::SingleColumnSpanSet::SpansType::const_iterator it = aMarkedSpans.begin(), itEnd = aMarkedSpans.end();
             for (; it != itEnd; ++it)
                 itPos = sc::ParseAllNonEmpty(itPos, maCells, it->mnRow1, it->mnRow2, aFunc);
+
+            aLongStr = aFunc.getMaxLenStr();
         }
 
         if (!aLongStr.isEmpty())
commit 0d89e83d02a887851d8d6e7be5a144b28f7d2f14
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Oct 9 17:46:54 2013 -0400

    Some cleanups to avoid unnecessary getString() calls.
    
    Change-Id: I334d64f7731915d27e3b81781c91e330dc446010

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index bdfb9c5..5270e4c 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1866,7 +1866,7 @@ public:
                 for (; it != itEnd; ++it, ++nRow)
                 {
                     const svl::SharedString& rStr = *it;
-                    if (rStr.getString().isEmpty())
+                    if (rStr.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 f66bd90..ca9281f 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -578,11 +578,10 @@ public:
 
     void operator() (size_t /*nRow*/, const svl::SharedString& rSS)
     {
-        OUString aStr = rSS.getString();
-        if (aStr.getLength() > mnMaxLen)
+        if (rSS.getLength() > mnMaxLen)
         {
-            mnMaxLen = aStr.getLength();
-            maMaxLenStr = aStr;
+            mnMaxLen = rSS.getLength();
+            maMaxLenStr = rSS.getString();
         }
     }
 
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index d7bea0b..232371b 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -721,10 +721,9 @@ bool XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry )
     bool bConflict = false;
     OUString  sText;
     const ScQueryEntry::Item& rItem = rItems[0];
-    OUString aQueryStr = rItem.maString.getString();
-    if (!aQueryStr.isEmpty())
+    if (!rItem.maString.isEmpty())
     {
-        sText = aQueryStr;
+        sText = rItem.maString.getString();
         switch( rEntry.eOp )
         {
             case SC_CONTAINS:
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index 1fd98cd..e7f568c 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -294,12 +294,11 @@ 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);
-    OUString aStr = rCell.mpString->getString();
-    if (!aStr.isEmpty())
+    if (!rCell.mpString->isEmpty())
     {
         SvXMLElementExport aElemP(rExport, XML_NAMESPACE_TEXT, XML_P, true, false);
         bool bPrevCharWasSpace(true);
-        rExport.GetTextParagraphExport()->exportText(aStr, bPrevCharWasSpace);
+        rExport.GetTextParagraphExport()->exportText(rCell.mpString->getString(), bPrevCharWasSpace);
     }
 }
 


More information about the Libreoffice-commits mailing list