Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "dpcache.hxx"
21 :
22 : #include "document.hxx"
23 : #include "queryentry.hxx"
24 : #include "queryparam.hxx"
25 : #include "dpglobal.hxx"
26 : #include "dpobject.hxx"
27 : #include "globstr.hrc"
28 : #include "docoptio.hxx"
29 : #include "dpitemdata.hxx"
30 : #include "dputil.hxx"
31 : #include "dpnumgroupinfo.hxx"
32 :
33 : #include <rtl/math.hxx>
34 : #include <unotools/textsearch.hxx>
35 : #include <unotools/localedatawrapper.hxx>
36 : #include <svl/zforlist.hxx>
37 :
38 : #include <memory>
39 :
40 : using namespace ::com::sun::star;
41 :
42 : using ::com::sun::star::uno::Exception;
43 : using ::com::sun::star::uno::Reference;
44 : using ::com::sun::star::uno::UNO_QUERY;
45 : using ::com::sun::star::uno::UNO_QUERY_THROW;
46 :
47 4 : ScDPCache::GroupItems::GroupItems() : mnGroupType(0) {}
48 :
49 2 : ScDPCache::GroupItems::GroupItems(const ScDPNumGroupInfo& rInfo, sal_Int32 nGroupType) :
50 2 : maInfo(rInfo), mnGroupType(nGroupType) {}
51 :
52 55 : ScDPCache::Field::Field() : mnNumFormat(0) {}
53 :
54 18 : ScDPCache::ScDPCache(ScDocument* pDoc) :
55 : mpDoc( pDoc ),
56 : mnColumnCount ( 0 ),
57 : maEmptyRows(0, MAXROW, true),
58 : mnDataSize(-1),
59 : mnRowCount(0),
60 18 : mbDisposing(false)
61 : {
62 18 : }
63 :
64 : namespace {
65 :
66 : struct ClearObjectSource : std::unary_function<ScDPObject*, void>
67 : {
68 0 : void operator() (ScDPObject* p) const
69 : {
70 0 : p->ClearTableData();
71 0 : }
72 : };
73 :
74 : }
75 :
76 36 : ScDPCache::~ScDPCache()
77 : {
78 : // Make sure no live ScDPObject instances hold reference to this cache any
79 : // more.
80 18 : mbDisposing = true;
81 18 : std::for_each(maRefObjects.begin(), maRefObjects.end(), ClearObjectSource());
82 18 : }
83 :
84 : namespace {
85 :
86 : /**
87 : * While the macro interpret level is incremented, the formula cells are
88 : * (semi-)guaranteed to be interpreted.
89 : */
90 : class MacroInterpretIncrementer
91 : {
92 : public:
93 20 : MacroInterpretIncrementer(ScDocument* pDoc) :
94 20 : mpDoc(pDoc)
95 : {
96 20 : mpDoc->IncMacroInterpretLevel();
97 20 : }
98 20 : ~MacroInterpretIncrementer()
99 : {
100 20 : mpDoc->DecMacroInterpretLevel();
101 20 : }
102 : private:
103 : ScDocument* mpDoc;
104 : };
105 :
106 55 : rtl::OUString createLabelString(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab)
107 : {
108 55 : rtl::OUString aDocStr = pDoc->GetString(nCol, nRow, nTab);
109 55 : if (aDocStr.isEmpty())
110 : {
111 : // Replace an empty label string with column name.
112 0 : rtl::OUStringBuffer aBuf;
113 0 : aBuf.append(ScGlobal::GetRscString(STR_COLUMN));
114 0 : aBuf.append(sal_Unicode(' '));
115 :
116 0 : ScAddress aColAddr(nCol, 0, 0);
117 0 : rtl::OUString aColStr;
118 0 : aColAddr.Format(aColStr, SCA_VALID_COL, NULL);
119 0 : aBuf.append(aColStr);
120 0 : aDocStr = aBuf.makeStringAndClear();
121 : }
122 55 : return aDocStr;
123 : }
124 :
125 410 : void initFromCell(
126 : ScDPCache& rCache, ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
127 : ScDPItemData& rData, sal_uLong& rNumFormat)
128 : {
129 410 : rtl::OUString aDocStr = pDoc->GetString(nCol, nRow, nTab);
130 410 : rNumFormat = 0;
131 :
132 410 : ScAddress aPos(nCol, nRow, nTab);
133 :
134 410 : if (pDoc->GetErrCode(aPos))
135 : {
136 0 : rData.SetErrorString(rCache.InternString(aDocStr));
137 : }
138 410 : else if (pDoc->HasValueData(nCol, nRow, nTab))
139 : {
140 248 : double fVal = pDoc->GetValue(aPos);
141 248 : rNumFormat = pDoc->GetNumberFormat(aPos);
142 248 : rData.SetValue(fVal);
143 : }
144 162 : else if (pDoc->HasData(nCol, nRow, nTab))
145 : {
146 162 : rData.SetString(rCache.InternString(aDocStr));
147 : }
148 : else
149 0 : rData.SetEmpty();
150 410 : }
151 :
152 6075 : struct Bucket
153 : {
154 : ScDPItemData maValue;
155 : SCROW mnOrderIndex;
156 : SCROW mnDataIndex;
157 : SCROW mnValueSortIndex;
158 410 : Bucket(const ScDPItemData& rValue, SCROW nOrder, SCROW nData) :
159 410 : maValue(rValue), mnOrderIndex(nOrder), mnDataIndex(nData), mnValueSortIndex(0) {}
160 : };
161 :
162 : #if DEBUG_PIVOT_TABLE
163 : #include <iostream>
164 : using std::cout;
165 : using std::endl;
166 :
167 : struct PrintBucket : std::unary_function<Bucket, void>
168 : {
169 : void operator() (const Bucket& v) const
170 : {
171 : cout << "value: " << v.maValue.GetValue() << " order index: " << v.mnOrderIndex << " data index: " << v.mnDataIndex << " value sort index: " << v.mnValueSortIndex << endl;
172 : }
173 : };
174 :
175 : #endif
176 :
177 : struct LessByValue : std::binary_function<Bucket, Bucket, bool>
178 : {
179 1071 : bool operator() (const Bucket& left, const Bucket& right) const
180 : {
181 1071 : return left.maValue < right.maValue;
182 : }
183 : };
184 :
185 : struct LessByValueSortIndex : std::binary_function<Bucket, Bucket, bool>
186 : {
187 1157 : bool operator() (const Bucket& left, const Bucket& right) const
188 : {
189 1157 : return left.mnValueSortIndex < right.mnValueSortIndex;
190 : }
191 : };
192 :
193 : struct LessByDataIndex : std::binary_function<Bucket, Bucket, bool>
194 : {
195 1143 : bool operator() (const Bucket& left, const Bucket& right) const
196 : {
197 1143 : return left.mnDataIndex < right.mnDataIndex;
198 : }
199 : };
200 :
201 : struct EqualByOrderIndex : std::binary_function<Bucket, Bucket, bool>
202 : {
203 355 : bool operator() (const Bucket& left, const Bucket& right) const
204 : {
205 355 : return left.mnOrderIndex == right.mnOrderIndex;
206 : }
207 : };
208 :
209 : class PushBackValue : std::unary_function<Bucket, void>
210 : {
211 : ScDPCache::ItemsType& mrItems;
212 : public:
213 55 : PushBackValue(ScDPCache::ItemsType& _items) : mrItems(_items) {}
214 292 : void operator() (const Bucket& v)
215 : {
216 292 : mrItems.push_back(v.maValue);
217 292 : }
218 : };
219 :
220 : class PushBackOrderIndex : std::unary_function<Bucket, void>
221 : {
222 : ScDPCache::IndexArrayType& mrData;
223 : public:
224 55 : PushBackOrderIndex(ScDPCache::IndexArrayType& _items) : mrData(_items) {}
225 410 : void operator() (const Bucket& v)
226 : {
227 410 : mrData.push_back(v.mnOrderIndex);
228 410 : }
229 : };
230 :
231 : class TagValueSortOrder : std::unary_function<Bucket, void>
232 : {
233 : SCROW mnCurIndex;
234 : public:
235 55 : TagValueSortOrder() : mnCurIndex(0) {}
236 410 : void operator() (Bucket& v)
237 : {
238 410 : v.mnValueSortIndex = mnCurIndex++;
239 410 : }
240 : };
241 :
242 55 : void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField)
243 : {
244 55 : if (aBuckets.empty())
245 55 : return;
246 :
247 : // Sort by the value.
248 55 : std::sort(aBuckets.begin(), aBuckets.end(), LessByValue());
249 :
250 : // Remember this sort order.
251 55 : std::for_each(aBuckets.begin(), aBuckets.end(), TagValueSortOrder());
252 :
253 : {
254 : // Set order index such that unique values have identical index value.
255 55 : SCROW nCurIndex = 0;
256 55 : std::vector<Bucket>::iterator it = aBuckets.begin(), itEnd = aBuckets.end();
257 55 : ScDPItemData aPrev = it->maValue;
258 55 : it->mnOrderIndex = nCurIndex;
259 410 : for (++it; it != itEnd; ++it)
260 : {
261 355 : if (!aPrev.IsCaseInsEqual(it->maValue))
262 237 : ++nCurIndex;
263 :
264 355 : it->mnOrderIndex = nCurIndex;
265 355 : aPrev = it->maValue;
266 55 : }
267 : }
268 :
269 : // Re-sort the bucket this time by the data index.
270 55 : std::sort(aBuckets.begin(), aBuckets.end(), LessByDataIndex());
271 :
272 : // Copy the order index series into the field object.
273 55 : rField.maData.reserve(aBuckets.size());
274 55 : std::for_each(aBuckets.begin(), aBuckets.end(), PushBackOrderIndex(rField.maData));
275 :
276 : // Sort by the value again.
277 55 : std::sort(aBuckets.begin(), aBuckets.end(), LessByValueSortIndex());
278 :
279 : // Unique by value.
280 : std::vector<Bucket>::iterator itUniqueEnd =
281 55 : std::unique(aBuckets.begin(), aBuckets.end(), EqualByOrderIndex());
282 :
283 : // Copy the unique values into items.
284 55 : std::vector<Bucket>::iterator itBeg = aBuckets.begin();
285 55 : size_t nLen = distance(itBeg, itUniqueEnd);
286 55 : rField.maItems.reserve(nLen);
287 55 : std::for_each(itBeg, itUniqueEnd, PushBackValue(rField.maItems));
288 : }
289 :
290 : }
291 :
292 20 : bool ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange& rRange)
293 : {
294 20 : Clear();
295 :
296 : // Make sure the formula cells within the data range are interpreted
297 : // during this call, for this method may be called from the interpretation
298 : // of GETPIVOTDATA, which disables nested formula interpretation without
299 : // increasing the macro level.
300 20 : MacroInterpretIncrementer aMacroInc(pDoc);
301 :
302 20 : SCROW nStartRow = rRange.aStart.Row(); // start of data
303 20 : SCROW nEndRow = rRange.aEnd.Row();
304 :
305 : // Sanity check
306 20 : if (!ValidRow(nStartRow) || !ValidRow(nEndRow) || nEndRow <= nStartRow)
307 0 : return false;
308 :
309 20 : sal_uInt16 nStartCol = rRange.aStart.Col();
310 20 : sal_uInt16 nEndCol = rRange.aEnd.Col();
311 20 : sal_uInt16 nDocTab = rRange.aStart.Tab();
312 :
313 20 : mnColumnCount = nEndCol - nStartCol + 1;
314 :
315 : // this row count must include the trailing empty rows.
316 20 : mnRowCount = nEndRow - nStartRow; // skip the topmost label row.
317 :
318 : // Skip trailing empty rows if exists.
319 20 : SCCOL nCol1 = nStartCol, nCol2 = nEndCol;
320 20 : SCROW nRow1 = nStartRow, nRow2 = nEndRow;
321 20 : pDoc->ShrinkToDataArea(nDocTab, nCol1, nRow1, nCol2, nRow2);
322 20 : bool bTailEmptyRows = nEndRow > nRow2; // Trailing empty rows exist.
323 20 : nEndRow = nRow2;
324 :
325 20 : if (nEndRow <= nStartRow)
326 : {
327 : // Check this again since the end row position has changed. It's
328 : // possible that the new end row becomes lower than the start row
329 : // after the shrinkage.
330 0 : Clear();
331 0 : return false;
332 : }
333 :
334 20 : maFields.reserve(mnColumnCount);
335 75 : for (size_t i = 0; i < static_cast<size_t>(mnColumnCount); ++i)
336 55 : maFields.push_back(new Field);
337 :
338 20 : maLabelNames.reserve(mnColumnCount+1);
339 :
340 20 : ScDPItemData aData;
341 75 : for (sal_uInt16 nCol = nStartCol; nCol <= nEndCol; ++nCol)
342 : {
343 55 : AddLabel(createLabelString(pDoc, nCol, nStartRow, nDocTab));
344 55 : Field& rField = maFields[nCol-nStartCol];
345 55 : std::vector<Bucket> aBuckets;
346 55 : aBuckets.reserve(nEndRow-nStartRow); // skip the topmost label cell.
347 :
348 : // Push back all original values.
349 55 : SCROW nOffset = nStartRow + 1;
350 465 : for (SCROW i = 0, n = nEndRow-nStartRow; i < n; ++i)
351 : {
352 410 : SCROW nRow = i + nOffset;
353 410 : sal_uLong nNumFormat = 0;
354 410 : initFromCell(*this, pDoc, nCol, nRow, nDocTab, aData, nNumFormat);
355 410 : aBuckets.push_back(Bucket(aData, 0, i));
356 :
357 410 : if (!aData.IsEmpty())
358 : {
359 410 : maEmptyRows.insert_back(i, i+1, false);
360 410 : rField.mnNumFormat = nNumFormat;
361 : }
362 : }
363 :
364 55 : processBuckets(aBuckets, rField);
365 :
366 55 : if (bTailEmptyRows)
367 : {
368 : // If the last item is not empty, append one. Note that the items
369 : // are sorted, and empty item should come last when sorted.
370 8 : if (rField.maItems.empty() || !rField.maItems.back().IsEmpty())
371 : {
372 8 : aData.SetEmpty();
373 8 : rField.maItems.push_back(aData);
374 : }
375 : }
376 55 : }
377 :
378 20 : PostInit();
379 20 : return true;
380 : }
381 :
382 0 : bool ScDPCache::InitFromDataBase(DBConnector& rDB)
383 : {
384 0 : Clear();
385 :
386 : try
387 : {
388 0 : mnColumnCount = rDB.getColumnCount();
389 0 : maFields.clear();
390 0 : maFields.reserve(mnColumnCount);
391 0 : for (size_t i = 0; i < static_cast<size_t>(mnColumnCount); ++i)
392 0 : maFields.push_back(new Field);
393 :
394 : // Get column titles and types.
395 0 : maLabelNames.clear();
396 0 : maLabelNames.reserve(mnColumnCount+1);
397 :
398 0 : std::vector<sal_Int32> aColTypes(mnColumnCount);
399 :
400 0 : for (sal_Int32 nCol = 0; nCol < mnColumnCount; ++nCol)
401 : {
402 0 : rtl::OUString aColTitle = rDB.getColumnLabel(nCol);
403 0 : AddLabel(aColTitle);
404 0 : }
405 :
406 0 : std::vector<Bucket> aBuckets;
407 0 : ScDPItemData aData;
408 0 : for (sal_Int32 nCol = 0; nCol < mnColumnCount; ++nCol)
409 : {
410 0 : if (!rDB.first())
411 0 : continue;
412 :
413 0 : aBuckets.clear();
414 0 : Field& rField = maFields[nCol];
415 0 : SCROW nRow = 0;
416 0 : do
417 : {
418 0 : short nFormatType = NUMBERFORMAT_UNDEFINED;
419 0 : aData.SetEmpty();
420 0 : rDB.getValue(nCol, aData, nFormatType);
421 0 : aBuckets.push_back(Bucket(aData, 0, nRow));
422 0 : if (!aData.IsEmpty())
423 : {
424 0 : maEmptyRows.insert_back(nRow, nRow+1, false);
425 0 : SvNumberFormatter* pFormatter = mpDoc->GetFormatTable();
426 0 : rField.mnNumFormat = pFormatter ? pFormatter->GetStandardFormat(nFormatType) : 0;
427 : }
428 :
429 0 : ++nRow;
430 : }
431 0 : while (rDB.next());
432 :
433 0 : processBuckets(aBuckets, rField);
434 : }
435 :
436 0 : rDB.finish();
437 :
438 0 : if (!maFields.empty())
439 0 : mnRowCount = maFields[0].maData.size();
440 :
441 0 : PostInit();
442 0 : return true;
443 : }
444 0 : catch (const Exception&)
445 : {
446 0 : return false;
447 : }
448 : }
449 :
450 212 : bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const
451 : {
452 212 : if (!rParam.GetEntryCount())
453 0 : return true;
454 :
455 212 : if (!rParam.GetEntry(0).bDoQuery)
456 196 : return true;
457 :
458 16 : bool bMatchWholeCell = mpDoc->GetDocOptions().IsMatchWholeCell();
459 :
460 16 : SCSIZE nEntryCount = rParam.GetEntryCount();
461 16 : std::vector<bool> aPassed(nEntryCount, false);
462 :
463 16 : long nPos = -1;
464 : CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::GetCaseCollator() :
465 16 : ScGlobal::GetCollator() );
466 : ::utl::TransliterationWrapper* pTransliteration = (rParam.bCaseSens ?
467 16 : ScGlobal::GetCaseTransliteration() : ScGlobal::GetpTransliteration());
468 :
469 32 : for (size_t i = 0; i < nEntryCount && rParam.GetEntry(i).bDoQuery; ++i)
470 : {
471 16 : const ScQueryEntry& rEntry = rParam.GetEntry(i);
472 16 : const ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
473 : // we can only handle one single direct query
474 : // #i115431# nField in QueryParam is the sheet column, not the field within the source range
475 16 : SCCOL nQueryCol = (SCCOL)rEntry.nField;
476 16 : if ( nQueryCol < rParam.nCol1 )
477 0 : nQueryCol = rParam.nCol1;
478 16 : if ( nQueryCol > rParam.nCol2 )
479 0 : nQueryCol = rParam.nCol2;
480 16 : SCCOL nSourceField = nQueryCol - rParam.nCol1;
481 16 : SCROW nId = GetItemDataId( nSourceField, nRow, false );
482 16 : const ScDPItemData* pCellData = GetItemDataById( nSourceField, nId );
483 :
484 16 : bool bOk = false;
485 :
486 16 : if (rEntry.GetQueryItem().meType == ScQueryEntry::ByEmpty)
487 : {
488 0 : if (rEntry.IsQueryByEmpty())
489 0 : bOk = pCellData->IsEmpty();
490 : else
491 : {
492 : OSL_ASSERT(rEntry.IsQueryByNonEmpty());
493 0 : bOk = !pCellData->IsEmpty();
494 : }
495 : }
496 16 : else if (rEntry.GetQueryItem().meType != ScQueryEntry::ByString && pCellData->IsValue())
497 : { // by Value
498 16 : double nCellVal = pCellData->GetValue();
499 :
500 16 : switch (rEntry.eOp)
501 : {
502 : case SC_EQUAL :
503 16 : bOk = ::rtl::math::approxEqual(nCellVal, rItem.mfVal);
504 16 : break;
505 : case SC_LESS :
506 0 : bOk = (nCellVal < rItem.mfVal) && !::rtl::math::approxEqual(nCellVal, rItem.mfVal);
507 0 : break;
508 : case SC_GREATER :
509 0 : bOk = (nCellVal > rItem.mfVal) && !::rtl::math::approxEqual(nCellVal, rItem.mfVal);
510 0 : break;
511 : case SC_LESS_EQUAL :
512 0 : bOk = (nCellVal < rItem.mfVal) || ::rtl::math::approxEqual(nCellVal, rItem.mfVal);
513 0 : break;
514 : case SC_GREATER_EQUAL :
515 0 : bOk = (nCellVal > rItem.mfVal) || ::rtl::math::approxEqual(nCellVal, rItem.mfVal);
516 0 : break;
517 : case SC_NOT_EQUAL :
518 0 : bOk = !::rtl::math::approxEqual(nCellVal, rItem.mfVal);
519 0 : break;
520 : default:
521 0 : bOk= false;
522 0 : break;
523 : }
524 : }
525 0 : else if ((rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL)
526 0 : || (rEntry.GetQueryItem().meType == ScQueryEntry::ByString
527 0 : && pCellData->HasStringData() )
528 : )
529 : { // by String
530 0 : String aCellStr = pCellData->GetString();
531 :
532 : bool bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
533 0 : || (rEntry.eOp == SC_NOT_EQUAL)));
534 0 : bool bTestRegExp = false;
535 0 : if (bRealRegExp || bTestRegExp)
536 : {
537 0 : xub_StrLen nStart = 0;
538 0 : xub_StrLen nEnd = aCellStr.Len();
539 : bool bMatch = (bool) rEntry.GetSearchTextPtr( rParam.bCaseSens )
540 0 : ->SearchFrwrd( aCellStr, &nStart, &nEnd );
541 : // from 614 on, nEnd is behind the found text
542 0 : if (bMatch && bMatchWholeCell
543 0 : && (nStart != 0 || nEnd != aCellStr.Len()))
544 0 : bMatch = false; // RegExp must match entire cell string
545 0 : if (bRealRegExp)
546 0 : bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch);
547 : }
548 0 : if (!bRealRegExp)
549 : {
550 0 : if (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL)
551 : {
552 0 : if (bMatchWholeCell)
553 : {
554 0 : String aStr = rEntry.GetQueryItem().maString;
555 0 : bOk = pTransliteration->isEqual(aCellStr, aStr);
556 0 : bool bHasStar = false;
557 : xub_StrLen nIndex;
558 0 : if (( nIndex = aStr.Search('*') ) != STRING_NOTFOUND)
559 0 : bHasStar = sal_True;
560 0 : if (bHasStar && (nIndex>0))
561 : {
562 0 : for (i=0;(i<nIndex) && (i< aCellStr.Len()) ; i++)
563 : {
564 0 : if (aCellStr.GetChar( (sal_uInt16)i ) == aStr.GetChar((sal_uInt16) i ))
565 : {
566 0 : bOk=1;
567 : }
568 : else
569 : {
570 0 : bOk=0;
571 0 : break;
572 : }
573 : }
574 0 : }
575 : }
576 : else
577 : {
578 0 : const rtl::OUString& rQueryStr = rEntry.GetQueryItem().maString;
579 0 : ::com::sun::star::uno::Sequence< sal_Int32 > xOff;
580 : String aCell = pTransliteration->transliterate(
581 0 : aCellStr, ScGlobal::eLnge, 0, aCellStr.Len(), &xOff);
582 : String aQuer = pTransliteration->transliterate(
583 0 : rQueryStr, ScGlobal::eLnge, 0, rQueryStr.getLength(), &xOff);
584 0 : bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND);
585 : }
586 0 : if (rEntry.eOp == SC_NOT_EQUAL)
587 0 : bOk = !bOk;
588 : }
589 : else
590 : { // use collator here because data was probably sorted
591 : sal_Int32 nCompare = pCollator->compareString(
592 0 : aCellStr, rEntry.GetQueryItem().maString);
593 0 : switch (rEntry.eOp)
594 : {
595 : case SC_LESS :
596 0 : bOk = (nCompare < 0);
597 0 : break;
598 : case SC_GREATER :
599 0 : bOk = (nCompare > 0);
600 0 : break;
601 : case SC_LESS_EQUAL :
602 0 : bOk = (nCompare <= 0);
603 0 : break;
604 : case SC_GREATER_EQUAL :
605 0 : bOk = (nCompare >= 0);
606 0 : break;
607 : case SC_NOT_EQUAL:
608 : OSL_FAIL("SC_NOT_EQUAL");
609 0 : break;
610 : case SC_TOPVAL:
611 : case SC_BOTVAL:
612 : case SC_TOPPERC:
613 : case SC_BOTPERC:
614 : default:
615 0 : break;
616 : }
617 : }
618 0 : }
619 : }
620 :
621 16 : if (nPos == -1)
622 : {
623 16 : nPos++;
624 16 : aPassed[nPos] = bOk;
625 : }
626 : else
627 : {
628 0 : if (rEntry.eConnect == SC_AND)
629 : {
630 0 : aPassed[nPos] = aPassed[nPos] && bOk;
631 : }
632 : else
633 : {
634 0 : nPos++;
635 0 : aPassed[nPos] = bOk;
636 : }
637 : }
638 : }
639 :
640 16 : for (long j=1; j <= nPos; j++)
641 0 : aPassed[0] = aPassed[0] || aPassed[j];
642 :
643 16 : bool bRet = aPassed[0];
644 16 : return bRet;
645 : }
646 :
647 8 : bool ScDPCache::IsRowEmpty(SCROW nRow) const
648 : {
649 8 : bool bEmpty = true;
650 8 : maEmptyRows.search_tree(nRow, bEmpty);
651 8 : return bEmpty;
652 : }
653 :
654 28 : const ScDPCache::GroupItems* ScDPCache::GetGroupItems(long nDim) const
655 : {
656 28 : if (nDim < 0)
657 0 : return NULL;
658 :
659 28 : long nSourceCount = static_cast<long>(maFields.size());
660 28 : if (nDim < nSourceCount)
661 15 : return maFields[nDim].mpGroup.get();
662 :
663 13 : nDim -= nSourceCount;
664 13 : if (nDim < static_cast<long>(maGroupFields.size()))
665 13 : return &maGroupFields[nDim];
666 :
667 0 : return NULL;
668 : }
669 :
670 2123 : rtl::OUString ScDPCache::GetDimensionName(LabelsType::size_type nDim) const
671 : {
672 : OSL_ENSURE(nDim < maLabelNames.size()-1 , "ScDPTableDataCache::GetDimensionName");
673 : OSL_ENSURE(maLabelNames.size() == static_cast <sal_uInt16> (mnColumnCount+1), "ScDPTableDataCache::GetDimensionName");
674 :
675 2123 : if ( nDim+1 < maLabelNames.size() )
676 : {
677 2123 : return maLabelNames[nDim+1];
678 : }
679 : else
680 0 : return rtl::OUString();
681 : }
682 :
683 : namespace {
684 :
685 : typedef boost::unordered_set<rtl::OUString, rtl::OUStringHash> LabelSet;
686 :
687 : class InsertLabel : public std::unary_function<rtl::OUString, void>
688 : {
689 : LabelSet& mrNames;
690 : public:
691 55 : InsertLabel(LabelSet& rNames) : mrNames(rNames) {}
692 112 : void operator() (const rtl::OUString& r)
693 : {
694 112 : mrNames.insert(r);
695 112 : }
696 : };
697 :
698 : }
699 :
700 20 : void ScDPCache::PostInit()
701 : {
702 : OSL_ENSURE(!maFields.empty(), "Cache not initialized!");
703 :
704 20 : maEmptyRows.build_tree();
705 : typedef mdds::flat_segment_tree<SCROW, bool>::const_reverse_iterator itr_type;
706 20 : itr_type it = maEmptyRows.rbegin();
707 : OSL_ENSURE(it != maEmptyRows.rend(), "corrupt flat_segment_tree instance!");
708 20 : mnDataSize = maFields[0].maData.size();
709 20 : ++it; // Skip the first position.
710 : OSL_ENSURE(it != maEmptyRows.rend(), "buggy version of flat_segment_tree is used.");
711 20 : if (it->second)
712 : {
713 20 : SCROW nLastNonEmpty = it->first - 1;
714 20 : if (nLastNonEmpty+1 < mnDataSize)
715 0 : mnDataSize = nLastNonEmpty+1;
716 : }
717 20 : }
718 :
719 20 : void ScDPCache::Clear()
720 : {
721 20 : mnColumnCount = 0;
722 20 : mnRowCount = 0;
723 20 : maFields.clear();
724 20 : maLabelNames.clear();
725 20 : maGroupFields.clear();
726 20 : maEmptyRows.clear();
727 20 : maStringPool.clear();
728 20 : }
729 :
730 55 : void ScDPCache::AddLabel(const rtl::OUString& rLabel)
731 : {
732 :
733 55 : if ( maLabelNames.empty() )
734 20 : maLabelNames.push_back(ScGlobal::GetRscString(STR_PIVOT_DATA));
735 :
736 : //reset name if needed
737 55 : LabelSet aExistingNames;
738 55 : std::for_each(maLabelNames.begin(), maLabelNames.end(), InsertLabel(aExistingNames));
739 55 : sal_Int32 nSuffix = 1;
740 55 : rtl::OUString aNewName = rLabel;
741 0 : while (true)
742 : {
743 55 : if (!aExistingNames.count(aNewName))
744 : {
745 : // unique name found!
746 55 : maLabelNames.push_back(aNewName);
747 55 : return;
748 : }
749 :
750 : // Name already exists.
751 0 : rtl::OUStringBuffer aBuf(rLabel);
752 0 : aBuf.append(++nSuffix);
753 0 : aNewName = aBuf.makeStringAndClear();
754 55 : }
755 : }
756 :
757 1090 : SCROW ScDPCache::GetItemDataId(sal_uInt16 nDim, SCROW nRow, bool bRepeatIfEmpty) const
758 : {
759 : OSL_ENSURE(nDim < mnColumnCount, "ScDPTableDataCache::GetItemDataId ");
760 :
761 1090 : const Field& rField = maFields[nDim];
762 1090 : if (static_cast<size_t>(nRow) >= rField.maData.size())
763 : {
764 : // nRow is in the trailing empty rows area.
765 8 : if (bRepeatIfEmpty)
766 0 : nRow = rField.maData.size()-1; // Move to the last non-empty row.
767 : else
768 : // Return the last item, which should always be empty if the
769 : // initialization has skipped trailing empty rows.
770 8 : return rField.maItems.size()-1;
771 :
772 : }
773 1082 : else if (bRepeatIfEmpty)
774 : {
775 0 : while (nRow > 0 && rField.maItems[rField.maData[nRow]].IsEmpty())
776 0 : --nRow;
777 : }
778 :
779 1082 : return rField.maData[nRow];
780 : }
781 :
782 953 : const ScDPItemData* ScDPCache::GetItemDataById(long nDim, SCROW nId) const
783 : {
784 953 : if (nDim < 0 || nId < 0)
785 0 : return NULL;
786 :
787 953 : size_t nSourceCount = maFields.size();
788 953 : size_t nDimPos = static_cast<size_t>(nDim);
789 953 : size_t nItemId = static_cast<size_t>(nId);
790 953 : if (nDimPos < nSourceCount)
791 : {
792 : // source field.
793 782 : const Field& rField = maFields[nDimPos];
794 782 : if (nItemId < rField.maItems.size())
795 636 : return &rField.maItems[nItemId];
796 :
797 146 : if (!rField.mpGroup)
798 3 : return NULL;
799 :
800 143 : nItemId -= rField.maItems.size();
801 143 : const ItemsType& rGI = rField.mpGroup->maItems;
802 143 : if (nItemId >= rGI.size())
803 0 : return NULL;
804 :
805 143 : return &rGI[nItemId];
806 : }
807 :
808 : // Try group fields.
809 171 : nDimPos -= nSourceCount;
810 171 : if (nDimPos >= maGroupFields.size())
811 0 : return NULL;
812 :
813 171 : const ItemsType& rGI = maGroupFields[nDimPos].maItems;
814 171 : if (nItemId >= rGI.size())
815 0 : return NULL;
816 :
817 171 : return &rGI[nItemId];
818 : }
819 :
820 56 : SCROW ScDPCache::GetRowCount() const
821 : {
822 56 : return mnRowCount;
823 : }
824 :
825 27 : SCROW ScDPCache::GetDataSize() const
826 : {
827 : OSL_ENSURE(mnDataSize <= GetRowCount(), "Data size should never be larger than the row count.");
828 27 : return mnDataSize >= 0 ? mnDataSize : 0;
829 : }
830 :
831 6 : const ScDPCache::ItemsType& ScDPCache::GetDimMemberValues(SCCOL nDim) const
832 : {
833 : OSL_ENSURE( nDim>=0 && nDim < mnColumnCount ," nDim < mnColumnCount ");
834 6 : return maFields.at(nDim).maItems;
835 : }
836 :
837 104 : sal_uLong ScDPCache::GetNumberFormat( long nDim ) const
838 : {
839 104 : if ( nDim >= mnColumnCount )
840 0 : return 0;
841 :
842 : // TODO: Find a way to determine the dominant number format in presence of
843 : // multiple number formats in the same field.
844 104 : return maFields[nDim].mnNumFormat;
845 : }
846 :
847 444 : bool ScDPCache::IsDateDimension( long nDim ) const
848 : {
849 444 : if (nDim >= mnColumnCount)
850 0 : return false;
851 :
852 444 : SvNumberFormatter* pFormatter = mpDoc->GetFormatTable();
853 444 : if (!pFormatter)
854 0 : return false;
855 :
856 444 : short eType = pFormatter->GetType(maFields[nDim].mnNumFormat);
857 444 : return (eType == NUMBERFORMAT_DATE) || (eType == NUMBERFORMAT_DATETIME);
858 : }
859 :
860 80 : long ScDPCache::GetDimMemberCount(long nDim) const
861 : {
862 : OSL_ENSURE( nDim>=0 && nDim < mnColumnCount ," ScDPTableDataCache::GetDimMemberCount : out of bound ");
863 80 : return maFields[nDim].maItems.size();
864 : }
865 :
866 6 : SCCOL ScDPCache::GetDimensionIndex(const rtl::OUString& sName) const
867 : {
868 6 : for (size_t i = 1; i < maLabelNames.size(); ++i)
869 : {
870 6 : if (maLabelNames[i].equals(sName))
871 6 : return static_cast<SCCOL>(i-1);
872 : }
873 0 : return -1;
874 : }
875 :
876 162 : const rtl::OUString* ScDPCache::InternString(const rtl::OUString& rStr) const
877 : {
878 162 : StringSetType::iterator it = maStringPool.find(rStr);
879 162 : if (it != maStringPool.end())
880 : // In the pool.
881 64 : return &(*it);
882 :
883 98 : std::pair<StringSetType::iterator, bool> r = maStringPool.insert(rStr);
884 98 : return r.second ? &(*r.first) : NULL;
885 : }
886 :
887 18 : void ScDPCache::AddReference(ScDPObject* pObj) const
888 : {
889 18 : maRefObjects.insert(pObj);
890 18 : }
891 :
892 18 : void ScDPCache::RemoveReference(ScDPObject* pObj) const
893 : {
894 18 : if (mbDisposing)
895 : // Object being deleted.
896 18 : return;
897 :
898 18 : maRefObjects.erase(pObj);
899 18 : if (maRefObjects.empty())
900 17 : mpDoc->GetDPCollection()->RemoveCache(this);
901 : }
902 :
903 2 : const ScDPCache::ObjectSetType& ScDPCache::GetAllReferences() const
904 : {
905 2 : return maRefObjects;
906 : }
907 :
908 80 : SCROW ScDPCache::GetIdByItemData(long nDim, const ScDPItemData& rItem) const
909 : {
910 80 : if (nDim < 0)
911 0 : return -1;
912 :
913 80 : if (nDim < mnColumnCount)
914 : {
915 : // source field.
916 34 : const ItemsType& rItems = maFields[nDim].maItems;
917 450 : for (size_t i = 0, n = rItems.size(); i < n; ++i)
918 : {
919 416 : if (rItems[i] == rItem)
920 0 : return i;
921 : }
922 :
923 34 : if (!maFields[nDim].mpGroup)
924 0 : return -1;
925 :
926 : // grouped source field.
927 34 : const ItemsType& rGI = maFields[nDim].mpGroup->maItems;
928 130 : for (size_t i = 0, n = rGI.size(); i < n; ++i)
929 : {
930 130 : if (rGI[i] == rItem)
931 34 : return rItems.size() + i;
932 : }
933 0 : return -1;
934 : }
935 :
936 : // group field.
937 46 : nDim -= mnColumnCount;
938 46 : if (static_cast<size_t>(nDim) < maGroupFields.size())
939 : {
940 46 : const ItemsType& rGI = maGroupFields[nDim].maItems;
941 81 : for (size_t i = 0, n = rGI.size(); i < n; ++i)
942 : {
943 81 : if (rGI[i] == rItem)
944 46 : return i;
945 : }
946 : }
947 :
948 0 : return -1;
949 : }
950 :
951 279 : rtl::OUString ScDPCache::GetFormattedString(long nDim, const ScDPItemData& rItem) const
952 : {
953 279 : if (nDim < 0)
954 32 : return rItem.GetString();
955 :
956 247 : ScDPItemData::Type eType = rItem.GetType();
957 247 : if (eType == ScDPItemData::Value)
958 : {
959 : // Format value using the stored number format.
960 75 : sal_uLong nNumFormat = GetNumberFormat(nDim);
961 75 : SvNumberFormatter* pFormatter = mpDoc->GetFormatTable();
962 75 : if (pFormatter)
963 : {
964 75 : Color* pColor = NULL;
965 75 : String aStr;
966 75 : pFormatter->GetOutputString(rItem.GetValue(), nNumFormat, aStr, &pColor);
967 75 : return aStr;
968 : }
969 : }
970 :
971 172 : if (eType == ScDPItemData::GroupValue)
972 : {
973 23 : ScDPItemData::GroupValueAttr aAttr = rItem.GetGroupValue();
974 23 : double fStart = 0.0, fEnd = 0.0;
975 23 : const GroupItems* p = GetGroupItems(nDim);
976 23 : if (p)
977 : {
978 23 : fStart = p->maInfo.mfStart;
979 23 : fEnd = p->maInfo.mfEnd;
980 : }
981 : return ScDPUtil::getDateGroupName(
982 23 : aAttr.mnGroupType, aAttr.mnValue, mpDoc->GetFormatTable(), fStart, fEnd);
983 : }
984 :
985 149 : if (eType == ScDPItemData::RangeStart)
986 : {
987 5 : double fVal = rItem.GetValue();
988 5 : const GroupItems* p = GetGroupItems(nDim);
989 5 : if (!p)
990 0 : return rItem.GetString();
991 :
992 5 : sal_Unicode cDecSep = ScGlobal::pLocaleData->getNumDecimalSep()[0];
993 5 : return ScDPUtil::getNumGroupName(fVal, p->maInfo, cDecSep, mpDoc->GetFormatTable());
994 : }
995 :
996 144 : return rItem.GetString();
997 : }
998 :
999 4 : long ScDPCache::AppendGroupField()
1000 : {
1001 4 : maGroupFields.push_back(new GroupItems);
1002 4 : return static_cast<long>(maFields.size() + maGroupFields.size() - 1);
1003 : }
1004 :
1005 6 : void ScDPCache::ResetGroupItems(long nDim, const ScDPNumGroupInfo& rNumInfo, sal_Int32 nGroupType)
1006 : {
1007 6 : if (nDim < 0)
1008 0 : return;
1009 :
1010 6 : long nSourceCount = static_cast<long>(maFields.size());
1011 6 : if (nDim < nSourceCount)
1012 : {
1013 2 : maFields.at(nDim).mpGroup.reset(new GroupItems(rNumInfo, nGroupType));
1014 2 : return;
1015 : }
1016 :
1017 4 : nDim -= nSourceCount;
1018 4 : if (nDim < static_cast<long>(maGroupFields.size()))
1019 : {
1020 4 : GroupItems& rGI = maGroupFields[nDim];
1021 4 : rGI.maItems.clear();
1022 4 : rGI.maInfo = rNumInfo;
1023 4 : rGI.mnGroupType = nGroupType;
1024 : }
1025 : }
1026 :
1027 37 : SCROW ScDPCache::SetGroupItem(long nDim, const ScDPItemData& rData)
1028 : {
1029 37 : if (nDim < 0)
1030 0 : return -1;
1031 :
1032 37 : long nSourceCount = static_cast<long>(maFields.size());
1033 37 : if (nDim < nSourceCount)
1034 : {
1035 19 : GroupItems& rGI = *maFields.at(nDim).mpGroup;
1036 19 : rGI.maItems.push_back(rData);
1037 19 : SCROW nId = maFields[nDim].maItems.size() + rGI.maItems.size() - 1;
1038 19 : return nId;
1039 : }
1040 :
1041 18 : nDim -= nSourceCount;
1042 18 : if (nDim < static_cast<long>(maGroupFields.size()))
1043 : {
1044 18 : ItemsType& rItems = maGroupFields.at(nDim).maItems;
1045 18 : rItems.push_back(rData);
1046 18 : return rItems.size()-1;
1047 : }
1048 :
1049 0 : return -1;
1050 : }
1051 :
1052 9 : void ScDPCache::GetGroupDimMemberIds(long nDim, std::vector<SCROW>& rIds) const
1053 : {
1054 9 : if (nDim < 0)
1055 0 : return;
1056 :
1057 9 : long nSourceCount = static_cast<long>(maFields.size());
1058 9 : if (nDim < nSourceCount)
1059 : {
1060 3 : if (!maFields.at(nDim).mpGroup)
1061 0 : return;
1062 :
1063 3 : size_t nOffset = maFields[nDim].maItems.size();
1064 3 : const ItemsType& rGI = maFields[nDim].mpGroup->maItems;
1065 36 : for (size_t i = 0, n = rGI.size(); i < n; ++i)
1066 33 : rIds.push_back(static_cast<SCROW>(i + nOffset));
1067 :
1068 3 : return;
1069 : }
1070 :
1071 6 : nDim -= nSourceCount;
1072 6 : if (nDim < static_cast<long>(maGroupFields.size()))
1073 : {
1074 6 : const ItemsType& rGI = maGroupFields.at(nDim).maItems;
1075 34 : for (size_t i = 0, n = rGI.size(); i < n; ++i)
1076 28 : rIds.push_back(static_cast<SCROW>(i));
1077 : }
1078 : }
1079 :
1080 : namespace {
1081 :
1082 : struct ClearGroupItems : std::unary_function<ScDPCache::Field, void>
1083 : {
1084 8 : void operator() (ScDPCache::Field& r) const
1085 : {
1086 8 : r.mpGroup.reset();
1087 8 : }
1088 : };
1089 :
1090 : }
1091 :
1092 4 : void ScDPCache::ClearGroupFields()
1093 : {
1094 4 : maGroupFields.clear();
1095 4 : std::for_each(maFields.begin(), maFields.end(), ClearGroupItems());
1096 4 : }
1097 :
1098 94 : const ScDPNumGroupInfo* ScDPCache::GetNumGroupInfo(long nDim) const
1099 : {
1100 94 : if (nDim < 0)
1101 0 : return NULL;
1102 :
1103 94 : long nSourceCount = static_cast<long>(maFields.size());
1104 94 : if (nDim < nSourceCount)
1105 : {
1106 48 : if (!maFields.at(nDim).mpGroup)
1107 14 : return NULL;
1108 :
1109 34 : return &maFields[nDim].mpGroup->maInfo;
1110 : }
1111 :
1112 46 : nDim -= nSourceCount;
1113 46 : if (nDim < static_cast<long>(maGroupFields.size()))
1114 46 : return &maGroupFields.at(nDim).maInfo;
1115 :
1116 0 : return NULL;
1117 : }
1118 :
1119 48 : sal_Int32 ScDPCache::GetGroupType(long nDim) const
1120 : {
1121 48 : if (nDim < 0)
1122 0 : return 0;
1123 :
1124 48 : long nSourceCount = static_cast<long>(maFields.size());
1125 48 : if (nDim < nSourceCount)
1126 : {
1127 16 : if (!maFields.at(nDim).mpGroup)
1128 0 : return 0;
1129 :
1130 16 : return maFields[nDim].mpGroup->mnGroupType;
1131 : }
1132 :
1133 32 : nDim -= nSourceCount;
1134 32 : if (nDim < static_cast<long>(maGroupFields.size()))
1135 32 : return maGroupFields.at(nDim).mnGroupType;
1136 :
1137 0 : return 0;
1138 : }
1139 :
1140 922 : SCROW ScDPCache::GetOrder(long /*nDim*/, SCROW nIndex) const
1141 : {
1142 922 : return nIndex;
1143 : }
1144 :
1145 5 : ScDocument* ScDPCache::GetDoc() const
1146 : {
1147 5 : return mpDoc;
1148 : };
1149 :
1150 10931 : long ScDPCache::GetColumnCount() const
1151 : {
1152 10931 : return mnColumnCount;
1153 15 : }
1154 :
1155 : #if DEBUG_PIVOT_TABLE
1156 :
1157 : namespace {
1158 :
1159 : std::ostream& operator<< (::std::ostream& os, const rtl::OUString& str)
1160 : {
1161 : return os << ::rtl::OUStringToOString(str, RTL_TEXTENCODING_UTF8).getStr();
1162 : }
1163 :
1164 : void dumpItems(const ScDPCache& rCache, long nDim, const ScDPCache::ItemsType& rItems, size_t nOffset)
1165 : {
1166 : for (size_t i = 0; i < rItems.size(); ++i)
1167 : cout << " " << (i+nOffset) << ": " << rCache.GetFormattedString(nDim, rItems[i]) << endl;
1168 : }
1169 :
1170 : void dumpSourceData(const ScDPCache& rCache, long nDim, const ScDPCache::ItemsType& rItems, const ScDPCache::IndexArrayType& rArray)
1171 : {
1172 : ScDPCache::IndexArrayType::const_iterator it = rArray.begin(), itEnd = rArray.end();
1173 : for (; it != itEnd; ++it)
1174 : cout << " '" << rCache.GetFormattedString(nDim, rItems[*it]) << "'" << endl;
1175 : }
1176 :
1177 : }
1178 :
1179 : void ScDPCache::Dump() const
1180 : {
1181 : cout << "--- pivot cache dump" << endl;
1182 : {
1183 : FieldsType::const_iterator it = maFields.begin(), itEnd = maFields.end();
1184 : for (size_t i = 0; it != itEnd; ++it, ++i)
1185 : {
1186 : const Field& fld = *it;
1187 : cout << "* source dimension: " << GetDimensionName(i) << " (ID = " << i << ")" << endl;
1188 : cout << " item count: " << fld.maItems.size() << endl;
1189 : dumpItems(*this, i, fld.maItems, 0);
1190 : if (fld.mpGroup)
1191 : {
1192 : cout << " group item count: " << fld.mpGroup->maItems.size() << endl;
1193 : dumpItems(*this, i, fld.mpGroup->maItems, fld.maItems.size());
1194 : }
1195 :
1196 : cout << " source data (re-constructed):" << endl;
1197 : dumpSourceData(*this, i, fld.maItems, fld.maData);
1198 : }
1199 : }
1200 :
1201 : {
1202 : struct { SCROW start; SCROW end; bool empty; } aRange;
1203 : cout << "* empty rows: " << endl;
1204 : mdds::flat_segment_tree<SCROW, bool>::const_iterator it = maEmptyRows.begin(), itEnd = maEmptyRows.end();
1205 : if (it != itEnd)
1206 : {
1207 : aRange.start = it->first;
1208 : aRange.empty = it->second;
1209 : ++it;
1210 : }
1211 :
1212 : for (; it != itEnd; ++it)
1213 : {
1214 : aRange.end = it->first-1;
1215 : cout << " rows " << aRange.start << "-" << aRange.end << ": " << (aRange.empty ? "empty" : "not-empty") << endl;
1216 : aRange.start = it->first;
1217 : aRange.empty = it->second;
1218 : }
1219 : }
1220 :
1221 : {
1222 : GroupFieldsType::const_iterator it = maGroupFields.begin(), itEnd = maGroupFields.end();
1223 : for (size_t i = maFields.size(); it != itEnd; ++it, ++i)
1224 : {
1225 : const GroupItems& gi = *it;
1226 : cout << "* group dimension: (unnamed) (ID = " << i << ")" << endl;
1227 : cout << " item count: " << gi.maItems.size() << endl;
1228 : dumpItems(*this, i, gi.maItems, 0);
1229 : }
1230 : }
1231 :
1232 : cout << "---" << endl;
1233 : }
1234 :
1235 : #endif
1236 :
1237 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|