[Libreoffice-commits] .: Branch 'feature/gsoc-calc-perf2' - sc/source

Daniel Bankston dbank at kemper.freedesktop.org
Wed Jul 11 15:37:08 PDT 2012


 sc/source/filter/xml/xmlcelli.cxx |   29 ++++++++++++++++++-----------
 sc/source/filter/xml/xmlcelli.hxx |    8 ++++----
 2 files changed, 22 insertions(+), 15 deletions(-)

New commits:
commit 1d6d2a56abfd28ff2e16855bdbaf7e64e17e92a4
Author: Daniel Bankston <daniel.e.bankston at gmail.com>
Date:   Wed Jul 11 17:33:25 2012 -0500

    ODS Import: Improve method names and comments
    
    -EndElement used to be very long method that I broke into sub-methods.
     Some of these method names were possibly misleading so changed them to
     better reflect their intent.
    -I added and improved comments in this area too.
    
    Change-Id: I290c74362aff268b5e153a67dc9145965341cb9d

diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 1662e05..e0807cf 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -753,10 +753,12 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
     }
 }
 
-void ScXMLTableRowCellContext::AddTextCellToDoc( const ScAddress& rCurrentPos,
+void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos,
         const SCCOL nCurrentCol, const ::boost::optional< rtl::OUString >& pOUText )
 {
     bool bDoIncrement = true;
+    //matrix reference cells that contain text formula results;
+    //cell was already put in document, just need to set text here.
     if( rXMLImport.GetTables().IsPartOfMatrix(rCurrentPos) )
     {
         ScBaseCell* pCell = rXMLImport.GetDocument()->GetCell( rCurrentPos );
@@ -775,7 +777,7 @@ void ScXMLTableRowCellContext::AddTextCellToDoc( const ScAddress& rCurrentPos,
             pFCell->ResetDirty();
         }
     }
-    else
+    else //regular text cells
     {
         ScBaseCell* pNewCell = NULL;
         ScDocument* pDoc = rXMLImport.GetDocument();
@@ -798,8 +800,10 @@ void ScXMLTableRowCellContext::AddTextCellToDoc( const ScAddress& rCurrentPos,
         rXMLImport.ProgressBarIncrement(false);
 }
 
-void ScXMLTableRowCellContext::AddNumberCellToDoc( const ScAddress& rCurrentPos )
+void ScXMLTableRowCellContext::PutValueCell( const ScAddress& rCurrentPos )
 {
+    //matrix reference cells that contain value formula results;
+    //cell was already put in document, just need to set value here.
     if( rXMLImport.GetTables().IsPartOfMatrix(rCurrentPos) )
     {
         ScBaseCell* pCell = rXMLImport.GetDocument()->GetCell( rCurrentPos );
@@ -809,7 +813,7 @@ void ScXMLTableRowCellContext::AddNumberCellToDoc( const ScAddress& rCurrentPos
             SetFormulaCell(pFCell);
         }
     }
-    else
+    else  //regular value cell
     {
         // #i62435# Initialize the value cell's script type
         // if the default style's number format is latin-only.
@@ -836,7 +840,7 @@ bool isEmptyOrNote( ScDocument* pDoc, const ScAddress& rCurrentPos )
 
 }
 
-void ScXMLTableRowCellContext::AddCellsToTable( const ScAddress& rCellPos,
+void ScXMLTableRowCellContext::AddTextAndValueCells( const ScAddress& rCellPos,
         const ::boost::optional< rtl::OUString >& pOUText, ScAddress& rCurrentPos )
 {
     ScMyTables& rTables = rXMLImport.GetTables();
@@ -864,7 +868,7 @@ void ScXMLTableRowCellContext::AddCellsToTable( const ScAddress& rCellPos,
                         {
                             case util::NumberFormat::TEXT:
                             {
-                                AddTextCellToDoc( rCurrentPos, i, pOUText );
+                                PutTextCell( rCurrentPos, i, pOUText );
                             }
                             break;
                             case util::NumberFormat::NUMBER:
@@ -875,7 +879,7 @@ void ScXMLTableRowCellContext::AddCellsToTable( const ScAddress& rCellPos,
                             case util::NumberFormat::DATETIME:
                             case util::NumberFormat::LOGICAL:
                             {
-                                AddNumberCellToDoc( rCurrentPos );
+                                PutValueCell( rCurrentPos );
                             }
                             break;
                             default:
@@ -988,7 +992,7 @@ void ScXMLTableRowCellContext::AddNonFormulaCells( const ScAddress& rCellPos )
     if( HasSpecialContent() )
         bIsEmpty = false;
 
-    AddCellsToTable( rCellPos, pOUText, aCurrentPos );
+    AddTextAndValueCells( rCellPos, pOUText, aCurrentPos );
 
     if( CellsAreRepeated() )
     {
@@ -1007,7 +1011,7 @@ void ScXMLTableRowCellContext::AddNonFormulaCells( const ScAddress& rCellPos )
     }
 }
 
-void ScXMLTableRowCellContext::AddNonMatrixFormulaCell( const ScAddress& rCellPos )
+void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
 {
     ScDocument* pDoc = rXMLImport.GetDocument();
 
@@ -1071,20 +1075,23 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos )
         {
             if (nMatrixCols > 0 && nMatrixRows > 0)
             {
+                //matrix cells are put in the document, but we must set the
+                //value/text of each matrix cell later
                 rXMLImport.GetTables().AddMatrixRange(
                         rCellPos.Col(), rCellPos.Row(),
                         rCellPos.Col() + nMatrixCols - 1,
                         rCellPos.Row() + nMatrixRows - 1,
                         pOUFormula->first, pOUFormula->second, eGrammar);
 
-                //add the cached formula result of the first matrix position
+                //set the value/text of the first matrix position (top-left).
+                //the value/text of the matrix reference cells will be set later.
                 ScFormulaCell* pFCell =
                     static_cast<ScFormulaCell*>( rXMLImport.GetDocument()->GetCell(rCellPos) );
                 SetFormulaCell(pFCell);
             }
         }
         else
-            AddNonMatrixFormulaCell( rCellPos );
+            PutFormulaCell( rCellPos );
 
         SetAnnotation( rCellPos );
         SetDetectiveObj( rCellPos );
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index 9b038c6..b16eff5 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -92,13 +92,13 @@ class ScXMLTableRowCellContext : public SvXMLImportContext
     bool CellsAreRepeated() const;
 
     void SetFormulaCell             ( ScFormulaCell* pFCell ) const;
-    void AddTextCellToDoc           ( const ScAddress& rScCurrentPos, const SCCOL nCurrentCol,
+    void PutTextCell                ( const ScAddress& rScCurrentPos, const SCCOL nCurrentCol,
                                       const ::boost::optional< rtl::OUString >& pOUText );
-    void AddNumberCellToDoc         ( const ScAddress& rScCurrentPos );
-    void AddCellsToTable            ( const ScAddress& rScCellPos,
+    void PutValueCell               ( const ScAddress& rScCurrentPos );
+    void AddTextAndValueCells       ( const ScAddress& rScCellPos,
                                       const ::boost::optional< rtl::OUString >& pOUText, ScAddress& rScCurrentPos );
     void AddNonFormulaCells         ( const ScAddress& rScCellPos );
-    void AddNonMatrixFormulaCell    ( const ScAddress& rScCurrentPos );
+    void PutFormulaCell             ( const ScAddress& rScCurrentPos );
     void AddFormulaCell             ( const ScAddress& rScCellPos );
 
 public:


More information about the Libreoffice-commits mailing list