[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/qa sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Tue Mar 19 21:20:42 PDT 2013


 sc/qa/unit/helper/csv_handler.hxx |    2 +-
 sc/source/ui/docshell/docsh.cxx   |   18 ++++++++----------
 sc/source/ui/docshell/docsh8.cxx  |   21 +++++++++------------
 sc/source/ui/unoobj/cellsuno.cxx  |    2 +-
 4 files changed, 19 insertions(+), 24 deletions(-)

New commits:
commit ee23d04f6a173f1cc8a04fd6ca58099d17a5f1d0
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Mar 20 00:22:38 2013 -0400

    More on reducing the ScBaseCell usage. That's it for today.
    
    Change-Id: Ie35681e62a4ebcd792fd2f4dd62b5c4b8e4db49c

diff --git a/sc/qa/unit/helper/csv_handler.hxx b/sc/qa/unit/helper/csv_handler.hxx
index 7fe94ff..e23efb1 100644
--- a/sc/qa/unit/helper/csv_handler.hxx
+++ b/sc/qa/unit/helper/csv_handler.hxx
@@ -51,7 +51,7 @@ rtl::OUString getConditionalFormatString(ScDocument* pDoc, SCCOL nCol, SCROW nRo
     const ScPatternAttr* pPattern = pDoc->GetPattern(nCol, nRow, nTab);
     SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
     sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
-    ScCellFormat::GetString( pCell, nFormat, aString, &pColor, *pFormatter);
+    aString = ScCellFormat::GetString(*pDoc, ScAddress(nCol, nRow, nTab), nFormat, &pColor, *pFormatter);
     return aString;
 }
 
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 67ae652..77b8ab6 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -1874,6 +1874,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
             nNextCol = nCol + 1;
 
         CellType eType = pCell->GetCellType();
+        ScAddress aPos(nCol, nRow, nTab);
         if ( bTabProtect )
         {
             const ScProtectionAttr* pProtAttr =
@@ -1907,12 +1908,11 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
                     }
                     else if ( ((ScFormulaCell*)pCell)->IsValue() )
                     {
-                        sal_uInt32 nFormat;
-                        aDocument.GetNumberFormat( nCol, nRow, nTab, nFormat );
+                        sal_uInt32 nFormat = aDocument.GetNumberFormat(aPos);
                         if ( bFixedWidth || bSaveAsShown )
                         {
                             Color* pDummy;
-                            ScCellFormat::GetString( pCell, nFormat, aString, &pDummy, rFormatter );
+                            aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter);
                             bString = bSaveAsShown && rFormatter.IsTextFormat( nFormat);
                         }
                         else
@@ -1925,10 +1925,9 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
                     {
                         if ( bSaveAsShown )
                         {
-                            sal_uInt32 nFormat;
-                            aDocument.GetNumberFormat( nCol, nRow, nTab, nFormat );
+                            sal_uInt32 nFormat = aDocument.GetNumberFormat(aPos);
                             Color* pDummy;
-                            ScCellFormat::GetString( pCell, nFormat, aString, &pDummy, rFormatter );
+                            aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter);
                         }
                         else
                             aString = ((ScFormulaCell*)pCell)->GetString();
@@ -1939,10 +1938,9 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
             case CELLTYPE_STRING :
                 if ( bSaveAsShown )
                 {
-                    sal_uInt32 nFormat;
-                    aDocument.GetNumberFormat( nCol, nRow, nTab, nFormat );
+                    sal_uInt32 nFormat = aDocument.GetNumberFormat(aPos);
                     Color* pDummy;
-                    ScCellFormat::GetString( pCell, nFormat, aString, &pDummy, rFormatter );
+                    aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter);
                 }
                 else
                     aString = ((ScStringCell*)pCell)->GetString();
@@ -1964,7 +1962,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
                     if ( bFixedWidth || bSaveAsShown )
                     {
                         Color* pDummy;
-                        ScCellFormat::GetString( pCell, nFormat, aString, &pDummy, rFormatter );
+                        aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter);
                         bString = bSaveAsShown && rFormatter.IsTextFormat( nFormat);
                     }
                     else
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 40c4a0f..e17b8c4 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -768,14 +768,13 @@ inline void lcl_getLongVarCharEditString( rtl::OUString& rString,
     rString = rEditEngine.GetText( LINEEND_CRLF );
 }
 
-inline void lcl_getLongVarCharString( rtl::OUString& rString, ScBaseCell* pCell,
-        ScDocument& rDocument, SCCOL nCol, SCROW nRow, SCTAB nTab,
-        SvNumberFormatter& rNumFmt )
+inline void lcl_getLongVarCharString(
+    OUString& rString, ScDocument& rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, SvNumberFormatter& rNumFmt )
 {
-    sal_uInt32 nFormat;
     Color* pColor;
-    rDocument.GetNumberFormat( nCol, nRow, nTab, nFormat );
-    ScCellFormat::GetString( pCell, nFormat, rString, &pColor, rNumFmt );
+    ScAddress aPos(nCol, nRow, nTab);
+    sal_uInt32 nFormat = rDoc.GetNumberFormat(aPos);
+    rString = ScCellFormat::GetString(rDoc, aPos, nFormat, &pColor, rNumFmt);
 }
 
 }
@@ -981,9 +980,8 @@ sal_uLong ScDocShell::DBaseExport( const rtl::OUString& rFullFileName, CharSet e
                                 }
                                 else
                                 {
-                                    lcl_getLongVarCharString( aString, pCell,
-                                            aDocument, nDocCol, nDocRow, nTab,
-                                            *pNumFmt);
+                                    lcl_getLongVarCharString(
+                                        aString, aDocument, nDocCol, nDocRow, nTab, *pNumFmt);
                                 }
                                 xRowUpdate->updateString( nCol+1, aString );
                             }
@@ -1095,9 +1093,8 @@ sal_uLong ScDocShell::DBaseExport( const rtl::OUString& rFullFileName, CharSet e
                                     lcl_getLongVarCharEditString( aString,
                                             pCell, aEditEngine);
                                 else
-                                    lcl_getLongVarCharString( aString,
-                                            pCell, aDocument, nDocCol,
-                                            nDocRow, nTab, *pNumFmt);
+                                    lcl_getLongVarCharString(
+                                        aString, aDocument, nDocCol, nDocRow, nTab, *pNumFmt);
                             }
                         }
                         break;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index cfd864a..ab082b5 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6273,7 +6273,7 @@ String ScCellObj::GetOutputString_Impl(ScDocument* pDoc, const ScAddress& aCellP
                 //  wie in GetString am Dokument (column)
                 Color* pColor;
                 sal_uLong nNumFmt = pDoc->GetNumberFormat( aCellPos );
-                ScCellFormat::GetString( pCell, nNumFmt, aVal, &pColor, *pDoc->GetFormatTable() );
+                aVal = ScCellFormat::GetString(*pDoc, aCellPos, nNumFmt, &pColor, *pDoc->GetFormatTable());
             }
         }
     }


More information about the Libreoffice-commits mailing list