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

Kohei Yoshida kohei.yoshida at gmail.com
Thu Mar 21 21:08:20 PDT 2013


 sc/inc/document.hxx              |    1 
 sc/source/core/data/document.cxx |    4 +++
 sc/source/filter/rtf/rtfexp.cxx  |   50 +++++++++++++++++----------------------
 3 files changed, 27 insertions(+), 28 deletions(-)

New commits:
commit f1dbc180d1f12a45b9d0b6eb60c2bcb71a34c4f4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Mar 22 00:10:15 2013 -0400

    Remove direct use of ScBaseCell.
    
    Change-Id: I6b36e2f16ab76c146572f36393aaa0e3df951d7a

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 5f0a681..783281e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -836,6 +836,7 @@ public:
     SC_DLLPUBLIC bool           HasData( SCCOL nCol, SCROW nRow, SCTAB nTab );
     SC_DLLPUBLIC bool           HasStringData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
     SC_DLLPUBLIC bool           HasValueData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
+    SC_DLLPUBLIC bool HasValueData( const ScAddress& rPos ) const;
     bool            HasStringCells( const ScRange& rRange ) const;
 
     /** Returns true, if there is any data to create a selection list for rPos. */
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 47075a1..d5ceb08 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3344,6 +3344,10 @@ bool ScDocument::HasValueData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
         return false;
 }
 
+bool ScDocument::HasValueData( const ScAddress& rPos ) const
+{
+    return HasValueData(rPos.Col(), rPos.Row(), rPos.Tab());
+}
 
 bool ScDocument::HasStringCells( const ScRange& rRange ) const
 {
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index 14c9b21..0e19de0 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -37,7 +37,6 @@
 #include "document.hxx"
 #include "patattr.hxx"
 #include "attrib.hxx"
-#include "cell.hxx"
 #include "cellform.hxx"
 #include "editutil.hxx"
 #include "stlpool.hxx"
@@ -173,40 +172,35 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol )
         return ;
     }
 
-    ScBaseCell* pCell;
-    pDoc->GetCell( nCol, nRow, nTab, pCell );
-    sal_Bool bValueData;
-    rtl::OUString aContent;
-    if ( pCell )
+    bool bValueData = false;
+    OUString aContent;
+    ScAddress aPos(nCol, nRow, nTab);
+    switch (pDoc->GetCellType(aPos))
     {
-        switch ( pCell->GetCellType() )
+        case CELLTYPE_NOTE:
+        case CELLTYPE_NONE:
+            bValueData = false;
+        break;
+        case CELLTYPE_EDIT:
         {
-            case CELLTYPE_NOTE :
-                bValueData = false;
-            break;      // nix
-            case CELLTYPE_EDIT :
+            bValueData = false;
+            const EditTextObject* pObj = pDoc->GetEditText(aPos);
+            if (pObj)
             {
-                bValueData = false;
                 EditEngine& rEngine = GetEditEngine();
-                const EditTextObject* pObj = static_cast<const ScEditCell*>(pCell)->GetData();
-                if ( pObj )
-                {
-                    rEngine.SetText( *pObj );
-                    aContent = rEngine.GetText( LINEEND_LF );   // LineFeed zwischen Absaetzen!
-                }
-            }
-            break;
-            default:
-            {
-                bValueData = pCell->HasValueData();
-                sal_uLong nFormat = pAttr->GetNumberFormat( pFormatter );
-                Color* pColor;
-                ScCellFormat::GetString( pCell, nFormat, aContent, &pColor, *pFormatter );
+                rEngine.SetText(*pObj);
+                aContent = rEngine.GetText(LINEEND_LF);   // LineFeed zwischen Absaetzen!
             }
         }
+        break;
+        default:
+        {
+            bValueData = pDoc->HasValueData(aPos);
+            sal_uLong nFormat = pAttr->GetNumberFormat(pFormatter);
+            Color* pColor;
+            aContent = ScCellFormat::GetString(*pDoc, aPos, nFormat, &pColor, *pFormatter);
+        }
     }
-    else
-        bValueData = false;
 
     sal_Bool bResetPar, bResetAttr;
     bResetPar = bResetAttr = false;


More information about the Libreoffice-commits mailing list