sc/inc/calcmacros.hxx | 24 ++ sc/inc/column.hxx | 6 sc/inc/document.hxx | 7 sc/inc/dpcache.hxx | 2 sc/inc/dpfilteredcache.hxx | 2 sc/inc/dpitemdata.hxx | 2 sc/inc/dpmacros.hxx | 23 -- sc/inc/dpnumgroupinfo.hxx | 2 sc/inc/dpobject.hxx | 2 sc/inc/dptabdat.hxx | 2 sc/inc/dptabres.hxx | 2 sc/inc/mtvelements.hxx | 3 sc/inc/pivot.hxx | 2 sc/inc/scmatrix.hxx | 3 sc/inc/table.hxx | 7 sc/qa/unit/data/xls/shared-formula.xls |binary sc/qa/unit/data/xlsx/shared-formula.xlsx |binary sc/qa/unit/filters-test.cxx | 36 ++++ sc/qa/unit/subsequent_filters-test.cxx | 37 ---- sc/qa/unit/ucalc.cxx | 19 ++ sc/source/core/data/column.cxx | 2 sc/source/core/data/column2.cxx | 267 +++++++++++++++++++++++++++---- sc/source/core/data/documen2.cxx | 2 sc/source/core/data/documen9.cxx | 7 sc/source/core/data/document.cxx | 13 + sc/source/core/data/dptabsrc.cxx | 2 sc/source/core/data/formulacell.cxx | 16 + sc/source/core/data/table1.cxx | 12 + sc/source/core/tool/interpr1.cxx | 65 ------- sc/source/core/tool/scmatrix.cxx | 111 ++++++++++++ sc/source/ui/dbgui/fieldwnd.cxx | 2 31 files changed, 494 insertions(+), 186 deletions(-)
New commits: commit bd4c6a7d7521abb0e36ebfba6e14685a1e195be8 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Mon Jul 1 09:02:13 2013 -0400 Fix a crasher on copy to clip. The logical row position equals the top block position plus offset within block, not minus. Change-Id: Ia6376d8e971f9d3379977895d14f97f43c5664ba diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index a224b6f..aa82f4d1 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1276,7 +1276,7 @@ public: void operator() (const sc::CellStoreType::value_type& aNode, size_t nOffset, size_t nDataSize) { - size_t nTopRow = aNode.position - nOffset; + size_t nTopRow = aNode.position + nOffset; switch (aNode.type) { commit add9e14a4a45d29ac7284f9cecf762e3a075a01d Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Jun 28 19:37:50 2013 -0400 Add tests for matrix's min and max values, and fix one bug. Apparently numeric_limits<type>::min() is not to be used for signed types. Change-Id: Ia9730328562905459eb1d3e5cfd1a023c644e219 diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index be470b1..c7eda91 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2562,6 +2562,25 @@ void Test::testMatrix() CPPUNIT_ASSERT_EQUAL(1.5, pMat->GetDouble(0, 1)); CPPUNIT_ASSERT_EQUAL(1.5, pMat->GetDouble(1, 0)); CPPUNIT_ASSERT_MESSAGE("PutEmpty() call failed.", pMat->IsEmpty(1, 1)); + + // Max and min values. + pMat = new ScMatrix(2, 2, 0.0); + pMat->PutDouble(-10, 0, 0); + pMat->PutDouble(-12, 0, 1); + pMat->PutDouble(-8, 1, 0); + pMat->PutDouble(-25, 1, 1); + CPPUNIT_ASSERT_EQUAL(-25.0, pMat->GetMinValue(false)); + CPPUNIT_ASSERT_EQUAL(-8.0, pMat->GetMaxValue(false)); + pMat->PutString("Test", 0, 0); + CPPUNIT_ASSERT_EQUAL(0.0, pMat->GetMaxValue(true)); // text as zero. + CPPUNIT_ASSERT_EQUAL(-8.0, pMat->GetMaxValue(false)); // ignore text. + pMat->PutBoolean(true, 0, 0); + CPPUNIT_ASSERT_EQUAL(1.0, pMat->GetMaxValue(false)); + pMat = new ScMatrix(2, 2, 10.0); + pMat->PutBoolean(false, 0, 0); + pMat->PutDouble(12.5, 1, 1); + CPPUNIT_ASSERT_EQUAL(0.0, pMat->GetMinValue(false)); + CPPUNIT_ASSERT_EQUAL(12.5, pMat->GetMaxValue(false)); } void Test::testEnterMixedMatrix() diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index bf3ea63..b0bef2e 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -940,7 +940,7 @@ public: struct MaxOp { - static double init() { return std::numeric_limits<double>::min(); } + static double init() { return -std::numeric_limits<double>::max(); } static double compare(double left, double right) { return std::max(left, right); commit 58380c11216cb9f03a98e3d53dcee702576fedb8 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Jun 28 17:54:34 2013 -0400 Better to calculate max and min value of matrix *in* the matrix itself. Change-Id: I410b345ac32550a188aa356e133ef8e0e9b13d9f diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index 66b271b..d6ac279 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -349,6 +349,9 @@ public: IterateResult Product(bool bTextAsZero) const; size_t Count(bool bCountStrings) const; + double GetMaxValue( bool bTextAsZero ) const; + double GetMinValue( bool bTextAsZero ) const; + // All other matrix functions MatMult, MInv, ... are in ScInterpreter // to be numerically safe. diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index aa55dcb..9cb89ae 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -3729,39 +3729,7 @@ void ScInterpreter::ScMin( bool bTextAsZero ) { ScMatrixRef pMat = GetMatrix(); if (pMat) - { - SCSIZE nC, nR; - nFuncFmtType = NUMBERFORMAT_NUMBER; - pMat->GetDimensions(nC, nR); - if (pMat->IsNumeric()) - { - for (SCSIZE nMatCol = 0; nMatCol < nC; nMatCol++) - for (SCSIZE nMatRow = 0; nMatRow < nR; nMatRow++) - { - nVal = pMat->GetDouble(nMatCol,nMatRow); - if (nMin > nVal) nMin = nVal; - } - } - else - { - for (SCSIZE nMatCol = 0; nMatCol < nC; nMatCol++) - { - for (SCSIZE nMatRow = 0; nMatRow < nR; nMatRow++) - { - if (!pMat->IsString(nMatCol,nMatRow)) - { - nVal = pMat->GetDouble(nMatCol,nMatRow); - if (nMin > nVal) nMin = nVal; - } - else if ( bTextAsZero ) - { - if ( nMin > 0.0 ) - nMin = 0.0; - } - } - } - } - } + nMin = pMat->GetMinValue(bTextAsZero); } break; case svString : @@ -3855,36 +3823,7 @@ void ScInterpreter::ScMax( bool bTextAsZero ) if (pMat) { nFuncFmtType = NUMBERFORMAT_NUMBER; - SCSIZE nC, nR; - pMat->GetDimensions(nC, nR); - if (pMat->IsNumeric()) - { - for (SCSIZE nMatCol = 0; nMatCol < nC; nMatCol++) - for (SCSIZE nMatRow = 0; nMatRow < nR; nMatRow++) - { - nVal = pMat->GetDouble(nMatCol,nMatRow); - if (nMax < nVal) nMax = nVal; - } - } - else - { - for (SCSIZE nMatCol = 0; nMatCol < nC; nMatCol++) - { - for (SCSIZE nMatRow = 0; nMatRow < nR; nMatRow++) - { - if (!pMat->IsString(nMatCol,nMatRow)) - { - nVal = pMat->GetDouble(nMatCol,nMatRow); - if (nMax < nVal) nMax = nVal; - } - else if ( bTextAsZero ) - { - if ( nMax < 0.0 ) - nMax = 0.0; - } - } - } - } + nMax = pMat->GetMaxValue(bTextAsZero); } } break; diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 26fe7d3..bf3ea63 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -223,6 +223,9 @@ public: ScMatrix::IterateResult Product(bool bTextAsZero) const; size_t Count(bool bCountStrings) const; + double GetMaxValue( bool bTextAsZero ) const; + double GetMinValue( bool bTextAsZero ) const; + #if DEBUG_MATRIX void Dump() const; #endif @@ -935,6 +938,90 @@ public: } }; +struct MaxOp +{ + static double init() { return std::numeric_limits<double>::min(); } + static double compare(double left, double right) + { + return std::max(left, right); + } + + static double boolValue( + mdds::mtv::boolean_element_block::const_iterator it, + mdds::mtv::boolean_element_block::const_iterator itEnd) + { + // If the array has at least one true value, the maximum value is 1. + it = std::find(it, itEnd, true); + return it == itEnd ? 0.0 : 1.0; + } +}; + +struct MinOp +{ + static double init() { return std::numeric_limits<double>::max(); } + static double compare(double left, double right) + { + return std::min(left, right); + } + + static double boolValue( + mdds::mtv::boolean_element_block::const_iterator it, + mdds::mtv::boolean_element_block::const_iterator itEnd) + { + // If the array has at least one false value, the minimum value is 0. + it = std::find(it, itEnd, false); + return it == itEnd ? 1.0 : 0.0; + } +}; + +template<typename _Op> +class CalcMaxMinValue : std::unary_function<MatrixImplType::element_block_type, void> +{ + double mfVal; + bool mbTextAsZero; +public: + CalcMaxMinValue( bool bTextAsZero ) : + mfVal(_Op::init()), + mbTextAsZero(bTextAsZero) {} + + double getValue() const { return mfVal; } + + void operator() (const MatrixImplType::element_block_node_type& node) + { + using namespace mdds::mtv; + + switch (node.type) + { + case mdds::mtm::element_numeric: + { + numeric_element_block::const_iterator it = numeric_element_block::begin(*node.data); + numeric_element_block::const_iterator itEnd = numeric_element_block::end(*node.data); + for (; it != itEnd; ++it) + mfVal = _Op::compare(mfVal, *it); + } + break; + case mdds::mtm::element_boolean: + { + boolean_element_block::const_iterator it = boolean_element_block::begin(*node.data); + boolean_element_block::const_iterator itEnd = boolean_element_block::end(*node.data); + double fVal = _Op::boolValue(it, itEnd); + mfVal = _Op::compare(mfVal, fVal); + } + break; + case mdds::mtm::element_string: + case mdds::mtm::element_empty: + { + // empty elements are treated as empty strings. + if (mbTextAsZero) + mfVal = _Op::compare(mfVal, 0.0); + } + break; + default: + ; + } + } +}; + } ScMatrix::IterateResult ScMatrixImpl::Sum(bool bTextAsZero) const @@ -966,6 +1053,20 @@ size_t ScMatrixImpl::Count(bool bCountStrings) const return aFunc.getCount(); } +double ScMatrixImpl::GetMaxValue( bool bTextAsZero ) const +{ + CalcMaxMinValue<MaxOp> aFunc(bTextAsZero); + maMat.walk(aFunc); + return aFunc.getValue(); +} + +double ScMatrixImpl::GetMinValue( bool bTextAsZero ) const +{ + CalcMaxMinValue<MinOp> aFunc(bTextAsZero); + maMat.walk(aFunc); + return aFunc.getValue(); +} + #if DEBUG_MATRIX void ScMatrixImpl::Dump() const { @@ -1308,6 +1409,16 @@ size_t ScMatrix::Count(bool bCountStrings) const return pImpl->Count(bCountStrings); } +double ScMatrix::GetMaxValue( bool bTextAsZero ) const +{ + return pImpl->GetMaxValue(bTextAsZero); +} + +double ScMatrix::GetMinValue( bool bTextAsZero ) const +{ + return pImpl->GetMinValue(bTextAsZero); +} + #if DEBUG_MATRIX void ScMatrix::Dump() const { commit dfd0b37d82db6cb8f02b48e735cf6caacc2420e4 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Jun 28 16:38:19 2013 -0400 This is not needed. Change-Id: I382b9d485b7bb58656561c4790580c9bc6339889 diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index c4c1409..3d9110b 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -690,9 +690,6 @@ void ScDocument::ApplyAsianEditSettings( ScEditEngineDefaulter& rEngine ) void ScDocument::RebuildFormulaGroups() { - if (!ScInterpreter::GetGlobalConfig().mbOpenCLEnabled) - return; - SCTAB nTab; for (nTab=0; nTab < static_cast<SCTAB>(maTabs.size()); nTab++) if (maTabs[nTab]) commit 1968e62d9f242ef5857dda0e09382fd6f59f8e0b Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Jun 28 15:49:43 2013 -0400 Add a convenient way to dump formula group states for a single column. Useful when debugging. Change-Id: I4e408ad9a3dc2046557d152fcd067c1b0c5645c0 diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 4601ae2..6cc3c4b 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -525,6 +525,10 @@ public: void FormulaCellsUndecided( SCROW nRow1, SCROW nRow2 ); +#if DEBUG_COLUMN_STORAGE + void DumpFormulaGroups() const; +#endif + private: sc::CellStoreType::iterator GetPositionToInsert( SCROW nRow ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 8d942b7..806fb77 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -36,6 +36,7 @@ #include <com/sun/star/chart2/XChartDocument.hpp> #include "typedstrdata.hxx" #include "compressedarray.hxx" +#include "calcmacros.hxx" #include <tools/fract.hxx> #include <tools/gen.hxx> @@ -1984,6 +1985,10 @@ public: */ bool HasBroadcaster( SCTAB nTab, SCCOL nCol ) const; +#if DEBUG_COLUMN_STORAGE + void DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const; +#endif + private: // CLOOK-Impl-methods /** diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index bda039f..03060bb 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -32,6 +32,7 @@ #include "types.hxx" #include "cellvalue.hxx" #include "formula/types.hxx" +#include "calcmacros.hxx" #include <set> #include <map> @@ -857,6 +858,10 @@ public: void SetFormulaResults( SCCOL nCol, SCROW nRow, const double* pResults, size_t nLen ); +#if DEBUG_COLUMN_STORAGE + void DumpFormulaGroups( SCCOL nCol ) const; +#endif + /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly. 'Replace' replaces at the 'current' position, but in order to achieve diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index a7056d0..ae20e44 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1544,6 +1544,46 @@ void ScColumn::FormulaCellsUndecided( SCROW /*nRow1*/, SCROW /*nRow2*/ ) { } +#if DEBUG_COLUMN_STORAGE + +namespace { + +struct FormulaGroupDumper : std::unary_function<sc::CellStoreType::value_type, void> +{ + void operator() (const sc::CellStoreType::value_type& rNode) const + { + if (rNode.type != sc::element_type_formula) + return; + + sc::formula_block::const_iterator it = sc::formula_block::begin(*rNode.data); + sc::formula_block::const_iterator itEnd = sc::formula_block::end(*rNode.data); + + for (; it != itEnd; ++it) + { + const ScFormulaCell& rCell = **it; + if (!rCell.IsShared()) + continue; + + if (rCell.GetSharedTopRow() != rCell.aPos.Row()) + continue; + + SCROW nLen = rCell.GetSharedLength(); + cout << " * group: start=" << rCell.aPos.Row() << ", length=" << nLen << endl; + std::advance(it, nLen-1); + } + } +}; + +} + +void ScColumn::DumpFormulaGroups() const +{ + cout << "-- formua groups" << endl; + std::for_each(maCells.begin(), maCells.end(), FormulaGroupDumper()); + cout << "--" << endl; +} +#endif + void ScColumn::CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const { rDestCol.maCellTextAttrs.set_empty(nRow1, nRow2); // Empty the destination range first. diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 3ce424f..9d3c72f 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2266,6 +2266,17 @@ bool ScDocument::HasBroadcaster( SCTAB nTab, SCCOL nCol ) const return pTab->HasBroadcaster(nCol); } +#if DEBUG_COLUMN_STORAGE +void ScDocument::DumpFormulaGroups( SCTAB nTab, SCCOL nCol ) const +{ + const ScTable* pTab = FetchTable(nTab); + if (!pTab) + return; + + pTab->DumpFormulaGroups(nCol); +} +#endif + bool ScDocument::TableExists( SCTAB nTab ) const { return ValidTab(nTab) && static_cast<size_t>(nTab) < maTabs.size() && maTabs[nTab]; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index dcd0344..02c8952 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2221,6 +2221,16 @@ void ScTable::SetFormulaResults( SCCOL nCol, SCROW nRow, const double* pResults, aCol[nCol].SetFormulaResults(nRow, pResults, nLen); } +#if DEBUG_COLUMN_STORAGE +void ScTable::DumpFormulaGroups( SCCOL nCol ) const +{ + if (!ValidCol(nCol)) + return; + + aCol[nCol].DumpFormulaGroups(); +} +#endif + const SvtBroadcaster* ScTable::GetBroadcaster( SCCOL nCol, SCROW nRow ) const { if (!ValidColRow(nCol, nRow)) commit fb604d067066249bda3a09b91743491dd63e8288 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Jun 28 15:22:05 2013 -0400 Start moving all these DEBUG_FOO into calcmacros.hxx. This header was formerly dpmacros.hxx, now renamed to calcmacros.hxx. Change-Id: I2ed768b7c5678f5216b1e93df2c0cede0c548be4 diff --git a/sc/inc/dpmacros.hxx b/sc/inc/calcmacros.hxx similarity index 86% rename from sc/inc/dpmacros.hxx rename to sc/inc/calcmacros.hxx index 72659cc..03ca590 100644 --- a/sc/inc/dpmacros.hxx +++ b/sc/inc/calcmacros.hxx @@ -7,9 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef __SC_DPMACROS_HXX__ -#define __SC_DPMACROS_HXX__ +#ifndef SC_CALCMACROS_HXX +#define SC_CALCMACROS_HXX +#define DEBUG_COLUMN_STORAGE 0 #define DEBUG_PIVOT_TABLE 0 #if DEBUG_PIVOT_TABLE diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx index 5a75463..707749c 100644 --- a/sc/inc/dpcache.hxx +++ b/sc/inc/dpcache.hxx @@ -21,7 +21,7 @@ #include "global.hxx" #include "dpnumgroupinfo.hxx" -#include "dpmacros.hxx" +#include "calcmacros.hxx" #include "tools/date.hxx" #include <boost/noncopyable.hpp> diff --git a/sc/inc/dpfilteredcache.hxx b/sc/inc/dpfilteredcache.hxx index c65b95c..bff1e18 100644 --- a/sc/inc/dpfilteredcache.hxx +++ b/sc/inc/dpfilteredcache.hxx @@ -24,7 +24,7 @@ #include "osl/mutex.hxx" #include "global.hxx" #include "dpitemdata.hxx" -#include "dpmacros.hxx" +#include "calcmacros.hxx" #include <vector> #include <boost/unordered_set.hpp> diff --git a/sc/inc/dpitemdata.hxx b/sc/inc/dpitemdata.hxx index 9137e2a..823a6c1 100644 --- a/sc/inc/dpitemdata.hxx +++ b/sc/inc/dpitemdata.hxx @@ -16,7 +16,7 @@ #include "sal/types.h" #include "tools/solar.h" #include "rtl/ustring.hxx" -#include "dpmacros.hxx" +#include "calcmacros.hxx" #include "dpglobal.hxx" /** diff --git a/sc/inc/dpnumgroupinfo.hxx b/sc/inc/dpnumgroupinfo.hxx index 523b792..6989fff 100644 --- a/sc/inc/dpnumgroupinfo.hxx +++ b/sc/inc/dpnumgroupinfo.hxx @@ -11,7 +11,7 @@ #define __SC_DPNUMGROUPINFO_HXX__ #include "scdllapi.h" -#include "dpmacros.hxx" +#include "calcmacros.hxx" struct ScDPNumGroupInfo { diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 735b033..bbd3ba8 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -26,7 +26,7 @@ #include "dpoutput.hxx" #include "dptypes.hxx" #include "pivot.hxx" -#include "dpmacros.hxx" +#include "calcmacros.hxx" #include <com/sun/star/sheet/XDimensionsSupplier.hpp> diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx index 22a8ffb..3239a80 100644 --- a/sc/inc/dptabdat.hxx +++ b/sc/inc/dptabdat.hxx @@ -24,7 +24,7 @@ #include "dpoutput.hxx" #include "dpfilteredcache.hxx" #include "dpcache.hxx" -#include "dpmacros.hxx" +#include "calcmacros.hxx" #include "svl/zforlist.hxx" diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx index e6289be..cab2da8 100644 --- a/sc/inc/dptabres.hxx +++ b/sc/inc/dptabres.hxx @@ -22,7 +22,7 @@ #include "global.hxx" #include "dpfilteredcache.hxx" -#include "dpmacros.hxx" +#include "calcmacros.hxx" #include <tools/string.hxx> #include <com/sun/star/sheet/MemberResult.hpp> diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx index 0ebf8be..ad65418 100644 --- a/sc/inc/mtvelements.hxx +++ b/sc/inc/mtvelements.hxx @@ -14,8 +14,7 @@ #include "formulacell.hxx" #include "svl/broadcast.hxx" #include "editeng/editobj.hxx" - -#define DEBUG_COLUMN_STORAGE 0 +#include "calcmacros.hxx" #if DEBUG_COLUMN_STORAGE #ifdef NDEBUG diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx index 85e19e0..12ed637 100644 --- a/sc/inc/pivot.hxx +++ b/sc/inc/pivot.hxx @@ -40,7 +40,7 @@ #include "global.hxx" #include "address.hxx" #include "dpglobal.hxx" -#include "dpmacros.hxx" +#include "calcmacros.hxx" #include <vector> #include <boost/ptr_container/ptr_vector.hpp> diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index c38ee38..76ec9f5 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -45,7 +45,7 @@ #include "dpitemdata.hxx" #include "dputil.hxx" #include "dpresfilter.hxx" -#include "dpmacros.hxx" +#include "calcmacros.hxx" #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/sheet/DataPilotFieldFilter.hpp> diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx index 3701081..8673e7f 100644 --- a/sc/source/ui/dbgui/fieldwnd.cxx +++ b/sc/source/ui/dbgui/fieldwnd.cxx @@ -48,7 +48,7 @@ #include "pvlaydlg.hxx" #include "dpuiglobal.hxx" -#include "dpmacros.hxx" +#include "calcmacros.hxx" #include "AccessibleDataPilotControl.hxx" #include "scresid.hxx" #include "pivot.hrc" commit e5bbf11028d524a5282e4ce1525cde41c2b1afa5 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Jun 28 13:28:31 2013 -0400 Ensure that the group calculation path won't get called when it's disabled. Change-Id: I0ea45616558bebf99c63862a0458776c67789bbc diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 2938009..c4c1409 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -690,11 +690,7 @@ void ScDocument::ApplyAsianEditSettings( ScEditEngineDefaulter& rEngine ) void ScDocument::RebuildFormulaGroups() { - bool bEnableFormulaGroups; - - bEnableFormulaGroups = ScInterpreter::GetGlobalConfig().mbOpenCLEnabled; - - if ( !bEnableFormulaGroups ) + if (!ScInterpreter::GetGlobalConfig().mbOpenCLEnabled) return; SCTAB nTab; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 26d7ee5..f2d72da 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -3084,6 +3084,9 @@ public: bool ScFormulaCell::InterpretFormulaGroup() { + if (!ScInterpreter::GetGlobalConfig().mbOpenCLEnabled) + return false; + // Re-build formulae groups if necessary - ideally this is done at // import / insert / delete etc. and is integral to the data structures pDocument->RebuildFormulaGroups(); commit 94040c2034ed657b2c4d4d24c8d92ab7c9caadfd Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Jun 28 11:50:25 2013 -0400 ResolveStaticReference() to also dynamically recalc formula cells. Change-Id: If42e5105be0e6db7c63d7c4e7c43de23716d6cbf diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 82990ab..a7056d0 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1859,13 +1859,10 @@ formula::FormulaTokenRef ScColumn::ResolveStaticReference( SCROW nRow ) case sc::element_type_formula: { ScFormulaCell* p = sc::formula_block::at(*it->data, aPos.second); - if (p->GetDirty()) - // Dirty formula cell is not considered static (for now). - // Return null token. Later we will switch to dynamically - // interpreting all dirty formula cells. - return formula::FormulaTokenRef(); + if (p->IsValue()) + return formula::FormulaTokenRef(new formula::FormulaDoubleToken(p->GetValue())); - return formula::FormulaTokenRef(new formula::FormulaDoubleToken(p->GetResultDouble())); + return formula::FormulaTokenRef(new formula::FormulaStringToken(p->GetString())); } case sc::element_type_empty: default: @@ -1881,28 +1878,34 @@ class ToMatrixHandler ScMatrix& mrMat; SCCOL mnMatCol; SCROW mnTopRow; - bool mbSuccess; public: ToMatrixHandler(ScMatrix& rMat, SCCOL nMatCol, SCROW nTopRow) : - mrMat(rMat), mnMatCol(nMatCol), mnTopRow(nTopRow), mbSuccess(true) {} + mrMat(rMat), mnMatCol(nMatCol), mnTopRow(nTopRow) {} void operator() (size_t nRow, double fVal) { mrMat.PutDouble(fVal, mnMatCol, nRow - mnTopRow); } - void operator() (size_t nRow, ScFormulaCell* p) + void operator() (size_t nRow, const ScFormulaCell* p) { - if (p->GetDirty()) - { - mbSuccess = false; - return; - } + // Formula cell may need to re-calculate. + ScFormulaCell& rCell = const_cast<ScFormulaCell&>(*p); + if (rCell.IsValue()) + mrMat.PutDouble(rCell.GetValue(), mnMatCol, nRow - mnTopRow); + else + mrMat.PutString(rCell.GetString(), mnMatCol, nRow - mnTopRow); + } - mrMat.PutDouble(p->GetResultDouble(), mnMatCol, nRow - mnTopRow); + void operator() (size_t nRow, const OUString& rStr) + { + mrMat.PutString(rStr, mnMatCol, nRow - mnTopRow); } - bool isSuccess() const { return mbSuccess; } + void operator() (size_t nRow, const EditTextObject* pStr) + { + mrMat.PutString(ScEditUtil::GetString(*pStr), mnMatCol, nRow - mnTopRow); + } }; } @@ -1913,8 +1916,8 @@ bool ScColumn::ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow return false; ToMatrixHandler aFunc(rMat, nMatCol, nRow1); - sc::ProcessFormulaNumeric(maCells.begin(), maCells, nRow1, nRow2, aFunc); - return aFunc.isSuccess(); + sc::ParseAllNonEmpty(maCells.begin(), maCells, nRow1, nRow2, aFunc); + return true; } namespace { commit f67fa232933e64779f0b3571711e4679214ca521 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Fri Jun 28 11:29:14 2013 -0400 Have FetchDoubleArray() to optionally calculate dependent formula cells. Change-Id: Ide29df664ff002f9cd8fe3edbf9512dd0cbb9eb6 diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index b119d3d..4601ae2 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -471,7 +471,7 @@ public: formula::FormulaTokenRef ResolveStaticReference( SCROW nRow ); bool ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow1, SCROW nRow2 ); void FillMatrix( ScMatrix& rMat, size_t nMatCol, SCROW nRow1, SCROW nRow2 ) const; - const double* FetchDoubleArray( sc::FormulaGroupContext& rCxt, SCROW nRow1, SCROW nRow2 ) const; + const double* FetchDoubleArray( sc::FormulaGroupContext& rCxt, SCROW nRow1, SCROW nRow2 ); void SetFormulaResults( SCROW nRow, const double* pResults, size_t nLen ); void SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index fd8f61f..8d942b7 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1973,7 +1973,7 @@ public: formula::FormulaTokenRef ResolveStaticReference( const ScRange& rRange ); const double* FetchDoubleArray( - sc::FormulaGroupContext& rCxt, const ScAddress& rPos, SCROW nLength ) const; + sc::FormulaGroupContext& rCxt, const ScAddress& rPos, SCROW nLength ); SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ); const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const; diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index bae3818..bda039f 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -842,7 +842,7 @@ public: formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol, SCROW nRow ); formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); const double* FetchDoubleArray( - sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const; + sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 ); ScRefCellValue GetRefCellValue( SCCOL nCol, SCROW nRow ); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 3704c6d..82990ab 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2073,23 +2073,189 @@ void ScColumn::FillMatrix( ScMatrix& rMat, size_t nMatCol, SCROW nRow1, SCROW nR sc::ParseBlock(maCells.begin(), maCells, aFunc, nRow1, nRow2); } -const double* ScColumn::FetchDoubleArray( sc::FormulaGroupContext& /*rCxt*/, SCROW nRow1, SCROW nRow2 ) const +namespace { + +bool appendDouble( + sc::FormulaGroupContext::DoubleArrayType& rArray, size_t nLen, + sc::CellStoreType::iterator it, const sc::CellStoreType::iterator& itEnd ) { - // TODO: I'll use the context object later. - if (nRow1 > nRow2) - return NULL; + size_t nLenRemain = nLen; + for (; it != itEnd; ++it) + { + switch (it->type) + { + case sc::element_type_numeric: + { + sc::numeric_block::iterator itData = sc::numeric_block::begin(*it->data); + sc::numeric_block::iterator itDataEnd; + if (nLenRemain >= it->size) + { + // Block is shorter than the remaining requested length. + itDataEnd = sc::numeric_block::end(*it->data); + nLenRemain -= it->size; + } + else + { + itDataEnd = itData; + std::advance(itDataEnd, nLenRemain); + nLenRemain = 0; + } - std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(nRow1); - if (aPos.first->type != sc::element_type_numeric) - // This is not a numeric cell block. + for (; itData != itDataEnd; ++itData) + rArray.push_back(*itData); + } + break; + case sc::element_type_formula: + { + sc::formula_block::iterator itData = sc::formula_block::begin(*it->data); + sc::formula_block::iterator itDataEnd; + if (nLenRemain >= it->size) + { + // Block is shorter than the remaining requested length. + itDataEnd = sc::formula_block::end(*it->data); + nLenRemain -= it->size; + } + else + { + itDataEnd = itData; + std::advance(itDataEnd, nLenRemain); + nLenRemain = 0; + } + + for (; itData != itDataEnd; ++itData) + { + ScFormulaCell& rFC = **itData; + rArray.push_back(rFC.GetValue()); + } + } + break; + case sc::element_type_empty: + { + // Fill it with 0's. + if (nLenRemain >= it->size) + { + rArray.resize(rArray.size() + it->size, 0); + nLenRemain -= it->size; + } + else + { + rArray.resize(rArray.size() + nLenRemain, 0); + nLenRemain = 0; + } + } + break; + case sc::element_type_string: + case sc::element_type_edittext: + default: + return false; + } + + if (!nLenRemain) + return true; + } + + return false; +} + +} + +const double* ScColumn::FetchDoubleArray( sc::FormulaGroupContext& rCxt, SCROW nRow1, SCROW nRow2 ) +{ + if (nRow1 > nRow2) return NULL; + size_t nLenRequested = nRow2 - nRow1 + 1; + sc::CellStoreType::position_type aPos = maCells.position(nRow1); size_t nLen = aPos.first->size - aPos.second; - if (static_cast<SCROW>(nLen) < nRow2 - nRow1 + 1) - // Array shorter than requested. - return NULL; + switch (aPos.first->type) + { + case sc::element_type_numeric: + { + // This is a numeric cell block. + if (nLenRequested <= nLen) + // Requested length fits a single block. + return &sc::numeric_block::at(*aPos.first->data, aPos.second); + + // Allocate a new array and copy the values to it. + sc::numeric_block::const_iterator it = sc::numeric_block::begin(*aPos.first->data); + sc::numeric_block::const_iterator itEnd = sc::numeric_block::end(*aPos.first->data); + std::advance(it, aPos.second); + rCxt.maArrays.push_back(new sc::FormulaGroupContext::DoubleArrayType(it, itEnd)); + sc::FormulaGroupContext::DoubleArrayType& rArray = rCxt.maArrays.back(); + rArray.reserve(nLenRequested); + + // Fill the remaining array with values from the following blocks. + ++aPos.first; + if (!appendDouble(rArray, nLenRequested - nLen, aPos.first, maCells.end())) + return NULL; + + return &rArray[0]; + } + break; + case sc::element_type_formula: + { + rCxt.maArrays.push_back(new sc::FormulaGroupContext::DoubleArrayType); + sc::FormulaGroupContext::DoubleArrayType& rArray = rCxt.maArrays.back(); + rArray.reserve(nLenRequested); + + sc::formula_block::const_iterator it = sc::formula_block::begin(*aPos.first->data); + sc::formula_block::const_iterator itEnd; + if (nLenRequested <= nLen) + { + // Requested length is within a single block. + itEnd = it; + std::advance(itEnd, nLenRequested); + for (; it != itEnd; ++it) + { + ScFormulaCell& rCell = **it; + rArray.push_back(rCell.GetValue()); // the cell may be interpreted. + } + + return &rArray[0]; + } + + itEnd = sc::formula_block::end(*aPos.first->data); + std::advance(itEnd, nLenRequested); + for (; it != itEnd; ++it) + { + ScFormulaCell& rCell = **it; + rArray.push_back(rCell.GetValue()); // the cell may be interpreted. + } + + // Fill the remaining array with values from the following blocks. + ++aPos.first; + if (!appendDouble(rArray, nLenRequested - nLen, aPos.first, maCells.end())) + return NULL; + + return &rArray[0]; + } + break; + case sc::element_type_empty: + { + if (nLenRequested <= nLen) + { + // Fill the whole length with zero. + rCxt.maArrays.push_back(new sc::FormulaGroupContext::DoubleArrayType(nLenRequested, 0.0)); + return &rCxt.maArrays.back()[0]; + } + + // Fill the array with zero for the length of the empty block. + rCxt.maArrays.push_back(new sc::FormulaGroupContext::DoubleArrayType(nLen, 0.0)); + sc::FormulaGroupContext::DoubleArrayType& rArray = rCxt.maArrays.back(); + rArray.reserve(nLenRequested); + + // Fill the remaining array with values from the following blocks. + ++aPos.first; + if (!appendDouble(rArray, nLenRequested - nLen, aPos.first, maCells.end())) + return NULL; + + return &rArray[0]; + } + default: + ; + } - return &sc::numeric_block::at(*aPos.first->data, aPos.second); + return NULL; } void ScColumn::SetFormulaResults( SCROW nRow, const double* pResults, size_t nLen ) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 3ed67c3..3ce424f 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -1609,7 +1609,7 @@ formula::FormulaTokenRef ScDocument::ResolveStaticReference( const ScRange& rRan } const double* ScDocument::FetchDoubleArray( - sc::FormulaGroupContext& rCxt, const ScAddress& rPos, SCROW nLength ) const + sc::FormulaGroupContext& rCxt, const ScAddress& rPos, SCROW nLength ) { SCTAB nTab = rPos.Tab(); if (!TableExists(nTab)) diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 2ade13b..26d7ee5 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2941,13 +2941,13 @@ namespace { class GroupTokenConverter { - sc::FormulaGroupContext maCxt; + sc::FormulaGroupContext& mrCxt; ScTokenArray& mrGroupTokens; ScDocument& mrDoc; ScFormulaCell& mrCell; public: - GroupTokenConverter(ScTokenArray& rGroupTokens, ScDocument& rDoc, ScFormulaCell& rCell) : - mrGroupTokens(rGroupTokens), mrDoc(rDoc), mrCell(rCell) {} + GroupTokenConverter(sc::FormulaGroupContext& rCxt, ScTokenArray& rGroupTokens, ScDocument& rDoc, ScFormulaCell& rCell) : + mrCxt(rCxt), mrGroupTokens(rGroupTokens), mrDoc(rDoc), mrCell(rCell) {} bool convert(ScTokenArray& rCode) { @@ -2978,7 +2978,7 @@ public: // we finish cell storage rework, we'll support temporary // generation of a double array which is a combination of // multiple cell array segments. - const double* pArray = mrDoc.FetchDoubleArray(maCxt, aRefPos, mrCell.GetCellGroup()->mnLength); + const double* pArray = mrDoc.FetchDoubleArray(mrCxt, aRefPos, mrCell.GetCellGroup()->mnLength); if (!pArray) return false; @@ -3020,7 +3020,7 @@ public: for (SCCOL i = aRef.Ref1.nCol; i <= aRef.Ref2.nCol; ++i) { aRefPos.SetCol(i); - const double* pArray = mrDoc.FetchDoubleArray(maCxt, aRefPos, nArrayLength); + const double* pArray = mrDoc.FetchDoubleArray(mrCxt, aRefPos, nArrayLength); if (!pArray) return false; @@ -3108,9 +3108,8 @@ bool ScFormulaCell::InterpretFormulaGroup() return InterpretInvariantFormulaGroup(); sc::FormulaGroupContext aCxt; - ScTokenArray aCode; - GroupTokenConverter aConverter(aCode, *pDocument, *this); + GroupTokenConverter aConverter(aCxt, aCode, *pDocument, *this); if (!aConverter.convert(*pCode)) return false; return sc::FormulaGroupInterpreter::getStatic()->interpret(*pDocument, aPos, xGroup, aCode); diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 2d90fa9..dcd0344 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2156,7 +2156,7 @@ formula::FormulaTokenRef ScTable::ResolveStaticReference( SCCOL nCol1, SCROW nRo } const double* ScTable::FetchDoubleArray( - sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const + sc::FormulaGroupContext& rCxt, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) { if (nRow2 < nRow1) return NULL; commit bdd8986ebd82884402b15d5d1d7cf76de37a47c6 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Jun 27 22:23:58 2013 -0400 Test loading of xls and xlsx with shared formulas. To make sure I won't break this. And I moved the xlsx version of the test from the slow check to the normal test, which gets run for the normal build target. Change-Id: Id65f79796b11c0ab039842f1c1c158e9af310757 diff --git a/sc/qa/unit/data/xls/shared-formula.xls b/sc/qa/unit/data/xls/shared-formula.xls new file mode 100644 index 0000000..a9be6b7 Binary files /dev/null and b/sc/qa/unit/data/xls/shared-formula.xls differ diff --git a/sc/qa/unit/data/xlsx/shared-formula.xlsx b/sc/qa/unit/data/xlsx/shared-formula.xlsx index d1b4f52..64d0501 100644 Binary files a/sc/qa/unit/data/xlsx/shared-formula.xlsx and b/sc/qa/unit/data/xlsx/shared-formula.xlsx differ diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index f82f1eb..dfaecfd 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -65,6 +65,8 @@ public: void testContentXLSX(); void testContentLotus123(); void testContentDIF(); + void testSharedFormulaXLS(); + void testSharedFormulaXLSX(); #if TEST_BUG_FILES //goes recursively through all files in this dir and tries to open them void testDir(osl::Directory& rDir, sal_Int32 nType); @@ -83,6 +85,8 @@ public: CPPUNIT_TEST(testContentXLSX); CPPUNIT_TEST(testContentLotus123); CPPUNIT_TEST(testContentDIF); + CPPUNIT_TEST(testSharedFormulaXLS); + CPPUNIT_TEST(testSharedFormulaXLSX); CPPUNIT_TEST(testLegacyCellAnchoredRotatedShape); #if TEST_BUG_FILES @@ -325,7 +329,39 @@ void ScFiltersTest::testContentDIF() ScDocument* pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(pDoc); + xDocSh->DoClose(); +} + +void ScFiltersTest::testSharedFormulaXLS() +{ + ScDocShellRef xDocSh = loadDoc("shared-formula.", XLS); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + xDocSh->DoHardRecalc(true); + // Check the results of formula cells in the shared formula range. + for (SCROW i = 1; i <= 18; ++i) + { + double fVal = pDoc->GetValue(ScAddress(1,i,0)); + double fCheck = i*10.0; + CPPUNIT_ASSERT_EQUAL(fCheck, fVal); + } + xDocSh->DoClose(); +} +void ScFiltersTest::testSharedFormulaXLSX() +{ + ScDocShellRef xDocSh = loadDoc("shared-formula.", XLSX); + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + xDocSh->DoHardRecalc(true); + // Check the results of formula cells in the shared formula range. + for (SCROW i = 1; i <= 18; ++i) + { + double fVal = pDoc->GetValue(ScAddress(1,i,0)); + double fCheck = i*10.0; + CPPUNIT_ASSERT_EQUAL(fCheck, fVal); + } + xDocSh->DoClose(); } void impl_testLegacyCellAnchoredRotatedShape( ScDocument* pDoc, Rectangle& aRect, ScDrawObjData& aAnchor, long TOLERANCE = 30 /* 30 hmm */ ) diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index f53a430..c8bbcf0 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -114,7 +114,6 @@ public: void testNewCondFormatXLSX(); //change this test file only in excel and not in calc - void testSharedFormulaXLSX(); void testCellValueXLSX(); //misc tests unrelated to the import filters @@ -168,7 +167,6 @@ public: CPPUNIT_TEST(testRepeatedColumnsODS); CPPUNIT_TEST(testDataValidityODS); CPPUNIT_TEST(testBrokenQuotesCSV); - CPPUNIT_TEST(testSharedFormulaXLSX); CPPUNIT_TEST(testCellValueXLSX); CPPUNIT_TEST(testControlImport); CPPUNIT_TEST(testChartImportODS); @@ -1190,41 +1188,6 @@ void ScFiltersTest::testBrokenQuotesCSV() xDocSh->DoClose(); } -void ScFiltersTest::testSharedFormulaXLSX() -{ - const OUString aFileNameBase("shared-formula."); - OUString aFileExtension(aFileFormats[XLSX].pName, strlen(aFileFormats[XLSX].pName), RTL_TEXTENCODING_UTF8 ); - OUString aFilterName(aFileFormats[XLSX].pFilterName, strlen(aFileFormats[XLSX].pFilterName), RTL_TEXTENCODING_UTF8) ; - OUString aFileName; - createFileURL(aFileNameBase, aFileExtension, aFileName); - OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); - std::cout << aFileFormats[XLSX].pName << " Test" << std::endl; - - unsigned int nFormatType = aFileFormats[XLSX].nFormatType; - unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; - ScDocShellRef xDocSh = ScBootstrapFixture::load(aFileName, aFilterName, OUString(), aFilterType, - nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); - - xDocSh->DoHardRecalc(true); - - CPPUNIT_ASSERT_MESSAGE("Failed to load shared-formula.xlsx", xDocSh.Is()); - ScDocument* pDoc = xDocSh->GetDocument(); - CPPUNIT_ASSERT_MESSAGE("No Document", pDoc); //remove with first test - - OUString aCSVPath; - createCSVPath( aFileNameBase, aCSVPath ); - testFile( aCSVPath, pDoc, 0 ); - - //test some additional properties - ScRangeName* pName = pDoc->GetRangeName(); - for (ScRangeName::iterator itr = pName->begin(); itr != pName->end(); ++itr) - { - CPPUNIT_ASSERT(itr->second->GetType() & RT_SHARED); - } - - xDocSh->DoClose(); -} - void ScFiltersTest::testCellValueXLSX() { const OUString aFileNameBase("cell-value."); commit cb1310356b358137210ea5445500bb2e96847fda Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Jun 27 16:47:17 2013 -0400 We don't need these header includes. Change-Id: Ia2f7226fa3c7dc5ac98bd23833e67d7262cd8b9b diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 6244eac..b1b3160 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -86,8 +86,6 @@ #include "macromgr.hxx" #include "formulacell.hxx" #include "clipcontext.hxx" -#include "interpre.hxx" -#include "formulagroup.hxx" using namespace com::sun::star; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits