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