sc/inc/cellvalue.hxx | 3 --- sc/inc/dociter.hxx | 4 ++-- sc/inc/mtvelements.hxx | 3 +++ sc/qa/unit/helper/qahelper.cxx | 1 + sc/source/core/data/cellvalue.cxx | 29 ----------------------------- sc/source/core/data/dociter.cxx | 18 ++++++++---------- sc/source/core/data/mtvelements.cxx | 25 +++++++++++++++++++++++++ 7 files changed, 39 insertions(+), 44 deletions(-)
New commits: commit c86b1a5c352df806166fc674fb3b85d334e4cb55 Author: Kohei Yoshida <[email protected]> Date: Thu Sep 12 21:15:10 2013 -0400 Change so that we won't have to include mtvelements.hxx in cellvalue.hxx. Because mtvelements.hxx is very slow to parse by the compiler, and cellvalue.hxx is included everywhere. Hopefully this will speed up the compilation time of sc... Change-Id: Ic9a9b8483c8325e4a91021f071f2391db8b57806 diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index 0e2987c..fd112a6 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -11,7 +11,6 @@ #define SC_CELLVALUE_HXX #include "global.hxx" -#include "mtvelements.hxx" class ScDocument; class ScFormulaCell; @@ -119,8 +118,6 @@ struct SC_DLLPUBLIC ScRefCellValue */ void assign( ScDocument& rDoc, const ScAddress& rPos ); - void assign( const sc::CellStoreType::const_iterator& itPos, size_t nOffset ); - /** * Set cell value at specified position in specified document. */ diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 8a57ef3..3a83f0a 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -49,7 +49,7 @@ class ScFormulaCell; class ScValueIterator // walk through all values in an area { - typedef std::pair<sc::CellStoreType::const_iterator, size_t> PositionType; + typedef sc::CellStoreType::const_position_type PositionType; ScDocument* pDoc; const ScAttrArray* pAttrArray; @@ -253,7 +253,7 @@ class ScQueryCellIterator // walk through all non-empty cells in an ar nTestEqualConditionFulfilled = nTestEqualConditionEnabled | nTestEqualConditionMatched }; - typedef std::pair<sc::CellStoreType::const_iterator, size_t> PositionType; + typedef sc::CellStoreType::const_position_type PositionType; PositionType maCurPos; boost::scoped_ptr<ScQueryParam> mpParam; diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx index 46a5d40..f0e5fff 100644 --- a/sc/inc/mtvelements.hxx +++ b/sc/inc/mtvelements.hxx @@ -31,6 +31,7 @@ #include <boost/unordered_map.hpp> class ScDocument; +struct ScRefCellValue; namespace sc { @@ -133,6 +134,8 @@ public: ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol); }; +ScRefCellValue toRefCell( const sc::CellStoreType::const_iterator& itPos, size_t nOffset ); + } #endif diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 7c409ef..33c8f04 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -11,6 +11,7 @@ #include "csv_handler.hxx" #include "drwlayer.hxx" #include "compiler.hxx" +#include "formulacell.hxx" #include "svx/svdpage.hxx" #include "svx/svdoole2.hxx" diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx index 2c40418..ba71d1e 100644 --- a/sc/source/core/data/cellvalue.cxx +++ b/sc/source/core/data/cellvalue.cxx @@ -496,35 +496,6 @@ void ScRefCellValue::assign( ScDocument& rDoc, const ScAddress& rPos ) *this = rDoc.GetRefCellValue(rPos); } -void ScRefCellValue::assign( const sc::CellStoreType::const_iterator& itPos, size_t nOffset ) -{ - switch (itPos->type) - { - case sc::element_type_numeric: - // Numeric cell - mfValue = sc::numeric_block::at(*itPos->data, nOffset); - meType = CELLTYPE_VALUE; - break; - case sc::element_type_string: - // String cell - mpString = &sc::string_block::at(*itPos->data, nOffset); - meType = CELLTYPE_STRING; - break; - case sc::element_type_edittext: - // Edit cell - mpEditText = sc::edittext_block::at(*itPos->data, nOffset); - meType = CELLTYPE_EDIT; - break; - case sc::element_type_formula: - // Formula cell - mpFormula = sc::formula_block::at(*itPos->data, nOffset); - meType = CELLTYPE_FORMULA; - break; - default: - clear(); - } -} - void ScRefCellValue::commit( ScDocument& rDoc, const ScAddress& rPos ) const { switch (meType) diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index f951ea3..6f4d4a7 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -400,8 +400,7 @@ bool ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue) continue; } - ScRefCellValue aCell; - aCell.assign(maCurPos.first, maCurPos.second); + ScRefCellValue aCell = sc::toRefCell(maCurPos.first, maCurPos.second); if (ScDBQueryDataIterator::IsQueryValid(*mpDoc, *mpParam, nTab, nRow, aCell)) { @@ -920,7 +919,7 @@ bool ScCellIterator::getCurrent() } } - maCurCell.assign(maCurColPos.first, maCurColPos.second); + maCurCell = sc::toRefCell(maCurColPos.first, maCurColPos.second); return true; } return false; @@ -1154,8 +1153,7 @@ bool ScQueryCellIterator::GetThis() continue; } - ScRefCellValue aCell; - aCell.assign(maCurPos.first, maCurPos.second); + ScRefCellValue aCell = sc::toRefCell(maCurPos.first, maCurPos.second); if (bAllStringIgnore && aCell.hasString()) IncPos(); @@ -1407,7 +1405,7 @@ bool ScQueryCellIterator::BinarySearch() { OUString aCellStr; sal_uLong nFormat = pCol->GetNumberFormat(toLogicalPos(aLoPos)); - aCell.assign(aLoPos.first, aLoPos.second); + aCell = sc::toRefCell(aLoPos.first, aLoPos.second); ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc); sal_Int32 nTmp = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString); if ((rEntry.eOp == SC_LESS_EQUAL && nTmp > 0) || @@ -1450,7 +1448,7 @@ bool ScQueryCellIterator::BinarySearch() aLastInRangeString = OUString(sal_Unicode(0xFFFF)); if (aLastInRange.first != pCol->maCells.end()) { - aCell.assign(aLastInRange.first, aLastInRange.second); + aCell = sc::toRefCell(aLastInRange.first, aLastInRange.second); if (aCell.hasString()) { sal_uLong nFormat = pCol->GetNumberFormat(toLogicalPos(aLastInRange)); @@ -1502,7 +1500,7 @@ bool ScQueryCellIterator::BinarySearch() if (!bStr && !bByString) { double nCellVal; - aCell.assign(aPos.first, aPos.second); + aCell = sc::toRefCell(aPos.first, aPos.second); switch (aCell.meType) { case CELLTYPE_VALUE : @@ -1557,7 +1555,7 @@ bool ScQueryCellIterator::BinarySearch() { OUString aCellStr; sal_uLong nFormat = pCol->GetNumberFormat(i); - aCell.assign(aPos.first, aPos.second); + aCell = sc::toRefCell(aPos.first, aPos.second); ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, pDoc); nRes = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString); @@ -1735,7 +1733,7 @@ ScRefCellValue* ScHorizontalCellIterator::GetNext( SCCOL& rCol, SCROW& rRow ) ColParam& r = maColPositions[mnCol-nStartCol]; size_t nOffset = static_cast<size_t>(mnRow) - r.maPos->position; - maCurCell.assign(r.maPos, nOffset); + maCurCell = sc::toRefCell(r.maPos, nOffset); Advance(); return &maCurCell; diff --git a/sc/source/core/data/mtvelements.cxx b/sc/source/core/data/mtvelements.cxx index efe07cf..222aabd 100644 --- a/sc/source/core/data/mtvelements.cxx +++ b/sc/source/core/data/mtvelements.cxx @@ -10,6 +10,7 @@ #include "mtvelements.hxx" #include "globalnames.hxx" #include "document.hxx" +#include "cellvalue.hxx" namespace sc { @@ -64,6 +65,30 @@ ColumnBlockPosition* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab, SCCOL return &it->second; } +ScRefCellValue toRefCell( const sc::CellStoreType::const_iterator& itPos, size_t nOffset ) +{ + switch (itPos->type) + { + case sc::element_type_numeric: + // Numeric cell + return ScRefCellValue(sc::numeric_block::at(*itPos->data, nOffset)); + case sc::element_type_string: + // String cell + return ScRefCellValue(&sc::string_block::at(*itPos->data, nOffset)); + case sc::element_type_edittext: + // Edit cell + return ScRefCellValue(sc::edittext_block::at(*itPos->data, nOffset)); + break; + case sc::element_type_formula: + // Formula cell + return ScRefCellValue(sc::formula_block::at(*itPos->data, nOffset)); + default: + ; + } + + return ScRefCellValue(); +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
