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

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Aug 16 16:10:35 UTC 2017


 sc/source/core/data/column4.cxx |   29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

New commits:
commit b06c374a3f2acbd1412bb195fc424ff3ce64d8b2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Aug 16 16:03:51 2017 +0200

    add formula cells/groups to the cache
    
    Change-Id: I04a8055f4df27a080291362ef31ccf559fa709cf
    Reviewed-on: https://gerrit.libreoffice.org/41219
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index ee1324cf6651..8ded9168246d 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1689,7 +1689,34 @@ public:
             break;
             case sc::element_type_formula:
             {
-                mrStrm.WriteUChar(2);
+                mrStrm.WriteUChar(3);
+                sc::formula_block::const_iterator it = sc::formula_block::begin(*node.data);
+                std::advance(it, nOffset);
+                sc::formula_block::const_iterator itEnd = it;
+                std::advance(itEnd, nDataSize);
+
+                for (; it != itEnd; /* incrementing throug std::advance*/)
+                {
+                    const ScFormulaCell* pCell = *it;
+                    OUString aFormula;
+                    pCell->GetFormula(aFormula, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
+                    auto xCellGroup = pCell->GetCellGroup();
+                    sal_uInt64 nGroupLength = 0;
+                    if (xCellGroup)
+                    {
+                        nGroupLength = xCellGroup->mnLength;
+                    }
+                    else
+                    {
+                        nGroupLength = 1;
+                    }
+                    mrStrm.WriteUInt64(nGroupLength);
+                    mrStrm.WriteInt32(aFormula.getLength());
+                    mrStrm.WriteCharPtr(OUStringToOString(aFormula, RTL_TEXTENCODING_UTF8).getStr());
+
+                    // incrementing the iterator
+                    std::advance(it, nGroupLength);
+                }
             }
             break;
         }


More information about the Libreoffice-commits mailing list