[Libreoffice-commits] core.git: sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Wed Apr 19 01:07:23 UTC 2017


 sc/inc/formulacell.hxx              |    4 ++
 sc/source/core/data/formulacell.cxx |   50 ++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)

New commits:
commit e175f9f4393eb3badd763fa5b1cdc5b3aabab0e4
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Apr 18 20:12:58 2017 -0400

    Add Dump() method to ScFormulaCell.
    
    I'm surprised I didn't add one till now.
    
    Change-Id: I36c9257013f92804cecaeefd0778db1d25759c2f
    Reviewed-on: https://gerrit.libreoffice.org/36652
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 148ab9572619..fce0227805e1 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -428,6 +428,10 @@ public:
     bool IsPostponedDirty() const { return mbPostponedDirty;}
 
     void SetIsExtRef() { mbIsExtRef = true; }
+
+#if DUMP_COLUMN_STORAGE
+    void Dump() const;
+#endif
 };
 
 #endif
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 4ee4b6ffb9b3..263f659c3bbe 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -4595,4 +4595,54 @@ void ScFormulaCell::SyncSharedCode()
     pCode = mxGroup->mpCode;
 }
 
+#if DUMP_COLUMN_STORAGE
+
+void ScFormulaCell::Dump() const
+{
+    cout << "-- formula cell (" << aPos.Format(ScRefFlags::VALID | ScRefFlags::TAB_3D, pDocument) << ")" << endl;
+    cout << "  * shared: " << (mxGroup ? "true" : "false") << endl;
+    if (mxGroup)
+    {
+        cout << "    * shared length: " << mxGroup->mnLength << endl;
+        cout << "    * shared calc state: " << mxGroup->meCalcState << endl;
+    }
+
+    sc::TokenStringContext aCxt(pDocument, pDocument->GetGrammar());
+    cout << "  * code: " << pCode->CreateString(aCxt, aPos) << endl;
+
+    FormulaError nErrCode = pCode->GetCodeError();
+    cout << "  * code error: ";
+    if (nErrCode == FormulaError::NONE)
+        cout << "(none)";
+    else
+    {
+        OUString aStr = ScGlobal::GetErrorString(nErrCode);
+        cout << "  * code error: " << aStr << " (" << int(nErrCode) << ")";
+    }
+    cout << endl;
+
+    cout << "  * result: ";
+    sc::FormulaResultValue aRV = aResult.GetResult();
+    switch (aRV.meType)
+    {
+        case sc::FormulaResultValue::Value:
+            cout << aRV.mfValue << " (value)";
+            break;
+        case sc::FormulaResultValue::String:
+            cout << aRV.maString.getString() << " (string)";
+            break;
+        case sc::FormulaResultValue::Error:
+            cout << ScGlobal::GetErrorString(aRV.mnError) << " (error: " << int(aRV.mnError) << ")";
+            break;
+        case sc::FormulaResultValue::Invalid:
+            cout << "(invalid)";
+            break;
+        default:
+            ;
+    }
+    cout << endl;
+}
+
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list