[Libreoffice-commits] .: 6 commits - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Mar 15 12:41:12 PDT 2012
sc/inc/dpcache.hxx | 9
sc/inc/dpitemdata.hxx | 2
sc/source/core/data/dpcache.cxx | 401 +++++++++++++++++++++----------------
sc/source/core/data/dpdimsave.cxx | 12 -
sc/source/core/data/dpitemdata.cxx | 11 +
5 files changed, 254 insertions(+), 181 deletions(-)
New commits:
commit 20d55ad66f0f94c9f6a583b5406a39717c1c6d46
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Mar 15 15:39:51 2012 -0400
Consolidated file-local functions.
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 140885e..08b0d25 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -62,89 +62,6 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
-namespace {
-
-void getItemValue(
- ScDPItemData& rData, const Reference<sdbc::XRow>& xRow, sal_Int32 nType,
- long nCol, const Date& rNullDate, short& rNumType)
-{
- rNumType = NUMBERFORMAT_NUMBER;
- try
- {
- double fValue = 0.0;
- switch (nType)
- {
- case sdbc::DataType::BIT:
- case sdbc::DataType::BOOLEAN:
- {
- rNumType = NUMBERFORMAT_LOGICAL;
- fValue = xRow->getBoolean(nCol) ? 1 : 0;
- rData.SetValue(fValue);
- break;
- }
- case sdbc::DataType::TINYINT:
- case sdbc::DataType::SMALLINT:
- case sdbc::DataType::INTEGER:
- case sdbc::DataType::BIGINT:
- case sdbc::DataType::FLOAT:
- case sdbc::DataType::REAL:
- case sdbc::DataType::DOUBLE:
- case sdbc::DataType::NUMERIC:
- case sdbc::DataType::DECIMAL:
- {
- //! do the conversion here?
- fValue = xRow->getDouble(nCol);
- rData.SetValue(fValue);
- break;
- }
- case sdbc::DataType::DATE:
- {
- rNumType = NUMBERFORMAT_DATE;
-
- util::Date aDate = xRow->getDate(nCol);
- fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate;
- rData.SetValue(fValue);
- break;
- }
- case sdbc::DataType::TIME:
- {
- rNumType = NUMBERFORMAT_TIME;
-
- util::Time aTime = xRow->getTime(nCol);
- fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 +
- aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
- rData.SetValue(fValue);
- break;
- }
- case sdbc::DataType::TIMESTAMP:
- {
- rNumType = NUMBERFORMAT_DATETIME;
-
- util::DateTime aStamp = xRow->getTimestamp(nCol);
- fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) +
- ( aStamp.Hours * 3600 + aStamp.Minutes * 60 +
- aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
- rData.SetValue(fValue);
- break;
- }
- case sdbc::DataType::CHAR:
- case sdbc::DataType::VARCHAR:
- case sdbc::DataType::LONGVARCHAR:
- case sdbc::DataType::SQLNULL:
- case sdbc::DataType::BINARY:
- case sdbc::DataType::VARBINARY:
- case sdbc::DataType::LONGVARBINARY:
- default:
- rData.SetString(xRow->getString(nCol));
- }
- }
- catch (uno::Exception&)
- {
- }
-}
-
-}
-
ScDPCache::GroupItems::GroupItems() {}
ScDPCache::GroupItems::GroupItems(const ScDPNumGroupInfo& rInfo) :
@@ -282,6 +199,85 @@ void initFromCell(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, ScDPItem
}
}
+void getItemValue(
+ ScDPItemData& rData, const Reference<sdbc::XRow>& xRow, sal_Int32 nType,
+ long nCol, const Date& rNullDate, short& rNumType)
+{
+ rNumType = NUMBERFORMAT_NUMBER;
+ try
+ {
+ double fValue = 0.0;
+ switch (nType)
+ {
+ case sdbc::DataType::BIT:
+ case sdbc::DataType::BOOLEAN:
+ {
+ rNumType = NUMBERFORMAT_LOGICAL;
+ fValue = xRow->getBoolean(nCol) ? 1 : 0;
+ rData.SetValue(fValue);
+ break;
+ }
+ case sdbc::DataType::TINYINT:
+ case sdbc::DataType::SMALLINT:
+ case sdbc::DataType::INTEGER:
+ case sdbc::DataType::BIGINT:
+ case sdbc::DataType::FLOAT:
+ case sdbc::DataType::REAL:
+ case sdbc::DataType::DOUBLE:
+ case sdbc::DataType::NUMERIC:
+ case sdbc::DataType::DECIMAL:
+ {
+ //! do the conversion here?
+ fValue = xRow->getDouble(nCol);
+ rData.SetValue(fValue);
+ break;
+ }
+ case sdbc::DataType::DATE:
+ {
+ rNumType = NUMBERFORMAT_DATE;
+
+ util::Date aDate = xRow->getDate(nCol);
+ fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate;
+ rData.SetValue(fValue);
+ break;
+ }
+ case sdbc::DataType::TIME:
+ {
+ rNumType = NUMBERFORMAT_TIME;
+
+ util::Time aTime = xRow->getTime(nCol);
+ fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 +
+ aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
+ rData.SetValue(fValue);
+ break;
+ }
+ case sdbc::DataType::TIMESTAMP:
+ {
+ rNumType = NUMBERFORMAT_DATETIME;
+
+ util::DateTime aStamp = xRow->getTimestamp(nCol);
+ fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) +
+ ( aStamp.Hours * 3600 + aStamp.Minutes * 60 +
+ aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
+ rData.SetValue(fValue);
+ break;
+ }
+ case sdbc::DataType::CHAR:
+ case sdbc::DataType::VARCHAR:
+ case sdbc::DataType::LONGVARCHAR:
+ case sdbc::DataType::SQLNULL:
+ case sdbc::DataType::BINARY:
+ case sdbc::DataType::VARBINARY:
+ case sdbc::DataType::LONGVARBINARY:
+ default:
+ rData.SetString(xRow->getString(nCol));
+ }
+ }
+ catch (uno::Exception&)
+ {
+ }
+}
+
struct Bucket
{
ScDPItemData maValue;
commit 4703758a075c56f308f9ddd7f970c1e8d928373c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Mar 15 15:36:40 2012 -0400
Removed unused.
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 0557481..6566979 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -169,7 +169,6 @@ private:
void PostInit();
void Clear();
void AddLabel(const rtl::OUString& rLabel);
- bool AddData(long nDim, const ScDPItemData& rData, sal_uLong nNumFormat);
const GroupItems* GetGroupItems(long nDim) const;
};
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 7a07ee2..140885e 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -64,44 +64,6 @@ using ::com::sun::star::uno::UNO_QUERY_THROW;
namespace {
-/**
- * Search for an item in the data array. If it's in the array, return its
- * index to the caller.
- *
- * @param rArray dimension array
- * @param rOrder global order (what's this?)
- * @param item item to search for
- * @param rIndex the index of the found item in the global order.
- *
- * @return true if the item is found, or false otherwise.
- */
-bool hasItemInDimension(const ScDPCache::ItemsType& rArray, const ScDPCache::IndexArrayType& rOrder, const ScDPItemData& rItem, SCROW& rIndex)
-{
- rIndex = rArray.size();
- bool bFound = false;
- SCROW nLo = 0;
- SCROW nHi = rArray.size() - 1;
- long nCompare;
- while (nLo <= nHi)
- {
- SCROW nIndex = (nLo + nHi) / 2;
- nCompare = ScDPItemData::Compare(rArray[rOrder[nIndex]], rItem);
- if (nCompare < 0)
- nLo = nIndex + 1;
- else
- {
- nHi = nIndex - 1;
- if (nCompare == 0)
- {
- bFound = true;
- nLo = nIndex;
- }
- }
- }
- rIndex = nLo;
- return bFound;
-}
-
void getItemValue(
ScDPItemData& rData, const Reference<sdbc::XRow>& xRow, sal_Int32 nType,
long nCol, const Date& rNullDate, short& rNumType)
@@ -755,35 +717,6 @@ bool ScDPCache::IsRowEmpty(SCROW nRow) const
return bEmpty;
}
-bool ScDPCache::AddData(long nDim, const ScDPItemData& rData, sal_uLong nNumFormat)
-{
- OSL_ENSURE( nDim < mnColumnCount && nDim >=0 , "dimension out of bound" );
-
- SCROW nIndex = 0;
- Field& rField = maFields[nDim];
- if (!hasItemInDimension(rField.maItems, rField.maGlobalOrder, rData, nIndex))
- {
- // This item doesn't exist in the dimension array yet.
- rField.maItems.push_back(rData);
- rField.maGlobalOrder.insert(
- rField.maGlobalOrder.begin()+nIndex, rField.maItems.size()-1);
- OSL_ENSURE(rField.maGlobalOrder[nIndex] == sal::static_int_cast<SCROW>(rField.maItems.size())-1, "ScDPTableDataCache::AddData ");
- rField.maData.push_back(rField.maItems.size()-1);
- }
- else
- rField.maData.push_back(rField.maGlobalOrder[nIndex]);
-
- size_t nCurRow = maFields[nDim].maData.size() - 1;
-
- if (!rData.IsEmpty())
- {
- maEmptyRows.insert_back(nCurRow, nCurRow+1, false);
- rField.mnNumFormat = nNumFormat;
- }
-
- return true;
-}
-
const ScDPCache::GroupItems* ScDPCache::GetGroupItems(long nDim) const
{
if (nDim < 0)
commit 3507f0f02d68261db62d4d6a3c5f4ccebd096835
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Mar 15 15:33:34 2012 -0400
Use the same algorithm for database initialization.
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index caa5123..7a07ee2 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -518,20 +518,31 @@ bool ScDPCache::InitFromDataBase (const Reference<sdbc::XRowSet>& xRowSet, const
// Now get the data rows.
Reference<sdbc::XRow> xRow(xRowSet, UNO_QUERY_THROW);
- xRowSet->first();
- ScDPItemData aData;
- do
+
+ std::vector<Bucket> aBuckets;
+ for (sal_Int32 nCol = 0; nCol < mnColumnCount; ++nCol)
{
- for (sal_Int32 nCol = 0; nCol < mnColumnCount; ++nCol)
+ xRowSet->first();
+ ScDPItemData aData;
+ aBuckets.clear();
+ Field& rField = maFields[nCol];
+ do
{
+ SCROW nRow = 0;
short nFormatType = NUMBERFORMAT_UNDEFINED;
getItemValue(aData, xRow, aColTypes[nCol], nCol+1, rNullDate, nFormatType);
- SvNumberFormatter* pFormatter = mpDoc->GetFormatTable();
- sal_uLong nNumFormat = pFormatter ? pFormatter->GetStandardFormat(nFormatType) : 0;
- AddData(nCol, aData, nNumFormat);
+ aBuckets.push_back(Bucket(aData, 0, nRow++));
+ if (!aData.IsEmpty())
+ {
+ maEmptyRows.insert_back(nRow, nRow+1, false);
+ SvNumberFormatter* pFormatter = mpDoc->GetFormatTable();
+ rField.mnNumFormat = pFormatter ? pFormatter->GetStandardFormat(nFormatType) : 0;
+ }
}
+ while (xRowSet->next());
+
+ processBuckets(aBuckets, rField);
}
- while (xRowSet->next());
xRowSet->beforeFirst();
commit b9880a798a841e9acd7b7fbc24eac14ed49459b2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Mar 15 15:08:53 2012 -0400
Fixed memory leak.
diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx
index 5b89aef..7c5bae5 100644
--- a/sc/source/core/data/dpitemdata.cxx
+++ b/sc/source/core/data/dpitemdata.cxx
@@ -223,6 +223,7 @@ bool ScDPItemData::operator< (const ScDPItemData& r) const
ScDPItemData& ScDPItemData::operator= (const ScDPItemData& r)
{
+ DisposeString();
meType = r.meType;
switch (r.meType)
{
commit fd05423b758b59451be3c250931f334011079343
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Mar 15 13:40:16 2012 -0400
Better algorithm to (re-)populate the cache.
With my test document, this brings the reload time down from 30 seconds
to 19 seconds. I was expecting a much better outcome, but this is still
better than the current.
diff --git a/sc/inc/dpitemdata.hxx b/sc/inc/dpitemdata.hxx
index 10363be..e30eae3 100644
--- a/sc/inc/dpitemdata.hxx
+++ b/sc/inc/dpitemdata.hxx
@@ -93,6 +93,8 @@ public:
// exact equality
bool operator==(const ScDPItemData& r) const;
+ bool operator!=(const ScDPItemData& r) const;
+ bool operator< (const ScDPItemData& r) const;
ScDPItemData& operator= (const ScDPItemData& r);
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index dba8ef9..caa5123 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -320,6 +320,112 @@ void initFromCell(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, ScDPItem
}
}
+struct Bucket
+{
+ ScDPItemData maValue;
+ SCROW mnOrderIndex;
+ SCROW mnDataIndex;
+ Bucket(const ScDPItemData& rValue, SCROW nOrder, SCROW nData) :
+ maValue(rValue), mnOrderIndex(nOrder), mnDataIndex(nData) {}
+};
+
+struct LessByValue : std::binary_function<Bucket, Bucket, bool>
+{
+ bool operator() (const Bucket& left, const Bucket& right) const
+ {
+ return left.maValue < right.maValue;
+ }
+};
+
+struct LessByDataIndex : std::binary_function<Bucket, Bucket, bool>
+{
+ bool operator() (const Bucket& left, const Bucket& right) const
+ {
+ return left.mnDataIndex < right.mnDataIndex;
+ }
+};
+
+struct EqualByValue : std::binary_function<Bucket, Bucket, bool>
+{
+ bool operator() (const Bucket& left, const Bucket& right) const
+ {
+ return left.maValue == right.maValue;
+ }
+};
+
+class PushBackValue : std::unary_function<Bucket, void>
+{
+ ScDPCache::ItemsType& mrItems;
+public:
+ PushBackValue(ScDPCache::ItemsType& _items) : mrItems(_items) {}
+ void operator() (const Bucket& v)
+ {
+ mrItems.push_back(v.maValue);
+ }
+};
+
+class PushBackOrderIndex : std::unary_function<Bucket, void>
+{
+ ScDPCache::IndexArrayType& mrData;
+public:
+ PushBackOrderIndex(ScDPCache::IndexArrayType& _items) : mrData(_items) {}
+ void operator() (const Bucket& v)
+ {
+ mrData.push_back(v.mnOrderIndex);
+ }
+};
+
+void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField)
+{
+ if (aBuckets.empty())
+ return;
+
+ // Sort by the value.
+ std::sort(aBuckets.begin(), aBuckets.end(), LessByValue());
+
+ {
+ // Set order index such that unique values have identical index value.
+ SCROW nCurIndex = 0;
+ std::vector<Bucket>::iterator it = aBuckets.begin(), itEnd = aBuckets.end();
+ ScDPItemData aPrev = it->maValue;
+ it->mnOrderIndex = nCurIndex;
+ for (++it; it != itEnd; ++it)
+ {
+ if (aPrev != it->maValue)
+ ++nCurIndex;
+
+ it->mnOrderIndex = nCurIndex;
+ aPrev = it->maValue;
+ }
+ }
+
+ // Re-sort the bucket this time by the data index.
+ std::sort(aBuckets.begin(), aBuckets.end(), LessByDataIndex());
+
+ // Copy the order index series into the field object.
+ rField.maData.reserve(aBuckets.size());
+ std::for_each(aBuckets.begin(), aBuckets.end(), PushBackOrderIndex(rField.maData));
+
+ // Sort by the value again.
+ std::sort(aBuckets.begin(), aBuckets.end(), LessByValue());
+
+ // Unique by value.
+ std::vector<Bucket>::iterator itUniqueEnd =
+ std::unique(aBuckets.begin(), aBuckets.end(), EqualByValue());
+
+ // Copy the unique values into items.
+ std::vector<Bucket>::iterator itBeg = aBuckets.begin();
+ size_t nLen = distance(itBeg, itUniqueEnd);
+ rField.maItems.reserve(nLen);
+ std::for_each(itBeg, itUniqueEnd, PushBackValue(rField.maItems));
+
+ // The items are actually already sorted. So, just insert a sequence
+ // of integers from 0 and up.
+ rField.maGlobalOrder.reserve(nLen);
+ for (size_t i = 0; i < nLen; ++i)
+ rField.maGlobalOrder.push_back(i);
+}
+
}
bool ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange& rRange)
@@ -350,12 +456,27 @@ bool ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange& rRange)
for (sal_uInt16 nCol = nStartCol; nCol <= nEndCol; ++nCol)
{
AddLabel(createLabelString(pDoc, nCol, nStartRow, nDocTab));
- for (SCROW nRow = nStartRow + 1; nRow <= nEndRow; ++nRow)
+ Field& rField = maFields[nCol];
+ std::vector<Bucket> aBuckets;
+ aBuckets.reserve(nEndRow-nStartRow); // skip the topmost label cell.
+
+ // Push back all original values.
+ SCROW nOffset = nStartRow + 1;
+ for (SCROW i = 0, n = nEndRow-nStartRow; i < n; ++i)
{
+ SCROW nRow = i + nOffset;
sal_uLong nNumFormat = 0;
initFromCell(pDoc, nCol, nRow, nDocTab, aData, nNumFormat);
- AddData(nCol - nStartCol, aData, nNumFormat);
+ aBuckets.push_back(Bucket(aData, 0, i));
+
+ if (!aData.IsEmpty())
+ {
+ maEmptyRows.insert_back(nRow, nRow+1, false);
+ rField.mnNumFormat = nNumFormat;
+ }
}
+
+ processBuckets(aBuckets, rField);
}
PostInit();
diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx
index 43c01cb..5b89aef 100644
--- a/sc/source/core/data/dpitemdata.cxx
+++ b/sc/source/core/data/dpitemdata.cxx
@@ -211,6 +211,16 @@ bool ScDPItemData::operator== (const ScDPItemData& r) const
return GetString() == r.GetString();
}
+bool ScDPItemData::operator!= (const ScDPItemData& r) const
+{
+ return !operator== (r);
+}
+
+bool ScDPItemData::operator< (const ScDPItemData& r) const
+{
+ return Compare(*this, r) == -1;
+}
+
ScDPItemData& ScDPItemData::operator= (const ScDPItemData& r)
{
meType = r.meType;
commit e6c65b03976971fbc21e7a1dec75f6713be6c322
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Mar 15 10:44:30 2012 -0400
DataListType -> ItemsType.
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index ea0c085..0557481 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -59,14 +59,14 @@ struct ScDPNumGroupInfo;
class SC_DLLPUBLIC ScDPCache : boost::noncopyable
{
public:
- typedef std::vector<ScDPItemData> DataListType;
+ typedef std::vector<ScDPItemData> ItemsType;
typedef std::set<ScDPObject*> ObjectSetType;
typedef std::vector<rtl::OUString> LabelsType;
typedef std::vector<SCROW> IndexArrayType;
struct GroupItems : boost::noncopyable
{
- DataListType maItems;
+ ItemsType maItems;
ScDPNumGroupInfo maInfo;
GroupItems();
@@ -80,7 +80,7 @@ public:
*/
boost::scoped_ptr<GroupItems> mpGroup;
- DataListType maItems; /// Unique values in the field.
+ ItemsType maItems; /// Unique values in the field.
/**
* Original source data represented as indices to the unique value
@@ -145,7 +145,7 @@ public:
SCROW GetDimMemberCount( SCCOL nDim ) const;
SCROW GetOrder( long nDim, SCROW nIndex ) const;
- const DataListType& GetDimMemberValues( SCCOL nDim ) const;
+ const ItemsType& GetDimMemberValues( SCCOL nDim ) const;
bool InitFromDoc(ScDocument* pDoc, const ScRange& rRange);
bool InitFromDataBase(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xRowSet, const Date& rNullDate);
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index fe262ac..dba8ef9 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -75,7 +75,7 @@ namespace {
*
* @return true if the item is found, or false otherwise.
*/
-bool hasItemInDimension(const ScDPCache::DataListType& rArray, const ScDPCache::IndexArrayType& rOrder, const ScDPItemData& rItem, SCROW& rIndex)
+bool hasItemInDimension(const ScDPCache::ItemsType& rArray, const ScDPCache::IndexArrayType& rOrder, const ScDPItemData& rItem, SCROW& rIndex)
{
rIndex = rArray.size();
bool bFound = false;
@@ -705,7 +705,7 @@ void ScDPCache::PostInit()
for (; it != itEnd; ++it)
{
// Trim excess capacity.
- DataListType(it->maItems).swap(it->maItems);
+ ItemsType(it->maItems).swap(it->maItems);
}
}
@@ -777,7 +777,7 @@ const ScDPItemData* ScDPCache::GetItemDataById(long nDim, SCROW nId) const
return NULL;
nItemId -= rField.maItems.size();
- const DataListType& rGI = rField.mpGroup->maItems;
+ const ItemsType& rGI = rField.mpGroup->maItems;
if (nItemId >= rGI.size())
return NULL;
@@ -789,7 +789,7 @@ const ScDPItemData* ScDPCache::GetItemDataById(long nDim, SCROW nId) const
if (nDimPos >= maGroupFields.size())
return NULL;
- const DataListType& rGI = maGroupFields[nDimPos].maItems;
+ const ItemsType& rGI = maGroupFields[nDimPos].maItems;
if (nItemId >= rGI.size())
return NULL;
@@ -804,7 +804,7 @@ SCROW ScDPCache::GetRowCount() const
return maFields[0].maData.size();
}
-const ScDPCache::DataListType& ScDPCache::GetDimMemberValues(SCCOL nDim) const
+const ScDPCache::ItemsType& ScDPCache::GetDimMemberValues(SCCOL nDim) const
{
OSL_ENSURE( nDim>=0 && nDim < mnColumnCount ," nDim < mnColumnCount ");
return maFields.at(nDim).maItems;
@@ -878,7 +878,7 @@ SCROW ScDPCache::GetIdByItemData(long nDim, const ScDPItemData& rItem) const
if (nDim < mnColumnCount)
{
// source field.
- const DataListType& rItems = maFields[nDim].maItems;
+ const ItemsType& rItems = maFields[nDim].maItems;
for (size_t i = 0, n = rItems.size(); i < n; ++i)
{
if (rItems[i] == rItem)
@@ -889,7 +889,7 @@ SCROW ScDPCache::GetIdByItemData(long nDim, const ScDPItemData& rItem) const
return -1;
// grouped source field.
- const DataListType& rGI = maFields[nDim].mpGroup->maItems;
+ const ItemsType& rGI = maFields[nDim].mpGroup->maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
{
if (rGI[i] == rItem)
@@ -902,7 +902,7 @@ SCROW ScDPCache::GetIdByItemData(long nDim, const ScDPItemData& rItem) const
nDim -= mnColumnCount;
if (static_cast<size_t>(nDim) < maGroupFields.size())
{
- const DataListType& rGI = maGroupFields[nDim].maItems;
+ const ItemsType& rGI = maGroupFields[nDim].maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
{
if (rGI[i] == rItem)
@@ -1005,7 +1005,7 @@ SCROW ScDPCache::SetGroupItem(long nDim, const ScDPItemData& rData)
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
{
- DataListType& rItems = maGroupFields.at(nDim).maItems;
+ ItemsType& rItems = maGroupFields.at(nDim).maItems;
rItems.push_back(rData);
return rItems.size()-1;
}
@@ -1025,7 +1025,7 @@ void ScDPCache::GetGroupDimMemberIds(long nDim, std::vector<SCROW>& rIds) const
return;
size_t nOffset = maFields[nDim].maItems.size();
- const DataListType& rGI = maFields[nDim].mpGroup->maItems;
+ const ItemsType& rGI = maFields[nDim].mpGroup->maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
rIds.push_back(static_cast<SCROW>(i + nOffset));
@@ -1035,7 +1035,7 @@ void ScDPCache::GetGroupDimMemberIds(long nDim, std::vector<SCROW>& rIds) const
nDim -= nSourceCount;
if (nDim < static_cast<long>(maGroupFields.size()))
{
- const DataListType& rGI = maGroupFields.at(nDim).maItems;
+ const ItemsType& rGI = maGroupFields.at(nDim).maItems;
for (size_t i = 0, n = rGI.size(); i < n; ++i)
rIds.push_back(static_cast<SCROW>(i));
}
diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx
index 8cf8d39..f313990 100644
--- a/sc/source/core/data/dpdimsave.cxx
+++ b/sc/source/core/data/dpdimsave.cxx
@@ -304,8 +304,8 @@ void fillDateGroupDimension(
double fSourceMax = 0.0;
bool bFirst = true;
- const ScDPCache::DataListType& rItems = rCache.GetDimMemberValues(nSourceDim);
- ScDPCache::DataListType::const_iterator it = rItems.begin(), itEnd = rItems.end();
+ const ScDPCache::ItemsType& rItems = rCache.GetDimMemberValues(nSourceDim);
+ ScDPCache::ItemsType::const_iterator it = rItems.begin(), itEnd = rItems.end();
for (; it != itEnd; ++it)
{
const ScDPItemData& rItem = *it;
@@ -419,9 +419,9 @@ void ScDPSaveGroupDimension::AddToCache(ScDPCache& rCache) const
}
}
- const ScDPCache::DataListType& rItems = rCache.GetDimMemberValues(nSourceDim);
+ const ScDPCache::ItemsType& rItems = rCache.GetDimMemberValues(nSourceDim);
{
- ScDPCache::DataListType::const_iterator it = rItems.begin(), itEnd = rItems.end();
+ ScDPCache::ItemsType::const_iterator it = rItems.begin(), itEnd = rItems.end();
for (; it != itEnd; ++it)
{
const ScDPItemData& rItem = *it;
@@ -494,8 +494,8 @@ void ScDPSaveNumGroupDimension::AddToCache(ScDPCache& rCache) const
double fSourceMax = 0.0;
bool bFirst = true;
- const ScDPCache::DataListType& rItems = rCache.GetDimMemberValues(nDim);
- ScDPCache::DataListType::const_iterator it = rItems.begin(), itEnd = rItems.end();
+ const ScDPCache::ItemsType& rItems = rCache.GetDimMemberValues(nDim);
+ ScDPCache::ItemsType::const_iterator it = rItems.begin(), itEnd = rItems.end();
for (; it != itEnd; ++it)
{
const ScDPItemData& rItem = *it;
More information about the Libreoffice-commits
mailing list