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

Kohei Yoshida kohei.yoshida at gmail.com
Tue Mar 26 15:20:44 PDT 2013


 sc/inc/dociter.hxx                 |    7 ++++---
 sc/source/core/data/dociter.cxx    |   15 ++++++++++++---
 sc/source/filter/excel/xetable.cxx |   29 ++++++++++++-----------------
 sc/source/filter/inc/xetable.hxx   |    7 +++----
 4 files changed, 31 insertions(+), 27 deletions(-)

New commits:
commit f40fc0bf4e8d2050c030fcf41cf6db2947798c81
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Mar 26 18:20:20 2013 -0400

    Take care of xetable.?xx.
    
    Change-Id: I00e57ca172ba41733d39aa5025c3f0a6f1de755d

diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index acb31e2..b50c68a 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -527,7 +527,7 @@ private:
 
     SCCOL                   nCellCol;
     SCROW                   nCellRow;
-    const ScBaseCell*       pCell;
+    ScBaseCell*             pCell;
     SCCOL                   nAttrCol1;
     SCCOL                   nAttrCol2;
     SCROW                   nAttrRow;
@@ -537,7 +537,8 @@ private:
     SCCOL                   nFoundEndCol;
     SCROW                   nFoundRow;
     const ScPatternAttr*    pFoundPattern;
-    const ScBaseCell*       pFoundCell;
+
+    ScRefCellValue maFoundCell;
 
 public:
             ScUsedAreaIterator( ScDocument* pDocument, SCTAB nTable,
@@ -550,7 +551,7 @@ public:
     SCCOL                   GetEndCol() const       { return nFoundEndCol; }
     SCROW                   GetRow() const          { return nFoundRow; }
     const ScPatternAttr*    GetPattern() const      { return pFoundPattern; }
-    const ScBaseCell*       GetCell() const         { return pFoundCell; }
+    const ScRefCellValue&   GetCell() const;
 };
 
 class ScRowBreakIterator
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 87b832d..8cfa1eb 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -2206,7 +2206,7 @@ bool ScUsedAreaIterator::GetNext()
     {
         if ( IsGreater( nCellCol, nCellRow, nAttrCol1, nAttrRow ) ) // Only attributes at the beginning?
         {
-            pFoundCell = NULL;
+            maFoundCell.clear();
             pFoundPattern = pPattern;
             nFoundRow = nAttrRow;
             nFoundStartCol = nAttrCol1;
@@ -2231,7 +2231,7 @@ bool ScUsedAreaIterator::GetNext()
     }
     else if ( pPattern ) // Just attributes -> take over right away
     {
-        pFoundCell = NULL;
+        maFoundCell.clear();
         pFoundPattern = pPattern;
         nFoundRow = nAttrRow;
         nFoundStartCol = nAttrCol1;
@@ -2242,7 +2242,11 @@ bool ScUsedAreaIterator::GetNext()
 
     if ( bUseCell ) // Cell position
     {
-        pFoundCell = pCell;
+        if (pCell)
+            maFoundCell.assign(*pCell);
+        else
+            maFoundCell.clear();
+
         nFoundRow = nCellRow;
         nFoundStartCol = nFoundEndCol = nCellCol;
     }
@@ -2256,6 +2260,11 @@ bool ScUsedAreaIterator::GetNext()
     return bFound;
 }
 
+const ScRefCellValue& ScUsedAreaIterator::GetCell() const
+{
+    return maFoundCell;
+}
+
 //-------------------------------------------------------------------------------
 
 ScDocAttrIterator::ScDocAttrIterator(ScDocument* pDocument, SCTAB nTable,
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index e71cfcd..06e70bb 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -643,25 +643,24 @@ IMPL_FIXEDMEMPOOL_NEWDEL( XclExpLabelCell )
 
 XclExpLabelCell::XclExpLabelCell(
         const XclExpRoot& rRoot, const XclAddress& rXclPos,
-        const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId, const ScStringCell& rCell ) :
+        const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId, const OUString& rStr ) :
     XclExpSingleCellBase( EXC_ID3_LABEL, 0, rXclPos, nForcedXFId )
 {
     sal_uInt16 nMaxLen = (rRoot.GetBiff() == EXC_BIFF8) ? EXC_STR_MAXLEN : EXC_LABEL_MAXLEN;
     XclExpStringRef xText = XclExpStringHelper::CreateCellString(
-        rRoot, rCell.GetString(), pPattern, EXC_STR_DEFAULT, nMaxLen );
+        rRoot, rStr, pPattern, EXC_STR_DEFAULT, nMaxLen);
     Init( rRoot, pPattern, xText );
 }
 
 XclExpLabelCell::XclExpLabelCell(
         const XclExpRoot& rRoot, const XclAddress& rXclPos,
         const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
-        const ScEditCell& rCell, XclExpHyperlinkHelper& rLinkHelper ) :
+        const EditTextObject* pEditText, XclExpHyperlinkHelper& rLinkHelper ) :
     XclExpSingleCellBase( EXC_ID3_LABEL, 0, rXclPos, nForcedXFId )
 {
     sal_uInt16 nMaxLen = (rRoot.GetBiff() == EXC_BIFF8) ? EXC_STR_MAXLEN : EXC_LABEL_MAXLEN;
 
     XclExpStringRef xText;
-    const EditTextObject* pEditText = rCell.GetData();
     if (pEditText)
         xText = XclExpStringHelper::CreateCellString(
             rRoot, *pEditText, pPattern, rLinkHelper, EXC_STR_DEFAULT, nMaxLen);
@@ -2301,7 +2300,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
         XclAddress aXclPos( static_cast< sal_uInt16 >( nScCol ), static_cast< sal_uInt32 >( nScRow ) );
         sal_uInt16 nLastXclCol = static_cast< sal_uInt16 >( nLastScCol );
 
-        const ScBaseCell* pScCell = aIt.GetCell();
+        const ScRefCellValue& rScCell = aIt.GetCell();
         XclExpCellRef xCell;
 
         const ScPatternAttr* pPattern = aIt.GetPattern();
@@ -2324,12 +2323,11 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
 
         String aAddNoteText;    // additional text to be appended to a note
 
-        CellType eCellType = pScCell ? pScCell->GetCellType() : CELLTYPE_NONE;
-        switch( eCellType )
+        switch (rScCell.meType)
         {
             case CELLTYPE_VALUE:
             {
-                double fValue = static_cast< const ScValueCell* >( pScCell )->GetValue();
+                double fValue = rScCell.mfValue;
 
                 // try to create a Boolean cell
                 if( pPattern && ((fValue == 0.0) || (fValue == 1.0)) )
@@ -2355,18 +2353,16 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
 
             case CELLTYPE_STRING:
             {
-                const ScStringCell& rScStrCell = *static_cast< const ScStringCell* >( pScCell );
-                xCell.reset( new XclExpLabelCell(
-                    GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScStrCell ) );
+                xCell.reset(new XclExpLabelCell(
+                    GetRoot(), aXclPos, pPattern, nMergeBaseXFId, *rScCell.mpString));
             }
             break;
 
             case CELLTYPE_EDIT:
             {
-                const ScEditCell& rScEditCell = *static_cast< const ScEditCell* >( pScCell );
                 XclExpHyperlinkHelper aLinkHelper( GetRoot(), aScPos );
-                xCell.reset( new XclExpLabelCell(
-                    GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScEditCell, aLinkHelper ) );
+                xCell.reset(new XclExpLabelCell(
+                    GetRoot(), aXclPos, pPattern, nMergeBaseXFId, rScCell.mpEditText, aLinkHelper));
 
                 // add a single created HLINK record to the record list
                 if( aLinkHelper.HasLinkRecord() )
@@ -2379,10 +2375,9 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
 
             case CELLTYPE_FORMULA:
             {
-                const ScFormulaCell& rScFmlaCell = *static_cast< const ScFormulaCell* >( pScCell );
-                xCell.reset( new XclExpFormulaCell(
+                xCell.reset(new XclExpFormulaCell(
                     GetRoot(), aXclPos, pPattern, nMergeBaseXFId,
-                    rScFmlaCell, maArrayBfr, maShrfmlaBfr, maTableopBfr ) );
+                    *rScCell.mpFormula, maArrayBfr, maShrfmlaBfr, maTableopBfr));
             }
             break;
 
diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index 3a2ec38..655d6ea 100644
--- a/sc/source/filter/inc/xetable.hxx
+++ b/sc/source/filter/inc/xetable.hxx
@@ -399,9 +399,8 @@ private:
     bool                mbValue;        /// The cell value.
 };
 
-class ScStringCell;
-class ScEditCell;
 class XclExpHyperlinkHelper;
+class EditTextObject;
 
 /** Represents a text cell record.
 
@@ -417,12 +416,12 @@ public:
     /** Constructs the record from an unformatted Calc string cell. */
     explicit            XclExpLabelCell( const XclExpRoot& rRoot, const XclAddress& rXclPos,
                             const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
-                            const ScStringCell& rCell );
+                            const OUString& rStr );
 
     /** Constructs the record from a formatted Calc edit cell. */
     explicit            XclExpLabelCell( const XclExpRoot& rRoot, const XclAddress& rXclPos,
                             const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
-                            const ScEditCell& rCell, XclExpHyperlinkHelper& rHlinkHelper );
+                            const EditTextObject* pEditText, XclExpHyperlinkHelper& rHlinkHelper );
 
     /** Returns true if the cell contains multi-line text. */
     virtual bool        IsMultiLineText() const;


More information about the Libreoffice-commits mailing list