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